Commit 465acf06 authored by Manuel Grizonnet's avatar Manuel Grizonnet

COMP: remove remaining New tests in MapProjection and Simulation

- For MapProjection: remove MapProjectionNew test declaration and merge all tests related to MapProjection in one cxx file. Moreover MapProjectionsTest is renamed in MapProjectionAccessorsTest
- For Simulation test: Remove SurfaceReflectanceToReflectanceTest wich only contains a template class declaration and instanciation by calling the New() method.
parent 0eea7824
......@@ -35,7 +35,6 @@ otbVectorDataProjectionFilterFromMapToSensor.cxx
otbRationalTransform.cxx
otbGeometriesProjectionFilterFromMapToSensor.cxx
otbImageToEnvelopeVectorDataFilter.cxx
otbMapProjectionsNew.cxx
otbImageToGenericRSOutputParameters.cxx
otbGeometriesProjectionFilterFromMapToGeo.cxx
otbROIdataConversion.cxx
......@@ -460,12 +459,10 @@ otb_add_test(NAME prTvImageToEnvelopeVectorDataFilter COMMAND otbProjectionTestD
${TEMP}/prTvImageToEnvelopeVectorDataFilterOutput.kml
)
otb_add_test(NAME prTuMapProjectionsNew COMMAND otbProjectionTestDriver otbMapProjectionsNew )
otb_add_test(NAME prTvMapProjectionsTest COMMAND otbProjectionTestDriver
--compare-ascii ${EPSILON_4} ${BASELINE_FILES}/prTvMapProjectionsTest.txt
${TEMP}/prTvMapProjectionsTest.txt
otbMapProjectionsTest
otbMapProjectionAccessorsTest
${TEMP}/prTvMapProjectionsTest.txt
)
......
......@@ -130,3 +130,83 @@ int otbMapProjection(int itkNotUsed(argc), char* argv[])
return EXIT_SUCCESS;
}
//Test the specific accessors for some map projection
int otbMapProjectionAccessorsTest(int itkNotUsed(argc), char * argv[])
{
char * filename = argv[1];
std::ofstream file;
file.open(filename);
otb::Eckert4InverseProjection::Pointer lEckert4Projection = otb::Eckert4InverseProjection::New();
file << lEckert4Projection->GetFalseEasting() << std::endl;
file << lEckert4Projection->GetFalseNorthing() << std::endl;
lEckert4Projection->SetFalseEasting(500000);
lEckert4Projection->SetFalseNorthing(500000);
file << lEckert4Projection->GetFalseEasting() << std::endl;
file << lEckert4Projection->GetFalseNorthing() << std::endl;
lEckert4Projection->SetParameters(200000, 300000);
file << lEckert4Projection->GetFalseEasting() << std::endl;
file << lEckert4Projection->GetFalseNorthing() << std::endl;
otb::Eckert4ForwardProjection::Pointer lEckert4Projection2 = otb::Eckert4ForwardProjection::New();
file << lEckert4Projection2->GetFalseEasting() << std::endl;
file << lEckert4Projection2->GetFalseNorthing() << std::endl;
lEckert4Projection2->SetFalseEasting(500000);
lEckert4Projection2->SetFalseNorthing(500000);
file << lEckert4Projection2->GetFalseEasting() << std::endl;
file << lEckert4Projection2->GetFalseNorthing() << std::endl;
lEckert4Projection2->SetParameters(200000, 300000);
file << lEckert4Projection2->GetFalseEasting() << std::endl;
file << lEckert4Projection2->GetFalseNorthing() << std::endl;
otb::MollweidInverseProjection::Pointer lMollweidProjection = otb::MollweidInverseProjection::New();
file << lMollweidProjection->GetFalseEasting() << std::endl;
file << lMollweidProjection->GetFalseNorthing() << std::endl;
lMollweidProjection->SetFalseEasting(500000);
lMollweidProjection->SetFalseNorthing(500000);
file << lMollweidProjection->GetFalseEasting() << std::endl;
file << lMollweidProjection->GetFalseNorthing() << std::endl;
lMollweidProjection->SetParameters(200000, 300000);
file << lMollweidProjection->GetFalseEasting() << std::endl;
file << lMollweidProjection->GetFalseNorthing() << std::endl;
otb::MollweidForwardProjection::Pointer lMollweidProjection2 = otb::MollweidForwardProjection::New();
file << lMollweidProjection2->GetFalseEasting() << std::endl;
file << lMollweidProjection2->GetFalseNorthing() << std::endl;
lMollweidProjection2->SetFalseEasting(500000);
lMollweidProjection2->SetFalseNorthing(500000);
file << lMollweidProjection2->GetFalseEasting() << std::endl;
file << lMollweidProjection2->GetFalseNorthing() << std::endl;
lMollweidProjection2->SetParameters(200000, 300000);
file << lMollweidProjection2->GetFalseEasting() << std::endl;
file << lMollweidProjection2->GetFalseNorthing() << std::endl;
otb::SinusoidalInverseProjection::Pointer lSinusoidalProjection = otb::SinusoidalInverseProjection::New();
file << lSinusoidalProjection->GetFalseEasting() << std::endl;
file << lSinusoidalProjection->GetFalseNorthing() << std::endl;
lSinusoidalProjection->SetFalseEasting(500000);
lSinusoidalProjection->SetFalseNorthing(500000);
file << lSinusoidalProjection->GetFalseEasting() << std::endl;
file << lSinusoidalProjection->GetFalseNorthing() << std::endl;
lSinusoidalProjection->SetParameters(200000, 300000);
file << lSinusoidalProjection->GetFalseEasting() << std::endl;
file << lSinusoidalProjection->GetFalseNorthing() << std::endl;
otb::SinusoidalForwardProjection::Pointer lSinusoidalProjection2 = otb::SinusoidalForwardProjection::New();
file << lSinusoidalProjection2->GetFalseEasting() << std::endl;
file << lSinusoidalProjection2->GetFalseNorthing() << std::endl;
lSinusoidalProjection2->SetFalseEasting(500000);
lSinusoidalProjection2->SetFalseNorthing(500000);
file << lSinusoidalProjection2->GetFalseEasting() << std::endl;
file << lSinusoidalProjection2->GetFalseNorthing() << std::endl;
lSinusoidalProjection2->SetParameters(200000, 300000);
file << lSinusoidalProjection2->GetFalseEasting() << std::endl;
file << lSinusoidalProjection2->GetFalseNorthing() << std::endl;
file.close();
return EXIT_SUCCESS;
}
/*
* Copyright (C) 2005-2017 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 <iostream>
#include <fstream>
#include "itkMacro.h"
#include "otbImage.h"
#include "otbMapProjections.h"
//Test the specific accessors for some map projection
int otbMapProjectionsTest(int itkNotUsed(argc), char * argv[])
{
char * filename = argv[1];
std::ofstream file;
file.open(filename);
otb::Eckert4InverseProjection::Pointer lEckert4Projection = otb::Eckert4InverseProjection::New();
file << lEckert4Projection->GetFalseEasting() << std::endl;
file << lEckert4Projection->GetFalseNorthing() << std::endl;
lEckert4Projection->SetFalseEasting(500000);
lEckert4Projection->SetFalseNorthing(500000);
file << lEckert4Projection->GetFalseEasting() << std::endl;
file << lEckert4Projection->GetFalseNorthing() << std::endl;
lEckert4Projection->SetParameters(200000, 300000);
file << lEckert4Projection->GetFalseEasting() << std::endl;
file << lEckert4Projection->GetFalseNorthing() << std::endl;
otb::Eckert4ForwardProjection::Pointer lEckert4Projection2 = otb::Eckert4ForwardProjection::New();
file << lEckert4Projection2->GetFalseEasting() << std::endl;
file << lEckert4Projection2->GetFalseNorthing() << std::endl;
lEckert4Projection2->SetFalseEasting(500000);
lEckert4Projection2->SetFalseNorthing(500000);
file << lEckert4Projection2->GetFalseEasting() << std::endl;
file << lEckert4Projection2->GetFalseNorthing() << std::endl;
lEckert4Projection2->SetParameters(200000, 300000);
file << lEckert4Projection2->GetFalseEasting() << std::endl;
file << lEckert4Projection2->GetFalseNorthing() << std::endl;
otb::MollweidInverseProjection::Pointer lMollweidProjection = otb::MollweidInverseProjection::New();
file << lMollweidProjection->GetFalseEasting() << std::endl;
file << lMollweidProjection->GetFalseNorthing() << std::endl;
lMollweidProjection->SetFalseEasting(500000);
lMollweidProjection->SetFalseNorthing(500000);
file << lMollweidProjection->GetFalseEasting() << std::endl;
file << lMollweidProjection->GetFalseNorthing() << std::endl;
lMollweidProjection->SetParameters(200000, 300000);
file << lMollweidProjection->GetFalseEasting() << std::endl;
file << lMollweidProjection->GetFalseNorthing() << std::endl;
otb::MollweidForwardProjection::Pointer lMollweidProjection2 = otb::MollweidForwardProjection::New();
file << lMollweidProjection2->GetFalseEasting() << std::endl;
file << lMollweidProjection2->GetFalseNorthing() << std::endl;
lMollweidProjection2->SetFalseEasting(500000);
lMollweidProjection2->SetFalseNorthing(500000);
file << lMollweidProjection2->GetFalseEasting() << std::endl;
file << lMollweidProjection2->GetFalseNorthing() << std::endl;
lMollweidProjection2->SetParameters(200000, 300000);
file << lMollweidProjection2->GetFalseEasting() << std::endl;
file << lMollweidProjection2->GetFalseNorthing() << std::endl;
otb::SinusoidalInverseProjection::Pointer lSinusoidalProjection = otb::SinusoidalInverseProjection::New();
file << lSinusoidalProjection->GetFalseEasting() << std::endl;
file << lSinusoidalProjection->GetFalseNorthing() << std::endl;
lSinusoidalProjection->SetFalseEasting(500000);
lSinusoidalProjection->SetFalseNorthing(500000);
file << lSinusoidalProjection->GetFalseEasting() << std::endl;
file << lSinusoidalProjection->GetFalseNorthing() << std::endl;
lSinusoidalProjection->SetParameters(200000, 300000);
file << lSinusoidalProjection->GetFalseEasting() << std::endl;
file << lSinusoidalProjection->GetFalseNorthing() << std::endl;
otb::SinusoidalForwardProjection::Pointer lSinusoidalProjection2 = otb::SinusoidalForwardProjection::New();
file << lSinusoidalProjection2->GetFalseEasting() << std::endl;
file << lSinusoidalProjection2->GetFalseNorthing() << std::endl;
lSinusoidalProjection2->SetFalseEasting(500000);
lSinusoidalProjection2->SetFalseNorthing(500000);
file << lSinusoidalProjection2->GetFalseEasting() << std::endl;
file << lSinusoidalProjection2->GetFalseNorthing() << std::endl;
lSinusoidalProjection2->SetParameters(200000, 300000);
file << lSinusoidalProjection2->GetFalseEasting() << std::endl;
file << lSinusoidalProjection2->GetFalseNorthing() << std::endl;
file.close();
return EXIT_SUCCESS;
}
......@@ -36,8 +36,7 @@ void RegisterTests()
REGISTER_TEST(otbRationalTransform);
REGISTER_TEST(otbGeometriesProjectionFilterFromMapToSensor);
REGISTER_TEST(otbImageToEnvelopeVectorDataFilter);
REGISTER_TEST(otbMapProjectionsNew);
REGISTER_TEST(otbMapProjectionsTest);
REGISTER_TEST(otbMapProjectionAccessorsTest);
REGISTER_TEST(otbImageToGenericRSOutputParameters);
REGISTER_TEST(otbGeometriesProjectionFilterFromMapToGeo);
REGISTER_TEST(otbROIdataConversion);
......
......@@ -34,7 +34,6 @@ otbReduceSpectralResponseSVMClassifier.cxx
otbProspectTransTest.cxx
otbReduceSpectralResponseClassifierRAndNIR.cxx
otbSatelliteRSR.cxx
otbSurfaceReflectanceToReflectanceFilterNew.cxx
otbImageSimulationMethodWithSpatialisationTest.cxx
otbImageSimulationMethodSVMClassif.cxx
otbReduceSpectralResponse.cxx
......@@ -107,7 +106,7 @@ otb_add_test(NAME siTuSatelliteRSRSolarIrradianceCheckValue2 COMMAND otbSimulati
4 #nb band
1.7525000e+00 #lambda
1.8526000e+02 #expected
)
)
otb_add_test(NAME siTuSatelliteRSRSolarIrradianceCheckValue COMMAND otbSimulationTestDriver
otbSatelliteRSRSolarIrradianceCheckValue
......@@ -115,7 +114,7 @@ otb_add_test(NAME siTuSatelliteRSRSolarIrradianceCheckValue COMMAND otbSimulatio
4 #nb band
0.45 #lambda
2.0573899e3 #expected
)
)
otb_add_test(NAME siTuSatelliteRSR COMMAND otbSimulationTestDriver
otbSatelliteRSR
......@@ -132,10 +131,7 @@ otb_add_test(NAME siTuSatelliteRSRCheckValue2 COMMAND otbSimulationTestDriver
0.68 #lambda
1 #num band
0.717 #expected
)
otb_add_test(NAME siTuReflectanceToSurfaceReflectanceFilterNew COMMAND otbSimulationTestDriver
otbSurfaceReflectanceToReflectanceFilterNew )
)
otb_add_test(NAME siTuImageSimulationMethodWithSpatialisationTest COMMAND otbSimulationTestDriver
otbImageSimulationMethodWithSpatialisationTest
......@@ -182,7 +178,7 @@ otb_add_test(NAME siTvReduceSpectralResponseReflectanceMode COMMAND otbSimulatio
4 #nb band
1 #reflectance mode
${TEMP}/siTvReduceSpectralResponseReflectanceMode.txt
)
)
otb_add_test(NAME siTvProspectReflTest COMMAND otbSimulationTestDriver
--compare-ascii ${EPSILON_3} ${BASELINE_FILES}/Simulation/siTvProspectReflTest.txt
......
......@@ -28,8 +28,6 @@ void RegisterTests()
REGISTER_TEST(otbSatelliteRSR);
REGISTER_TEST(otbSatelliteRSRCheckValue);
REGISTER_TEST(otbSatelliteRSRSolarIrradianceCheckValue);
REGISTER_TEST(otbSurfaceReflectanceToReflectanceFilterNew);
REGISTER_TEST(otbSurfaceReflectanceToReflectanceFilterTest);
REGISTER_TEST(otbImageSimulationMethodWithSpatialisationTest);
REGISTER_TEST(otbImageSimulationMethodSVMClassif);
REGISTER_TEST(otbReduceSpectralResponse);
......
/*
* Copyright (C) 2005-2017 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 "otbMacro.h"
#include "otbSpectralResponse.h"
#include "otbSurfaceReflectanceToReflectanceFilter.h"
int otbSurfaceReflectanceToReflectanceFilterTest(int argc, char * argv[])
{
if ( argc != 7 )
{
std::cout << argv[0] << std::endl << "\t" << "<RSR_filename>" << "\t" << "<intrinsic>" << "\t" << "<albedeo>" << "\t" << "<gaseous>" << "\t" << "<downTrans>" << "\t" << "<upTrans>" << std::endl;
return EXIT_FAILURE;
}
const unsigned int Dimension = 2;
typedef double PixelType;
typedef otb::VectorImage<PixelType, Dimension> ImageType;
// typedef itk::ImageRegionIterator< ImageType > IteratorType;
//typedef ResponseType::PairType PairType;
//typedef otb::ObjectList< PairType > PairListType;
// PairListType::Pointer pairList = PairListType::New();
typedef otb::SurfaceReflectanceToReflectanceFilter< ImageType, ImageType> SurfaceReflectanceToReflectanceFilterType;
typedef SurfaceReflectanceToReflectanceFilterType::Pointer SurfaceReflectanceToReflectanceFilterPointerType;
typedef otb::SpectralResponse< PixelType, PixelType> ResponseType;
typedef ResponseType::Pointer ResponsePointerType;
//
ResponsePointerType myResponse=ResponseType::New();
//Load file into vector
const std::string file(argv[1]);
myResponse->Load(file, 100.0);
std::cout << "Input SpectResponse " << myResponse << std::endl;
//rsr to image
ImageType::IndexType start;
start[0] = 0;
start[1] = 0;
ImageType::SizeType size;
size[0] = 1;
size[1] = 1;
std::cout << "Image size: " << size << std::endl;
ImageType::PointType origin;
origin[0] = 0;
origin[1] = 0;
//origin[1] = -90;
ImageType::SpacingType spacing;
spacing[0] = 1;
spacing[1] = 1;
//spacing[1] = -resolution;
ImageType::RegionType region;
region.SetSize( size );
region.SetIndex( start );
ImageType::Pointer image = ImageType::New();
image->SetRegions( region );
image->SetNumberOfComponentsPerPixel( (myResponse)->Size() );
image->Allocate();
ImageType::PixelType pixel;
pixel.SetSize((myResponse)->Size());
for ( unsigned int i = 0; i<(myResponse)->Size(); ++i )
{
pixel[i] = myResponse->GetResponse()[i].second;
}
image->SetPixel(start, pixel);
//Instantiation
SurfaceReflectanceToReflectanceFilterPointerType myFilter=SurfaceReflectanceToReflectanceFilterType::New();
// myFilter->SetInput(image);
//
// typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType;
// otb::AtmosphericRadiativeTerms::Pointer atmo = otb::AtmosphericRadiativeTerms::New();
//
// DataVectorType intrinsic;
// DataVectorType albedo;
// DataVectorType gaseous;
// DataVectorType downTrans;
// DataVectorType upTrans;
//
//
// intrinsic.push_back(static_cast<double>(atof(argv[2])));
// albedo.push_back(static_cast<double>(atof(argv[3])));
// gaseous.push_back(static_cast<double>(atof(argv[4])));
// downTrans.push_back(static_cast<double>(atof(argv[5])));
// upTrans.push_back(static_cast<double>(atof(argv[6])));
//
//
// atmo->SetIntrinsicAtmosphericReflectances(intrinsic);
// atmo->SetSphericalAlbedos(albedo);
// atmo->SetTotalGaseousTransmissions(gaseous);
// atmo->SetDownwardTransmittances(downTrans);
// atmo->SetUpwardTransmittances(upTrans);
//
// myFilter->SetAtmosphericRadiativeTerms(atmo);
// myFilter->Update();
//
// i = 0;
// IteratorType iterator2( myFilter->GetOutput(), myFilter->GetOutput()->GetRequestedRegion() );
// for ( iterator2.GoToBegin(); !iterator2.IsAtEnd(); ++iterator2 )
// {
// myResponse->GetResponse()[i]->second = iterator2.Get()[];
// ++i;
// }
//
// std::cout << "Output SpectResponse " << myResponse << std::endl;
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