Commit 625ea8fa authored by Julien Osman's avatar Julien Osman
Browse files

TEST: Refactor test ioTvImageFileReaderExtendedFileName_* so it uses compare-metadata

parent 2631ba31
ProjRef: GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AXIS["Latitude",NORTH],
AXIS["Longitude",EAST],
AUTHORITY["EPSG","4326"]]
Origin: [1943.5, 2364.5]
Spacing: [1, 1]
ProjRef: GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AXIS["Latitude",NORTH],
AXIS["Longitude",EAST],
AUTHORITY["EPSG","4326"]]
Origin: [1943.5, 2364.5]
Spacing: [1, 1]
ProjRef: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]
Origin: [1943.5, 2364.5]
Spacing: [1, 1]
{"ProductionDate": "2004-05-25T19:49:03Z","AcquisitionDate": "2002-04-01T10:52:28.415362Z","SatAzimuth": "359","Instrument": "BGIS2000","SunAzimuth": "154.8","Mission": "Quickbird","SensorID": "QB02","TileHintX": "250","ProjectionWKT": "GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AXIS["Latitude",NORTH],
AXIS["Longitude",EAST],
AUTHORITY["EPSG","4326"]]","ProductType": "Multi","RPC": "<RPCParam>","DataType": "9","AreaOrPoint": "Area","SatElevation": "72.4","TileHintY": "2","SunElevation": "48.6","RedDisplayChannel": "2","GreenDisplayChannel": "1","BlueDisplayChannel": "0",}
\ No newline at end of file
......@@ -109,13 +109,12 @@ otb_add_test(NAME ioTvImageFileWriterExtendedFileName_StreamingNone COMMAND otbE
${TEMP}/ioImageFileWriterExtendedFileName_streamingNone.tif?&streaming:type=none)
otb_add_test(NAME ioTvImageFileReaderExtendedFileName_GEOM COMMAND otbExtendedFilenameTestDriver
--compare-ascii ${NOTOL}
${BASELINE}/ioImageFileReaderWithExternalGEOMFile.txt
${TEMP}/ioImageFileReaderWithExternalGEOMFile.txt
--compare-metadata ${NOTOL}
${BASELINE}/ioImageFileReaderWithExternalGEOMFile.tiff
${TEMP}/ioImageFileReaderWithExternalGEOMFile.tiff
otbImageFileReaderWithExtendedFilename
${INPUTDATA}/ToulouseExtract_WithGeom.tif?&geom=${INPUTDATA}/ToulouseExtract_ModifiedGeom.geom
${TEMP}/ioImageFileReaderWithExternalGEOMFile.txt
${TEMP}/ioImageFileReaderWithExternalGEOMFile_pr.txt
${TEMP}/ioImageFileReaderWithExternalGEOMFile.tiff
)
# TODO: This test needs to be removed when the extended filename writegeom is replaced by writeMetadata
......@@ -138,13 +137,12 @@ otb_add_test(NAME ioTvImageFileWriterExtendedFileName_StreamingAuto COMMAND otbE
${TEMP}/ioImageFileWriterExtendedFileName_streamingAuto.tif?&streaming:type=auto&streaming:sizevalue=${streaming_sizevalue_auto})
otb_add_test(NAME ioTvImageFileReaderExtendedFileName_mix1 COMMAND otbExtendedFilenameTestDriver
--compare-ascii ${NOTOL}
${BASELINE}/ioImageFileReaderExtendedFileName_mix1pr.txt
${TEMP}/ioImageFileReaderExtendedFileName_mix1pr.txt
--compare-metadata ${NOTOL}
${BASELINE}/ioImageFileReaderExtendedFileName_mix1pr.tiff
${TEMP}/ioImageFileReaderExtendedFileName_mix1pr.tiff
otbImageFileReaderWithExtendedFilename
${INPUTDATA}/bretagne.j2k?&skipcarto=true&resol=2
${TEMP}/ioImageFileReaderExtendedFileName_mix1kwl.txt
${TEMP}/ioImageFileReaderExtendedFileName_mix1pr.txt
${TEMP}/ioImageFileReaderExtendedFileName_mix1pr.tiff
)
otb_add_test(NAME ioTvImageFileWriterExtendedFileName_gdalco COMMAND otbExtendedFilenameTestDriver
......@@ -157,23 +155,21 @@ otb_add_test(NAME ioTvImageFileWriterExtendedFileName_gdalco COMMAND otbExtended
)
otb_add_test(NAME ioTvImageFileReaderExtendedFileName_SkipGeom COMMAND otbExtendedFilenameTestDriver
--compare-ascii ${NOTOL}
${BASELINE}/ioImageFileReaderExtendedFileName_Skipgeom_pr.txt
${TEMP}/ioImageFileReaderExtendedFileName_Skipgeom_pr.txt
--compare-metadata ${NOTOL}
${BASELINE}/ioImageFileReaderExtendedFileName_Skipgeom_pr.tiff
${TEMP}/ioImageFileReaderExtendedFileName_Skipgeom.tiff
otbImageFileReaderWithExtendedFilename
${INPUTDATA}/ToulouseExtract_WithGeom.tif?&skipgeom=true
${TEMP}/ioImageFileReaderExtendedFileName_Skipgeom_kwl.txt
${TEMP}/ioImageFileReaderExtendedFileName_Skipgeom_pr.txt
${TEMP}/ioImageFileReaderExtendedFileName_Skipgeom.tiff
)
otb_add_test(NAME ioTvImageFileReaderExtendedFileName_SkipPR COMMAND otbExtendedFilenameTestDriver
--compare-ascii ${NOTOL}
${BASELINE}/ioImageFileReaderExtendedFileName_SkipPR.txt
${TEMP}/ioImageFileReaderExtendedFileName_SkipPR.txt
--compare-metadata ${NOTOL}
${BASELINE}/ioImageFileReaderExtendedFileName_SkipPR.tiff
${TEMP}/ioImageFileReaderExtendedFileName_SkipPR.tiff
otbImageFileReaderWithExtendedFilename
${INPUTDATA}/ToulouseExtract_WithGeom.tif?&skipcarto=true
${TEMP}/ioImageFileReaderExtendedFileName_SkipPR_kwl.txt
${TEMP}/ioImageFileReaderExtendedFileName_SkipPR.txt
${TEMP}/ioImageFileReaderExtendedFileName_SkipPR.tiff
)
otb_add_test(NAME ioTvImageFileWriterExtendedFileName_NODATA COMMAND otbExtendedFilenameTestDriver
......
......@@ -26,36 +26,31 @@
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
int otbImageFileReaderWithExtendedFilename(int itkNotUsed(argc), char* argv[])
int otbImageFileReaderWithExtendedFilename(int argc, char* argv[])
{
// Verify the number of parameters in the command line
const char* inputFilename = argv[1];
const char* outputFilename1 = argv[2];
const char* outputFilename2 = argv[3];
if (argc != 3)
{
std::cout << "Usage: otbImageFileReaderWithExtendedFilename <inputImageFile> <outputImageFile>\n";
}
const char* inputFilename = argv[1];
const char* outputFilename = argv[2];
typedef float InputPixelType;
using PixelType = float;
const unsigned int Dimension = 2;
typedef otb::Image<InputPixelType, Dimension> InputImageType;
using ImageType = otb::Image<PixelType, Dimension>;
typedef otb::ImageFileReader<InputImageType> ReaderType;
using ReaderType = otb::ImageFileReader<ImageType>;
using WriterType = otb::ImageFileWriter<ImageType>;
ReaderType::Pointer reader = ReaderType::New();
std::ofstream file1;
file1.open(outputFilename1);
std::ofstream file2;
file2.open(outputFilename2);
WriterType::Pointer writer = WriterType::New();
reader->SetFileName(inputFilename);
reader->Update();
file1 << reader->GetOutput()->GetImageMetadata().ToJSON();
file2 << "ProjRef: " << reader->GetOutput()->GetProjectionRef() << std::endl;
file2 << "Origin: " << reader->GetOutput()->GetOrigin() << std::endl;
file2 << "Spacing: " << reader->GetOutput()->GetSignedSpacing() << std::endl;
writer->SetInput(reader->GetOutput());
writer->SetFileName(outputFilename);
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