diff --git a/Testing/Code/BasicFilters/CMakeLists.txt b/Testing/Code/BasicFilters/CMakeLists.txt index a3661df7154315711e1b4f68ab8b8edf4d3d8e64..31a8edd78e756e1d15633ef714057a930559fc1e 100755 --- a/Testing/Code/BasicFilters/CMakeLists.txt +++ b/Testing/Code/BasicFilters/CMakeLists.txt @@ -426,7 +426,19 @@ ADD_TEST(bfTvUnaryImageFunctorWithVectorImageFilter ${BASICFILTERS_TESTS} ${TEMP}/bfTvUnaryImageFunctorWithVectorImageFilter.tif ) +# ------- otb::PrintableImageFilter ------------------------------ +ADD_TEST(bfTuPrintableImageFilterNew ${BASICFILTERS_TESTS} + otbPrintableImageFilterNew) + +ADD_TEST(bfTvPrintableImageFilter ${BASICFILTERS_TESTS} + --compare-image ${TOL} + ${BASELINE}/bfTvPrintableImageFilter.png + ${TEMP}/bfTvPrintableImageFilter.png + otbPrintableImageFilter + ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif + ${TEMP}/bfTvPrintableImageFilter.png + ) # A enrichir SET(BasicFilters_SRCS @@ -479,6 +491,8 @@ otbMatrixTransposeMatrixImageFilterNew.cxx otbMatrixTransposeMatrixImageFilter.cxx otbUnaryImageFunctorWithVectorImageFilterNew.cxx otbUnaryImageFunctorWithVectorImageFilter.cxx +otbPrintableImageFilterNew.cxx +otbPrintableImageFilter.cxx ) diff --git a/Testing/Code/BasicFilters/otbBasicFiltersTests.cxx b/Testing/Code/BasicFilters/otbBasicFiltersTests.cxx index 40f95f68867054b2bd201eedefe8c2849791e20d..8d3a8ef41cfb6cb836307c3d676b49d99689de8a 100755 --- a/Testing/Code/BasicFilters/otbBasicFiltersTests.cxx +++ b/Testing/Code/BasicFilters/otbBasicFiltersTests.cxx @@ -76,4 +76,6 @@ REGISTER_TEST(otbMatrixTransposeMatrixImageFilterNew); REGISTER_TEST(otbMatrixTransposeMatrixImageFilter); REGISTER_TEST(otbUnaryImageFunctorWithVectorImageFilterNew); REGISTER_TEST(otbUnaryImageFunctorWithVectorImageFilter); +REGISTER_TEST(otbPrintableImageFilterNew); +REGISTER_TEST(otbPrintableImageFilter); } diff --git a/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx b/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..332d5ca7c8af936f0043768da8af152e7bd3a7e3 --- /dev/null +++ b/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx @@ -0,0 +1,85 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include "otbImageFileReader.h" + +#include "itkExceptionObject.h" +#include "otbImageFileWriter.h" +#include "otbVectorImage.h" + +#include "otbPrintableImageFilter.h" + +int otbPrintableImageFilter( int argc, char * argv[] ) +{ + try + { + const char * inputFilename = argv[1]; + const char * outputFilename = argv[2]; + + + typedef double InputPixelType; + const unsigned int Dimension = 2; + + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + + typedef otb::ImageFileReader< InputImageType > ReaderType; + + typedef otb::PrintableImageFilter< InputImageType> FilterType; + typedef FilterType::OutputImageType OutputImageType; + + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + + FilterType::Pointer printableImageFilter = FilterType::New(); + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + + reader->SetFileName( inputFilename ); + writer->SetFileName( outputFilename ); + + printableImageFilter->SetInput( reader->GetOutput() ); + printableImageFilter->SetChannel(3); + printableImageFilter->SetChannel(2); + printableImageFilter->SetChannel(1); + writer->SetInput( printableImageFilter->GetOutput() ); + + writer->Update(); + + } + catch( itk::ExceptionObject & err ) + { + std::cout << "Exception itk::ExceptionObject levee !" << std::endl; + std::cout << err << std::endl; + return EXIT_FAILURE; + } + catch( ... ) + { + std::cout << "Exception levee inconnue !" << std::endl; + return EXIT_FAILURE; + } + // Software Guide : EndCodeSnippet + +//#endif + return EXIT_SUCCESS; +} + + diff --git a/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx b/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..40a5816845842fb4b9504daee83ad61685f0a6c9 --- /dev/null +++ b/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx @@ -0,0 +1,55 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include "itkExceptionObject.h" +#include "otbVectorImage.h" + +#include "otbPrintableImageFilter.h" + +int otbPrintableImageFilterNew( int argc, char * argv[] ) +{ + try + { + typedef double InputPixelType; + const unsigned int Dimension = 2; + + typedef otb::VectorImage< InputPixelType, Dimension > InputImageType; + + typedef otb::PrintableImageFilter + < InputImageType> FilterType; + + FilterType::Pointer printableImage = FilterType::New(); + } + catch( itk::ExceptionObject & err ) + { + std::cout << "Exception itk::ExceptionObject levee !" << std::endl; + std::cout << err << std::endl; + return EXIT_FAILURE; + } + catch( ... ) + { + std::cout << "Exception levee inconnue !" << std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} +