Skip to content
Snippets Groups Projects
Commit f457f978 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

Mise en place du test sur otbShiftScaleImageAdaptor.

parent 1caeefdc
No related branches found
No related tags found
No related merge requests found
......@@ -515,6 +515,18 @@ ADD_TEST(coTvVectorData ${COMMON_TESTS7}
otbVectorData
)
ADD_TEST(coTuShiftScaleImageAdaptorNew ${COMMON_TESTS7}
otbShiftScaleImageAdaptorNew
)
ADD_TEST(coTvShiftScaleImageAdaptor ${COMMON_TESTS7}
--compare-image ${TOL}
${BASELINE}/coTvShiftScaleImageAdaptor.tif # copie the input image
${TEMP}/coTvShiftScaleImageAdaptor.tif
otbShiftScaleImageAdaptor
${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif
${TEMP}/coTvShiftScaleImageAdaptor.tif
)
# ------- Fichiers sources CXX -----------------------------------
SET(BasicCommon_SRCS1
......@@ -592,6 +604,8 @@ otbStandardFilterWatcherNew.cxx
otbDataNodeTest.cxx
otbVectorDataNew.cxx
otbVectorData.cxx
otbShiftScaleImageAdaptorNew.cxx
otbShiftScaleImageAdaptor.cxx
)
INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}")
......
......@@ -32,4 +32,6 @@ REGISTER_TEST(otbStandardFilterWatcherNew);
REGISTER_TEST(otbDataNodeTest);
REGISTER_TEST(otbVectorDataNew);
REGISTER_TEST(otbVectorData);
REGISTER_TEST(otbShiftScaleImageAdaptorNew);
REGISTER_TEST(otbShiftScaleImageAdaptor);
}
/*=========================================================================
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 "otbImage.h"
#include "itkRescaleIntensityImageFilter.h"
#include "otbShiftScaleImageAdaptor.h"
int otbShiftScaleImageAdaptor( int argc, char * argv[] )
{
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
typedef double PixelType;
typedef otb::Image<PixelType, 2> InputImageType;
typedef otb::Image<PixelType, 2> OutputImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef otb::ImageFileWriter< OutputImageType > WriterType;
typedef otb::ShiftScaleImageAdaptor<InputImageType, PixelType> FilterType;
typedef itk::RescaleIntensityImageFilter<FilterType, OutputImageType> RescalerType;
FilterType::Pointer filter = FilterType::New();
RescalerType::Pointer rescaler = RescalerType::New();
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
filter->SetScale(3.);
filter->SetShift(10.);
reader->SetFileName( inputFilename );
filter->SetImage( reader->GetOutput() );
rescaler->SetOutputMinimum( 0 );
rescaler->SetOutputMaximum( 255 );
rescaler->SetInput( filter );
writer->SetFileName( outputFilename );
writer->SetInput( rescaler->GetOutput() );
writer->Update();
return EXIT_SUCCESS;
}
/*=========================================================================
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 "otbVectorImage.h"
#include "otbShiftScaleImageAdaptor.h"
int otbShiftScaleImageAdaptorNew( int argc, char * argv[] )
{
typedef double InputPixelType;
typedef otb::VectorImage<InputPixelType, 2> ImageType;
typedef otb::ShiftScaleImageAdaptor< ImageType, InputPixelType > FilterType;
FilterType::Pointer filter = FilterType::New();
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment