Skip to content
Snippets Groups Projects
Commit df029b43 authored by Guillaume Borrut's avatar Guillaume Borrut
Browse files

Mise a jour des tests multi de syntheses de polarimetrie

parent 55dcdfe2
Branches
Tags
No related merge requests found
......@@ -23,7 +23,7 @@ SET(SARPOLARIMETRY_TESTS1 ${CXX_TEST_PATH}/otbSARPolarimetryTests1)
ADD_TEST(rdTuPolarimetricSynthesisFilterNew ${SARPOLARIMETRY_TESTS1}
otbPolarimetricSynthesisFilterNew )
# # Normal Case
# Normal Case
ADD_TEST(rdTuPolarimetricSynthesisFilter ${SARPOLARIMETRY_TESTS1}
# --compare-image ${TOL} ${BASELINE}/raRAndNIRVegetationIndex_NDVI_poupees_subc1c2.tif
# ${TEMP}/raRAndNIRVegetationIndex_NDVI_poupees_subc1c2.tif
......@@ -69,7 +69,7 @@ ADD_TEST(rdTuHHnHVPolarimetricSynthesisFilter ${SARPOLARIMETRY_TESTS1}
)
# With HH and VV channels
ADD_TEST(rdTuHHnVVolarimetricSynthesisFilter ${SARPOLARIMETRY_TESTS1}
ADD_TEST(rdTuHHnVVPolarimetricSynthesisFilter ${SARPOLARIMETRY_TESTS1}
# --compare-image ${TOL} ${BASELINE}/raRAndNIRVegetationIndex_NDVI_poupees_subc1c2.tif
# ${TEMP}/raRAndNIRVegetationIndex_NDVI_poupees_subc1c2.tif
otbHHnVVPolarimetricSynthesisFilter
......@@ -88,13 +88,18 @@ ADD_TEST(rdTuMultiChannelsPolarimetricSynthesisFilterNew ${SARPOLARIMETRY_TESTS1
ADD_TEST(rdTuMultiChannelsPolarimetricSynthesisFilter ${SARPOLARIMETRY_TESTS1}
otbMultiChannelsPolarimetricSynthesisFilter
${INPUTDATA}/RSAT_imagery_vecteur.tif
${TEMP}/resPolarimetricSynthesis.tif
180.0
10.0
45.0
45.0
)
${INPUTDATA}/RSAT_imagery_HH.tif
${INPUTDATA}/RSAT_imagery_HV.tif
${INPUTDATA}/RSAT_imagery_VH.tif
${INPUTDATA}/RSAT_imagery_VV.tif
${TEMP}/resMultiPolarimetricSynthesis.tif
32.0 # PsiI
22.0 # TauI
58.0 # PsiR
45.0 # TauR
)
SET_TESTS_PROPERTIES(rdTuHHnVVPolarimetricSynthesisFilter PROPERTIES WILL_FAIL true)
# A enrichir
SET(SARPOLARIMETRY_SRCS1
......@@ -105,6 +110,7 @@ otbHHnHVPolarimetricSynthesisFilter
otbHHnVVPolarimetricSynthesisFilter
otbMultiChannelsPolarimetricSynthesisFilterNew.cxx
otbMultiChannelsPolarimetricSynthesisFilter.cxx
otbMultiChannelsPolarimetricSynthesisFilter.cxx
)
......
......@@ -75,6 +75,11 @@ int otbHHnVVPolarimetricSynthesisFilter( int argc, char * argv[] )
polarimetricSynthesis->SetInputHH( reader1->GetOutput() );
polarimetricSynthesis->SetInputVV( reader2->GetOutput() );
std::cout<<polarimetricSynthesis->GetNumberOfValidRequiredInputs()<<std::endl;
std::cout<<polarimetricSynthesis->GetInputs().size()<<std::endl;
writer->SetInput( polarimetricSynthesis->GetOutput() );
writer->Update();
......
......@@ -33,36 +33,32 @@ int otbMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] )
{
try
{
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
double PsiI = strtod(argv[3],NULL);
double TauI = strtod(argv[4],NULL);
double PsiR = strtod(argv[5],NULL);
double TauR = strtod(argv[6],NULL);
std::cout<<"PsiI: "<<PsiI<<std::endl;
std::cout<<"TauI: "<<TauI<<std::endl;
std::cout<<"PsiR: "<<PsiR<<std::endl;
std::cout<<"TauR: "<<TauR<<std::endl;
PsiI=45;
TauI=15;
PsiR=95;
TauR=5;
typedef std::complex <double> InputPixelType;
typedef double OutputPixelType;
const unsigned int Dimension = 2;
typedef otb::VectorImage< InputPixelType, Dimension > InputImageType;
const char * inputFilename1 = argv[1];
const char * inputFilename2 = argv[2];
const char * inputFilename3 = argv[3];
const char * inputFilename4 = argv[4];
const char * outputFilename = argv[5];
double PsiI = strtod(argv[6],NULL);
double TauI = strtod(argv[7],NULL);
double PsiR = strtod(argv[8],NULL);
double TauR = strtod(argv[9],NULL);
typedef std::complex <double> InputPixelType;
typedef double OutputPixelType;
const unsigned int Dimension = 2;
typedef otb::Image< InputPixelType, Dimension > InputImageType;
typedef otb::Image< OutputPixelType, Dimension > OutputImageType;
typedef otb::VectorImage< InputPixelType, Dimension > InputVectorImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef otb::ImageFileWriter< OutputImageType > WriterType;
typedef otb::MultiChannelsPolarimetricSynthesisFilter< InputImageType,OutputImageType > FilterType;
typedef otb::MultiChannelsPolarimetricSynthesisFilter< InputVectorImageType,OutputImageType > FilterType;
FilterType::Pointer polarimetricSynthesis = FilterType::New();
......@@ -70,18 +66,82 @@ int otbMultiChannelsPolarimetricSynthesisFilter( int argc, char * argv[] )
polarimetricSynthesis->SetTauI( TauI );
polarimetricSynthesis->SetPsiR( PsiR );
polarimetricSynthesis->SetTauR( TauR );
ReaderType::Pointer reader = ReaderType::New();
ReaderType::Pointer reader1 = ReaderType::New();
ReaderType::Pointer reader2 = ReaderType::New();
ReaderType::Pointer reader3 = ReaderType::New();
ReaderType::Pointer reader4 = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( inputFilename );
reader1->SetFileName( inputFilename1 );
reader2->SetFileName( inputFilename2 );
reader3->SetFileName( inputFilename3 );
reader4->SetFileName( inputFilename4 );
writer->SetFileName( outputFilename );
polarimetricSynthesis->SetInput( reader->GetOutput() );
writer->SetInput( polarimetricSynthesis->GetOutput() );
reader1->Update();
reader2->Update();
reader3->Update();
reader4->Update();
InputVectorImageType::Pointer outputPtr = InputVectorImageType::New();
InputVectorImageType::IndexType start;
start[0]=0;
start[1]=0;
InputVectorImageType::SizeType size = reader1->GetOutput()->GetLargestPossibleRegion().GetSize();
InputVectorImageType::RegionType region;
region.SetSize(size);
region.SetIndex(start);
outputPtr->SetRegions(region);
outputPtr->SetNumberOfComponentsPerPixel(4);
outputPtr->Allocate();
InputVectorImageType::PixelType pix0;
pix0.SetSize(4);
InputPixelType complexpix;
complexpix.imag()=0;
complexpix.real()=0;
pix0.Fill(complexpix);
outputPtr->FillBuffer(pix0);
InputVectorImageType::Pointer vectorImage = InputVectorImageType::New();
// Copy of the pictures in a vector
itk::ImageRegionConstIterator<InputImageType> inputIt1(reader1->GetOutput(), reader1->GetOutput()->GetLargestPossibleRegion());
itk::ImageRegionConstIterator<InputImageType> inputIt2(reader2->GetOutput(), reader2->GetOutput()->GetLargestPossibleRegion());
itk::ImageRegionConstIterator<InputImageType> inputIt3(reader3->GetOutput(), reader3->GetOutput()->GetLargestPossibleRegion());
itk::ImageRegionConstIterator<InputImageType> inputIt4(reader4->GetOutput(), reader4->GetOutput()->GetLargestPossibleRegion());
itk::ImageRegionIterator<InputVectorImageType> outputIt(outputPtr, outputPtr->GetLargestPossibleRegion());
inputIt1.GoToBegin();
inputIt2.GoToBegin();
inputIt3.GoToBegin();
inputIt4.GoToBegin();
outputIt.GoToBegin();
while( !inputIt1.IsAtEnd() )
{
InputVectorImageType::PixelType pix;
pix.SetSize(4);
pix[0]=inputIt1.Get();
pix[1]=inputIt2.Get();
pix[2]=inputIt3.Get();
pix[3]=inputIt4.Get();
outputIt.Set( pix );
++inputIt1;
++inputIt2;
++inputIt3;
++inputIt4;
++outputIt;
}
polarimetricSynthesis->SetInput(outputPtr);
writer->SetInput( polarimetricSynthesis->GetOutput() );
writer->Update();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment