Commit 03cce8c4 authored by Mickael Savinaud's avatar Mickael Savinaud

ENH: enhance test for new class otbImageListToSingleImageFilter

parent 18abb36b
......@@ -51,9 +51,6 @@ ImageListToSingleImageFilter<TImageType>
this->GetInput()->GetNthElement(m_ExtractedImagePosition));
}
/**
* Main computation method
*/
......@@ -62,8 +59,6 @@ void
ImageListToSingleImageFilter<TImageType>
::GenerateData(void)
{
std::cout << "ImageListToSingleImageFilter::GenerateData" << std::endl;
OutputImagePointerType outputPtr = this->GetOutput();
InputImagePointerType inputPtr = this->GetInput()->GetNthElement(m_ExtractedImagePosition);
......@@ -94,9 +89,6 @@ ImageListToSingleImageFilter<TImageType>
}
++inputIt;
}
std::cout << "VectorImageToImagesFilter::GenerateData END" << std::endl;
}
/**
......
......@@ -361,16 +361,21 @@ ADD_TEST(bfTuImageListToSingleImageFilterNew ${BASICFILTERS_TESTS3}
otbImageListToSingleImageFilterNew)
ADD_TEST(bfTvImageListToSingleImageFilter ${BASICFILTERS_TESTS3}
--compare-image ${NOTOL}
${BASELINE}/bfTvImageListToSingleImageFilter.tif
${TEMP}/bfTvImageListToSingleImageFilterOut.tif
otbImageListToSingleImageFilter
${INPUTDATA}/poupees.png
${TEMP}/bfTvImageListToSingleImageFilter.tif
${TEMP}/bfTvImageListToSingleImageFilterOut.tif
)
ADD_TEST(bfTvImageListToSingleImageFilterBig ${BASICFILTERS_TESTS3}
otbImageListToSingleImageFilter
${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF
${TEMP}/bfTvImageListToSingleImageFilter.tif
)
#IF(OTB_DATA_USE_LARGEINPUT)
# ADD_TEST(bfTvImageListToSingleImageFilterLarge ${BASICFILTERS_TESTS3}
# otbImageListToSingleImageFilter
# ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF
# ${TEMP}/bfTvImageListToSingleImageFilterLargeOut.tif
# )
#ENDIF()
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbBasicFiltersTests4 ~~~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -52,51 +52,51 @@ int otbImageListToSingleImageFilter(int argc, char * argv[])
char * infname = argv[1];
char * outfname1 = argv[2];
typedef unsigned char PixelType;
typedef float PixelType;
typedef otb::Image<PixelType, Dimension> ImageType;
typedef otb::VectorImage<PixelType, Dimension> VectorImageType;
typedef otb::ImageList<ImageType> ImageListType;
// IO
// IO Typedef
typedef otb::ImageFileReader<VectorImageType> ReaderType;
typedef otb::ImageFileWriter<ImageType> WriterType;
// Filter Typedef
typedef otb::VectorImageToImageListFilter<VectorImageType, ImageListType> VectorImageToImageListFilterType;
typedef otb::ImageListToSingleImageFilter<ImageListType::ImageType> ImageListToSingleImageFilter;
typedef otb::BandMathImageFilter<ImageType> BandMathImageFilterType ;
// Instantiating object
// Instantiating objects
VectorImageToImageListFilterType::Pointer filter1 = VectorImageToImageListFilterType::New();
ImageListToSingleImageFilter::Pointer filter2_1 = ImageListToSingleImageFilter::New();
ImageListToSingleImageFilter::Pointer filter2_2 = ImageListToSingleImageFilter::New();
BandMathImageFilterType::Pointer filter3 = BandMathImageFilterType::New();
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
// Reader
reader->SetFileName(infname);
// VectorImage to Image List
filter1->SetInput(reader->GetOutput());
filter1->UpdateOutputInformation();
// Retrieve one image from the image list
filter2_1->SetExtractedImagePosition(1);
filter2_1->SetInput(filter1->GetOutput());
// Retrieve one image from the image list
filter2_2->SetExtractedImagePosition(2);
filter2_2->SetInput(filter1->GetOutput());
// Use an BandMath with the selected image
filter3->SetNthInput(0,filter2_1->GetOutput());
filter3->SetNthInput(1,filter2_2->GetOutput());
filter3->SetExpression("b1/b2");
filter3->SetExpression(" if( b2 > 1.0, b1/b2, 0)" );
WriterType::Pointer writer = WriterType::New();
// Write the result
writer->SetFileName(outfname1);
writer->SetNumberOfDivisionsTiledStreaming(4);
writer->SetNumberOfDivisionsTiledStreaming(8);
writer->SetInput(filter3->GetOutput());
writer->Update();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment