From e28bd061b1a66650eacf08619a84bfb07c293636 Mon Sep 17 00:00:00 2001 From: Cyrille Valladeau <cyrille.valladeau@c-s.fr> Date: Thu, 18 Nov 2010 10:57:46 +0100 Subject: [PATCH] ENH : cast output as vectorimage instaed of image<complex> --- ...rraSarBrightnessImageComplexFilterTest.cxx | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx b/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx index 68937f0724..2ddd907909 100644 --- a/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx +++ b/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx @@ -19,9 +19,11 @@ #include "otbTerraSarBrightnessImageFilter.h" #include "otbImage.h" +#include "otbVectorImage.h" #include "itkExtractImageFilter.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" +#include "otbComplexToVectorImageCastFilter.h" int otbTerraSarBrightnessImageComplexFilterTest(int argc, char * argv[]) { @@ -30,17 +32,21 @@ int otbTerraSarBrightnessImageComplexFilterTest(int argc, char * argv[]) const bool useMetadata = atoi(argv[3]); const bool resultsInDb = atoi(argv[4]); - typedef std::complex<double> ComplexType; - typedef otb::Image<ComplexType, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<ImageType> WriterType; - typedef otb::TerraSarBrightnessImageFilter<ImageType, ImageType> FilterType; - typedef itk::ExtractImageFilter<ImageType, ImageType> ExtractorType; + typedef std::complex<double> ComplexType; + typedef otb::Image<ComplexType, 2> ImageType; + typedef otb::VectorImage<double, 2> VectorImageType; + typedef otb::ImageFileReader<ImageType> ReaderType; + typedef otb::ImageFileWriter<VectorImageType> WriterType; + + typedef otb::TerraSarBrightnessImageFilter<ImageType, ImageType> FilterType; + typedef itk::ExtractImageFilter<ImageType, ImageType> ExtractorType; + typedef otb::ComplexToVectorImageCastFilter<ImageType, VectorImageType> CastType; ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); FilterType::Pointer filter = FilterType::New(); ExtractorType::Pointer extractor = ExtractorType::New(); + CastType::Pointer caster = CastType::New(); reader->SetFileName(inputFileName); writer->SetFileName(outputFileName); @@ -61,14 +67,16 @@ int otbTerraSarBrightnessImageComplexFilterTest(int argc, char * argv[]) extractor->SetExtractionRegion(region); extractor->SetInput(filter->GetOutput()); - writer->SetInput(extractor->GetOutput()); + caster->SetInput(extractor->GetOutput()); } else { filter->SetCalibrationFactor(10); - writer->SetInput(filter->GetOutput()); + caster->SetInput(filter->GetOutput()); } + + writer->SetInput(caster->GetOutput()); writer->Update(); return EXIT_SUCCESS; -- GitLab