diff --git a/Testing/Code/Fusion/CMakeLists.txt b/Testing/Code/Fusion/CMakeLists.txt index ab588e0c5255291c7c02337bd48ad4789468c8f3..ed46fe83c152f793889e246bbf1bb171bb6c8708 100755 --- a/Testing/Code/Fusion/CMakeLists.txt +++ b/Testing/Code/Fusion/CMakeLists.txt @@ -41,6 +41,20 @@ ADD_TEST(fuTvBayesianFusionFilter ${FUSION_TESTS} ) +# ------- otb::SimpleRcsPanSharpeningFusionImageFilter ------------------- +ADD_TEST(fuTuSimpleRcsPanSharpeningFusionImageFilterNew ${FUSION_TESTS} + otbSimpleRcsPanSharpeningFusionImageFilterNew +) + +ADD_TEST(fuTvSimpleRcsPanSharpeningFusionImageFilter ${FUSION_TESTS} + --compare-image ${TOL} ${BASELINE}/fuTvRcsPanSharpeningFusion.tif + ${TEMP}/fuTvRcsPanSharpeningFusion.tif + otbSimpleRcsPanSharpeningFusionImageFilter + ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif + ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif + ${TEMP}/fuTvRcsPanSharpeningFusion.tif +) + # A enrichir @@ -48,6 +62,8 @@ SET(Fusion_SRCS otbFusionImageBaseNew.cxx otbBayesianFusionFilterNew.cxx otbBayesianFusionFilter.cxx +otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx +otbSimpleRcsPanSharpeningFusionImageFilter.cxx ) diff --git a/Testing/Code/Fusion/otbFusionTests.cxx b/Testing/Code/Fusion/otbFusionTests.cxx index 6fa5dc19c4669c40598be673da5d4ed14e27c99f..93610366871a532759a4766469abe1a6da192427 100755 --- a/Testing/Code/Fusion/otbFusionTests.cxx +++ b/Testing/Code/Fusion/otbFusionTests.cxx @@ -31,4 +31,6 @@ void RegisterTests() REGISTER_TEST(otbBayesianFusionFilterNew); REGISTER_TEST(otbBayesianFusionFilter); REGISTER_TEST(otbFusionImageBaseNew); +REGISTER_TEST(otbSimpleRcsPanSharpeningFusionImageFilterNew); +REGISTER_TEST(otbSimpleRcsPanSharpeningFusionImageFilter); } diff --git a/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx b/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c759184edaab8d4173f017e4e4927269ca7cadaf --- /dev/null +++ b/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx @@ -0,0 +1,80 @@ +/*========================================================================= + + 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. + +=========================================================================*/ + + +#include "itkExceptionObject.h" +#include "otbImageFileReader.h" +#include "otbStreamingImageFileWriter.h" +#include "otbVectorImage.h" +#include "otbImage.h" + +#include "otbSimpleRcsPanSharpeningFusionImageFilter.h" + +int otbSimpleRcsPanSharpeningFusionImageFilter( int argc, char * argv[] ) +{ + try + { + const char * panchro = argv[1]; + const char * multispect = argv[2]; + const char * output = argv[3]; + + const unsigned int Dimension = 2; + typedef double PixelType; + + + typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::Image<PixelType,Dimension> PanchroImageType; + typedef otb::ImageFileReader<VectorImageType> VectorReaderType; + typedef otb::ImageFileReader<PanchroImageType> ImageReaderType; + typedef otb::StreamingImageFileWriter<VectorImageType> VectorImageWriterType; + typedef otb::SimpleRcsPanSharpeningFusionImageFilter + <PanchroImageType, VectorImageType, VectorImageType> FilterType; + + VectorReaderType::Pointer multiSpectReader = VectorReaderType::New(); + ImageReaderType::Pointer panchroReader = ImageReaderType::New(); + FilterType::Pointer filter = FilterType::New(); + VectorImageWriterType::Pointer writer = VectorImageWriterType::New(); + + multiSpectReader->SetFileName(multispect); + panchroReader->SetFileName(panchro); + + filter->SetXsInput(multiSpectReader->GetOutput()); + filter->SetPanInput(panchroReader->GetOutput()); + writer->SetInput( filter->GetOutput() ); + writer->SetFileName(output); + 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; + } + + + return EXIT_SUCCESS; +} + + diff --git a/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx b/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a512b5a872d9416704bba30046a2e7efa25ae354 --- /dev/null +++ b/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx @@ -0,0 +1,64 @@ +/*========================================================================= + + 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. + +=========================================================================*/ + + +#include "itkExceptionObject.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "otbVectorImage.h" +#include "otbImage.h" + +#include "otbSimpleRcsPanSharpeningFusionImageFilter.h" + +int otbSimpleRcsPanSharpeningFusionImageFilterNew( int argc, char * argv[] ) +{ + try + { + + const unsigned int Dimension = 2; + typedef double PixelType; + + + typedef otb::VectorImage<PixelType,Dimension> VectorImageType; + typedef otb::Image<PixelType,Dimension> PanchroImageType; + typedef otb::ImageFileReader<VectorImageType> VectorReaderType; + typedef otb::ImageFileReader<PanchroImageType> ImageReaderType; + typedef otb::SimpleRcsPanSharpeningFusionImageFilter + <PanchroImageType, VectorImageType, VectorImageType> FilterType; + + FilterType::Pointer filter = 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; +} + +