diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index 2ce629166fb90c96d230edea22884b54e13bfd54..e2de9c9bb33e7aeb3b1acae187cb5a0bcded5085 100644 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -3725,6 +3725,17 @@ ADD_TEST(raTuWavelengthSpectralBandsNew ${IO_TESTS23} ENDFOREACH(NBBANDS ${NBBANDS_LIST}) ENDFOREACH(DATA_PIXELTYPE ${DATA_PIXELTYPES_LIST}) + +ADD_TEST(ioTvImageFileReaderWithExternalGEOMFile ${IO_TESTS1} +--compare-ascii ${NOTOL} + ${BASELINE}/ioImageFileReaderWithExternalGEOMFile.txt + ${TEMP}/ioImageFileReaderWithExternalGEOMFile.txt + otbImageFileReaderWithExternalGEOMFile + ${INPUTDATA}/ToulouseExtract_WithGeom.tif + ${INPUTDATA}/ToulouseExtract_ModifiedGeom.geom + ${TEMP}/ioImageFileReaderWithExternalGEOMFile.txt + ) + #---------------------------------------------------------------------------------- SET(BasicIO_SRCS1 otbIOTests1.cxx diff --git a/Testing/Code/IO/otbIOTests1.cxx b/Testing/Code/IO/otbIOTests1.cxx index bb05c22a0ba451f7d9377845c689b5121c443fd7..d90899f9313afc21009749828535979cbca7473c 100644 --- a/Testing/Code/IO/otbIOTests1.cxx +++ b/Testing/Code/IO/otbIOTests1.cxx @@ -29,6 +29,7 @@ void RegisterTests() REGISTER_TEST(otbMWImageIOTestCanRead); REGISTER_TEST(otbMWImageIOTestCanWrite); REGISTER_TEST(otbImageFileReaderTest); + REGISTER_TEST(otbImageFileReaderWithExternalGEOMFile); REGISTER_TEST(otbImageFileReaderTestFloat); REGISTER_TEST(otbShortImageIOTest); REGISTER_TEST(otbImageIOFactoryNew); diff --git a/Testing/Code/IO/otbImageFileReaderTest.cxx b/Testing/Code/IO/otbImageFileReaderTest.cxx index 5713e4ac41d7345d50d8fcb7a153b33f3ed5c821..fdf2be76ca91258337083c97c700133a9073b70b 100644 --- a/Testing/Code/IO/otbImageFileReaderTest.cxx +++ b/Testing/Code/IO/otbImageFileReaderTest.cxx @@ -52,3 +52,31 @@ int otbImageFileReaderTest(int argc, char* argv[]) return EXIT_SUCCESS; } + +int otbImageFileReaderWithExternalGEOMFile(int argc, char* argv[]) +{ + // Verify the number of parameters in the command line + const char * inputFilename = argv[1]; + const char * inputGEOMFilename = argv[2]; + const char * outputFilename = argv[3]; + + typedef float InputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image<InputPixelType, Dimension> InputImageType; + + typedef otb::ImageFileReader<InputImageType> ReaderType; + + ReaderType::Pointer reader = ReaderType::New(); + + std::ofstream file; + file.open(outputFilename); + + reader->SetFileName(inputFilename); + reader->SetExtGEOMFilename(inputGEOMFilename); + reader->Update(); + + file << reader->GetOutput()->GetImageKeywordlist(); + + return EXIT_SUCCESS; +}