diff --git a/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx b/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx index 8910c5bcdd784185427788ce3726b1947cbc3b98..ff70251c3316bf0670c252f18a82fd4f90c5def9 100644 --- a/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx +++ b/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx @@ -117,6 +117,7 @@ private: { AddParameter(ParameterType_InputImage, "in", "Input Image"); AddParameter(ParameterType_OutputImage, "out", "Output Image"); + MandatoryOff("out"); AddParameter(ParameterType_Choice, "dr", "Dimension reduction"); AddChoice("dr.pca", "PCA"); @@ -146,6 +147,7 @@ private: AddChoice("ua.isra", "ISRA"); AddChoice("ua.ncls", "NCLS"); AddChoice("ua.fcls", "FCLS"); + //SetParameterString("ua", "none"); AddParameter(ParameterType_OutputImage, "oe", "Output Endmembers"); MandatoryOff("oe"); @@ -179,15 +181,16 @@ private: dimReduction = DimReductionMethod_MNF; } } - otbMsgDevMacro( << "Using " - << (dimReduction == DimReductionMethod_NONE ? "NONE" : (dimReduction == DimReductionMethod_PCA ? "PCA" : "MNF") ) - << " dimensionality reduction method" ); + otbAppLogDEBUG(<< "Using " + << (dimReduction == DimReductionMethod_NONE ? "NONE" : (dimReduction == DimReductionMethod_PCA ? "PCA" : "MNF") ) + << " dimensionality reduction method") // Number of endmembers unsigned int nbEndmembers = 0; if ( IsParameterEnabled("ne") && HasValue("ne") ) { nbEndmembers = GetParameterInt("ne"); + otbAppLogDEBUG(<< "nbEndmembers: " << nbEndmembers) } // Dimensionnality estimation @@ -198,6 +201,8 @@ private: { std::cerr << "Only ELM is supported for parameter DimensionalityEstimationMethod" << std::endl; } + otbAppLogDEBUG(<< "dimEstMethodStr: " << dimEstMethodStr) + } if ( IsParameterEnabled("ee") && HasValue("ee") ) @@ -207,17 +212,17 @@ private: { std::cerr << "Only VCA is supported for parameter EndmembersEstimationMethod" << std::endl; } + otbAppLogDEBUG(<< "eeEstMethodStr: " << eeEstMethodStr) } std::string inputEndmembers; if ( IsParameterEnabled("ie") && HasValue("ie") ) { inputEndmembers = GetParameterString("ie"); + otbAppLogDEBUG("inputEndmembers: " << inputEndmembers) } - UnMixingMethod unmixingAlgo = UnMixingMethod_FCLS; - std::cout << " IsParameterEnabled(ua) " << IsParameterEnabled("ua") << std::endl; - std::cout << " HasValue(ua) " << HasValue("ua") << std::endl; + UnMixingMethod unmixingAlgo = UnMixingMethod_NONE; if ( IsParameterEnabled("ua") && HasValue("ua") ) { std::string unmixingAlgoStr = GetParameterString("ua"); @@ -226,20 +231,33 @@ private: { unmixingAlgo = UnMixingMethod_UCLS; } + else if ( boost::to_upper_copy(unmixingAlgoStr) == "NCLS" ) + { + unmixingAlgo = UnMixingMethod_NCLS; + } + else if ( boost::to_upper_copy(unmixingAlgoStr) == "FCLS" ) + { + unmixingAlgo = UnMixingMethod_FCLS; + } else if ( boost::to_upper_copy(unmixingAlgoStr) == "ISRA" ) { unmixingAlgo = UnMixingMethod_ISRA; } } - otbMsgDevMacro( << "Using " + otbAppLogDEBUG( << "Using " << UnMixingMethodNames[unmixingAlgo] - << " unmixing algorithm" ); + << " unmixing algorithm") std::string outputEndmembers; if ( IsParameterEnabled("oe") && HasValue("oe") && inputEndmembers.empty() ) { outputEndmembers = GetParameterString("oe"); } + otbAppLogDEBUG( << "IsParameterEnabled(oe) " << IsParameterEnabled("oe") ) + otbAppLogDEBUG( << "HasValue(oe) " << HasValue("oe") ) + otbAppLogDEBUG( << "inputEndmembers.empty() " << inputEndmembers.empty() ) + otbAppLogDEBUG( << "outputEndmembers: " << outputEndmembers ) + /* * diff --git a/Testing/Applications/CMakeLists.txt b/Testing/Applications/CMakeLists.txt index f43acc81940ac99a097dcd6896dccd67709de8ac..78c5974baee2d0ae47af1c3106fec71f1d71c5cb 100644 --- a/Testing/Applications/CMakeLists.txt +++ b/Testing/Applications/CMakeLists.txt @@ -14,4 +14,5 @@ SET(NOTOL 0.0) SET(EPSILON_3 0.001) SET(EPSILON_9 0.000000001) +add_subdirectory(Hyperspectral) add_subdirectory(Util) diff --git a/Testing/Applications/Hyperspectral/CMakeLists.txt b/Testing/Applications/Hyperspectral/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d867107ce87ce88af8c504fe1745f0b3a9f6857e --- /dev/null +++ b/Testing/Applications/Hyperspectral/CMakeLists.txt @@ -0,0 +1,88 @@ + +#--- HyperspectralUnmixing ---# + +add_test(NAME apTvHyHyperspectralUnmixing_UCLS + COMMAND otbTestDriver + --compare-image ${EPSILON_9} + ${BASELINE_FILES}/apTvHyHyperspectralUnmixing_UCLS.tif + ${TEMP}/apTvHyHyperspectralUnmixing_UCLS.tif + Execute $<TARGET_FILE:otbApplicationLauncherCommandLine> + HyperspectralUnmixing + --modulePath $<TARGET_FILE_DIR:otbapp_HyperspectralUnmixing> + --in ${INPUTDATA}/Hyperspectral/synthetic/hsi_cube.tif + --ie ${INPUTDATA}/Hyperspectral/synthetic/endmembers.tif + --out ${TEMP}/apTvHyHyperspectralUnmixing_UCLS.tif double + --ua ucls ) + +add_test(NAME apTvHyHyperspectralUnmixing_NCLS + COMMAND otbTestDriver + --compare-image ${EPSILON_9} + ${BASELINE_FILES}/apTvHyHyperspectralUnmixing_NCLS.tif + ${TEMP}/apTvHyHyperspectralUnmixing_NCLS.tif + Execute $<TARGET_FILE:otbApplicationLauncherCommandLine> + HyperspectralUnmixing + --modulePath $<TARGET_FILE_DIR:otbapp_HyperspectralUnmixing> + --in ${INPUTDATA}/Hyperspectral/synthetic/hsi_cube.tif + --ie ${INPUTDATA}/Hyperspectral/synthetic/endmembers.tif + --out ${TEMP}/apTvHyHyperspectralUnmixing_NCLS.tif double + --ua ncls ) +# Too long ! +#add_test(NAME apTvHyHyperspectralUnmixing_ISRA +# COMMAND otbTestDriver +# --compare-image ${EPSILON_9} +# ${BASELINE_FILES}/apTvHyHyperspectralUnmixing_ISRA.tif +# ${TEMP}/apTvHyHyperspectralUnmixing_ISRA.tif +# Execute $<TARGET_FILE:otbApplicationLauncherCommandLine> +# HyperspectralUnmixing +# --modulePath $<TARGET_FILE_DIR:otbapp_HyperspectralUnmixing> +# --in ${INPUTDATA}/Hyperspectral/synthetic/hsi_cube.tif +# --ie ${INPUTDATA}/Hyperspectral/synthetic/endmembers.tif +# --out ${TEMP}/apTvHyHyperspectralUnmixing_ISRA.tif double +# --ua isra ) + +add_test(NAME apTvHyHyperspectralUnmixing_FCLS + COMMAND otbTestDriver + --compare-image ${EPSILON_9} + ${BASELINE_FILES}/apTvHyHyperspectralUnmixing_FCLS.tif + ${TEMP}/apTvHyHyperspectralUnmixing_FCLS.tif + Execute $<TARGET_FILE:otbApplicationLauncherCommandLine> + HyperspectralUnmixing + --modulePath $<TARGET_FILE_DIR:otbapp_HyperspectralUnmixing> + --in ${INPUTDATA}/Hyperspectral/synthetic/hsi_cube.tif + --ie ${INPUTDATA}/Hyperspectral/synthetic/endmembers.tif + --out ${TEMP}/apTvHyHyperspectralUnmixing_FCLS.tif double + --ua fcls ) + +add_test(NAME apTvHyHyperspectralUnmixing_VCA + COMMAND otbTestDriver + --compare-image ${EPSILON_9} + ${BASELINE_FILES}/apTvHyHyperspectralUnmixing_VCA.tif + ${TEMP}/apTvHyHyperspectralUnmixing_VCA.tif + Execute $<TARGET_FILE:otbApplicationLauncherCommandLine> + HyperspectralUnmixing + --modulePath $<TARGET_FILE_DIR:otbapp_HyperspectralUnmixing> + --in ${INPUTDATA}/Hyperspectral/synthetic/hsi_cube.tif + --ne 5 + --oe ${TEMP}/apTvHyHyperspectralUnmixing_VCA.tif double ) + +add_test(NAME apTvHyHyperspectralUnmixing_VCA_UCLS + COMMAND otbTestDriver + Execute $<TARGET_FILE:otbApplicationLauncherCommandLine> + HyperspectralUnmixing + --modulePath $<TARGET_FILE_DIR:otbapp_HyperspectralUnmixing> + --in ${OTB_DATA_ROOT}/Input/Hyperspectral/synthetic/hsi_cube.tif + --out ${TEMP}/apTvHyHyperspectralUnmixing_ucls.tif double + --ne 5 + --ua ucls ) + +add_test(NAME apTvHyHyperspectralUnmixing_VCA_FCLS + COMMAND otbTestDriver + Execute $<TARGET_FILE:otbApplicationLauncherCommandLine> + HyperspectralUnmixing + --modulePath $<TARGET_FILE_DIR:otbapp_HyperspectralUnmixing> + --in ${OTB_DATA_ROOT}/Input/Hyperspectral/synthetic/hsi_cube.tif + --out ${TEMP}/apTvHyHyperspectralUnmixing_fcls.tif double + --ne 5 + --ua fcls ) + + \ No newline at end of file