Commit b07214b3 authored by Cédric Traizet's avatar Cédric Traizet

REFAC: move the importExportMetadata test from IOGDAL to ImageIO

parent 0e307262
Pipeline #6953 failed with stages
in 75 minutes and 54 seconds
......@@ -31,7 +31,6 @@ otbGDALReadPxlComplex.cxx
otbGDALImageIOTestCanRead.cxx
otbMultiDatasetReadingInfo.cxx
otbOGRVectorDataIOCanRead.cxx
otbGDALImageIOImportMetadata.cxx
otbGDALRPCTransformerTest.cxx
otbGDALRPCTransformerTest2.cxx
)
......@@ -131,15 +130,6 @@ otb_add_test(NAME ioTvGDALImageIOWriteMetadata COMMAND otbIOGDALTestDriver
${TEMP}/ioTvGDALImageIOWriteMetadata.hdr
${TEMP}/ioTvGDALImageIOWriteMetadata_Report.txt
)
# TODO implement this test
otb_add_test(NAME ioTvGDALImageIOImportMetadata COMMAND otbIOGDALTestDriver
# --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvGDALImageIOImportExportMetadata_JPEG_99.txt
# ${TEMP}/ioTvGDALImageIOImportExportMetadata_JPEG_99.txt
otbGDALImageIOImportMetadata
${INPUTDATA}/metadataIOexample.tif
${TEMP}/ioTvGDALImageIOImportMetadata.txt
)
otb_add_test(NAME ioTvGDALOverviewsBuilder_TIFF COMMAND otbIOGDALTestDriver
otbGDALOverviewsBuilder
......
/*
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "itkMacro.h"
#include <iostream>
#include "otbGDALImageIO.h"
//struct sGDALImageIO : public GDALImageIO
//{
//
//};
int otbGDALImageIOImportMetadata(int itkNotUsed(argc), char* argv[])
{
// Verify the number of parameters in the command line
const char* inputFilename = argv[1];
const char* outputReaderFilename = argv[2];
std::ofstream outfileR(outputReaderFilename);
auto readerGDAL = otb::GDALImageIO::New();
readerGDAL->SetFileName(inputFilename);
if (readerGDAL->CanReadFile(inputFilename))
{
readerGDAL->ReadImageInformation();
outfileR << readerGDAL->GetImageMetadata();
}
else
{
std::cout << "GDALImageIO cannot read the input file: "
<< inputFilename << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
......@@ -33,7 +33,6 @@ void RegisterTests()
REGISTER_TEST(otbGDALImageIOTestCanRead);
REGISTER_TEST(otbMultiDatasetReadingInfo);
REGISTER_TEST(otbOGRVectorDataIOTestCanRead);
REGISTER_TEST(otbGDALImageIOImportMetadata);
REGISTER_TEST(otbGDALRPCTransformerTest);
REGISTER_TEST(otbGDALRPCTransformerTest2);
}
......@@ -1317,3 +1317,12 @@ otb_add_test(NAME ioTvCompareMetadataTest COMMAND otbImageIOTestDriver
otbImageFileReaderRGBTest
${INPUTDATA}/couleurs_extrait.png
${TEMP}/ioImageFileReaderRGB_PNG2PNG.png )
# Imports metadata from a tif file containing OTB type metadata and export it in another tif
otb_add_test(NAME ioTvImportExportMetadataTest COMMAND otbImageIOTestDriver
--compare-metadata ${EPSILON_9}
${INPUTDATA}/metadataIOexample.tif
${TEMP}/ioTvImportExportMetadataTest.tif
otbImageFileReaderTest
${INPUTDATA}/metadataIOexample.tif # contains OTB metadata
${TEMP}/ioTvImportExportMetadataTest.tif )
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