Commit 81953398 authored by Jordi Inglada's avatar Jordi Inglada

TEST: added a test for float pixel image generation read/write

parent d5aeb06b
......@@ -173,14 +173,14 @@ ADD_TEST(ioTuMWImageIOCanReadMW ${IO_TESTS1} otbMWImageIOTestCanRead
ADD_TEST(ioTvImageFileReaderMW2TIFIMG ${IO_TESTS1}
--compare-image ${TOL} ${BASELINE}/QB_Toulouse_Ortho_PAN.img
${TEMP}/ioImageFileReaderMW2TIF.tif
otbImageFileReaderTest
otbImageFileReaderTestFloat
${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif
${TEMP}/ioImageFileReaderMW2TIF.tif )
ADD_TEST(ioTvImageFileReaderMW2TIFMW ${IO_TESTS1}
--compare-image ${TOL} ${BASELINE}/QB_Toulouse_Ortho_PAN.mw
${TEMP}/ioImageFileReaderMW2TIF.tif
otbImageFileReaderTest
otbImageFileReaderTestFloat
${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif
${TEMP}/ioImageFileReaderMW2TIF.tif )
......@@ -193,7 +193,7 @@ ADD_TEST(ioTuMWImageIOCanWrite ${IO_TESTS1} otbMWImageIOTestCanWrite
ADD_TEST(ioTvImageFileReaderTIF2MW ${IO_TESTS1}
--compare-image ${TOL} ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif
${TEMP}/ioImageFileReaderTIF2MW.mw
otbImageFileReaderTest
otbImageFileReaderTestFloat
${BASELINE}/QB_Toulouse_Ortho_PAN.mw
${TEMP}/ioImageFileReaderTIF2MW.mw )
......@@ -1593,6 +1593,7 @@ otbLUMImageIOTestCanWrite.cxx
otbMWImageIOTestCanRead.cxx
otbMWImageIOTestCanWrite.cxx
otbImageFileReaderTest.cxx
otbImageFileReaderTestFloat.cxx
otbShortImageIOTest.cxx
)
SET(BasicIO_SRCS2
......
......@@ -34,5 +34,6 @@ REGISTER_TEST(otbLUMImageIOTestCanWrite);
REGISTER_TEST(otbMWImageIOTestCanRead);
REGISTER_TEST(otbMWImageIOTestCanWrite);
REGISTER_TEST(otbImageFileReaderTest);
REGISTER_TEST(otbImageFileReaderTestFloat);
REGISTER_TEST(otbShortImageIOTest);
}
/*=========================================================================
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.
=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif
#include "otbImage.h"
#include "itkExceptionObject.h"
#include <iostream>
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
int otbImageFileReaderTestFloat(int argc, char* argv[])
{
// Verify the number of parameters in the command line
const char * inputFilename = argv[1];
const char * outputFilename = argv[2];
typedef float InputPixelType;
typedef float OutputPixelType;
const unsigned int Dimension = 2;
typedef otb::Image< InputPixelType, Dimension > InputImageType;
typedef otb::Image< OutputPixelType, Dimension > OutputImageType;
typedef otb::ImageFileReader< InputImageType > ReaderType;
typedef otb::ImageFileWriter< OutputImageType > WriterType;
ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName( inputFilename );
writer->SetFileName( outputFilename );
writer->SetInput( reader->GetOutput() );
writer->Update();
return EXIT_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment