Skip to content
Snippets Groups Projects
Commit 68a60c3f authored by Thomas Feuvrier's avatar Thomas Feuvrier
Browse files

Creation d'un fichier ASCII pour les résultats du LogPolarTransform

parent e73dc6c6
Branches
Tags
No related merge requests found
......@@ -111,8 +111,13 @@ ADD_TEST(bfTuLogPolarTransformNew ${BASICFILTERS_TESTS}
otbLogPolarTransformNew)
ADD_TEST(bfTvLogPolarTransform ${BASICFILTERS_TESTS}
--compare-ascii ${TOL}
${BASELINE_FILES}/bfLogPolarTransformResults.txt
${TEMP}/bfLogPolarTransformResults.txt
otbLogPolarTransform
1 1 6 0 0 0 10 45 0 3.14 3.14 18 1 50 50
1 1
${TEMP}/bfLogPolarTransformResults.txt
5 0 0 0 10 45 0 3.14 3.14 18 1
)
ADD_TEST(bfTvLogPolarTransformResample ${BASICFILTERS_TESTS}
......
......@@ -18,6 +18,7 @@
#include "otbLogPolarTransform.h"
#include "itkPoint.h"
#include "otbMacro.h"
#include <fstream>
int otbLogPolarTransform(int argc, char* argv[])
{
......@@ -25,20 +26,26 @@ try
{
double radialStep = atof(argv[1]);
double angularStep = atof(argv[2]);
unsigned int nbPoints = atoi(argv[3]);
const char * outputFilename(argv[3]);
unsigned int nbPoints = atoi(argv[4]);
typedef double PrecisionType;
typedef otb::LogPolarTransform<PrecisionType> LogPolarTransformType;
typedef itk::Point<PrecisionType,2> PointType;
typedef std::vector<PointType> PointsVectorType;
std::ofstream file;
file.open(outputFilename);
file << "input points retrieval : "<<std::endl;
// input points retrieval
PointsVectorType vect;
for(unsigned int i=0;i<nbPoints;++i)
{
PointType p;
p[0]=atof(argv[4+2*i]);
p[1]=atof(argv[5+2*i]);
std::cout<<"Adding point "<<p<<"."<<std::endl;
p[0]=atof(argv[5+2*i]);
p[1]=atof(argv[6+2*i]);
file<<"Adding point "<<p<<"."<<std::endl;
vect.push_back(p);
}
......@@ -51,6 +58,7 @@ try
params[3]=angularStep;
transform->SetParameters(params);
file << "Transform calculation ... :" <<std::endl;
for(PointsVectorType::iterator it=vect.begin();it!=vect.end();++it)
{
PointType p = transform->TransformPoint(*it);
......@@ -60,14 +68,17 @@ try
double theta = (*it)[0]*angularStep*acos(-1.0)/180.0;
double logRho = (*it)[1]*radialStep;
std::cout<<"Rho: "<<logRho<<", Theta: "<<theta<<std::endl;
file <<"Rho: "<<logRho<<", Theta: "<<theta<<std::endl;
pprime[0]=exp(logRho) * cos(theta);
pprime[1]=exp(logRho) * sin(theta);
std::cout<<"Original Point: "<<(*it)<<", Reference point: "<<pprime<<", Transformed point: "<<p<<std::endl;
otbControlConditionTestMacro(p[0]!=pprime[0],"Error while transforming point.");
otbControlConditionTestMacro(p[1]!=pprime[1],"Error while transforming point.");
file <<"Original Point: "<<(*it)<<", Reference point: "<<pprime<<", Transformed point: "<<p<<std::endl<<std::endl;
// otbControlConditionTestMacro(p[0]!=pprime[0],"Error while transforming point.");
// otbControlConditionTestMacro(p[1]!=pprime[1],"Error while transforming point.");
}
file.close();
}
catch( itk::ExceptionObject & err )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment