diff --git a/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx b/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx new file mode 100755 index 0000000000000000000000000000000000000000..f7e4e1c3c1e2eb8bceaf99b3dcecca6249986ac4 --- /dev/null +++ b/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx @@ -0,0 +1,86 @@ +/*========================================================================= + + Programme : OTB (ORFEO ToolBox) + Auteurs : CS - C.Ruffel + Language : C++ + Date : 27 mars 2006 + Version : + Role : Test du filtre réalisant la somme associative assymétrique + $Id$ + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#define MAIN + + +#include "itkExceptionObject.h" +#include "itkImage.h" +#include "itkImageFileWriter.h" +#include <iostream> + +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "otbAssociativeSymmetricalSumImageFilter.h" + + +int otbAssociativeSymmetricalSum( int argc, char* argv[] ) +{ + try + { + const char * inputFilename1 = argv[1]; + const char * inputFilename2 = argv[2]; + const char * outputFilename = argv[3]; + + + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; + + typedef itk::Image< InputPixelType, Dimension > InputImageType1; + typedef itk::Image< InputPixelType, Dimension > InputImageType2; + typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::ImageFileReader< InputImageType1 > ReaderType1; + typedef otb::ImageFileReader< InputImageType2 > ReaderType2; + typedef otb::ImageFileWriter< OutputImageType > WriterType; + + typedef otb::AssociativeSymmetricalSumImageFilter< InputImageType1, InputImageType2, OutputImageType > FilterType; + + FilterType::Pointer filter = FilterType::New(); + + ReaderType1::Pointer reader1 = ReaderType1::New(); + ReaderType2::Pointer reader2 = ReaderType2::New(); + WriterType::Pointer writer = WriterType::New(); + + reader1->SetFileName( inputFilename1 ); + reader2->SetFileName( inputFilename2 ); + writer->SetFileName( outputFilename ); + + filter->SetInput1( reader1->GetOutput() ); + filter->SetInput2( reader2->GetOutput() ); + writer->SetInput( filter->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/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx b/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx new file mode 100755 index 0000000000000000000000000000000000000000..b56b0cae5dcb01de2975757e188bce1d44bc8da5 --- /dev/null +++ b/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx @@ -0,0 +1,65 @@ +/*========================================================================= + + Programme : OTB (ORFEO ToolBox) + Auteurs : CS - C.Ruffel + Language : C++ + Date : 27 mars 2006 + Version : + Role : Test d'instanciation du filtre réalisant la somme + associative assymétrique + $Id$ + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#define MAIN + + +#include "itkExceptionObject.h" +#include "itkImage.h" +#include <iostream> + + +#include "otbAssociativeSymmetricalSumImageFilter.h" + + +int otbAssociativeSymmetricalSumNew( int argc, char* argv[] ) +{ + try + { + + typedef double InputPixelType; + typedef double OutputPixelType; + const unsigned int Dimension = 2; + + typedef itk::Image< InputPixelType, Dimension > InputImageType1; + typedef itk::Image< InputPixelType, Dimension > InputImageType2; + typedef itk::Image< OutputPixelType, Dimension > OutputImageType; + + typedef otb::AssociativeSymmetricalSumImageFilter< InputImageType1, InputImageType2, OutputImageType > 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; + } + // Software Guide : EndCodeSnippet + +//#endif + return EXIT_SUCCESS; +} + +