diff --git a/Testing/Code/Simulation/CMakeLists.txt b/Testing/Code/Simulation/CMakeLists.txt index 16d5bfedc4a8c9e0524e5e287d821bdc60bb45a1..a62628f1472975b428e7edd93af6ad5086b81417 100644 --- a/Testing/Code/Simulation/CMakeLists.txt +++ b/Testing/Code/Simulation/CMakeLists.txt @@ -92,6 +92,7 @@ add_test(siTuReduceSpectralResponse ${Simulation_TESTS2} ${SPECTRUM_DB}/jpl/beckman/minerals/Arsenate/txt/A01Ac.txt ${INPUTDATA}/Radiometry/SPOT5/HRG2/rep6S.dat 4 #nb band + 0 #reflectance mode ) add_test(siTvReduceSpectralResponse ${Simulation_TESTS2} @@ -101,6 +102,7 @@ add_test(siTvReduceSpectralResponse ${Simulation_TESTS2} ${INPUTDATA}/SpectralResponse1.txt ${INPUTDATA}/Radiometry/Test/rep6S.dat 4 #nb band + 0 #reflectance mode ${TEMP}/siTvReduceSpectralResponse.txt ) diff --git a/Testing/Code/Simulation/otbReduceSpectralResponse.cxx b/Testing/Code/Simulation/otbReduceSpectralResponse.cxx index 2c1ad759caa109d21fd7dc2c68b2c4462615d192..cf92c426469e45ba934d46edef220c7dcabbdf95 100644 --- a/Testing/Code/Simulation/otbReduceSpectralResponse.cxx +++ b/Testing/Code/Simulation/otbReduceSpectralResponse.cxx @@ -24,11 +24,11 @@ int otbReduceSpectralResponse(int argc, char * argv[]) { - if ((argc != 4) && (argc != 5)) + if ((argc != 5) && (argc != 6)) { std::cout << argv[0] << std::endl << "\t" << "<Spectral_response_filename>"; std::cout << "\t" << "<RSR_filename>" << "\t" << "<Nb total satellite band>"; - std::cout << "\t" << "(<Output_filename>)" << std::endl; + std::cout << "\t" << "<reflectance mode>" << "\t" << "(<Output_filename>)" << std::endl; return EXIT_FAILURE; } @@ -44,6 +44,7 @@ int otbReduceSpectralResponse(int argc, char * argv[]) const std::string spectreFile(argv[1]); const std::string RSRfile(argv[2]); unsigned int nbBand = atoi(argv[3]); + bool reflectanceMode(atoi(argv[4])); //Instantiation ResponsePointerType mySpectralResponse = ResponseType::New(); @@ -63,6 +64,8 @@ int otbReduceSpectralResponse(int argc, char * argv[]) myReduceResponse->SetInputSatRSR(myRSR); /** Load the spectral response of the object in the simulator*/ myReduceResponse->SetInputSpectralResponse(mySpectralResponse); + /** Set the reflectance or luminance mode */ + myReduceResponse->SetReflectanceMode(reflectanceMode); //Load file into vector /** Print the input spectral response*/ @@ -75,9 +78,9 @@ int otbReduceSpectralResponse(int argc, char * argv[]) myReduceResponse->CalculateResponse(); /** Print the Reduce SR*/ std::cout << myReduceResponse << std::endl; - if (argc == 5) + if (argc == 6) { - char * outputName = argv[4]; + char * outputName = argv[5]; std::ofstream outputFile(outputName, std::ios::out); outputFile << myReduceResponse << std::endl;