diff --git a/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx b/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx index f0f8d93847353f418d1b2af7dd3ef33cadecec42..672b363c6bd180493d4b358d42090f4237725b33 100644 --- a/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx +++ b/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx @@ -27,10 +27,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbExtractROI.h" -#include "itkComplexToRealImageFilter.h" -#include "itkComplexToImaginaryImageFilter.h" -#include "otbImageList.h" -#include "otbImageListToVectorImageFilter.h" +#include "otbComplexToVectorImageCastFilter.h" int otbImageFileReaderRADComplexFloatExtract(int argc, char* argv[]) @@ -48,18 +45,16 @@ int otbImageFileReaderRADComplexFloatExtract(int argc, char* argv[]) typedef otb::Image<OutputPixelType, Dimension> OutputCplxImageType; typedef otb::Image<float, Dimension> OutputScalarImageType; typedef otb::VectorImage<float, Dimension> OutputImageType; - typedef otb::ImageList<OutputScalarImageType> ImageListType; typedef otb::ImageFileReader<InputImageType> ReaderType; typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef itk::ComplexToRealImageFilter<OutputCplxImageType, OutputScalarImageType> RealExtractorType; - typedef itk::ComplexToImaginaryImageFilter<OutputCplxImageType -, OutputScalarImageType> ImaginaryExtractorType; - typedef otb::ImageListToVectorImageFilter<ImageListType, OutputImageType> ListToVectorImageFilterType; + + typedef otb::ComplexToVectorImageCastFilter<OutputCplxImageType, OutputImageType> CasterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); + CasterType::Pointer caster = CasterType::New(); reader->SetFileName(inputFilename); writer->SetFileName(outputFilename); @@ -76,22 +71,9 @@ int otbImageFileReaderRADComplexFloatExtract(int argc, char* argv[]) extractROIFilter->SetSizeX(100); extractROIFilter->SetSizeY(100); - // The rest of the code is here to translate the image complexe into - // a VectorImage of int which each channel is the real and imagynary part - - RealExtractorType::Pointer realExt = RealExtractorType::New(); - ImaginaryExtractorType::Pointer imgExt = ImaginaryExtractorType::New(); - - realExt->SetInput(extractROIFilter->GetOutput()); - imgExt->SetInput(extractROIFilter->GetOutput()); - - ImageListType::Pointer imList = ImageListType::New(); - imList->PushBack(realExt->GetOutput()); - imList->PushBack(imgExt->GetOutput()); - ListToVectorImageFilterType::Pointer listCaster = ListToVectorImageFilterType::New(); - listCaster->SetInput(imList); + caster->SetInput(extractROIFilter->GetOutput()); - writer->SetInput(listCaster->GetOutput()); + writer->SetInput(caster->GetOutput()); writer->Update(); return EXIT_SUCCESS; diff --git a/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx b/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx index c892f47c1f12654f55a2a02d73b9ae7c656521db..6df4bffe9ab864fc4b1f532d833cf15c0e1aae48 100644 --- a/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx +++ b/Testing/Code/Radiometry/otbTerraSarCalibrationImageComplexFilterTest.cxx @@ -24,10 +24,7 @@ #include "itkExtractImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -#include "itkComplexToRealImageFilter.h" -#include "itkComplexToImaginaryImageFilter.h" -#include "otbImageList.h" -#include "otbImageListToVectorImageFilter.h" +#include "otbComplexToVectorImageCastFilter.h" int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) @@ -37,25 +34,22 @@ int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) const bool useFastCalibration = atoi(argv[3]); const bool resultsInDbs = atoi(argv[4]); - typedef std::complex<double> ComplexType; - typedef otb::Image<ComplexType, 2> ImageCplxType; - typedef otb::Image<double, 2> ImageScalarType; - typedef otb::VectorImage<double, 2> OutputImageType; - typedef otb::ImageList<ImageScalarType> ImageListType; + typedef std::complex<double> ComplexType; + typedef otb::Image<ComplexType, 2> ImageCplxType; + typedef otb::Image<double, 2> ImageScalarType; + typedef otb::VectorImage<double, 2> OutputImageType; - typedef otb::ImageFileReader<ImageCplxType> ReaderType; - typedef otb::ImageFileWriter<OutputImageType> WriterType; - typedef otb::TerraSarCalibrationImageFilter<ImageCplxType, ImageCplxType> FilterType; - typedef itk::ExtractImageFilter<ImageCplxType, ImageCplxType> ExtractorType; - - typedef itk::ComplexToRealImageFilter<ImageCplxType, ImageScalarType> RealExtractorType; - typedef itk::ComplexToImaginaryImageFilter<ImageCplxType, ImageScalarType> ImaginaryExtractorType; - typedef otb::ImageListToVectorImageFilter<ImageListType, OutputImageType> ListToVectorImageFilterType; + typedef otb::ImageFileReader<ImageCplxType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + typedef otb::TerraSarCalibrationImageFilter<ImageCplxType, ImageCplxType> FilterType; + typedef itk::ExtractImageFilter<ImageCplxType, ImageCplxType> ExtractorType; + typedef otb::ComplexToVectorImageCastFilter<ImageCplxType, OutputImageType> CasterType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); ExtractorType::Pointer extractor = ExtractorType::New(); + CasterType::Pointer caster = CasterType::New(); reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -66,10 +60,6 @@ int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) filter->SetUseFastCalibration(useFastCalibration); filter->SetResultsInDecibels(resultsInDbs); - // The rest of the code is here to translate the image complexe into - // a VectorImage of int which each channel is the real and imagynary part - RealExtractorType::Pointer realExt = RealExtractorType::New(); - ImaginaryExtractorType::Pointer imgExt = ImaginaryExtractorType::New(); if (argc == 9) { @@ -85,23 +75,15 @@ int otbTerraSarCalibrationImageComplexFilterTest(int argc, char * argv[]) extractor->SetExtractionRegion(region); extractor->SetInput(filter->GetOutput()); - realExt->SetInput(extractor->GetOutput()); - imgExt->SetInput(extractor->GetOutput()); + caster->SetInput(extractor->GetOutput()); } else { - realExt->SetInput(filter->GetOutput()); - imgExt->SetInput(filter->GetOutput()); + caster->SetInput(filter->GetOutput()); } - - ImageListType::Pointer imList = ImageListType::New(); - imList->PushBack(realExt->GetOutput()); - imList->PushBack(imgExt->GetOutput()); - ListToVectorImageFilterType::Pointer listCaster = ListToVectorImageFilterType::New(); - listCaster->SetInput(imList); - - writer->SetInput(listCaster->GetOutput()); + + writer->SetInput(caster->GetOutput()); writer->Update(); return EXIT_SUCCESS;