diff --git a/Code/FeatureExtraction/otbCloudDetectionFunctor.h b/Code/FeatureExtraction/otbCloudDetectionFunctor.h index b6aa79eab5c708449fbd3ad7509f31f87ef94926..a21786358f8eb4bf49b4a3710c80df44a9d5311c 100644 --- a/Code/FeatureExtraction/otbCloudDetectionFunctor.h +++ b/Code/FeatureExtraction/otbCloudDetectionFunctor.h @@ -44,7 +44,7 @@ public: ~CloudDetectionFunctor() {}; inline TOutputValue operator()(const TInput& inPix) { - if ( (m_CloudEstimatorFunctor(inPix)>m_MinThreshold) && (m_CloudEstimatorFunctor(inPix)<m_MaxThreshold) ) + if ( (m_CloudEstimatorFunctor(inPix)>m_MinThreshold) && (m_CloudEstimatorFunctor(inPix)<=m_MaxThreshold) ) { return 1; } diff --git a/Code/FeatureExtraction/otbSiftFastImageFilter.txx b/Code/FeatureExtraction/otbSiftFastImageFilter.txx index bcda8485768f5df52a2de8067e608c630990a328..31fc57b92a05566d7671eb3d7e41f22d815179a6 100644 --- a/Code/FeatureExtraction/otbSiftFastImageFilter.txx +++ b/Code/FeatureExtraction/otbSiftFastImageFilter.txx @@ -25,8 +25,6 @@ PURPOSE. See the above copyright notices for more information. #include "itkContinuousIndex.h" #include "itkImageRegionIterator.h" -#include "otbImageFileWriter.h" - namespace otb { /** diff --git a/Code/FeatureExtraction/otbSpectralAngleFunctor.h b/Code/FeatureExtraction/otbSpectralAngleFunctor.h index 38c36ef1b63fc268026835641f88f11f51ccbeb9..85d81cf8042c68b2362556bc5f44a6c63734078e 100644 --- a/Code/FeatureExtraction/otbSpectralAngleFunctor.h +++ b/Code/FeatureExtraction/otbSpectralAngleFunctor.h @@ -19,6 +19,7 @@ #define __otbSpectralAngleFunctor_h #include "otbMath.h" +#include <algorithm> namespace otb { diff --git a/Code/Projections/otbGeocentricTransform.h b/Code/Projections/otbGeocentricTransform.h new file mode 100644 index 0000000000000000000000000000000000000000..381ada6175b4e620a09f248455324db34912b34a --- /dev/null +++ b/Code/Projections/otbGeocentricTransform.h @@ -0,0 +1,87 @@ +/*========================================================================= + +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. + +=========================================================================*/ +#ifndef __otbGeocentricTransform_h +#define __otbGeocentricTransform_h + +#include "itkTransform.h" +#include "otbGenericMapProjection.h" + +#include "base/ossimEllipsoid.h" + +namespace otb +{ + template <InverseOrForwardTransformationEnum TDirectionOfMapping, + class TScalarType = double, + unsigned int NInputDimensions=3, + unsigned int NOutputDimensions=3> + class ITK_EXPORT GeocentricTransform: public itk::Transform<TScalarType, // Data type for scalars + NInputDimensions, // Number of dimensions in the input space + NOutputDimensions> // Number of dimensions in the output space + { + public : + /** Standard class typedefs. */ + typedef itk::Transform< TScalarType, + NInputDimensions, + NOutputDimensions > Superclass; + typedef GeocentricTransform Self; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef typename Superclass::ScalarType ScalarType; + typedef ossimProjection OssimMapProjectionType; + typedef itk::Point<ScalarType,NInputDimensions > InputPointType; + typedef itk::Point<ScalarType,NOutputDimensions > OutputPointType; + + /** Method for creation through the object factory. */ + itkNewMacro( Self ); + + /** Run-time type information (and related methods). */ + itkTypeMacro( GeocentricTransform, itk::Transform ); + + + typedef InverseOrForwardTransformationEnum DirectionOfMappingEnumType; + + itkStaticConstMacro(DirectionOfMapping,DirectionOfMappingEnumType,TDirectionOfMapping); + itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions); + itkStaticConstMacro(SpaceDimension, unsigned int, NInputDimensions); + itkStaticConstMacro(ParametersDimension, unsigned int,NInputDimensions*(NInputDimensions+1)); + + + OutputPointType TransformPoint(const InputPointType &point) const; + + + protected: + GeocentricTransform(); + virtual ~GeocentricTransform(); + ossimEllipsoid* m_Ellipsoid; + + private : + GeocentricTransform(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + }; + +} // namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbGeocentricTransform.txx" +#endif + + +#endif diff --git a/Code/Projections/otbGeocentricTransform.txx b/Code/Projections/otbGeocentricTransform.txx new file mode 100644 index 0000000000000000000000000000000000000000..4596797b08505d2648e512c8f70d1eeabb03205b --- /dev/null +++ b/Code/Projections/otbGeocentricTransform.txx @@ -0,0 +1,57 @@ +/*========================================================================= + +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. + +=========================================================================*/ +#ifndef __otbGeocentricTransform_txx +#define __otbGeocentricTransform_txx + +#include "otbGeocentricTransform.h" + +namespace otb +{ + + template<InverseOrForwardTransformationEnum TransformDirection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> + GeocentricTransform<TransformDirection, TScalarType, NInputDimensions, NOutputDimensions> + ::GeocentricTransform() : Superclass(SpaceDimension,ParametersDimension) + { + m_Ellipsoid = new ossimEllipsoid(); + } + + template<InverseOrForwardTransformationEnum TransformDirection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> + GeocentricTransform<TransformDirection, TScalarType, NInputDimensions, NOutputDimensions> + ::~GeocentricTransform() + { + if (m_Ellipsoid != NULL) + { + delete m_Ellipsoid; + } + } + + template<InverseOrForwardTransformationEnum TransformDirection, class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions> + typename GeocentricTransform<TransformDirection, TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType + GeocentricTransform<TransformDirection, TScalarType, NInputDimensions, NOutputDimensions> + ::TransformPoint(const InputPointType & point) const + { + OutputPointType outputPoint; + + //To be completed + return outputPoint; + } + + +} // namespace otb + +#endif diff --git a/Code/Radiometry/otbVegetationIndex.h b/Code/Radiometry/otbVegetationIndex.h index 9304da4f3a9db43063f2c0484fbed068bd609175..ead5d02719e3f2b4fb1dd1a097fef76e0327d16d 100644 --- a/Code/Radiometry/otbVegetationIndex.h +++ b/Code/Radiometry/otbVegetationIndex.h @@ -321,6 +321,7 @@ public: return static_cast<TOutput>(0.); } return ( static_cast<TOutput>( m_G * (dnir - dr)/denominator ) ); +//return ( static_cast<TOutput>( dnir ) ); } /** Set/Get G parameter */ void SetG(const double g) diff --git a/Examples/FeatureExtraction/CMakeLists.txt b/Examples/FeatureExtraction/CMakeLists.txt index e0301c735f7442d2710fde08d17f615450087e90..f85666ebcdd3cd9e31304073c3037765546042e1 100644 --- a/Examples/FeatureExtraction/CMakeLists.txt +++ b/Examples/FeatureExtraction/CMakeLists.txt @@ -82,6 +82,9 @@ ADD_EXECUTABLE(ParallelLineDetectionExample ParallelLineDetectionExample.cxx) TARGET_LINK_LIBRARIES(ParallelLineDetectionExample OTBIO OTBCommon OTBFeatureExtraction ITKCommon ITKBasicFilters) +ADD_EXECUTABLE(CloudDetectionExample CloudDetectionExample.cxx) +TARGET_LINK_LIBRARIES(CloudDetectionExample OTBIO OTBCommon OTBFeatureExtraction +ITKCommon ITKBasicFilters) IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) @@ -293,6 +296,18 @@ ADD_TEST(ScaleInvariantFeatureImageFilterTest ${EXE_TESTS2} 1 10 0.5 0 ) +# ------- CloudDetectionExampleTest---------- + +ADD_TEST(CloudDetectionExampleTest ${EXE_TESTS2} + --compare-image ${TOL} + ${BASELINE}/CloudDetectionOutput.png + ${TEMP}/CloudDetectionOutput.png + CloudDetectionExampleTest + ${INPUTDATA}/CloudsOnReunion.tif + ${TEMP}/CloudDetectionOutput.png + 553 467 734 581 0.4 0.6 1.0 +) + ADD_EXECUTABLE(otbFeatureExtractionExamplesTests1 otbFeatureExtractionExamplesTests1.cxx) TARGET_LINK_LIBRARIES(otbFeatureExtractionExamplesTests1 gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction OTBLearning OTBMultiScale) diff --git a/Examples/FeatureExtraction/CloudDetectionExample.cxx b/Examples/FeatureExtraction/CloudDetectionExample.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1c4296563da5028096f19cba5599d8ad5b958dbb --- /dev/null +++ b/Examples/FeatureExtraction/CloudDetectionExample.cxx @@ -0,0 +1,238 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#ifdef __BORLANDC__ +#define ITK_LEAN_AND_MEAN +#endif + +// Software Guide : BeginCommandLineArgs +// INPUT: {CloudsOnReunion.tif} +// OUTPUT: {CloudDetectionOutput.png} +// 553 467 734 581 0.4 0.6 1.0 +// Software Guide : EndCommandLineArgs + + +// Software Guide : BeginLatex +// +// The cloud detection functor is a processing chain composed by the computation of a spectral angle (with SpectralAngleFunctor). +// The result is multiplied by a gaussian factor (with CloudEstimatorFunctor) and finally thresholded to obtain +// a binary image (with CloudDetectionFilter). +// However, modifications can be added in the pipeline to adapt to a particular situation. +// +// This example demonstrates the use of the \doxygen{otb}{CloudDetectionFilter}. +// This filter uses the spectral angle principle to measure the radiometric gap between a reference pixel +// and the other pixels of the image. +// +// The first step toward the use of this filter is the inclusion of the proper header files. +// +// Software Guide : EndLatex + +// Software Guide : BeginCodeSnippet + +#include "otbCloudDetectionFunctor.h" +#include "otbCloudDetectionFilter.h" + +// Software Guide : EndCodeSnippet + +#include "otbImage.h" +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "itkExceptionObject.h" + +int main( int argc, char * argv[] ) +{ + + if (argc != 10) + { + std::cerr << "Usage: "<< argv[0]; + std::cerr << "inputFileName outputFileName "; + std::cerr << "firstPixelComponent secondPixelComponent thirdPixelComponent fourthPixelComponent "; + std::cerr << "variance "; + std::cerr << "minThreshold maxThreshold "<<std::endl; + return EXIT_FAILURE; + } + + const unsigned int Dimension = 2; + // Software Guide : BeginLatex + // + // Then we must decide what pixel type to use for the image. We choose to do + // all the computation in double precision and rescale the results + // between 0 and 255 in order to export PNG images. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + + typedef double InputPixelType; + typedef unsigned short OutputPixelType; + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // The images are defined using the pixel type and the dimension. Please note that + // the \doxygen{otb}{RoadExtractionFilter} needs an \doxygen{otb}{VectorImage} as input + // to handle multispectral images. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + typedef otb::VectorImage<InputPixelType,Dimension> VectorImageType; + typedef VectorImageType::PixelType VectorPixelType; + typedef otb::Image<OutputPixelType,Dimension> OutputImageType; + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // We define the functor type that the filter will use. We use the + // \doxygen{otb}{CloudDetectionFunctor}. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + + typedef otb::Functor::CloudDetectionFunctor<VectorPixelType,InputPixelType > FunctorType; + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // Now we can define the \doxygen{otb}{CloudDetectionFilter} that takes a multi-spectral + // image as input and produces a binary image. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + + typedef otb::CloudDetectionFilter<VectorImageType,OutputImageType,FunctorType > CloudDetectionFilterType; + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // An \doxygen{otb}{ImageFileReader} class is also instantiated in order to read + // image data from a file. Then, an \doxygen{otb}{ImageFileWriter} is instantiated in order + // to write the output image to a file. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + + typedef otb::ImageFileReader<VectorImageType> ReaderType; + typedef otb::ImageFileWriter<OutputImageType> WriterType; + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // The different filters composing our pipeline are created by invoking their + // \code{New()} methods, assigning the results to smart pointers. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + + ReaderType::Pointer reader = ReaderType::New(); + CloudDetectionFilterType::Pointer cloudDetection = CloudDetectionFilterType::New(); + WriterType::Pointer writer = WriterType::New(); + + // Software Guide : EndCodeSnippet + + reader->SetFileName(argv[1]); + cloudDetection->SetInput(reader->GetOutput()); + + // Software Guide : BeginLatex + // + // The \doxygen{otb}{CloudDetectionFilter} needs to have a reference pixel + // corresponding to the spectral content likely to represent a cloud. This is done + // by passing a pixel to the filter. Here we suppose that the input image + // has four spectral bands. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + + VectorPixelType referencePixel; + referencePixel.SetSize(4); + referencePixel.Fill(0.); + referencePixel[0] = (atof(argv[3])); + referencePixel[1] = (atof(argv[4])); + referencePixel[2] = (atof(argv[5])); + referencePixel[3] = (atof(argv[6])); + cloudDetection->SetReferencePixel(referencePixel); + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // We must also set the variance parameter of the filter and the parameter of the gaussian functor. + // The bigger the value, the more tolerant the detector will be. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + + cloudDetection->SetVariance(atof(argv[7])); + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // The minimum and maximum thresholds are set to binarise the final result. + // These values have to be between 0 and 1. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + + cloudDetection->SetMinThreshold(atof(argv[8])); + cloudDetection->SetMaxThreshold(atof(argv[9])); + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginCodeSnippet + + writer->SetFileName(argv[2]); + writer->SetInput(cloudDetection->GetOutput()); + writer->Update(); + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // Figure~\ref{fig:CLOUDDETECTION_FILTER} shows the result of applying + // the cloud detection filter to a cloudy image. + // \begin{figure} + // \center + // \includegraphics[width=0.44\textwidth]{CloudsOnReunion.eps} + // \includegraphics[width=0.44\textwidth]{CloudDetectionOutput.eps} + // From left to right : original image, mask cloud resulting from processing.} + // \label{fig:CLOUDDETECTION_FILTER} + // \end{figure} + // + // Software Guide : EndLatex + + + return EXIT_SUCCESS; +} + diff --git a/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx b/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx index 1e6a74294c45a4e645682a37b33d976359dde5df..dec218af753b8e7f491d495ead88ab46a4899ce7 100644 --- a/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx +++ b/Examples/FeatureExtraction/otbFeatureExtractionExamplesTests2.cxx @@ -31,6 +31,7 @@ void RegisterTests() REGISTER_TEST(SeamCarvingOtherExampleTest); //REGISTER_TEST(ImageToSIFTKeyPointSetFilterTest); REGISTER_TEST(ScaleInvariantFeatureImageFilterTest); + REGISTER_TEST(CloudDetectionExampleTest); } #undef main @@ -56,3 +57,8 @@ void RegisterTests() #undef main #define main ScaleInvariantFeatureImageFilterTest #include "ScaleInvariantFeatureImageFilter.cxx" + +#undef main +#define main CloudDetectionExampleTest +#include "CloudDetectionExample.cxx" + diff --git a/Testing/Code/Projections/CMakeLists.txt b/Testing/Code/Projections/CMakeLists.txt index ebd139b2864e6808ec9d0cca8a849b1e8004b4ca..4b941260185825f0db3804e0f3dcc45908192ceb 100644 --- a/Testing/Code/Projections/CMakeLists.txt +++ b/Testing/Code/Projections/CMakeLists.txt @@ -436,7 +436,7 @@ ADD_TEST(prTvVectorDataProjectionFilterFromMapToGeo ${PROJECTIONS_TESTS3} ${TEMP}/prTvVectorDataProjectionFilterFromMapToGeo.kml ) - +ADD_TEST(prTuGeocentricTransformNew ${PROJECTIONS_TESTS3} otbGeocentricTransformNew ) #======================================================================================= SET(Projections_SRCS1 @@ -467,6 +467,7 @@ otbVectorDataProjectionFilterNew.cxx otbVectorDataProjectionFilter.cxx otbVectorDataProjectionFilterFromMapToSensor.cxx otbVectorDataProjectionFilterFromMapToGeo.cxx +otbGeocentricTransformNew.cxx ) diff --git a/Testing/Code/Projections/otbGeocentricTransformNew.cxx b/Testing/Code/Projections/otbGeocentricTransformNew.cxx new file mode 100644 index 0000000000000000000000000000000000000000..222a34ee9400d3ab6ead315a21f93b05d10c1a4d --- /dev/null +++ b/Testing/Code/Projections/otbGeocentricTransformNew.cxx @@ -0,0 +1,35 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include "otbMacro.h" +#include "otbImage.h" +#include "otbGeocentricTransform.h" + +int otbGeocentricTransformNew( int argc, char* argv[] ) +{ + + typedef otb::GeocentricTransform<otb::FORWARD> ProjectionType; + ProjectionType::Pointer projection = ProjectionType::New(); + + + return EXIT_SUCCESS; + +} diff --git a/Testing/Code/Projections/otbProjectionsTests3.cxx b/Testing/Code/Projections/otbProjectionsTests3.cxx index 80e69c356bf05553a648e2ca3f15473726d4447c..83042ced75aff8a3b0463d536b8028ac3b47afaa 100644 --- a/Testing/Code/Projections/otbProjectionsTests3.cxx +++ b/Testing/Code/Projections/otbProjectionsTests3.cxx @@ -35,4 +35,5 @@ void RegisterTests() REGISTER_TEST(otbVectorDataProjectionFilter); REGISTER_TEST(otbVectorDataProjectionFilterFromMapToSensor); REGISTER_TEST(otbVectorDataProjectionFilterFromMapToGeo); + REGISTER_TEST(otbGeocentricTransformNew); } diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt index b49d17bd43ca3ba338b71f3ec09ace193297a47c..493460ffb68a41cf907b45769774043f3dc65e7e 100644 --- a/Testing/Code/Radiometry/CMakeLists.txt +++ b/Testing/Code/Radiometry/CMakeLists.txt @@ -505,8 +505,8 @@ ADD_TEST(raTvEVIRAndBAndNIRVegetationIndexImageFilter ${RADIOMETRY_TESTS4} # ------- otb::MultiChannelRAndBAndNIRVegetationIndexImageFilter ------------------------------ ADD_TEST(raTvEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter ${RADIOMETRY_TESTS4} - #--compare-image ${EPSILON} ${BASELINE}/raRAndBAndNIRVegetationIndex_EVI_poupees_subc1c2c3.tif - # ${TEMP}/raRAndBAndNIRVegetationIndex_EVI_poupees_subc1c2c3.tif + --compare-image ${EPSILON} ${BASELINE}/raRAndBAndNIRVegetationIndex_EVI_qb_RoadExtract.tif + ${TEMP}/raRAndBAndNIRVegetationIndex_EVI_qb_RoadExtract.tif otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter EVI ${INPUTDATA}/qb_RoadExtract.img.hdr @@ -514,14 +514,15 @@ ADD_TEST(raTvEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter ${RADIOMETRY_T 3 # red 1 # blue 4 # nir - 2.5 # gain factor - 6.0 # coefficient of the aerosol resistance term - 7.5 # coefficient of the aerosol resistance term - 1.0 # canopy background adjustment + 10.0 # gain factor + 30.0 # coefficient of the aerosol resistance term + 7.5 # coefficient of the aerosol resistance term + 400.0 # canopy background adjustment ) + # A enrichir SET(Radiometry_SRCS1 otbRAndNIRVegetationIndexImageFilterNew.cxx diff --git a/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx index bd3d6503c45b9fa0d68c939a7d0857ce6c5593f9..c8d18acff476275c6591a14acb1d44c01aa6de67 100644 --- a/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx @@ -45,6 +45,7 @@ int generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char unsigned int redChannel(::atoi(argv[3])); unsigned int blueChannel(::atoi(argv[4])); unsigned int nirChannel(::atoi(argv[5])); +std::cout << "ORDER : "<<redChannel<<" "<<blueChannel<<" "<<nirChannel<<std::endl; double g(::atof(argv[6])); double c1(::atof(argv[7])); diff --git a/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx b/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx index a2e8f87ed377dc7429b390914d1b6ba876de0262..9966707b51a99b338714cdcdb2a8bfc532155c0d 100644 --- a/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx +++ b/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx @@ -61,7 +61,7 @@ int generic_MultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * a int otbMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) { const unsigned int Dimension = 2; - typedef otb::VectorImage<unsigned char ,Dimension> InputImageType; + typedef otb::VectorImage<double ,Dimension> InputImageType; typedef otb::Image<float,Dimension> OutputImageType; std::string strArgv(argv[1]); diff --git a/Utilities/otbossim/CMakeLists.txt b/Utilities/otbossim/CMakeLists.txt index 38625cb20fc07f64b0c87c230a9151611d879d6f..de09ab6fa240f56cc82588a7973c29631ada987e 100644 --- a/Utilities/otbossim/CMakeLists.txt +++ b/Utilities/otbossim/CMakeLists.txt @@ -15,7 +15,7 @@ CHECK_INCLUDE_FILE("dbmalloc.h" CMAKE_HAVE_DBMALLOC_H) CHECK_INCLUDE_FILE("malloc.h" CMAKE_HAVE_MALLOC_H) CHECK_INCLUDE_FILE("dlfcn.h" CMAKE_HAVE_DLFCN_H) -# itkjpeg headers are not generated and put into the include dir automatically. +# itkjpeg headers are not generated and put into the include dir automatically. # Therefore we have to do it ourselves. IF(OTB_USE_EXTERNAL_ITK) @@ -58,24 +58,31 @@ CONFIGURE_FILE(${OTB_SOURCE_DIR}/Utilities/otbossim/include/ossim/ossimConfig.h. ${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimConfig.h) # Run ossim/version-config.cpp taht will generate ossim/ossimVersion.h file nedeed to compile OSSIM -SET(INCLUDES_OSSIM_TRY_RUN "-DINCLUDE_DIRECTORIES:STRING=${OTB_BINARY_DIR}/Utilities/otbossim/include" ) -TRY_RUN(RUN_RESULT_VAR COMPILE_RESULT_VAR - ${OTB_BINARY_DIR} - ${OTB_SOURCE_DIR}/Utilities/otbossim/src/ossim/version-config.cpp - CMAKE_FLAGS "${INCLUDES_OSSIM_TRY_RUN}" - OUTPUT_VARIABLE output - ARGS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" -) - -IF(NOT COMPILE_RESULT_VAR) - MESSAGE(FATAL_ERROR "OSSIM : cannot compile version-config.cpp") -ENDIF(NOT COMPILE_RESULT_VAR) +# SET(INCLUDES_OSSIM_TRY_RUN "-DINCLUDE_DIRECTORIES:STRING=${OTB_BINARY_DIR}/Utilities/otbossim/include" ) +# TRY_RUN(RUN_RESULT_VAR COMPILE_RESULT_VAR +# ${OTB_BINARY_DIR} +# ${OTB_SOURCE_DIR}/Utilities/otbossim/src/ossim/version-config.cpp +# CMAKE_FLAGS "${INCLUDES_OSSIM_TRY_RUN}" +# OUTPUT_VARIABLE output +# ARGS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" +# ) +ADD_EXECUTABLE(version-config ${OTB_SOURCE_DIR}/Utilities/otbossim/src/ossim/version-config.cpp) +ADD_CUSTOM_COMMAND( + OUTPUT ${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h + DEPENDS version-config + COMMAND version-config + ARGS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" + ) + +# IF(NOT COMPILE_RESULT_VAR) +# MESSAGE(FATAL_ERROR "OSSIM : cannot compile version-config.cpp") +# ENDIF(NOT COMPILE_RESULT_VAR) + +# IF(RUN_RESULT_VAR) +# MESSAGE(FATAL_ERROR "OSSIM : cannot create ossimVersion.h file") +# ENDIF(RUN_RESULT_VAR) -IF(RUN_RESULT_VAR) - MESSAGE(FATAL_ERROR "OSSIM : cannot create ossimVersion.h file") -ENDIF(RUN_RESULT_VAR) - SUBDIRS(include) # ADDED BY OTB DEVELOPPERS TO AVOID INTENSIVE RECOMPILATION IF(NOT OTB_DISABLE_UTILITIES_COMPILATION)