From b05eb4db3ec0d9f3e2788b93acb9cb72e1fde01a Mon Sep 17 00:00:00 2001 From: Cyrille Valladeau <cyrille.valladeau@c-s.fr> Date: Thu, 18 Nov 2010 11:51:02 +0100 Subject: [PATCH] ENH : process only one band of the image (don't read vectorimage as image) --- Testing/Code/Projections/CMakeLists.txt | 2 +- .../otbOrthoRectificationMonoThreadFilter.cxx | 21 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Testing/Code/Projections/CMakeLists.txt b/Testing/Code/Projections/CMakeLists.txt index dd8ed1c121..4d58d4944d 100644 --- a/Testing/Code/Projections/CMakeLists.txt +++ b/Testing/Code/Projections/CMakeLists.txt @@ -393,7 +393,7 @@ ADD_TEST(prTlOrthoRectificationSPOT5 ${PROJECTIONS_TESTS2} ) ADD_TEST(prTlOrthoRectificationMonoThreadSPOT5 ${PROJECTIONS_TESTS2} - --compare-image ${EPSILON_4} ${BASELINE}/prTvOrthoRectificationSPOT5_UTM.tif + --compare-image ${EPSILON_4} ${BASELINE}/prTvOrthoRectificationSPOT5_UTM_band1.tif ${TEMP}/prTvOrthoRectificationMonoThreadSPOT5_UTM.tif otbOrthoRectificationMonoThreadFilter ${LARGEINPUT}/SPOT5/TEHERAN/IMAGERY.TIF diff --git a/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx b/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx index 649b021cf3..7e3334f2d6 100644 --- a/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx +++ b/Testing/Code/Projections/otbOrthoRectificationMonoThreadFilter.cxx @@ -25,10 +25,12 @@ #include "otbMacro.h" #include "otbImage.h" +#include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbStreamingImageFileWriter.h" #include "otbInverseSensorModel.h" #include "otbStreamingResampleImageFilter.h" +#include "otbMultiToMonoChannelExtractROI.h" #include "otbOrthoRectificationFilter.h" #include "otbMapProjections.h" @@ -47,15 +49,21 @@ int otbOrthoRectificationMonoThreadFilter(int argc, char* argv[]) return EXIT_FAILURE; } - typedef otb::Image<double, 2> ImageType; - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::StreamingImageFileWriter<ImageType> WriterType; + typedef double PixelType; + typedef otb::Image<PixelType, 2> ImageType; + typedef otb::VectorImage<PixelType, 2> VectorImageType; + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::StreamingImageFileWriter<ImageType> WriterType; + + typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType> ExtractorType; typedef otb::UtmInverseProjection UtmMapProjectionType; typedef otb::OrthoRectificationFilter<ImageType, ImageType, UtmMapProjectionType> OrthoRectifFilterType; + //Allocate pointer ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); + ExtractorType::Pointer extractor = ExtractorType::New(); OrthoRectifFilterType::Pointer orthoRectifFilter = OrthoRectifFilterType::New(); UtmMapProjectionType::Pointer utmMapProjection = UtmMapProjectionType::New(); @@ -65,9 +73,12 @@ int otbOrthoRectificationMonoThreadFilter(int argc, char* argv[]) writer->SetFileName(argv[2]); reader->GenerateOutputInformation(); - std::cout << reader->GetOutput() << std::endl; - orthoRectifFilter->SetInput(reader->GetOutput()); + // Extract the first channel of the image + extractor->SetInput(reader->GetOutput()); + extractor->SetChannel(1); + + orthoRectifFilter->SetInput(extractor->GetOutput()); ImageType::IndexType start; start[0] = 0; -- GitLab