diff --git a/Examples/Hyperspectral/CMakeLists.txt~ b/Examples/Hyperspectral/CMakeLists.txt~ deleted file mode 100644 index 5e49f856cf2448b72e2d75add7bc191fc04e1ea8..0000000000000000000000000000000000000000 --- a/Examples/Hyperspectral/CMakeLists.txt~ +++ /dev/null @@ -1,41 +0,0 @@ -# -# Examples on the use of hyperspectral algorithms -# - -PROJECT(HyperspectralExamples) -INCLUDE_REGULAR_EXPRESSION("^.*$") - -ADD_EXECUTABLE(Unmixing HyperspectralUnmixing.cxx ) -TARGET_LINK_LIBRARIES(Unmixing OTBCommon OTBIO OTBHyperspectral) - - -IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) - -SET(BASELINE ${OTB_DATA_ROOT}/Baseline/Examples/Hyperspctral) -SET(BASELINE_IMAGES_OTB ${OTB_DATA_ROOT}/Baseline/OTB/Images) - -SET(INPUTDATA_EXAMPLES ${OTB_DATA_ROOT}/Examples) -SET(INPUTDATA ${OTB_DATA_ROOT}/Input) -SET(TEMP ${OTB_BINARY_DIR}/Testing/Temporary) - -SET(EXE_TESTS ${CXX_TEST_PATH}/otbSimulationExamplesTests) - -SET(TOL 0.0) - -# tests# -# ------- ProsailModelExampleTest ---------- - -ADD_TEST(siTvHyperspectralExampleTest ${EXE_TESTS} - --compare-image ${TOL} ${BASELINE}/siTvUnmixingExampleTest.txt - ${TEMP}/siTvUnmixingExampleTest.txt - Unmixing - ${INPUTDATA}/cuprite.tif - ${TEMP}/siTvUnmixingExampleTest.txt -) - -INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code) - -ADD_EXECUTABLE(otbHyperspectralExamplesTests otbHyperspectralExamplesTests.cxx) -TARGET_LINK_LIBRARIES(otbHyperspectralExamplesTests OTBCommon OTBIO OTBHyperspectral OTBCommon OTBTesting) - -ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) diff --git a/Examples/Hyperspectral/HyperspectralUnmixing.cxx~ b/Examples/Hyperspectral/HyperspectralUnmixing.cxx~ deleted file mode 100644 index 73ec9d416a32f35ed90c1d9f3570e5442f599523..0000000000000000000000000000000000000000 --- a/Examples/Hyperspectral/HyperspectralUnmixing.cxx~ +++ /dev/null @@ -1,158 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#include "otbVectorImage.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" -#include "otbStreamingStatisticsVectorImageFilter.h" -#include "otbEigenvalueLikelihoodMaximisation.h" -#include "otbVcaImageFilter.h" -#include "otbUnConstrainedLeastSquareImageFilter.h" - -#include "otbVectorImageToMatrixImageFilter.h" - -#include "itkCastImageFilter.h" - - -int main(int argc, char * argv[]) -{ - if (argc != 3) - { - std::cerr << "Usage: " << argv[0]; - std::cerr << "inputFileName outputFileName " << std::endl; - return EXIT_FAILURE; - } - - const char * infname = argv[1]; - const char * outfname = argv[2]; - const unsigned int Dimension = 2; - - typedef double PixelType; - typedef otb::VectorImage<PixelType, Dimension> ImageType; - typedef otb::VectorImage<float, Dimension> FloatImageType; - - typedef itk::CastImageFilter<ImageType, FloatImageType> DoubleToFloatFilterType; - - typedef otb::ImageFileReader<ImageType> ReaderType; - typedef otb::ImageFileWriter<FloatImageType> WriterType; - - typedef otb::StreamingStatisticsVectorImageFilter<ImageType> StreamingStatisticsVectorImageFilterType; - typedef otb::EigenvalueLikelihoodMaximisation<double> ELMType; - typedef otb::VCAImageFilter<ImageType> VCAFilterType; - - typedef otb::UnConstrainedLeastSquareImageFilter<ImageType,ImageType,double> UCLSUnmixingFilterType; - - typedef otb::VectorImageToMatrixImageFilter<ImageType> VectorImageToMatrixImageFilterType; - - typedef vnl_vector<double> VectorType; - typedef vnl_matrix<double> MatrixType; - -/// / Noise filtering - // typedef otb::LocalActivityVectorImageFilter< ImageType, ImageType > NoiseFilterType; - - // // Image filtering - // typedef otb::MNFImageFilter< ImageType, ImageType, - // NoiseFilterType, otb::Transform::FORWARD > FilterType; - - //read image - ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(infname); - reader->UpdateOutputInformation(); - - std::cout << "Computing stats" << std::endl; - - StreamingStatisticsVectorImageFilterType::Pointer stats = StreamingStatisticsVectorImageFilterType::New(); - - stats->SetInput(reader->GetOutput()); - otb::StandardWriterWatcher watcher(stats->GetStreamer(), stats->GetFilter(), "Computing image stats"); - stats->Update(); - - VectorType mean (stats->GetMean().GetDataPointer(), stats->GetMean().GetSize()); - MatrixType covariance = stats->GetCovariance().GetVnlMatrix(); - MatrixType correlation = stats->GetCorrelation().GetVnlMatrix(); - - /* - * Estimate Endmembers Numbers - */ - std::cout << "Estimate Endmembers Numbers by ELM" << std::endl; - - ELMType::Pointer elm = ELMType::New(); - elm->SetCovariance(covariance); - elm->SetCorrelation(correlation); - elm->SetNumberOfPixels(reader->GetOutput()->GetLargestPossibleRegion().GetNumberOfPixels()); - elm->Compute(); - - const unsigned int nbEndmembers = elm->GetNumberOfEndmembers(); - - std::cout << "ELM : " << nbEndmembers << " estimated endmembers" << std::endl; - - std::cout << "ELM likelihood values: " << elm->GetLikelihood() << std::endl; - - -/* - * Estimate Endmembers - */ - std::cout << "Estimate Endmembers by VCA" << std::endl; - - VCAFilterType::Pointer vca = VCAFilterType::New(); - vca->SetNumberOfEndmembers(nbEndmembers); - vca->SetInput(reader->GetOutput()); - - ImageType::Pointer endmembersImage; - endmembersImage = vca->GetOutput(); - - /* - * Transform Endmembers image to matrix representation - */ - std::cout << "Endmembers extracted" << std::endl; - std::cout << "Converting endmembers to matrix" << std::endl; - VectorImageToMatrixImageFilterType::Pointer endMember2Matrix = VectorImageToMatrixImageFilterType::New(); - endMember2Matrix->SetInput(endmembersImage); - endMember2Matrix->Update(); - - MatrixType endMembersMatrix = endMember2Matrix->GetMatrix(); - std::cout << "Endmembers matrix : " << endMembersMatrix << std::endl; - - /* - * Unmix - */ - UCLSUnmixingFilterType::Pointer unmixer = - UCLSUnmixingFilterType::New(); - - unmixer->SetInput(reader->GetOutput()); - unmixer->SetMatrix(endMembersMatrix); - unmixer->SetNumberOfThreads(1); // FIXME : currently buggy - - ImageType::Pointer abundanceMap; - abundanceMap = unmixer->GetOutput(); - - /* - * Write abundance map - */ - //std::cout << "Write abundance map" << outputImageName << std::endl; - DoubleToFloatFilterType::Pointer cast = DoubleToFloatFilterType::New(); - cast->SetInput( abundanceMap ); - FloatImageType::Pointer abundanceMapFloat = cast->GetOutput(); - - WriterType::Pointer writer = WriterType::New(); - writer->SetInput(abundanceMapFloat); - writer->SetFileName(outfname); - - writer->Update(); - - return EXIT_SUCCESS; -} // end main diff --git a/Examples/Hyperspectral/otbHyperspectralExamples.cxx~ b/Examples/Hyperspectral/otbHyperspectralExamples.cxx~ deleted file mode 100644 index 3f5527613ead1cbd09ae83ccaca156a54f5f2ee5..0000000000000000000000000000000000000000 --- a/Examples/Hyperspectral/otbHyperspectralExamples.cxx~ +++ /dev/null @@ -1,45 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -// this file defines the otbMultiScaleTest for the test driver -// and all it expects is that you have a function called RegisterTests - -#include <iostream> -#include "otbTestMain.h" - -void RegisterTests() -{ - REGISTER_TEST(ProsailModel); - REGISTER_TEST(LAIFromNDVIImageTransform); - REGISTER_TEST(LAIAndPROSAILToSensorResponse); -} - -#undef main -#define main ProsailModel -#include "ProsailModel.cxx" - - -#undef main -#define main LAIFromNDVIImageTransform -#include "LAIFromNDVIImageTransform.cxx" - - -#undef main -#define main LAIAndPROSAILToSensorResponse -#include "LAIAndPROSAILToSensorResponse.cxx" - -