[otb] 01/02: Imported Upstream version 5.2.0

Rashad Kanavath rashad-guest at moszumanska.debian.org
Thu Dec 24 13:44:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

rashad-guest pushed a commit to branch master
in repository otb.

commit 95bc72b04e8edfa32b2cbb4b49c36acfb1939ce4
Author: Rashad Kanavath <rashad.kanavath at c-s.fr>
Date:   Thu Dec 24 14:42:57 2015 +0100

    Imported Upstream version 5.2.0
---
 .gitignore                                         |   10 +
 .hg_archival.txt                                   |    4 -
 .hgtags                                            |   58 -
 .travis.yml                                        |   29 +
 CMake/CTestCustom.cmake.in                         |   25 +-
 CMake/FindLibSVM.cmake                             |    1 +
 CMake/FindNumpy.cmake                              |   28 +
 CMake/FindOssim.cmake                              |   17 +
 CMake/MinGWPackage.cmake                           |  185 ++
 CMake/OTBApplicationMacros.cmake                   |    1 +
 CMake/OTBModuleHeaderTest.cmake                    |    2 +-
 CMake/OTBSetStandardCompilerFlags.cmake            |   17 +
 CMake/SourceStatus.cmake                           |   53 +-
 CMake/otbTestNumpy.py                              |    2 +
 CMake/otbcli.bat.in                                |    4 +-
 CMake/otbcli.sh.in                                 |    4 +-
 CMake/otbgui.bat.in                                |    4 +-
 CMake/otbgui.sh.in                                 |    4 +-
 CMakeLists.txt                                     |   80 +-
 Copyright/Copyright.txt                            |    2 +-
 Copyright/{GETCopyright.txt => IMTCopyright.txt}   |    8 +-
 Examples/BasicFilters/CMakeLists.txt               |    9 +
 Examples/BasicFilters/test/CMakeLists.txt          |   20 +-
 Examples/CMakeLists.txt                            |  147 +-
 .../KullbackLeiblerDistanceChDet.cxx               |   20 +-
 .../KullbackLeiblerSupervizedDistanceChDet.cxx     |    4 +-
 Examples/Classification/CMakeLists.txt             |    4 +-
 Examples/DisparityMap/CMakeLists.txt               |    3 +
 Examples/DisparityMap/test/CMakeLists.txt          |    2 +
 Examples/FeatureExtraction/CMakeLists.txt          |   23 +-
 Examples/FeatureExtraction/test/CMakeLists.txt     |    4 +-
 .../Filtering/GeometriesChangeSpatialReference.cxx |    4 +-
 Examples/Filtering/GeometriesFilter.cxx            |    4 +-
 Examples/IO/CMakeLists.txt                         |    2 +
 Examples/IO/test/CMakeLists.txt                    |    2 +
 Examples/Learning/CMakeLists.txt                   |    5 +-
 Examples/Learning/SEMModelEstimatorExample.cxx     |    4 +-
 Examples/Learning/SOMExample.cxx                   |    2 +-
 .../SVMGenericKernelImageClassificationExample.cxx |    4 +-
 .../SVMGenericKernelImageModelEstimatorExample.cxx |    4 +-
 Examples/Learning/test/CMakeLists.txt              |   25 +-
 Examples/OBIA/CMakeLists.txt                       |    2 +
 .../RadiometricAttributesLabelMapFilterExample.cxx |    2 +-
 Examples/OBIA/test/CMakeLists.txt                  |    2 +
 Examples/Patented/CMakeLists.txt                   |   10 +-
 Examples/Patented/SIFTDensityExample.cxx           |    1 +
 Examples/Projections/test/CMakeLists.txt           |   10 +-
 Examples/Radiometry/CMakeLists.txt                 |    3 +
 Examples/Radiometry/test/CMakeLists.txt            |    2 +
 Examples/Segmentation/CMakeLists.txt               |    6 +-
 Examples/Segmentation/test/CMakeLists.txt          |    3 +-
 Examples/Simulation/CMakeLists.txt                 |    8 +-
 Examples/Simulation/test/CMakeLists.txt            |   31 +-
 Examples/Tutorials/ScalingPipeline.cxx             |    2 +-
 .../BoostAdapters/include/otbStringUtils.h         |  142 +
 .../include/otb_boost_expint_header.h}             |   26 +-
 .../include/otb_boost_graph_header.h}              |   36 +-
 .../include/otb_boost_math_gamma_header.h}         |   26 +-
 .../include/otb_boost_math_normal_header.h}        |   26 +-
 .../include/otb_boost_string_header.h}             |   29 +-
 .../include/otb_boost_tokenizer_header.h}          |   34 +-
 Modules/Adapters/CurlAdapters/otb-module.cmake     |    1 +
 .../Adapters/CurlAdapters/src/otbCurlHelper.cxx    |   13 +-
 Modules/Adapters/CurlAdapters/test/CMakeLists.txt  |    4 +-
 .../CurlAdapters/test/otbIsNightlyRevision.cxx     |   18 +-
 .../GdalAdapters/include/otbOGRDataSourceWrapper.h |   69 +-
 .../include/otbOGRDataSourceWrapper.txx            |    4 +-
 .../GdalAdapters/include/otbOGRFeatureWrapper.h    |   12 +-
 .../GdalAdapters/include/otbOGRFeatureWrapper.txx  |   12 +-
 .../GdalAdapters/include/otbOGRFieldWrapper.h      |   10 +-
 .../GdalAdapters/include/otbOGRFieldWrapper.txx    |   17 +-
 .../GdalAdapters/include/otbOGRLayerWrapper.h      |   14 +-
 .../GdalAdapters/include/otbOGRVersionProxy.h      |  186 ++
 Modules/Adapters/GdalAdapters/src/CMakeLists.txt   |    6 +
 .../src/otbGeometriesToGeometriesFilter.cxx        |    2 +-
 .../GdalAdapters/src/otbOGRDataSourceWrapper.cxx   |  145 +-
 .../GdalAdapters/src/otbOGRFeatureWrapper.cxx      |   17 +-
 .../GdalAdapters/src/otbOGRFieldWrapper.cxx        |    4 +-
 .../GdalAdapters/src/otbOGRLayerWrapper.cxx        |   18 +-
 .../GdalAdapters/src/otbOGRVersionProxy1x.cxx      |  129 +
 .../GdalAdapters/src/otbOGRVersionProxy2x.cxx      |  162 +
 .../test/otbOGRDataSourceWrapperNew.cxx            |   20 +-
 .../Adapters/OSSIMAdapters/include/otbDEMHandler.h |   39 +-
 .../OSSIMAdapters/include/otbImageKeywordlist.h    |    5 +-
 .../OSSIMAdapters/include/otbMetaDataKey.h         |    5 +
 .../include/otbRPCProjectionAdapter.h              |   93 -
 Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt  |    3 +-
 .../OSSIMAdapters/src/otbDEMConvertAdapter.cxx     |   22 +
 .../Adapters/OSSIMAdapters/src/otbDEMHandler.cxx   |  100 +-
 .../OSSIMAdapters/src/otbEllipsoidAdapter.cxx      |   11 +
 .../src/otbGeometricSarSensorModelAdapter.cxx      |   12 +
 .../OSSIMAdapters/src/otbImageKeywordlist.cxx      |  136 +-
 .../OSSIMAdapters/src/otbMapProjectionAdapter.cxx  |   29 +-
 .../Adapters/OSSIMAdapters/src/otbMetaDataKey.cxx  |    7 +-
 .../OSSIMAdapters/src/otbRPCProjectionAdapter.cxx  |  161 -
 .../OSSIMAdapters/src/otbRPCSolverAdapter.cxx      |   13 +
 .../OSSIMAdapters/src/otbSensorModelAdapter.cxx    |   37 +-
 Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt |    1 +
 .../OSSIMAdapters/test/otbDEMHandlerTest.cxx       |   14 +-
 .../OSSIMAdapters/test/otbImageKeywordlist.cxx     |   13 +
 .../test/otbOssimElevManagerTest2.cxx              |   10 +
 .../test/otbOssimElevManagerTest4.cxx              |   10 +
 .../test/otbOssimJpegFileRessourceLeakTest.cxx     |   12 +
 .../AppClassification/app/CMakeLists.txt           |   19 +-
 .../app/otbClassificationMapRegularization.cxx     |    2 +-
 .../app/otbComputeImagesStatistics.cxx             |    2 +-
 .../app/otbComputeOGRLayersFeaturesStatistics.cxx  |    4 +-
 .../app/otbDSFuzzyModelEstimation.cxx              |    2 +-
 .../app/otbFusionOfClassifications.cxx             |    1 +
 .../AppClassification/app/otbImageClassifier.cxx   |   33 +-
 .../app/otbKMeansClassification.cxx                |    1 +
 .../app/otbOGRLayerClassifier.cxx                  |   10 +-
 ...mageClassifier.cxx => otbPredictRegression.cxx} |  142 +-
 .../AppClassification/app/otbSOMClassification.cxx |    1 +
 .../app/otbTrainImagesClassifier.cxx               |  230 +-
 .../app/otbTrainImagesClassifier.h                 |  198 --
 .../AppClassification/app/otbTrainKNN.cxx          |   52 -
 .../AppClassification/app/otbTrainLibSVM.cxx       |   84 -
 .../app/otbTrainOGRLayersClassifier.cxx            |   10 +-
 .../AppClassification/app/otbTrainRegression.cxx   |  543 ++++
 .../include/otbLearningApplicationBase.h           |  232 ++
 .../include/otbLearningApplicationBase.txx         |  181 ++
 .../otbTrainBoost.txx}                             |   29 +-
 .../otbTrainDecisionTree.txx}                      |   29 +-
 .../otbTrainGradientBoostedTree.txx}               |   63 +-
 .../AppClassification/include/otbTrainKNN.txx      |   86 +
 .../AppClassification/include/otbTrainLibSVM.txx   |  160 +
 .../otbTrainNeuralNetwork.txx}                     |   48 +-
 .../otbTrainNormalBayes.txx}                       |   30 +-
 .../otbTrainRandomForests.txx}                     |   29 +-
 .../otbTrainSVM.cxx => include/otbTrainSVM.txx}    |  160 +-
 .../AppClassification/test/CMakeLists.txt          |  353 ++-
 .../app/otbDimensionalityReduction.cxx             |   41 +-
 .../Applications/AppFiltering/app/otbDespeckle.cxx |   62 +-
 .../Applications/AppFiltering/test/CMakeLists.txt  |   44 +
 .../Applications/AppImageUtils/app/CMakeLists.txt  |    5 +
 .../AppImageUtils/app/otbColorMapping.cxx          |    1 +
 .../AppImageUtils/app/otbManageNoData.cxx          |  217 ++
 .../AppImageUtils/app/otbReadImageInfo.cxx         |   41 +-
 .../app/otbOpticalCalibration.cxx                  |    4 +-
 .../app/otbSarRadiometricCalibration.cxx           |   41 +-
 .../AppSARCalibration/test/CMakeLists.txt          |   15 +
 .../AppSARDecompositions/CMakeLists.txt            |    2 +
 .../AppSARDecompositions/app/CMakeLists.txt        |   12 +
 .../app/otbSARDecompositions.cxx                   |  189 ++
 .../AppSARDecompositions/otb-module.cmake          |   17 +
 .../AppSARDecompositions/test/CMakeLists.txt       |   14 +
 .../AppSARPolarMatrixConvert/CMakeLists.txt        |    2 +
 .../AppSARPolarMatrixConvert/app/CMakeLists.txt    |   12 +
 .../app/otbSARPolarMatrixConvert.cxx               |  709 +++++
 .../AppSARPolarMatrixConvert/otb-module.cmake      |   17 +
 .../AppSARPolarMatrixConvert/test/CMakeLists.txt   |  157 +
 .../Applications/AppSARPolarSynth/CMakeLists.txt   |    2 +
 .../AppSARPolarSynth/app/CMakeLists.txt            |   12 +
 .../AppSARPolarSynth/app/otbSARPolarSynth.cxx      |  185 ++
 .../Applications/AppSARPolarSynth/otb-module.cmake |   17 +
 .../AppSARPolarSynth/test/CMakeLists.txt           |   13 +
 .../app/otbHooverCompareSegmentation.cxx           |    2 +
 .../AppSegmentation/app/otbLSMSSegmentation.cxx    |   26 +-
 .../app/otbLSMSSmallRegionsMerging.cxx             |    1 +
 .../AppSegmentation/app/otbSegmentation.cxx        |    4 +-
 .../Applications/AppSegmentation/otb-module.cmake  |    1 -
 .../AppStereo/app/otbBlockMatching.cxx             |    1 +
 .../AppStereo/app/otbStereoFramework.cxx           |   11 +-
 Modules/Applications/AppStereo/otb-module.cmake    |    1 +
 .../AppTest/test/otbWrapperApplicationDocTests.cxx |    1 -
 .../app/otbRasterization.cxx                       |    2 +-
 .../Core/Common/include/otbDecimateImageFilter.h   |    4 +-
 .../Core/Common/include/otbDecimateImageFilter.txx |    6 +-
 .../Core/Common/include/otbDotProductImageFilter.h |    2 +-
 .../include/otbImageRegionAdaptativeSplitter.txx   |   39 +-
 .../Core/Common/include/otbMachineLearningUtils.h  |   34 -
 .../Core/Common/include/otbModelComponentBase.h    |    4 +-
 .../Core/Common/include/otbModelComponentBase.txx  |    4 +-
 .../otbSubsampledImageRegionConstIterator.h        |    4 +-
 .../otbSubsampledImageRegionConstIterator.txx      |    4 +-
 .../include/otbSubsampledImageRegionIterator.h     |    4 +-
 Modules/Core/Common/otb-module.cmake               |    2 +
 Modules/Core/Common/src/CMakeLists.txt             |    1 -
 Modules/Core/Common/src/otbConfigure.h.in          |    1 +
 .../Core/Common/src/otbMachineLearningUtils.cxx    |   94 -
 Modules/Core/Common/test/CMakeLists.txt            |   30 +
 .../test/otbImageRegionAdaptativeSplitter.cxx      |   49 +-
 Modules/Core/Common/test/otbRGBAPixelConverter.cxx |   25 +-
 Modules/Core/ImageBase/include/otbImage.h          |    8 +
 Modules/Core/ImageBase/include/otbVectorImage.h    |    7 +
 Modules/Core/ImageBase/test/CMakeLists.txt         |    3 +
 .../ImageBase/test/otbExtractROITestMetaData.cxx   |    2 +-
 .../test/otbFlexibleDistanceWithMissingValue.cxx   |    2 +-
 .../otbFlexibleDistanceWithMissingValueNew.cxx     |    2 +-
 .../LabelMap/include/otbAttributesMapLabelObject.h |    8 +
 .../include/otbShapeAttributesLabelMapFilter.h     |    2 +
 .../include/otbShapeAttributesLabelMapFilter.txx   |   42 +-
 .../include/otbImageMetadataInterfaceBase.h        |   19 +-
 Modules/Core/Metadata/include/otbNoDataHelper.h    |  165 ++
 .../include/otbRadarsat2ImageMetadataInterface.h   |  203 ++
 .../otbRadarsat2ImageMetadataInterfaceFactory.h}   |   40 +-
 .../Metadata/include/otbSarCalibrationLookupData.h |   72 +
 .../include/otbSarDefaultImageMetadataInterface.h  |    7 +-
 .../include/otbSarImageMetadataInterface.h         |   34 +-
 .../include/otbSentinel1ImageMetadataInterface.h   |  236 ++
 .../otbSentinel1ImageMetadataInterfaceFactory.h}   |   39 +-
 Modules/Core/Metadata/otb-module.cmake             |    6 +-
 Modules/Core/Metadata/src/CMakeLists.txt           |   41 +-
 .../src/otbFormosatImageMetadataInterface.cxx      |    2 +-
 .../src/otbIkonosImageMetadataInterface.cxx        |    2 +-
 .../Metadata/src/otbImageMetadataInterfaceBase.cxx |    8 +
 .../src/otbImageMetadataInterfaceFactory.cxx       |    6 +-
 Modules/Core/Metadata/src/otbNoDataHelper.cxx      |   43 +
 .../src/otbPleiadesImageMetadataInterface.cxx      |    5 +-
 .../src/otbQuickBirdImageMetadataInterface.cxx     |    2 +-
 .../src/otbRadarsat2ImageMetadataInterface.cxx     |  260 ++
 .../otbRadarsat2ImageMetadataInterfaceFactory.cxx  |   58 +
 .../Metadata/src/otbSarImageMetadataInterface.cxx  |   89 +-
 .../src/otbSarImageMetadataInterfaceFactory.cxx    |    6 +-
 .../src/otbSentinel1ImageMetadataInterface.cxx     |  339 +++
 .../otbSentinel1ImageMetadataInterfaceFactory.cxx  |   58 +
 .../src/otbSpot6ImageMetadataInterface.cxx         |    4 +-
 .../Metadata/src/otbSpotImageMetadataInterface.cxx |    2 +-
 .../src/otbTerraSarImageMetadataInterface.cxx      |    2 +-
 .../src/otbWorldView2ImageMetadataInterface.cxx    |    2 +-
 Modules/Core/Metadata/test/CMakeLists.txt          |   45 +
 .../Core/Metadata/test/otbMetadataTestDriver.cxx   |    4 +
 Modules/Core/Metadata/test/otbNoDataHelperTest.cxx |   53 +
 .../otbRadarsat2ImageMetadataInterfaceNew.cxx}     |   15 +-
 .../test/otbSarCalibrationLookupDataTest.cxx       |   75 +
 .../otbSentinel1ImageMetadataInterfaceNew.cxx}     |   15 +-
 Modules/Core/ObjectList/include/otbObjectList.h    |    9 +-
 Modules/Core/ObjectList/include/otbObjectList.txx  |    8 +-
 .../include/otbStreamingWarpImageFilter.h          |    2 +
 .../include/otbStreamingWarpImageFilter.txx        |   37 +
 .../test/otbCreateProjectionWithOSSIM.cxx          |   12 +
 .../Transform/test/otbCreateProjectionWithOTB.cxx  |   12 +
 .../include/otbGISConnectionImplementation.h       |    2 +-
 .../include/otbPolyLineParametricPathWithValue.h   |    8 +
 .../include/otbVectorDataKeywordlist.h             |    5 +-
 .../src/otbVectorDataKeywordlist.cxx               |  206 +-
 .../test/otbHorizontalSobelVectorImageFilter.cxx   |    2 +-
 .../Edge/test/otbSobelVectorImageFilter.cxx        |    2 +-
 .../test/otbVerticalSobelVectorImageFilter.cxx     |    2 +-
 ...ceMatrixAdvancedTextureCoefficientsCalculator.h |  164 -
 ...MatrixAdvancedTextureCoefficientsCalculator.txx |  196 --
 Modules/Feature/Textures/test/CMakeLists.txt       |   13 -
 ...MatrixAdvancedTextureCoefficientsCalculator.cxx |  196 --
 ...rixAdvancedTextureCoefficientsCalculatorNew.cxx |   33 -
 .../Textures/test/otbTexturesTestDriver.cxx        |    2 -
 .../otbKullbackLeiblerDistanceImageFilter.h        |    4 +-
 .../otbKullbackLeiblerDistanceImageFilter.txx      |    4 +-
 .../include/otbKullbackLeiblerProfileImageFilter.h |    4 +-
 .../otbKullbackLeiblerProfileImageFilter.txx       |    4 +-
 ...bKullbackLeiblerSupervizedDistanceImageFilter.h |    4 +-
 ...ullbackLeiblerSupervizedDistanceImageFilter.txx |    4 +-
 .../include/otbFastICAImageFilter.h                |    2 +
 .../include/otbFastICAImageFilter.txx              |   76 +-
 .../include/otbMNFImageFilter.h                    |    2 +
 .../include/otbMNFImageFilter.txx                  |   94 +-
 .../include/otbPCAImageFilter.h                    |    4 +-
 .../include/otbPCAImageFilter.txx                  |  113 +-
 .../test/otbAngularProjectionBinaryImageFilter.cxx |    2 +-
 .../test/otbLocalActivityVectorImageFilter.cxx     |    2 +-
 .../ImageManipulation/include/otbAffineFunctor.h   |   90 +
 ...bBinaryImageMinimalBoundingRegionCalculator.txx |    2 +-
 .../include/otbBoxAndWhiskerImageFilter.h          |    2 +-
 .../include/otbBoxAndWhiskerImageFilter.txx        |    2 +-
 .../include/otbChangeInformationImageFilter.h      |   94 +
 .../include/otbChangeInformationImageFilter.txx    |  150 +
 .../include/otbChangeNoDataValueFilter.h           |  178 ++
 .../include/otbConcatenateScalarValueImageFilter.h |    2 +-
 .../otbEuclideanDistanceMetricWithMissingValue.h   |    4 +-
 ...tbEuclideanDistanceMetricWithMissingValuePow2.h |    4 +-
 ...EuclideanDistanceMetricWithMissingValuePow2.txx |    4 +-
 .../include/otbFlexibleDistanceWithMissingValue.h  |    4 +-
 .../otbFlexibleDistanceWithMissingValue.txx        |    4 +-
 .../include/otbImageToNoDataMaskFilter.h           |  156 +
 .../otbNRIBandImagesToOneNComplexBandsImage.h      |   92 +
 .../otbNRIBandImagesToOneNComplexBandsImage.txx    |  139 +
 .../otbOneRIBandImageToOneComplexBandImage.h       |   91 +
 .../otbOneRIBandImageToOneComplexBandImage.txx     |  100 +
 .../include/otbShiftScaleVectorImageFilter.h       |    8 +
 .../include/otbStreamingResampleImageFilter.h      |    5 +-
 .../include/otbStreamingResampleImageFilter.txx    |   51 +-
 .../otbTwoNRIBandsImageToNComplexBandsImage.h      |   92 +
 .../otbTwoNRIBandsImageToNComplexBandsImage.txx    |  143 +
 .../Filtering/ImageManipulation/otb-module.cmake   |    1 +
 .../ImageManipulation/test/CMakeLists.txt          |   47 +
 .../test/otbAmplitudeFunctorTest.cxx               |    7 +-
 .../test/otbBoxAndWhiskerImageFilterNew.cxx        |    2 +-
 .../test/otbChangeInformationImageFilter.cxx       |   66 +
 .../test/otbChangeNoDataValueFilter.cxx            |  103 +
 .../otbEuclideanDistanceMetricWithMissingValue.cxx |    2 +-
 ...bEuclideanDistanceMetricWithMissingValueNew.cxx |    2 +-
 .../test/otbImageManipulationTestDriver.cxx        |    6 +
 .../test/otbImageToNoDataMaskFilter.cxx            |   88 +
 .../test/otbLocalGradientVectorImageFilter.cxx     |    2 +-
 .../otbNRIBandImagesToOneNComplexBandsImage.cxx    |   62 +
 .../otbOneRIBandImageToOneComplexBandImage.cxx     |   56 +
 .../ImageManipulation/test/otbPhaseFunctorTest.cxx |    7 +-
 .../otbTwoNRIBandsImageToNComplexBandsImage.cxx    |   56 +
 .../ImageNoise/include/otbFrostImageFilter.h       |   23 +-
 .../ImageNoise/include/otbFrostImageFilter.txx     |   82 +-
 ...tbLeeImageFilter.h => otbGammaMAPImageFilter.h} |   50 +-
 ...eImageFilter.txx => otbGammaMAPImageFilter.txx} |   69 +-
 .../{otbLeeImageFilter.h => otbKuanImageFilter.h}  |   50 +-
 ...tbLeeImageFilter.txx => otbKuanImageFilter.txx} |   61 +-
 .../ImageNoise/include/otbLeeImageFilter.h         |   16 +-
 .../ImageNoise/include/otbLeeImageFilter.txx       |   47 +-
 Modules/Filtering/ImageNoise/test/CMakeLists.txt   |   26 +-
 .../ImageNoise/test/otbGammaMAPFilter.cxx          |   71 +
 .../ImageNoise/test/otbImageNoiseTestDriver.cxx    |    2 +
 .../Filtering/ImageNoise/test/otbKuanFilter.cxx    |   71 +
 .../otbParserConditionDataNodeFeatureFunction.h    |    2 +-
 .../include/otbBandMathXImageFilter.txx            |    1 +
 Modules/Filtering/MathParserX/include/otbParserX.h |   10 +-
 .../MathParserX/include/otbParserXPlugins.h        |   79 +
 Modules/Filtering/MathParserX/src/otbParserX.cxx   |    4 +
 .../MathParserX/src/otbParserXPlugins.cxx          |  117 +-
 .../MathParserX/test/otbBandMathXImageFilter.cxx   |   18 +-
 .../otbMorphologicalPyramidAnalysisFilter.txx      |    2 +-
 .../include/otbMorphologicalPyramidResampler.txx   |    2 +-
 .../otbMuellerToReciprocalCovarianceImageFilter.h  |   37 +-
 ...otbMultiChannelsPolarimetricSynthesisFilter.txx |    1 +
 ...procalCoherencyToReciprocalMuellerImageFilter.h |   79 +-
 ...calCovarianceToReciprocalCoherencyImageFilter.h |   44 +-
 .../include/otbReciprocalHAlphaImageFilter.h       |   62 +-
 ...anceToReciprocalCircularCovarianceImageFilter.h |   71 +-
 .../otbSinclairToCircularCovarianceMatrixFunctor.h |   16 +-
 .../include/otbSinclairToMuellerMatrixFunctor.h    |    4 +-
 ...irToReciprocalCircularCovarianceMatrixFunctor.h |   10 +-
 ...otbSinclairToReciprocalCoherencyMatrixFunctor.h |   35 +-
 ...tbSinclairToReciprocalCovarianceMatrixFunctor.h |   30 +-
 Modules/Filtering/Polarimetry/test/CMakeLists.txt  |  130 +-
 .../otbMuellerToReciprocalCovarianceFunctor.cxx    |   12 +-
 .../test/otbReciprocalHAlphaImageFilter.cxx        |   81 +-
 ...tbSinclairToCircularCovarianceMatrixFunctor.cxx |   10 +-
 ...ToReciprocalCircularCovarianceMatrixFunctor.cxx |   11 +-
 ...SinclairToReciprocalCovarianceMatrixFunctor.cxx |    6 +-
 .../include/otbGenericRSResampleImageFilter.h      |    5 +-
 .../include/otbGenericRSResampleImageFilter.txx    |   98 +-
 .../include/otbOrthoRectificationFilter.txx        |    1 +
 .../include/otbProjectiveProjectionImageFilter.h   |    2 +-
 .../Projection/include/otbROIdataConversion.h      |    2 -
 .../Projection/include/otbROIdataConversion.txx    |    2 -
 .../otbVectorDataIntoImageProjectionFilter.txx     |    2 +-
 Modules/Filtering/Projection/otb-module.cmake      |    2 +-
 .../src/otbGeometriesProjectionFilter.cxx          |    8 -
 .../otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx |    1 +
 .../include/otbMeanShiftSmoothingImageFilter.txx   |   12 +-
 .../include/otbNormalizeVectorImageFilter.h        |    3 +-
 .../include/otbNormalizeVectorImageFilter.txx      |   18 +-
 .../include/otbShiftScaleSampleListFilter.h        |    3 +
 Modules/Filtering/Statistics/test/CMakeLists.txt   |    4 +
 .../Statistics/test/otbStatisticsTestDriver.cxx    |    1 +
 .../otbStreamingHistogramVectorImageFilter.cxx     |  113 +-
 .../VectorDataRendering/include/otbMapnikAdapter.h |   18 +
 .../include/otbVectorDataStyle.h                   |    9 +
 .../include/otbVectorDataToImageFilter.h           |   10 +
 .../include/otbVectorDataToMapFilter.h             |   10 +
 .../VectorDataRendering/src/CMakeLists.txt         |    6 +-
 .../VectorDataRendering/src/otbVectorDataStyle.cxx |   15 +
 .../Wavelet/include/otbSubsampleImageFilter.h      |    4 +-
 .../Wavelet/include/otbSubsampleImageFilter.txx    |    4 +-
 .../Wavelet/include/otbWaveletFilterBank.h         |    4 +-
 .../Wavelet/include/otbWaveletFilterBank.txx       |    4 +-
 .../Wavelet/include/otbWaveletGenerator.h          |    4 +-
 .../Wavelet/include/otbWaveletHighPassOperator.h   |    4 +-
 .../Wavelet/include/otbWaveletLowPassOperator.h    |    4 +-
 .../Filtering/Wavelet/include/otbWaveletOperator.h |    4 +-
 .../Wavelet/include/otbWaveletOperatorBase.h       |    4 +-
 .../Wavelet/include/otbWaveletOperatorBase.txx     |    4 +-
 .../include/otbWaveletPacketDecompositionCosts.h   |    4 +-
 .../Wavelet/include/otbWaveletPacketTransform.h    |    4 +-
 .../Wavelet/include/otbWaveletPacketTransform.txx  |    4 +-
 .../Wavelet/include/otbWaveletTransform.h          |    4 +-
 .../Wavelet/include/otbWaveletTransform.txx        |    4 +-
 .../Filtering/Wavelet/src/otbWaveletGenerator.cxx  |    8 +-
 .../Wavelet/test/otbSubsampleImageFilter.cxx       |    4 +-
 .../Wavelet/test/otbSubsampleImageFilterNew.cxx    |    4 +-
 .../Wavelet/test/otbWaveletFilterBank.cxx          |    4 +-
 .../Wavelet/test/otbWaveletInverseTransformNew.cxx |    4 +-
 .../Filtering/Wavelet/test/otbWaveletOperator.cxx  |    4 +-
 .../Wavelet/test/otbWaveletOperatorNew.cxx         |    4 +-
 .../test/otbWaveletPacketInverseTransformNew.cxx   |    4 +-
 .../Wavelet/test/otbWaveletPacketTransform.cxx     |    4 +-
 .../Filtering/Wavelet/test/otbWaveletTransform.cxx |    4 +-
 .../otbNeighborhoodMajorityVotingImageFilter.h     |    1 +
 .../otbNeighborhoodMajorityVotingImageFilter.txx   |   27 +
 Modules/Fusion/MajorityVoting/otb-module.cmake     |    1 +
 .../include/otbBayesianFusionFilter.txx            |    6 +-
 .../include/otbVirtualDimensionality.txx           |    2 +-
 .../EndmembersExtraction/otb-module.cmake          |    2 +-
 .../include/otbISRAUnmixingImageFilter.txx         |    4 +-
 .../Unmixing/include/otbMDMDNMFImageFilter.txx     |    6 +-
 .../include/otbNCLSUnmixingImageFilter.txx         |    4 +-
 .../otbUnConstrainedLeastSquareImageFilter.h       |    2 +-
 Modules/IO/ExtendedFilename/otb-module.cmake       |    2 +-
 .../src/otbExtendedFilenameHelper.cxx              |    7 +-
 .../src/otbExtendedFilenameToReaderOptions.cxx     |    6 +-
 .../src/otbExtendedFilenameToWriterOptions.cxx     |    6 +-
 Modules/IO/IOGDAL/include/otbOGRIOHelper.h         |    7 +-
 Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h     |    8 +-
 Modules/IO/IOGDAL/otb-module.cmake                 |    2 +-
 .../IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx  |    4 +-
 Modules/IO/IOGDAL/src/otbGDALImageIO.cxx           |  165 +-
 Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx           |    8 +-
 Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx       |   45 +-
 Modules/IO/IOGDAL/test/otbGDALOverviewsBuilder.cxx |    5 +-
 Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx   |    3 +-
 Modules/IO/IOLUM/src/otbLUMImageIO.cxx             |    1 +
 Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx         |   16 +-
 Modules/IO/ImageIO/include/otbImageFileReader.h    |   17 +-
 Modules/IO/ImageIO/include/otbImageFileWriter.txx  |    3 +-
 .../IO/ImageIO/include/otbImageSeriesFileReader.h  |    6 +-
 .../ImageIO/include/otbImageSeriesFileReader.txx   |    6 +-
 .../ImageIO/include/otbImageSeriesFileReaderBase.h |    4 +-
 .../include/otbImageSeriesFileReaderBase.txx       |    4 +-
 .../ImageIO/include/otbStreamingImageFileWriter.h  |   72 -
 Modules/IO/ImageIO/otb-module.cmake                |    2 +-
 Modules/IO/ImageIO/test/CMakeLists.txt             |    9 +-
 Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx   |    2 +-
 .../IO/ImageIO/test/otbImageSeriesFileReader.cxx   |    4 +-
 .../test/otbStreamingImageFileWriterTest.cxx       |   20 +-
 Modules/IO/TestKernel/src/otbTestDriver.cxx        |    4 +-
 Modules/IO/TestKernel/src/otbTestHelper.cxx        |  114 +-
 .../include/otbDSFusionOfClassifiersImageFilter.h  |    2 +
 .../otbDSFusionOfClassifiersImageFilter.txx        |   20 +
 .../include/otbGaussianModelComponent.h            |    4 +-
 .../include/otbGaussianModelComponent.txx          |    4 +-
 .../LearningBase/include/otbSEMClassifier.h        |    4 +-
 .../LearningBase/include/otbSEMClassifier.txx      |   14 +-
 .../include/otbMRFEnergyFisherClassification.h     |    2 +-
 Modules/Learning/Markov/otb-module.cmake           |    2 +-
 .../include/otbCzihoSOMLearningBehaviorFunctor.h   |    2 +-
 .../otbCzihoSOMNeighborhoodBehaviorFunctor.h       |    2 +-
 Modules/Learning/SOM/include/otbPeriodicSOM.h      |    2 +-
 Modules/Learning/SOM/include/otbPeriodicSOM.txx    |    2 +-
 Modules/Learning/SOM/include/otbSOM.h              |    2 +-
 Modules/Learning/SOM/include/otbSOM.txx            |    2 +-
 .../SOM/include/otbSOMLearningBehaviorFunctor.h    |    2 +-
 Modules/Learning/SOM/include/otbSOMMap.h           |    2 +-
 Modules/Learning/SOM/include/otbSOMMap.txx         |    2 +-
 .../Learning/SOM/include/otbSOMWithMissingValue.h  |    2 +-
 .../SOM/include/otbSOMWithMissingValue.txx         |    6 +-
 .../Learning/SOM/include/otbSOMbasedImageFilter.h  |    2 +-
 .../SOM/include/otbSOMbasedImageFilter.txx         |    2 +-
 .../SOM/test/otbSOMWithMissingValueNew.cxx         |    2 +-
 .../SOM/test/otbSOMbasedImageFilterNew.cxx         |    2 +-
 .../otbSVMImageClassificationWithRuleFilter.h      |    2 +-
 .../otbSVMImageClassificationWithRuleFilter.txx    |    2 +-
 Modules/Learning/SVMLearning/include/otbSVMModel.h |    6 +
 .../Learning/SVMLearning/include/otbSVMModel.txx   |    4 +-
 .../include/otbBoostMachineLearningModel.h         |   22 +-
 .../include/otbBoostMachineLearningModel.txx       |    9 +-
 .../include/otbConfusionMatrixCalculator.txx       |    2 +-
 .../Supervised/include/otbCvRTreesWrapper.h        |   64 +
 .../include/otbDecisionTreeMachineLearningModel.h  |   28 +-
 .../otbDecisionTreeMachineLearningModel.txx        |   14 +-
 .../otbGradientBoostedTreeMachineLearningModel.h   |   23 +-
 .../otbGradientBoostedTreeMachineLearningModel.txx |   17 +-
 .../include/otbImageClassificationFilter.h         |   16 +-
 .../include/otbImageClassificationFilter.txx       |   45 +-
 .../otbKNearestNeighborsMachineLearningModel.h     |   40 +-
 .../otbKNearestNeighborsMachineLearningModel.txx   |   84 +-
 .../include/otbLibSVMMachineLearningModel.h        |   68 +-
 .../include/otbLibSVMMachineLearningModel.txx      |  102 +-
 .../Supervised}/include/otbMachineLearningModel.h  |   30 +-
 .../include/otbMachineLearningModel.txx            |   37 +-
 .../include/otbNeuralNetworkMachineLearningModel.h |   42 +-
 .../otbNeuralNetworkMachineLearningModel.txx       |  105 +-
 .../include/otbNormalBayesMachineLearningModel.h   |   21 +-
 .../include/otbNormalBayesMachineLearningModel.txx |   10 +-
 .../Learning/Supervised/include/otbOpenCVUtils.h   |   19 +
 .../include/otbRandomForestsMachineLearningModel.h |   40 +-
 .../otbRandomForestsMachineLearningModel.txx       |   76 +-
 .../otbRandomForestsMachineLearningModelFactory.h  |    2 +-
 .../include/otbSVMMachineLearningModel.h           |   27 +-
 .../include/otbSVMMachineLearningModel.txx         |   71 +-
 .../include/otbSVMMachineLearningModelFactory.h    |    2 +-
 Modules/Learning/Supervised/otb-module.cmake       |    4 +-
 Modules/Learning/Supervised/src/CMakeLists.txt     |    6 +-
 .../Learning/Supervised/src/otbCvRTreesWrapper.cxx |   76 +
 Modules/Learning/Supervised/test/CMakeLists.txt    |    1 +
 .../test/otbMachineLearningRegressionTests.cxx     |  671 +++++
 .../Supervised/test/otbSupervisedTestDriver.cxx    |   11 +-
 .../test/otbTrainMachineLearningModel.cxx          |   36 +-
 .../Learning/Supervised/test/tests-libsvm.cmake    |    4 +
 .../Learning/Supervised/test/tests-opencv.cmake    |   26 +
 .../RCC8/include/otbImageToImageRCC8Calculator.txx |    2 +-
 .../RCC8/include/otbPolygonListToRCC8GraphFilter.h |    3 +-
 Modules/OBIA/RCC8/include/otbRCC8Graph.h           |    3 +-
 Modules/OBIA/RCC8/otb-module.cmake                 |    2 +-
 .../include/otbAtmosphericRadiativeTerms.h         |    5 +-
 .../Radiometry/OpticalCalibration/otb-module.cmake |    2 +-
 .../src/otbAtmosphericRadiativeTerms.cxx           |    4 +-
 .../src/otbSpectralSensitivityReader.cxx           |    2 +-
 .../include/otbSarRadiometricCalibrationFunction.h |   87 +-
 .../otbSarRadiometricCalibrationFunction.txx       |  106 +-
 .../include/otbSarRadiometricCalibrationFunctor.h  |  161 -
 .../otbSarRadiometricCalibrationToImageFilter.h    |   41 +-
 .../otbSarRadiometricCalibrationToImageFilter.txx  |  162 +-
 .../Radiometry/SARCalibration/test/CMakeLists.txt  |   32 +-
 .../test/otbSARCalibrationTestDriver.cxx           |    2 -
 .../test/otbSarBrightnessFunctionWithoutNoise.cxx  |    1 +
 .../test/otbSarBrightnessFunctor.cxx               |   12 +-
 .../test/otbSarBrightnessFunctorWithoutNoise.cxx   |   20 +-
 Modules/Radiometry/Simulation/otb-module.cmake     |    2 +-
 .../Radiometry/Simulation/src/otbProspectModel.cxx |    3 +-
 Modules/Radiometry/Simulation/src/otbSailModel.cxx |    7 +-
 .../include/otbDisparityTranslateFilter.txx        |   12 +
 ...nesInterpolateDisplacementFieldGeneratorNew.cxx |    7 +-
 .../Stereo/include/otbAdhesionCorrectionFilter.txx |    2 +-
 .../Stereo/include/otbBijectionCoherencyFilter.txx |   14 +-
 .../Stereo/include/otbMulti3DMapToDEMFilter.txx    |   21 +-
 Modules/Remote/Mosaic.remote.cmake                 |    9 +
 Modules/Remote/SertitObject.remote.cmake           |   27 +
 Modules/Remote/otbGRM.remote.cmake                 |   16 +
 .../include/otbOGRDataSourceToLabelImageFilter.txx |   11 +
 .../include/otbRasterizeVectorDataFilter.h         |    8 +-
 .../include/otbVectorDataToLabelImageFilter.h      |    6 +-
 .../test/otbOGRDataSourceToLabelImageFilter.cxx    |    2 -
 .../test/otbPolygonizationRasterizationTest.cxx    |    2 -
 .../test/otbVectorDataRasterizeFilter.cxx          |    2 -
 .../test/otbVectorDataToLabelImageFilter.cxx       |    2 -
 ...tbVectorDataToLabelImageFilterWithoutReader.cxx |    2 -
 .../Metrics/include/otbHooverInstanceFilter.h      |   22 +-
 .../include/otbOGRLayerStreamStitchingFilter.txx   |   18 +
 Modules/ThirdParty/GDAL/CMakeLists.txt             |    2 -
 Modules/ThirdParty/GDAL/gdalVersionTest.cxx        |    2 +-
 Modules/ThirdParty/GDAL/otb-module-init.cmake      |   40 +-
 .../ThirdParty/ITK/include/otbWarpImageFilter.h    |    2 +-
 .../ThirdParty/ITK/include/otbWarpImageFilter.txx  |    5 +-
 Modules/ThirdParty/ITK/otb-module-init.cmake       |    3 +-
 Modules/ThirdParty/MuParser/CMakeLists.txt         |   39 +-
 Modules/ThirdParty/OpenCV/otb-module-init.cmake    |    1 +
 Modules/ThirdParty/OpenJPEG/CMakeLists.txt         |    2 +-
 Modules/ThirdParty/OpenJPEG/otb-module-init.cmake  |    3 +-
 Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt |    2 +-
 .../src/ossim/ossimGeometricSarSensorModel.h       |   37 +-
 .../src/ossim/ossimPluginProjectionFactory.cpp     |  219 +-
 .../src/ossim/ossimPluginProjectionFactory.h       |   23 +-
 .../OssimPlugins/src/ossim/ossimRadarSat2Model.cpp |  227 +-
 .../OssimPlugins/src/ossim/ossimRadarSat2Model.h   |    5 +
 .../src/ossim/ossimRadarSat2ProductDoc.cpp         |   24 +-
 .../src/ossim/ossimRadarSat2ProductDoc.h           |   28 +-
 .../src/ossim/ossimRadarSat2TiffReader.cpp         |    4 +-
 .../OssimPlugins/src/ossim/ossimSentinel1Model.cpp |  546 ++++
 .../OssimPlugins/src/ossim/ossimSentinel1Model.h   |  160 +
 .../src/ossim/ossimSentinel1ProductDoc.cpp         |  722 +++++
 .../src/ossim/ossimSentinel1ProductDoc.h           |  112 +
 .../src/ossim/ossimTerraSarTiffReader.cpp          |    8 +-
 .../OssimPlugins/src/ossim/ossimTileMapModel.h     |   42 +-
 Modules/ThirdParty/SiftFast/src/CMakeLists.txt     |   39 +-
 .../include/otbWrapperApplication.h                |   14 +
 .../include/otbWrapperApplicationFactory.h         |   30 +-
 .../include/otbWrapperApplicationFactoryBase.h     |   58 +
 .../include/otbWrapperApplicationRegistry.h        |   18 +-
 .../otbWrapperComplexOutputImageParameter.h        |   17 +-
 .../include/otbWrapperInputProcessXMLParameter.h   |   13 +-
 .../include/otbWrapperOutputImageParameter.h       |   14 +
 .../Wrappers/ApplicationEngine/otb-module.cmake    |    2 +-
 .../Wrappers/ApplicationEngine/src/CMakeLists.txt  |    1 +
 .../src/otbWrapperApplication.cxx                  |   26 +-
 .../src/otbWrapperApplicationFactoryBase.cxx       |   43 +
 .../src/otbWrapperApplicationRegistry.cxx          |  357 ++-
 .../src/otbWrapperComplexOutputImageParameter.cxx  |   26 +-
 .../src/otbWrapperInputImageParameter.cxx          |    3 +-
 .../src/otbWrapperInputImageParameterDouble.cxx    |    2 +-
 .../src/otbWrapperInputImageParameterFloat.cxx     |    2 +-
 .../src/otbWrapperInputImageParameterInt16.cxx     |    2 +-
 .../src/otbWrapperInputImageParameterInt32.cxx     |    2 +-
 .../src/otbWrapperInputImageParameterUInt16.cxx    |    2 +-
 .../src/otbWrapperInputImageParameterUInt32.cxx    |    2 +-
 .../src/otbWrapperInputImageParameterUInt8.cxx     |    2 +-
 .../src/otbWrapperInputProcessXMLParameter.cxx     |   40 +-
 .../src/otbWrapperOutputImageParameter.cxx         |   48 +-
 .../src/otbWrapperParameterGroup.cxx               |    2 +-
 .../src/otbWrapperParameterKey.cxx                 |    2 +-
 .../src/otbWrapperCommandLineLauncher.cxx          |   60 +-
 .../QtWidget/include/otbQtFileSelectionWidget.h    |    2 +-
 .../otbWrapperQtWidgetInputProcessXMLParameter.h   |   19 +
 .../otbWrapperQtWidgetOutputFilenameParameter.h    |   24 +-
 .../otbWrapperQtWidgetOutputImageParameter.h       |   19 +
 .../otbWrapperQtWidgetOutputProcessXMLParameter.h  |   23 +-
 .../otbWrapperQtWidgetOutputVectorDataParameter.h  |   24 +-
 .../QtWidget/src/otbApplicationLauncherQt.cxx      |    6 +-
 .../QtWidget/src/otbQtFileSelectionWidget.cxx      |    8 +
 ...tbWrapperQtWidgetComplexInputImageParameter.cxx |   14 +-
 ...bWrapperQtWidgetComplexOutputImageParameter.cxx |    7 +-
 .../src/otbWrapperQtWidgetDirectoryParameter.cxx   |   14 +-
 ...tbWrapperQtWidgetInputFilenameListParameter.cxx |    6 +-
 .../otbWrapperQtWidgetInputFilenameParameter.cxx   |   31 +-
 .../otbWrapperQtWidgetInputImageListParameter.cxx  |    4 +-
 .../src/otbWrapperQtWidgetInputImageParameter.cxx  |   27 +-
 .../otbWrapperQtWidgetInputProcessXMLParameter.cxx |   48 +-
 ...WrapperQtWidgetInputVectorDataListParameter.cxx |    4 +-
 .../otbWrapperQtWidgetInputVectorDataParameter.cxx |   32 +-
 .../otbWrapperQtWidgetOutputFilenameParameter.cxx  |   28 +-
 .../src/otbWrapperQtWidgetOutputImageParameter.cxx |   22 +-
 ...otbWrapperQtWidgetOutputProcessXMLParameter.cxx |   25 +-
 ...otbWrapperQtWidgetOutputVectorDataParameter.cxx |   16 +-
 .../QtWidget/test/otbWrapperQtWidgetShowWidget.cxx |    1 -
 Modules/Wrappers/SWIG/otb-module-init.cmake        |    4 +-
 Modules/Wrappers/SWIG/src/CMakeLists.txt           |   22 +-
 Modules/Wrappers/SWIG/src/numpy.i                  | 3117 ++++++++++++++++++++
 Modules/Wrappers/SWIG/src/otbApplication.i         |  598 +++-
 Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h |   17 +-
 Modules/Wrappers/SWIG/test/java/CMakeLists.txt     |    2 +-
 Modules/Wrappers/SWIG/test/python/CMakeLists.txt   |   19 +-
 .../PythonNewStyleParametersInstanciateAllTest.py  |   14 +
 .../test/python/PythonNewStyleParametersTest.py    |  130 +
 .../Wrappers/SWIG/test/python/PythonNumpyTest.py   |   64 +
 README                                             |    2 +
 RELEASE_NOTES.txt                                  |   92 +
 Utilities/Doxygen/CMakeLists.txt                   |    3 +
 Utilities/Maintenance/SuperbuildDownloadList.sh    |   69 +-
 614 files changed, 20946 insertions(+), 4923 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7e84294
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+syntax: glob
+*~
+.*.swp
+*.orig
+*.pyc
+.\#*
+\#*\#
+tags
+*vim*
+*.template
diff --git a/.hg_archival.txt b/.hg_archival.txt
deleted file mode 100644
index adbb4b7..0000000
--- a/.hg_archival.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-repo: aba0c56ceeda5161830c14bced82592ab71dfb9b
-node: a4011863ae1e583567ebfb89434ff64e8747de06
-branch: default
-tag: 5.0.0
diff --git a/.hgtags b/.hgtags
deleted file mode 100644
index f004829..0000000
--- a/.hgtags
+++ /dev/null
@@ -1,58 +0,0 @@
-fc5b40e11a8aaa1c8829e52e9f039d2cf9b4f130 2.6-RC-1
-d6fa9d6d4d9cc3504d0c58307a5244b5e9ebefaa 2.6-RC-2
-8c3ece27d9c2c87cbd1b18e3c6ab3c55d9e5a9e3 2.6.0
-c57de48c795be9dc598c523f6caa4fec0cc3d485 1.0.0
-e06828f13c2b147869bcbbe50748367f0ae6ff59 1.0.1
-eb38def1f9c078596478c9df896543cc122475bc 1.2.0
-89253d6376e4381e43a508d4d0cef8c67bd1efda 1.2.1
-c0602b6c225117d4bec7cd8dde0b16ff0de150f2 1.4.0
-3a935a7786c380820ade0db8ef3d2de0c74adba9 1.6.0
-f88e6c180538300877e2a96a49e130c49378fd54 2.0.0
-5a955ca2bbb4bb77704372fdfa318698e143a34c 2.2.0
-b731fc7a20144b9872d8816dd0b2dd25da32b9f1 2.4.0
-e81798625eef1406860392c7455f14f1809c22ec 2.8-RC1
-1f39fbb34a42629faa09dda2f7bdd44a6dd5d9cb 2.8-RC2
-4af55448630465beb844ba77785682372c82bb28 2.8
-4d0929a7669f49958212ecf428d6da9c226c2b9f 3.0-RC1
-6328daec4683b67da236e143b543e4c7f7002a0d 3.0-RC2
-b4cdf08a95acd88cd70e6e2557978418292acba7 3.0.0
-1d6d1039db22bdcad89f6ce4d5a887509f7e13e9 3.2-RC1
-b7ed8110e224906075527d5d435279201a934b9b 3.2-RC2
-5abb5111b4db8635eaecbd291f24b9407d1455d8 3.2.0
-b82303655c0d5a6552ad4261e113c86cb6394c0b 3.2.1
-0000000000000000000000000000000000000000 3.2.1
-53fa101a57738e5b798f11487891f45cf77c397c 3.2.1
-89b3aa4692feed004854eaaeebc7bc585a402bbf COMPRESSION_STAGE_2
-478cb2b06ed751d79a327dfea90418c0d88c79cb 3.4-RC1
-89bcca2b6e9c9bf88c6f0bdf66add46b5d8388a5 3.4-RC2
-c07af3906a803b43018e1a7e15db5c11f54d14b4 3.4.0
-b55f3b8834f2bb8ca71090f12e00fe96e09b722c 3.4.1
-89b3aa4692feed004854eaaeebc7bc585a402bbf COMPRESSION_STAGE_2
-0000000000000000000000000000000000000000 COMPRESSION_STAGE_2
-8daf73b35678fe0604d330a2d19bc33b4fd4eec0 3.6-RC1
-cd8cd293bb70f7489d2b0e35bed676d4f77f6e8e 3.6-RC2
-8eab04ea951bfa288b40a77bc2930928787aafd6 3.6.0
-960a2ecae2bc9a1e4a9561faf1c23df07978dd12 3.8-RC1
-c965f23d849d9b23f1e4d42aa237e91a56aeaaeb 3.8.0
-7bfbfb6d2b0463fe262c00eb3fecf4e7cae26a04 3.10-RC1
-ee53a998b2d9cfcec1c634cdecc3b37d900f7cba 3.10.0
-214e39c2b60bd9e650149b260f011ec58f899856 3.12-RC1
-a4b2838e8448ab7c337d479676ae6ba80d5742e4 3.12.0
-6692aa57bc002e726c8e4bba4e4158a5d91eb1b9 3.14-RC1
-7efc75f29429ed4a837784797ffb1625dd789e31 3.14-RC2
-699df50a3f0ff33de5b9c1d5d398f18b6889eafb 3.14.0
-ad4afc38975a41aad0f9b506777ff2339135d299 3.14.1
-6d0c3799915ce0b6a963f4930f1e89372bf74c76 3.16-rc1
-80062157befbe038bf58ad6fe4739803d6778c81 3.16.0
-6fdd078498509dc8726bf888f0f3789693079321 3.18-rc1
-005cad1512798fdc2794280a389673570f69f483 3.18.0
-296c1e1532fd8dab778f6666a96c49a98a385077 3.18.1
-02113d4594c59f9951635643416d0b232b8a5c6f 3.20-rc1
-3e7a91d3fbe595170753ce018a193dd28aef26af 3.20.0
-9cafe3e2dc540f6008f86da44e5e37d95318380f 4.0-rc1
-8c14c4efeaec0e37b0213b367c5a9997751e3e2a 4.0.0
-97b540d916d7961a9f62b1c8d0192ebb889ad675 4.2-rc1
-7db1f09e3054e73c663802624b69a7564e1396b2 4.2.0
-af1ee118977e739e8961661141a410295a04324d 4.2.1
-baf740ee211315414f04e25930abd03ec8a04650 4.4.0
-ec06cb8e102579ea3f9dc4529ce7af8ede852fdc 5.0.0-rc1
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..c9272e0
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
+language: cpp
+
+sudo: false
+
+compiler:
+- clang
+
+addons:
+  apt:
+    packages:
+    - libqt4-dev
+    - libqtcore4
+    - libqtgui4
+
+before_script:
+  - export SOURCE_DIR=$PWD
+  - cd /tmp
+  - wget https://cmake.org/files/v3.4/cmake-3.4.0-rc3-Linux-x86_64.tar.gz --no-check-certificate
+  - tar -xzf cmake-3.4.0-rc3-Linux-x86_64.tar.gz
+  - wget https://github.com/martine/ninja/releases/download/v1.6.0/ninja-linux.zip --no-check-certificate
+  - unzip ninja-linux.zip
+  - wget https://www.orfeo-toolbox.org/packages/xdk/OTB-xdk-Linux64.run  --no-check-certificate
+  - chmod +x /tmp/OTB-xdk-Linux64.run
+  - /tmp/OTB-xdk-Linux64.run
+  - cd $SOURCE_DIR/../
+  - mkdir build
+  - cd build
+
+script: /tmp/cmake-3.4.0-rc3-Linux-x86_64/bin/cmake -DCMAKE_MAKE_PROGRAM=/tmp/ninja -DCMAKE_CXX_FLAGS="-Wno-gnu -Wno-unused-parameter -Wno-overloaded-virtual -Wno-\\#warnings" -DCMAKE_PREFIX_PATH=/tmp/OTB-xdk-Linux64 -DCMAKE_INSTALL_PREFIX=../install -G "Ninja" $SOURCE_DIR && /tmp/ninja
\ No newline at end of file
diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in
index a9d61cb..5bf2cea 100644
--- a/CMake/CTestCustom.cmake.in
+++ b/CMake/CTestCustom.cmake.in
@@ -45,7 +45,6 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE
 
 set(CTEST_CUSTOM_WARNING_EXCEPTION
   ${CTEST_CUSTOM_WARNING_EXCEPTION}
-  "vcl_deprecated_header"
   "backward_warning"
   "warning LNK4221"
   "ranlib:.*file:.*has no symbols"
@@ -63,5 +62,27 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
   # Ignore clang's summary warning, assuming prior text has matched some
   # other warning expression:
   "[0-9,]+ warnings? generated."
-
+  ".*include.opencv2.*warning.*"
+  ".*include.opencv2.*note.*"
+  ".*include.kml.*warning.*"
+  ".*include.ogr_feature.*warning.*"
+  ".*include.ogr_feature.*note.*"
+  ".*itksys.SharedForward.h.*warning.*"
+  ".*vcl_deprecated_header.h.*"
+  ".*otbCurlHelper.cxx:.*warning.*maxConnect.*"
+  ".*include.ITK-4.*warning.*"
+  ".*include.curl.curl.h.*warning.*"
+  ".*include.ossim.*warning.*"
+  ".*include.ossim.*note.*"
+  ".*include.ogr_core.h.*warning.*"
+  ".*include.ogr_srs_api.h.*warning.*"
+  ".*include.ogrsf_frmts.h.*warning.*"
+  ".*include.ogr_geometry.h.*warning.*"
+  ".*include.ogr_spatialref.h.*warning.*"
+  ".*include.cpl_error.h.*warning.*"
+  ".*vnl.vnl_numeric_traits.h.*warning.*"
+  ".*vcl_config_compiler.h.*warning.*"
+  ".*boost.move.unique_ptr.hpp:.*"
+  ".*include.mpValue.h.*[Ww]arning.*\\[-Wc\\+\\+11-extensions\\]"
+  ".*itksys.SharedForward.h.*warning.*itksys_shared_forward_to_real.*"
   )
diff --git a/CMake/FindLibSVM.cmake b/CMake/FindLibSVM.cmake
index 6d35618..75d9f80 100644
--- a/CMake/FindLibSVM.cmake
+++ b/CMake/FindLibSVM.cmake
@@ -109,6 +109,7 @@ set ( LIBSVM_LIBRARIES ${LIBSVM_LIBRARY} )
 # link with math library on unix
 if ( UNIX )
   find_library(M_LIB m)
+  mark_as_advanced(M_LIB)
   list (APPEND LIBSVM_LIBRARIES ${M_LIB} )
 endif ()
 
diff --git a/CMake/FindNumpy.cmake b/CMake/FindNumpy.cmake
new file mode 100644
index 0000000..b53aa7c
--- /dev/null
+++ b/CMake/FindNumpy.cmake
@@ -0,0 +1,28 @@
+# - Find Numpy
+# Find the native numpy includes
+#
+#   NUMPY_FOUND        - True if Numpy headers are found.
+#   NUMPY_INCLUDE_DIR   - where to find numpy/arrayobject.h, etc.
+
+EXEC_PROGRAM ("${PYTHON_EXECUTABLE}"
+  ARGS "${CMAKE_SOURCE_DIR}/CMake/otbTestNumpy.py"
+  OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
+  RETURN_VALUE NUMPY_NOT_FOUND)
+
+if( NUMPY_INCLUDE_DIR MATCHES "Traceback" )
+# Did not successfully include numpy
+set( NUMPY_INCLUDE_DIR )
+else()
+  set( NUMPY_INCLUDE_DIR ${NUMPY_INCLUDE_DIR} CACHE STRING "Numpy include path." )
+endif()
+
+include( FindPackageHandleStandardArgs )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( Numpy DEFAULT_MSG NUMPY_INCLUDE_DIR )
+
+mark_as_advanced( NUMPY_INCLUDE_DIR )
+
+if(NUMPY_FOUND)
+  set(NUMPY_INCLUDE_DIRS ${NUMPY_INCLUDE_DIR})
+else()
+  set(NUMPY_INCLUDE_DIRS)
+endif()
diff --git a/CMake/FindOssim.cmake b/CMake/FindOssim.cmake
index ca4bcd8..5c431b3 100644
--- a/CMake/FindOssim.cmake
+++ b/CMake/FindOssim.cmake
@@ -28,6 +28,23 @@ else()
   endif()
 endif()
 
+# Parse a certain header to check if SVN revision is 23537
+if(EXISTS "${OSSIM_INCLUDE_DIR}/ossim/imaging/ossimImageRenderer.h")
+  file(STRINGS "${OSSIM_INCLUDE_DIR}/ossim/imaging/ossimImageRenderer.h" _ossim_image_renderer_h_CONTENTS REGEX "^// \\$Id: ossimImageRenderer\\.h [0-9.]+ ")
+  string(REGEX REPLACE ".*ossimImageRenderer\\.h ([0-9.]+) .*" "\\1" _ossim_svn_revision_hint "${_ossim_image_renderer_h_CONTENTS}")
+  if(NOT "${_ossim_svn_revision_hint}" STREQUAL "23537")
+    message(WARNING "The OSSIM version found doesn't correspond to SVN revision 23537 (the recommended revision for OTB)."
+                      "There are known issues with version 1.8.16 (bugs in Sentinel1 "
+                      "calibration) and with official archive 1.8.20-1 (RpcModel returns "
+                      "nans outside the image extent)")
+  endif()
+  #message(STATUS "OSSIM SVN rev. hint : ${_ossim_svn_revision_hint}")
+else()
+  if(NOT Ossim_FIND_QUIETLY)
+    message(WARNING "ossimImageRenderer.h not found !")
+  endif()
+endif()
+
 find_library(OSSIM_LIBRARY
              NAMES ossim)
 
diff --git a/CMake/MinGWPackage.cmake b/CMake/MinGWPackage.cmake
new file mode 100644
index 0000000..ab4d361
--- /dev/null
+++ b/CMake/MinGWPackage.cmake
@@ -0,0 +1,185 @@
+macro(package_mingw)
+  cmake_parse_arguments(PACKAGE  "" "PREFIX_DIR;ARCH;MXEROOT;WITH_OTBGUI" "SEARCHDIRS;PEFILES" ${ARGN} )
+
+  list(APPEND PACKAGE_PEFILES ${CMAKE_INSTALL_PREFIX}/bin/otbApplicationLauncherCommandLine.exe)
+  list(APPEND PACKAGE_PEFILES ${CMAKE_INSTALL_PREFIX}/bin/otbTestDriver.exe)
+  if(PACKAGE_WITH_OTBGUI)
+    list(APPEND PACKAGE_PEFILES ${CMAKE_INSTALL_PREFIX}/bin/otbApplicationLauncherQt.exe)
+  endif()
+
+  if("${PACKAGE_ARCH}" STREQUAL "x86")
+    set(MXE_BIN_DIR "${PACKAGE_MXEROOT}/usr/i686-w64-mingw32.shared/bin")
+    set(MXE_OBJDUMP "${PACKAGE_MXEROOT}/usr/bin/i686-w64-mingw32.shared-objdump")
+  elseif("${PACKAGE_ARCH}" STREQUAL "x64")
+    set(MXE_BIN_DIR "${PACKAGE_MXEROOT}/usr/x86_64-w64-mingw32.shared/bin")
+    set(MXE_OBJDUMP "${PACKAGE_MXEROOT}/usr/bin/x86_64-w64-mingw32.shared-objdump")
+  endif()
+
+  list(APPEND PACKAGE_SEARCHDIRS ${MXE_BIN_DIR})
+  list(APPEND PACKAGE_SEARCHDIRS "${MXE_BIN_DIR}/../qt/bin") #Qt
+  list(APPEND PACKAGE_SEARCHDIRS "${MXE_BIN_DIR}/../qt/lib") #Qwt
+  list(APPEND PACKAGE_SEARCHDIRS "${CMAKE_INSTALL_PREFIX}/bin") #mvd
+  list(APPEND PACKAGE_SEARCHDIRS "${CMAKE_INSTALL_PREFIX}/lib/otb/applications") #otb apps
+
+  install_common(${PACKAGE_WITH_OTBGUI})
+
+  file(GLOB otbapps_list ${CMAKE_INSTALL_PREFIX}/lib/otb/applications/otbapp_*dll) # /lib/otb
+  list(APPEND PACKAGE_PEFILES ${otbapps_list})
+
+  set(alldlls)
+  set(notfound_dlls)
+  foreach(infile ${PACKAGE_PEFILES})
+    get_filename_component(bn ${infile} NAME)
+    process_deps(${bn})
+  endforeach()
+
+  list(LENGTH notfound_dlls nos)
+  if(${nos} GREATER 0)
+    STRING(REPLACE ".dll" ".dll," notfound ${notfound_dlls})
+    message(FATAL_ERROR "Following dlls were not found: ${notfound}
+                   Please consider adding their paths to SEARCHDIRS when calling package_mingw macro.")
+  endif()
+
+endmacro(package_mingw)
+
+SET(SYSTEM_DLLS
+  msvc.*dll
+  USER32.dll
+  GDI32.dll
+  SHELL32.DLL
+  KERNEL32.dll
+  ADVAPI32.dll
+  CRYPT32.dll
+  WS2_32.dll
+  wldap32.dll
+  ole32.dll
+  OPENGL32.DLL
+  GLU32.DLL
+  COMDLG32.DLL
+  IMM32.DLL
+  OLEAUT32.dll
+  COMCTL32.DLL
+  WINMM.DLL
+
+  SHELL32.dll
+  WLDAP32.dll
+  OPENGL32.dll
+  GLU32.dll
+  comdlg32.dll
+  IMM32.dll
+  WINMM.dll
+  WINSPOOL.DRV)
+
+## http://www.cmake.org/Wiki/CMakeMacroListOperations
+macro(IS_SYSTEM_DLL matched value)
+  set(${matched})
+  foreach (pattern ${SYSTEM_DLLS})
+    if(${value} MATCHES ${pattern})
+      set(${matched} TRUE)
+    endif()
+  endforeach()
+endmacro()
+
+macro(list_contains var value)
+  set(${var})
+  foreach(value2 ${ARGN})
+    if(${value} STREQUAL ${value2})
+      set(${var} TRUE)
+    endif()
+  endforeach(value2)
+endmacro()
+
+function(process_deps infile)
+
+  get_filename_component(bn ${infile} NAME)
+
+  list_contains(contains "${bn}" "${alldlls}")
+  if(NOT contains)
+    set(DLL_FOUND FALSE)
+    foreach(SEARCHDIR ${PACKAGE_SEARCHDIRS})
+      if(NOT DLL_FOUND)
+        if(EXISTS ${SEARCHDIR}/${infile})
+          set(DLL_FOUND TRUE)
+
+          message(STATUS "Processing ${SEARCHDIR}/${infile}")
+          if(NOT "${infile}" MATCHES "otbapp")
+            install(
+              FILES "${SEARCHDIR}/${infile}"
+              DESTINATION ${PACKAGE_PREFIX_DIR}/bin)
+          else()
+
+          endif()
+          if(NOT EXISTS ${MXE_OBJDUMP})
+            message(FATAL_ERROR "objdump executable not found. please check MXE_OBJDUMP is set to correct cross compiled executable")
+          endif()
+          execute_process(COMMAND ${MXE_OBJDUMP} "-p" "${SEARCHDIR}/${infile}"  OUTPUT_VARIABLE dlldeps)
+          string(REGEX MATCHALL "DLL.Name..[A-Za-z(0-9\\.0-9)+_\\-]*" OUT "${dlldeps}")
+          string(REGEX REPLACE "DLL.Name.." "" OUT "${OUT}")
+          foreach(o ${OUT})
+            process_deps(${o})
+          endforeach()
+        endif()
+      endif(NOT DLL_FOUND)
+    endforeach()
+
+    if(NOT DLL_FOUND)
+      is_system_dll(iss "${infile}")
+      if(NOT iss)
+        set(notfound_dlls "${notfound_dlls};${infile}")
+      endif()
+    else(NOT DLL_FOUND)
+
+      set( alldlls "${alldlls};${bn}" PARENT_SCOPE )
+    endif(NOT DLL_FOUND)
+
+    set(notfound_dlls "${notfound_dlls}" PARENT_SCOPE )
+   endif()
+endfunction()
+
+function(install_common with_otbgui)
+  set(APP_PREFIX_DIR "${PACKAGE_PREFIX_DIR}")
+  set(APP_BIN_DIR "${APP_PREFIX_DIR}/bin")
+  set(APP_OTBLIBS_DIR "${APP_PREFIX_DIR}/lib/otb")
+  set(APP_DATA_DIR "${APP_PREFIX_DIR}/share")
+
+  ####################### install GDAL data #######################
+
+  set(GDAL_DATA ${MXE_BIN_DIR}/../share/gdal)
+  if(NOT EXISTS "${GDAL_DATA}/epsg.wkt")
+    message(FATAL_ERROR "Cannot generate package without GDAL_DATA : ${GDAL_DATA}")
+  endif()
+
+  install(
+    DIRECTORY ${GDAL_DATA}
+    DESTINATION ${APP_DATA_DIR})
+
+  ####################### Check otb applications #######################
+
+  file(GLOB OTB_APPS_LIST ${CMAKE_INSTALL_PREFIX}/lib/otb/applications/otbapp_*dll) # /lib/otb
+  if(NOT OTB_APPS_LIST)
+    message(FATAL_ERROR "No OTB-applications detected")
+  endif()
+
+  ## otb apps dir /lib/otb/applications
+  install(
+    DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib/otb/applications"
+    DESTINATION ${APP_OTBLIBS_DIR})
+
+  file(GLOB CLI_SCRIPTS ${CMAKE_INSTALL_PREFIX}/bin/otbcli*)
+  foreach(CLI_SCRIPT ${CLI_SCRIPTS})
+    install(
+      FILES "${CLI_SCRIPT}"
+      DESTINATION ${APP_BIN_DIR})
+  endforeach()
+
+  if(with_otbgui)
+    file(GLOB GUI_SCRIPTS ${CMAKE_INSTALL_PREFIX}/bin/otbgui*)
+    foreach(GUI_SCRIPT ${GUI_SCRIPTS})
+      install(
+        FILES "${GUI_SCRIPT}"
+        DESTINATION ${APP_BIN_DIR})
+    endforeach()
+  endif()
+
+
+endfunction()
diff --git a/CMake/OTBApplicationMacros.cmake b/CMake/OTBApplicationMacros.cmake
index 344c8e6..d3d0e7d 100644
--- a/CMake/OTBApplicationMacros.cmake
+++ b/CMake/OTBApplicationMacros.cmake
@@ -121,6 +121,7 @@ macro(otb_create_application)
    list(REMOVE_DUPLICATES OTB_APPLICATIONS_NAME_LIST)
    set(OTB_APPLICATIONS_NAME_LIST ${OTB_APPLICATIONS_NAME_LIST}
        CACHE STRING "List of all applications" FORCE)
+   mark_as_advanced(OTB_APPLICATIONS_NAME_LIST)
 
 endmacro()
 
diff --git a/CMake/OTBModuleHeaderTest.cmake b/CMake/OTBModuleHeaderTest.cmake
index 1b21b1f..34f710f 100644
--- a/CMake/OTBModuleHeaderTest.cmake
+++ b/CMake/OTBModuleHeaderTest.cmake
@@ -23,7 +23,7 @@ add_custom_target( OTBHeaderTests
 
 SET(BANNED_HEADERS)
 if(NOT OTB_USE_OPENCV)
-	SET(BANNED_HEADERS "${BANNED_HEADERS} otbDecisionTreeMachineLearningModelFactory.h otbDecisionTreeMachineLearningModel.h otbKNearestNeighborsMachineLearningModelFactory.h otbKNearestNeighborsMachineLearningModel.h otbRandomForestsMachineLearningModelFactory.h otbRandomForestsMachineLearningModel.h otbSVMMachineLearningModelFactory.h otbSVMMachineLearningModel.h otbGradientBoostedTreeMachineLearningModelFactory.h otbGradientBoostedTreeMachineLearningModel.h otbBoostMachineLearningModelFa [...]
+	SET(BANNED_HEADERS "${BANNED_HEADERS} otbDecisionTreeMachineLearningModelFactory.h otbDecisionTreeMachineLearningModel.h otbKNearestNeighborsMachineLearningModelFactory.h otbKNearestNeighborsMachineLearningModel.h otbRandomForestsMachineLearningModelFactory.h otbRandomForestsMachineLearningModel.h otbSVMMachineLearningModelFactory.h otbSVMMachineLearningModel.h otbGradientBoostedTreeMachineLearningModelFactory.h otbGradientBoostedTreeMachineLearningModel.h otbBoostMachineLearningModelFa [...]
 endif()
  
 if(NOT OTB_USE_LIBSVM)
diff --git a/CMake/OTBSetStandardCompilerFlags.cmake b/CMake/OTBSetStandardCompilerFlags.cmake
index 6814998..c44cb79 100644
--- a/CMake/OTBSetStandardCompilerFlags.cmake
+++ b/CMake/OTBSetStandardCompilerFlags.cmake
@@ -132,6 +132,23 @@ endfunction()
 
 
 macro(check_compiler_platform_flags)
+  # Since CMake 2.8.11, the size of the stack is not modified by CMake on
+  # windows platform, it uses the default size: with visual compiler it is 1Mbyte
+  # which is to lower for us (thanks to 6S code).
+  if(MSVC)
+    if (${CMAKE_VERSION} VERSION_GREATER "2.8.10.2")
+      if("${CMAKE_EXE_LINKER_FLAGS}" MATCHES "/STACK:[0-9]+")
+          message(STATUS "The size of the stack is already defined, so we dont't modified it.")
+      else()
+          set(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} /STACK:10000000")
+          message(STATUS "The stack size is set to 10 Mbytes (/STACK:10000000).")
+      endif()
+    endif() #if (${CMAKE_VERSION..
+  elseif(MINGW)
+    set(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} -Wl,--stack,10000000")
+    message(STATUS "The stack size is set to 10 Mbytes (-Wl,--stack,10000000).")
+  endif() # if(MSVC)
+
   # On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
   # warnings
   if(WIN32)
diff --git a/CMake/SourceStatus.cmake b/CMake/SourceStatus.cmake
index b6d9483..46a951a 100644
--- a/CMake/SourceStatus.cmake
+++ b/CMake/SourceStatus.cmake
@@ -1,3 +1,4 @@
+if(EXISTS "${PROJECT_SOURCE_DIR}/.hg")
 find_package(Mercurial)
 if(Mercurial_FOUND)
   message(STATUS "Repository status :")
@@ -16,11 +17,55 @@ if(Mercurial_FOUND)
   string(REGEX REPLACE "\n" ";" OTB_WC_STATUS "${OTB_WC_STATUS}")
   set(OTB_WC_STATUS ${OTB_WC_STATUS} CACHE STRING "Repository status" FORCE)
   mark_as_advanced(OTB_WC_STATUS)
+endif()
+endif()
 
-  if(OTB_DATA_ROOT)
-    Mercurial_WC_IDENTIFY(${OTB_DATA_ROOT} OTB_DATA)
-    set(OTB_DATA_WC_REVISION ${OTB_DATA_WC_REVISION} CACHE STRING "Repository version" FORCE)
-    mark_as_advanced(OTB_DATA_WC_REVISION)
+if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
+  find_package(Git)
+  if(GIT_FOUND)
+    execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H
+      WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+      OUTPUT_VARIABLE OTB_WC_REVISION
+      OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+    execute_process(COMMAND ${GIT_EXECUTABLE} status -s
+      WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+      OUTPUT_VARIABLE OTB_WC_STATUS
+      OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+    message(STATUS "Repository status :")
+    message(STATUS "  Repository revision is ${OTB_WC_REVISION}")
+    if(OTB_WC_STATUS)
+      message(STATUS "  Local file modifications:")
+      string(REPLACE "\n" "\n--     " OTB_WC_STATUS_PRETTYPRINT "    ${OTB_WC_STATUS}")
+      message(STATUS "${OTB_WC_STATUS_PRETTYPRINT}")
+    else()
+      message(STATUS "  No files modified locally")
+    endif()
   endif()
+endif()
 
+if(OTB_DATA_ROOT)
+  if(EXISTS "${OTB_DATA_ROOT}/.hg")
+    if(NOT Mercurial_FOUND)
+      find_package(Mercurial)
+    endif()
+    if(Mercurial_FOUND)
+      Mercurial_WC_IDENTIFY(${OTB_DATA_ROOT} OTB_DATA)
+      set(OTB_DATA_WC_REVISION ${OTB_DATA_WC_REVISION} CACHE STRING "Repository version" FORCE)
+      mark_as_advanced(OTB_DATA_WC_REVISION)
+    endif()
+  endif()
+  
+  if(EXISTS "${OTB_DATA_ROOT}/.git")
+    if(NOT GIT_FOUND)
+      find_package(Git)
+    endif()
+    if(GIT_FOUND)
+      execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%H
+        WORKING_DIRECTORY ${OTB_DATA_ROOT}
+        OUTPUT_VARIABLE OTB_DATA_WC_REVISION
+        OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
+      set(OTB_DATA_WC_REVISION ${OTB_DATA_WC_REVISION} CACHE STRING "Repository version" FORCE)
+      mark_as_advanced(OTB_DATA_WC_REVISION)
+    endif()
+  endif()
 endif()
diff --git a/CMake/otbTestNumpy.py b/CMake/otbTestNumpy.py
new file mode 100644
index 0000000..6b9a801
--- /dev/null
+++ b/CMake/otbTestNumpy.py
@@ -0,0 +1,2 @@
+import numpy
+print numpy.get_include()
diff --git a/CMake/otbcli.bat.in b/CMake/otbcli.bat.in
index f562f96..3e999de 100644
--- a/CMake/otbcli.bat.in
+++ b/CMake/otbcli.bat.in
@@ -14,10 +14,12 @@ if exist %CURRENT_SCRIPT_DIR%otbApplicationLauncherCommandLine.exe (
   set OTB_CLI_LAUNCHER=otbApplicationLauncherCommandLine.exe
 )
 
+setlocal
 :: works for install tree
 if exist %CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@ (
-  set ITK_AUTOLOAD_PATH=%CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@;%ITK_AUTOLOAD_PATH%
+  set OTB_APPLICATION_PATH=%CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@;%OTB_APPLICATION_PATH%
 )
 
 :: start the application
 %OTB_CLI_LAUNCHER% %*
+endlocal
diff --git a/CMake/otbcli.sh.in b/CMake/otbcli.sh.in
index 95d021a..b1236d7 100644
--- a/CMake/otbcli.sh.in
+++ b/CMake/otbcli.sh.in
@@ -19,11 +19,11 @@ fi
 # works for install tree
 if [ -d $CURRENT_SCRIPT_DIR/../@OTB_INSTALL_APP_DIR@ ]
 then
-  ITK_AUTOLOAD_PATH=$CURRENT_SCRIPT_DIR/../@OTB_INSTALL_APP_DIR@:$ITK_AUTOLOAD_PATH
+  OTB_APPLICATION_PATH=$CURRENT_SCRIPT_DIR/../@OTB_INSTALL_APP_DIR@:$OTB_APPLICATION_PATH
 fi
 
 # export it to make it available to otbApplicationLauncherCommandLine environment
-export ITK_AUTOLOAD_PATH
+export OTB_APPLICATION_PATH
 
 # start the application
 $OTB_CLI_LAUNCHER "$@"
diff --git a/CMake/otbgui.bat.in b/CMake/otbgui.bat.in
index 499378d..c02e16e 100644
--- a/CMake/otbgui.bat.in
+++ b/CMake/otbgui.bat.in
@@ -14,12 +14,14 @@ if exist %CURRENT_SCRIPT_DIR%otbApplicationLauncherQt.exe (
   set OTB_GUI_LAUNCHER=otbApplicationLauncherQt.exe
 )
 
+setlocal
 :: works for install tree
 if exist %CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@ (
-  set ITK_AUTOLOAD_PATH=%CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@;%ITK_AUTOLOAD_PATH%
+  set OTB_APPLICATION_PATH=%CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@;%OTB_APPLICATION_PATH%
 )
 
 set LC_NUMERIC=C
 
 :: start the application
 %OTB_GUI_LAUNCHER% %*
+endlocal
diff --git a/CMake/otbgui.sh.in b/CMake/otbgui.sh.in
index a30f07d..d18a4e1 100644
--- a/CMake/otbgui.sh.in
+++ b/CMake/otbgui.sh.in
@@ -19,11 +19,11 @@ fi
 # use the default install tree path for applications
 if [ -d $CURRENT_SCRIPT_DIR/../@OTB_INSTALL_APP_DIR@ ]
 then
-  ITK_AUTOLOAD_PATH=$CURRENT_SCRIPT_DIR/../@OTB_INSTALL_APP_DIR@:$ITK_AUTOLOAD_PATH
+  OTB_APPLICATION_PATH=$CURRENT_SCRIPT_DIR/../@OTB_INSTALL_APP_DIR@:$OTB_APPLICATION_PATH
 fi
 
 # export it to make it available to otbApplicationLauncherCommandLine environment
-export ITK_AUTOLOAD_PATH
+export OTB_APPLICATION_PATH
 
 # avoid numerical issues caused by locale
 export LC_NUMERIC=C
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c53bdf9..e9c7cf3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,8 @@ endif()
 
 foreach(p
     CMP0025 # CMake 3.0
-    CMP0042 # CMake 3.0 
+    CMP0042 # CMake 3.0
+    CMP0058
     )
   if(POLICY ${p})
     cmake_policy(SET ${p} NEW)
@@ -65,7 +66,7 @@ set(main_project_name ${_OTBModuleMacros_DEFAULT_LABEL})
 #-----------------------------------------------------------------------------
 # OTB version number.
 set(OTB_VERSION_MAJOR "5")
-set(OTB_VERSION_MINOR "0")
+set(OTB_VERSION_MINOR "2")
 set(OTB_VERSION_PATCH "0")
 set(OTB_VERSION_STRING "${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}.${OTB_VERSION_PATCH}")
 
@@ -248,7 +249,7 @@ set(EPSILON_15 0.000000000000001)
 #
 function(otb_add_test)
   set(largeinput_regex "LARGEINPUT{([^;{}\r\n]*)}")
-  
+
   set(_depends_on_largeinput OFF)
   foreach(arg IN LISTS ARGN)
      if("x${arg}" MATCHES "${largeinput_regex}")
@@ -392,6 +393,79 @@ endif()
 # Provide an option for generating documentation.
 add_subdirectory(Utilities/Doxygen)
 
+#----------------------------------------------------------------------
+# Provide a target to generate the SuperBuild archive (only for Unix)
+if(UNIX)
+  add_custom_target(SuperBuild-archive
+    COMMAND ./SuperbuildDownloadList.sh
+      ${OTB_BINARY_DIR}/Download
+      ${OTB_BINARY_DIR}
+    WORKING_DIRECTORY ${OTB_SOURCE_DIR}/Utilities/Maintenance
+    )
+endif()
+
 # TODO cleanup
 # Create target to download data from the OTBData group. This must come after
 # all tests have been added that reference the group, so we put it last.
+
+
+if(WIN32 AND CMAKE_CROSSCOMPILING)
+  if(DEFINED MXE_TARGET_DIR)
+
+    set(pefiles)
+
+    message(STATUS "MXE_TARGET_DIR = ${MXE_TARGET_DIR}")
+
+    if(MXE_TARGET_DIR MATCHES "i686")
+      set(mxearch x86)
+      set(archive_name ${CMAKE_PROJECT_NAME}-${OTB_VERSION_STRING}-win32)
+    elseif(MXE_TARGET_DIR MATCHES "x86_64")
+      set(mxearch x64)
+      set(archive_name ${CMAKE_PROJECT_NAME}-${OTB_VERSION_STRING}-win64)
+    endif()
+
+    execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory "${CMAKE_INSTALL_PREFIX}/${archive_name}")
+
+    get_filename_component(mxeroot ${MXE_TARGET_DIR} PATH)
+    get_filename_component(mxeroot ${mxeroot} PATH)
+
+    file(WRITE "${CMAKE_BINARY_DIR}/_mingw/CMakeLists.txt"
+      "cmake_minimum_required(VERSION 2.6)
+       include(CMakeParseArguments)
+       set(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")
+        include(${CMAKE_SOURCE_DIR}/CMake/MinGWPackage.cmake)
+        package_mingw(
+        ARCH \"${mxearch}\"
+        MXEROOT \"${mxeroot}\"
+        PREFIX_DIR \"${archive_name}\"
+        PEFILES \"${pefiles}\"
+        WITH_OTBGUI 1
+        SEARCHDIRS \"\")")
+
+    add_custom_target(configure-mingw
+      COMMAND ${CMAKE_COMMAND}
+      "${CMAKE_BINARY_DIR}/_mingw"
+      WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/_mingw")
+
+    add_custom_target(prepare-mingw
+      COMMAND ${CMAKE_COMMAND}
+      "--build" "${CMAKE_BINARY_DIR}/_mingw" "--target" "install"
+      WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/_mingw"
+      DEPENDS configure-mingw)
+
+    find_program(ZIP_EXECUTABLE zip)
+
+    if(ZIP_EXECUTABLE)
+      add_custom_target(packages
+        COMMAND ${ZIP_EXECUTABLE} "-r" "${CMAKE_BINARY_DIR}/${archive_name}.zip" "${archive_name}"
+        WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
+        DEPENDS prepare-mingw)
+    else()
+      message(FATAL_ERROR "Cannot find zip executable. Please add it to your path")
+    endif()
+
+  else(DEFINED MXE_TARGET_DIR)
+    message(WARNING "MXE_TARGET_DIR must be defined and contains location of mxe root directory")
+  endif(DEFINED MXE_TARGET_DIR)
+
+endif(WIN32 AND CMAKE_CROSSCOMPILING)
diff --git a/Copyright/Copyright.txt b/Copyright/Copyright.txt
index 6f7788f..eaafdd8 100644
--- a/Copyright/Copyright.txt
+++ b/Copyright/Copyright.txt
@@ -21,7 +21,7 @@
     See CrispCopyright.txt for details.
   
   * Parts of the code have been developped by Gregoire Mercier.
-    See GETCopyright.txt for details.
+    See IMTCopyright.txt for details.
 
   --------------------------- DEPENDENCIES ----------------------------------
   Several utilities are mandatory dependencies used by the OTB library :
diff --git a/Copyright/GETCopyright.txt b/Copyright/IMTCopyright.txt
similarity index 78%
rename from Copyright/GETCopyright.txt
rename to Copyright/IMTCopyright.txt
index 7ac8ce5..7fb5d5d 100644
--- a/Copyright/GETCopyright.txt
+++ b/Copyright/IMTCopyright.txt
@@ -1,10 +1,8 @@
 Parts of the code have been developped by Gregoire Mercier from 
-Groupe des Ecoles des Telecommunications / Ecole Nationale Superieure 
-des Telecommunications de Bretagne (GET/ENST Bretagne) during 
-CNES R&T contrats funded by the French Centre National d'Etudes 
-Spatiales, CNES.
+Institut Mines-Telecom / Telecom Bretagne during CNES R&T contrats 
+funded by the French Centre National d'Etudes Spatiales, CNES.
 
-Copyright (c) GET / ENST Bretagne 
+Copyright (c) Institut Mines-Telecom 
 
 This code has been integrated into the ORFEO Toolbox (OTB) under 
 the CeCILL licence version 2. See Licence_CeCILL_V2-en.txt or
diff --git a/Examples/BasicFilters/CMakeLists.txt b/Examples/BasicFilters/CMakeLists.txt
index c8fb34b..858e0fa 100644
--- a/Examples/BasicFilters/CMakeLists.txt
+++ b/Examples/BasicFilters/CMakeLists.txt
@@ -1,10 +1,16 @@
 project(BasicFiltersExamples)
 
+#OTB_USE_MUPARSER is OFF
+if(OTBMathParser_LOADED)
 add_executable(BandMathFilterExample BandMathFilterExample.cxx)
 target_link_libraries(BandMathFilterExample ${OTB_LIBRARIES})
+endif()
 
+#OTB_USE_MUPARSERX is OFF
+if(OTBMathParserX_LOADED)
 add_executable(BandMathXImageFilterExample BandMathXImageFilterExample.cxx)
 target_link_libraries(BandMathXImageFilterExample ${OTB_LIBRARIES})
+endif()
 
 add_executable(DEMToRainbowExample DEMToRainbowExample.cxx)
 target_link_libraries(DEMToRainbowExample ${OTB_LIBRARIES})
@@ -21,8 +27,11 @@ target_link_libraries(IndexedToRGBExample ${OTB_LIBRARIES})
 add_executable(LeeImageFilter LeeImageFilter.cxx)
 target_link_libraries(LeeImageFilter ${OTB_LIBRARIES})
 
+#OTBMeanShift depends OTBMathParser. But OTB_USE_MUPARSER is OFF
+if(OTBMathParser_LOADED)
 add_executable(MeanShiftSegmentationFilterExample MeanShiftSegmentationFilterExample.cxx)
 target_link_libraries(MeanShiftSegmentationFilterExample ${OTB_LIBRARIES})
+endif()
 
 add_executable(PrintableImageFilterExample PrintableImageFilterExample.cxx)
 target_link_libraries(PrintableImageFilterExample ${OTB_LIBRARIES})
diff --git a/Examples/BasicFilters/test/CMakeLists.txt b/Examples/BasicFilters/test/CMakeLists.txt
index 7984fa1..cc6dabe 100644
--- a/Examples/BasicFilters/test/CMakeLists.txt
+++ b/Examples/BasicFilters/test/CMakeLists.txt
@@ -3,11 +3,11 @@ set(INPUTDATA ${OTB_DATA_ROOT}/Examples)
 
 otb_add_test(NAME bfTeLeeImageFilterTest COMMAND ${OTB_TEST_DRIVER}
   --compare-n-images ${NOTOL} 1
-    ${BASELINE}/GomaSmallLeeFiltered.png
-    ${TEMP}/GomaSmallLeeFiltered.png
+    ${BASELINE}/GomaSmallLeeFiltered.tif
+    ${TEMP}/GomaSmallLeeFiltered.tif
   Execute $<TARGET_FILE:LeeImageFilter>
-    ${INPUTDATA}/GomaSmall.png
-    ${TEMP}/GomaSmallLeeFiltered.png
+    ${INPUTDATA}/GomaSmall.tif
+    ${TEMP}/GomaSmallLeeFiltered.tif
     3 1
 )
 
@@ -15,11 +15,11 @@ otb_add_test(NAME bfTeLeeImageFilterTest COMMAND ${OTB_TEST_DRIVER}
 
 otb_add_test(NAME bfTeFrostImageFilterTest COMMAND ${OTB_TEST_DRIVER}
   --compare-n-images ${NOTOL} 1
-    ${BASELINE}/GomaSmallFrostFiltered.png
-    ${TEMP}/GomaSmallFrostFiltered.png
+    ${BASELINE}/GomaSmallFrostFiltered.tif
+    ${TEMP}/GomaSmallFrostFiltered.tif
   Execute $<TARGET_FILE:FrostImageFilter>
-    ${INPUTDATA}/GomaSmall.png
-    ${TEMP}/GomaSmallFrostFiltered.png
+    ${INPUTDATA}/GomaSmall.tif
+    ${TEMP}/GomaSmallFrostFiltered.tif
     5 0.1
 )
 
@@ -84,7 +84,7 @@ otb_add_test(NAME bfTeIndexedToRGBExampleTest COMMAND ${OTB_TEST_DRIVER}
     ${TEMP}/buildingExtractionRGB.png
     ${TEMP}/buildingExtractionIndexed_scaled.png
 )
-
+if(OTBMathParser_LOADED)
 otb_add_test(NAME bfTeMeanShiftSegmentationFilterExampleTest COMMAND ${OTB_TEST_DRIVER}
   --compare-n-images ${NOTOL} 4
     ${BASELINE}/MSClusteredOutput.tif
@@ -107,7 +107,7 @@ otb_add_test(NAME bfTeMeanShiftSegmentationFilterExampleTest COMMAND ${OTB_TEST_
     100
     0.1
 )
-
+endif()
 # ------- HillShadingExampleTest ----------
 
 otb_add_test(NAME bfTeHillShadingExampleTest COMMAND ${OTB_TEST_DRIVER}
diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt
index d10db21..04b5705 100644
--- a/Examples/CMakeLists.txt
+++ b/Examples/CMakeLists.txt
@@ -1,22 +1,147 @@
-if(NOT OTB_BUILD_DEFAULT_MODULES)
-  message(FATAL_ERROR "BUILD_EXAMPLES requires OTB_BUILD_DEFAULT_MODULES to be ON")
+##### check if standalone project ######
+if(NOT PROJECT_NAME)
+  if(WIN32)
+    cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
+  else()
+    cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
+  endif()
+  project(OTBExamples)
 endif()
-# We also need to prevent any OTB_USE_XXX option to be OFF (except mapnik and openjpeg)
-# For now we parse module activation list and test if option is ON. If not the cmake configuration stop.
-#TODO We should provide a better mechanism here wich will deactivate only examples required by deactivated options.
-foreach (_activationOption ${OTB_MODULE_ACTIVATION_OPTION_LIST})
-  if(NOT ${_activationOption} AND NOT "x${_activationOption}" STREQUAL "xOTB_USE_MAPNIK" AND NOT "x${_activationOption}" STREQUAL "xOTB_USE_OPENJPEG")
-    message(FATAL_ERROR "BUILD_EXAMPLES requires ${_activationOption} to be ON")
+
+#check if this is a standalone build?
+
+if(PROJECT_NAME STREQUAL "OTBExamples")
+  if(BUILD_TESTING)
+    include(CTest)
+  endif()
+
+  # dashboard build. Why do I need to see the deprecated warnings on dashboard!
+  # It just fades the actual warnings and most importantly very annoying.
+  if(NOT "$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "")
+    if(UNIX)
+      if(CMAKE_COMPILER_IS_GNUCXX)
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cpp")
+      else()
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-#warnings")
+      endif() #CMAKE_COMPILER_IS_GNUCXX
+    endif() #UNIX
+  endif()
+
+  # --------------------------------------------------------------------------------
+  # Manage PHR data input
+  if(OTB_DATA_USE_LARGEINPUT)
+    set(GenericTestPHR_DATA_INPUTS
+      ${GenericTestPHR_DATA_INPUTS}
+      ${OTB_DATA_LARGEINPUT_ROOT}/PLEIADES-PRE/TLSE_JP2_ORTHO_DIMAPv2_PMS-N_lossy_12bits/IMG_PHR1Z_PMS_N_001/IMG_PHR1A_PMS-N_201006181052297_ORT_IPU_20111011_0619-001_R1C1.JP2
+      ${OTB_DATA_LARGEINPUT_ROOT}/PLEIADES-PRE/TLSE_TIFF_ORTHO_DIMAPv2_MS_lossless_8bits/IMG_PHR1A_MS_002/IMG_PHR1A_MS_201006181052297_ORT_IPU_20111109_7807-004_R1C1.TIF
+      ${OTB_DATA_LARGEINPUT_ROOT}/PLEIADES-PRE/TLSE_TIFF_PRIMARY_DIMAPv2_MS_lossly_12bits/IMG_PHR1A_MS_002/IMG_PHR1A_MS_201006181052297_SEN_IPU_20111025_3077-004_R1C1.TIF
+      ${OTB_DATA_LARGEINPUT_ROOT}/PLEIADES/TLSE_JP2_DIMAPv2_PRIMARY_PMS_lossless_12bits/IMGPHR_201222215194743808/IMG_PHR1A_PMS_201201151100183_SEN_IPU_20120222_0901-001_R2C1.JP2
+      ${OTB_DATA_LARGEINPUT_ROOT}/PLEIADES/LASVEGAS_JP2_DIMAPv1_PRIMARY_PMS_lossless_12bits/IMGPHR_PHR1A_SENSOR_20120217_IPU_20120217_5374-001_V1/IMG_R1C1.JP2
+      ${OTB_DATA_LARGEINPUT_ROOT}/PLEIADES/PARIS_JP2_DIMAPv1_ORTHO_PMS_lossless_12bits/IMGPHR_PHR1A_ORTHO_20120502_IPU_20120430_6347-003_V1/IMG_R1C1.JP2
+      )
+
+    set(GenericTestPHR_DATA_TYPES
+      ${GenericTestPHR_DATA_TYPES}
+      SIMUL_PHR_JP2_ORTHO_DIMAPv2_PMS-N_lossy_12bits
+      SIMUL_PHR_TIFF_ORTHO_DIMAPv2_MS_lossless_8bits
+      SIMUL_PHR_TIFF_PRIMARY_DIMAPv2_MS_lossy_12bits
+      PHR_JP2_DIMAPv2_PRIMARY_PMS_lossless_12bits
+      PHR_JP2_DIMAPv1_PRIMARY_PMS_lossless_12bits
+      PHR_JP2_DIMAPv1_ORTHO_PMS_lossless_12bits
+      )
+
+    set(GenericTestSPOT6_DATA_INPUTS
+      ${GenericTestSPOT6_DATA_INPUTS}
+      ${OTB_DATA_LARGEINPUT_ROOT}/SPOT6/SPOT6_Ortho_Bundle_12_bits/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_MS_001_A/IMG_SPOT6_MS_201306031242000_ORT_816005101_R1C1.JP2
+      ${OTB_DATA_LARGEINPUT_ROOT}/SPOT6/SPOT6_Ortho_Pan-sharpened_12_bits/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_PMS_001_A/IMG_SPOT6_PMS_201305251604372_ORT_816009101_R1C1.JP2
+      ${OTB_DATA_LARGEINPUT_ROOT}/SPOT6/SPOT6_Primary_Bundle_12_bits/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_MS_001_A/IMG_SPOT6_MS_201211100138085_SEN_816007101_R1C1.JP2
+      )
+
+    set(GenericTestSPOT6_DATA_TYPES
+      ${GenericTestSPOT6_DATA_TYPES}
+      SPOT6_Ortho_Bundle_12_bits
+      SPOT6_Ortho_Pan-sharpened_12_bits
+      SPOT6_Primary_Bundle_12_bits
+      )
   endif()
-endforeach()
+
+
+  ########################## copied from OTB/CMakeLists.txt ##########################
+
+  #Generate cmake variables with a set of largeinput data used in tests
+  set(BASELINE       ${OTB_DATA_ROOT}/Baseline/OTB/Images)
+  set(BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB/Files)
+  set(INPUTDATA      ${OTB_DATA_ROOT}/Input)
+  set(TEMP           ${CMAKE_BINARY_DIR}/Testing/Temporary)
+  set(EXAMPLEDATA    ${OTB_DATA_ROOT}/Examples)
+  set(OTBAPP_BASELINE       ${OTB_DATA_ROOT}/Baseline/OTB-Applications/Images)
+  set(OTBAPP_BASELINE_FILES ${OTB_DATA_ROOT}/Baseline/OTB-Applications/Files)
+
+  set(NOTOL      0.0)
+  set(EPSILON_1  0.1)
+  set(EPSILON_2  0.01)
+  set(EPSILON_3  0.001)
+  set(EPSILON_4  0.0001)
+  set(EPSILON_5  0.00001)
+  set(EPSILON_6  0.000001)
+  set(EPSILON_7  0.0000001)
+  set(EPSILON_8  0.00000001)
+  set(EPSILON_9  0.000000001)
+  set(EPSILON_10 0.0000000001)
+  set(EPSILON_11 0.00000000001)
+  set(EPSILON_12 0.000000000001)
+  set(EPSILON_13 0.0000000000001)
+  set(EPSILON_14 0.00000000000001)
+  set(EPSILON_15 0.000000000000001)
+
+  #-----------------------------------------------------------------------------
+  # OTB wrapper for add_test that automatically sets the test's LABELS property
+  # to the value of its containing module.
+  #
+  function(otb_add_test)
+    set(largeinput_regex "LARGEINPUT{([^;{}\r\n]*)}")
+    set(_depends_on_largeinput OFF)
+    foreach(arg IN LISTS ARGN)
+      if("x${arg}" MATCHES "${largeinput_regex}")
+        string(REGEX REPLACE "${largeinput_regex}" "\\1" largeinput_relative_path "${arg}")
+        set(_fullpath "${OTB_DATA_LARGEINPUT_ROOT}/${largeinput_relative_path}")
+        list(APPEND _out_arg ${_fullpath})
+        set(_depends_on_largeinput ON)
+      else()
+        list(APPEND _out_arg ${arg})
+      endif()
+    endforeach()
+    if (_depends_on_largeinput AND NOT OTB_DATA_USE_LARGEINPUT)
+      return()
+    endif()
+    add_test(${_out_arg})
+    if("NAME" STREQUAL "${ARGV0}")
+      set(_iat_testname ${ARGV1})
+    else()
+      set(_iat_testname ${ARGV0})
+    endif()
+    if(otb-module)
+      set(_label ${otb-module})
+    else()
+      set(_label ${main_project_name})
+    endif()
+    set_property(TEST ${_iat_testname} PROPERTY LABELS ${_label})
+  endfunction()
+
+  ########################## end copied from OTB/CMakeLists.txt ##########################
+else()
+
+  #Examples that require large input cannot be enabled when building as standalone
+  include(${CMAKE_CURRENT_SOURCE_DIR}/../CMake/OTBManageLargeInputPaths.cmake)
+endif()
 
 find_package(OTB REQUIRED)
 include(${OTB_USE_FILE})
-# TODO : build as standalone project
+message(STATUS "Found OTB: ${OTB_USE_FILE}")
 
 set(OTB_TEST_DRIVER otbTestDriver)
 
-if(BUILD_APPLICATIONS)
+if(OTBApplicationEngine_LOADED)
   add_subdirectory(Application)
 endif()
 add_subdirectory(BasicFilters)
diff --git a/Examples/ChangeDetection/KullbackLeiblerDistanceChDet.cxx b/Examples/ChangeDetection/KullbackLeiblerDistanceChDet.cxx
index a68e7b1..876bda9 100644
--- a/Examples/ChangeDetection/KullbackLeiblerDistanceChDet.cxx
+++ b/Examples/ChangeDetection/KullbackLeiblerDistanceChDet.cxx
@@ -36,28 +36,28 @@
 //        + \frac{1}{2} \left( \log \frac{\kappa_{X_2; 2}}{\kappa_{X_1; 2}}
 //                             -1+\frac{1}{\kappa_{X_2; 2}}
 //                             \left( \kappa_{X_1; 1} - \kappa_{X_2; 1} +  \kappa_{X_1; 2}^{1/2} \right)^2
-//                        \right) \\
+//                        \right)
 //        - \left( \kappa_{X_2; 3} \frac{a_1}{6} + \kappa_{X_2; 4} \frac{a_2}{24}
 //            + \kappa_{X_2; 3}^2 \frac{a_3}{72} \right)
 //        - \frac{1}{2} \frac{ \kappa_{X_2; 3}^2}{36}
 //            \left(
 //                c_6 - 6 \frac{c_4}{\kappa_{X_1; 2}} + 9 \frac{c_2}{\kappa_{X_2; 2}^2}
-//            \right) \\
+//            \right)
 //        - 10 \frac{\kappa_{X_1; 3} \kappa_{X_2; 3}
 //                        \left( \kappa_{X_1; 1} - \kappa_{X_2; 1} \right)
 //                        \left( \kappa_{X_1; 2} - \kappa_{X_2; 2} \right)}{\kappa_{X_2; 2}^6} \qquad
 // \end{multline}
 // where
 // \begin{align*}
-//    a_1 &= c_3 - 3 \frac{\alpha}{\kappa_{X_2; 2}} \\
-//    a_2 &= c_4 - 6 \frac{c_2}{\kappa_{X_2; 2}} + \frac{3}{\kappa_{X_2; 2}^2} \\
+//    a_1 &= c_3 - 3 \frac{\alpha}{\kappa_{X_2; 2}}
+//    a_2 &= c_4 - 6 \frac{c_2}{\kappa_{X_2; 2}} + \frac{3}{\kappa_{X_2; 2}^2}
 //    a_3 &= c_6 - 15\frac{c_4}{\kappa_{X_2; 2}} + 45\frac{c_2}{\kappa_{X_2; 2}^2} -
-//            \frac{15}{\kappa_{X_2; 2}^3} \\
-//    c_2 &= \alpha^2 + \beta^2 \\
-//    c_3 &= \alpha^3 + 3 \alpha \beta^2 \\
-//    c_4 &= \alpha^4 + 6 \alpha^2 \beta^2 + 3 \beta^4 \\
-//    c_6 &= \alpha^6 + 15\alpha^4 \beta^2 + 45 \alpha^2 \beta^4 + 15 \beta^6 \\
-//    \alpha &= \frac{\kappa_{X_1; 1} - \kappa_{X_2; 1}}{\kappa_{X_2; 2}} \\
+//            \frac{15}{\kappa_{X_2; 2}^3}
+//    c_2 &= \alpha^2 + \beta^2
+//    c_3 &= \alpha^3 + 3 \alpha \beta^2
+//    c_4 &= \alpha^4 + 6 \alpha^2 \beta^2 + 3 \beta^4
+//    c_6 &= \alpha^6 + 15\alpha^4 \beta^2 + 45 \alpha^2 \beta^4 + 15 \beta^6
+//    \alpha &= \frac{\kappa_{X_1; 1} - \kappa_{X_2; 1}}{\kappa_{X_2; 2}}
 //    \beta &= \frac{ \kappa_{X_1; 2}^{1/2} }{\kappa_{X_2; 2}}.
 // \end{align*}
 // $\kappa_{X_i; 1}$, $\kappa_{X_i; 2}$, $\kappa_{X_i; 3}$ and $\kappa_{X_i; 4}$
diff --git a/Examples/ChangeDetection/KullbackLeiblerSupervizedDistanceChDet.cxx b/Examples/ChangeDetection/KullbackLeiblerSupervizedDistanceChDet.cxx
index f892976..b0bb727 100644
--- a/Examples/ChangeDetection/KullbackLeiblerSupervizedDistanceChDet.cxx
+++ b/Examples/ChangeDetection/KullbackLeiblerSupervizedDistanceChDet.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Examples/Classification/CMakeLists.txt b/Examples/Classification/CMakeLists.txt
index 4aa4757..02db6fd 100644
--- a/Examples/Classification/CMakeLists.txt
+++ b/Examples/Classification/CMakeLists.txt
@@ -6,9 +6,11 @@ target_link_libraries(BayesianPluginClassifier ${OTB_LIBRARIES})
 add_executable(ClassificationMapRegularizationExample ClassificationMapRegularizationExample.cxx)
 target_link_libraries(ClassificationMapRegularizationExample ${OTB_LIBRARIES})
 
+#OTBDempsterShafer depends OTBMathParser. But OTB_USE_MUPARSER is OFF
+if(OTBMathParser_LOADED)
 add_executable(DempsterShaferFusionOfClassificationMapsExample DempsterShaferFusionOfClassificationMapsExample.cxx)
 target_link_libraries(DempsterShaferFusionOfClassificationMapsExample ${OTB_LIBRARIES})
-
+endif()
 add_executable(ExpectationMaximizationMixtureModelEstimator ExpectationMaximizationMixtureModelEstimator.cxx)
 target_link_libraries(ExpectationMaximizationMixtureModelEstimator ${OTB_LIBRARIES})
 
diff --git a/Examples/DisparityMap/CMakeLists.txt b/Examples/DisparityMap/CMakeLists.txt
index bd7b2c2..f42b945 100644
--- a/Examples/DisparityMap/CMakeLists.txt
+++ b/Examples/DisparityMap/CMakeLists.txt
@@ -9,8 +9,11 @@ target_link_libraries(NCCRegistrationFilterExample ${OTB_LIBRARIES})
 add_executable(SimpleDisparityMapEstimationExample SimpleDisparityMapEstimationExample.cxx)
 target_link_libraries(SimpleDisparityMapEstimationExample ${OTB_LIBRARIES})
 
+#StereoReconstructionExample depends OTBMathParser. But OTB_USE_MUPARSER is OFF
+if(OTBMathParser_LOADED)
 add_executable(StereoReconstructionExample StereoReconstructionExample.cxx)
 target_link_libraries(StereoReconstructionExample ${OTB_LIBRARIES})
+endif()
 
 if(BUILD_TESTING)
   add_subdirectory(test)
diff --git a/Examples/DisparityMap/test/CMakeLists.txt b/Examples/DisparityMap/test/CMakeLists.txt
index d90913c..9c24743 100644
--- a/Examples/DisparityMap/test/CMakeLists.txt
+++ b/Examples/DisparityMap/test/CMakeLists.txt
@@ -17,6 +17,7 @@ otb_add_test(NAME dmTeSimpleDisparityMapEstimationExampleTest COMMAND ${OTB_TEST
     100 10 15 10 10 250 0.9
 )
 
+if(OTBMathParser_LOADED)
 otb_add_test(NAME dmTeStereoReconstructionExampleTest COMMAND ${OTB_TEST_DRIVER}
   --compare-image ${NOTOL}
     ${BASELINE}/elevationOutput.tif
@@ -28,3 +29,4 @@ otb_add_test(NAME dmTeStereoReconstructionExampleTest COMMAND ${OTB_TEST_DRIVER}
     ${TEMP}/elevationOutputPrintable.png
     140
 )
+endif()
\ No newline at end of file
diff --git a/Examples/FeatureExtraction/CMakeLists.txt b/Examples/FeatureExtraction/CMakeLists.txt
index ec46f9f..edce7bf 100644
--- a/Examples/FeatureExtraction/CMakeLists.txt
+++ b/Examples/FeatureExtraction/CMakeLists.txt
@@ -1,8 +1,5 @@
 project(FeatureExtractionExamples)
 
-add_executable(AlignmentsExample AlignmentsExample.cxx)
-target_link_libraries(AlignmentsExample ${OTB_LIBRARIES})
-
 add_executable(AssymmetricFusionOfLineDetectorExample AssymmetricFusionOfLineDetectorExample.cxx)
 target_link_libraries(AssymmetricFusionOfLineDetectorExample ${OTB_LIBRARIES})
 
@@ -21,12 +18,21 @@ target_link_libraries(CorrelationLineDetectorExample ${OTB_LIBRARIES})
 add_executable(EdgeDensityExample EdgeDensityExample.cxx)
 target_link_libraries(EdgeDensityExample ${OTB_LIBRARIES})
 
+#OTBRoadExtraction depends OTBMathParser. But OTB_USE_MUPARSER is OFF
+if(OTBMathParser_LOADED)
 add_executable(ExtractRoadByStepsExample ExtractRoadByStepsExample.cxx)
 target_link_libraries(ExtractRoadByStepsExample ${OTB_LIBRARIES})
 
 add_executable(ExtractRoadExample ExtractRoadExample.cxx)
 target_link_libraries(ExtractRoadExample ${OTB_LIBRARIES})
 
+add_executable(ParallelLineDetectionExample ParallelLineDetectionExample.cxx)
+target_link_libraries(ParallelLineDetectionExample ${OTB_LIBRARIES})
+
+add_executable(AlignmentsExample AlignmentsExample.cxx)
+target_link_libraries(AlignmentsExample ${OTB_LIBRARIES})
+endif()
+
 add_executable(ExtractSegmentsByStepsExample ExtractSegmentsByStepsExample.cxx)
 target_link_libraries(ExtractSegmentsByStepsExample ${OTB_LIBRARIES})
 
@@ -45,6 +51,9 @@ target_link_libraries(HuMomentsImageFunctionExample ${OTB_LIBRARIES})
 if (Module_OTBVectorDataRendering AND OTB_USE_MAPNIK)
   add_executable(LineSegmentDetectorExample LineSegmentDetectorExample.cxx)
   target_link_libraries(LineSegmentDetectorExample ${OTB_LIBRARIES})
+
+  add_executable(RightAngleDetectionExample RightAngleDetectionExample.cxx)
+  target_link_libraries(RightAngleDetectionExample ${OTB_LIBRARIES})
 endif()
 
 add_executable(LocalHoughExample LocalHoughExample.cxx)
@@ -53,17 +62,9 @@ target_link_libraries(LocalHoughExample ${OTB_LIBRARIES})
 add_executable(PanTexExample PanTexExample.cxx)
 target_link_libraries(PanTexExample ${OTB_LIBRARIES})
 
-add_executable(ParallelLineDetectionExample ParallelLineDetectionExample.cxx)
-target_link_libraries(ParallelLineDetectionExample ${OTB_LIBRARIES})
-
 add_executable(RatioLineDetectorExample RatioLineDetectorExample.cxx)
 target_link_libraries(RatioLineDetectorExample ${OTB_LIBRARIES})
 
-if (Module_OTBVectorDataRendering AND OTB_USE_MAPNIK)
-  add_executable(RightAngleDetectionExample RightAngleDetectionExample.cxx)
-  target_link_libraries(RightAngleDetectionExample ${OTB_LIBRARIES})
-endif()
-
 add_executable(SeamCarvingExample SeamCarvingExample.cxx)
 target_link_libraries(SeamCarvingExample ${OTB_LIBRARIES})
 
diff --git a/Examples/FeatureExtraction/test/CMakeLists.txt b/Examples/FeatureExtraction/test/CMakeLists.txt
index 9e351ac..b748cac 100644
--- a/Examples/FeatureExtraction/test/CMakeLists.txt
+++ b/Examples/FeatureExtraction/test/CMakeLists.txt
@@ -107,7 +107,7 @@ otb_add_test(NAME feTeRatioLineDetectorExampleTest COMMAND ${OTB_TEST_DRIVER}
 )
 
 # ------- AlignmentsExampleTest----------
-
+if(OTBMathParser_LOADED)
 otb_add_test(NAME feTeAlignmentsExampleTest COMMAND ${OTB_TEST_DRIVER}
   --compare-n-images ${NOTOL} 1
     ${BASELINE}/QB_SuburbAlign.png
@@ -145,6 +145,8 @@ otb_add_test(NAME feTeExtractRoadExampleTest COMMAND ${OTB_TEST_DRIVER}
     337 557 432 859 1.0 0.00005 1.0 0.39269 1.0 10.0 25.
 )
 
+endif()
+
 # ------- SeamCarvingExamplesTest----------
 
 otb_add_test(NAME feTeSeamCarvingExampleTest COMMAND ${OTB_TEST_DRIVER}
diff --git a/Examples/Filtering/GeometriesChangeSpatialReference.cxx b/Examples/Filtering/GeometriesChangeSpatialReference.cxx
index 3567ef8..46d869c 100644
--- a/Examples/Filtering/GeometriesChangeSpatialReference.cxx
+++ b/Examples/Filtering/GeometriesChangeSpatialReference.cxx
@@ -206,10 +206,10 @@ int main (int argc, char **argv)
       = options.workingInplace ? input
       : options.outputIsStdout ? 0
       : otb::ogr::DataSource::New( options.outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly);
-    std::cout << "input: " << input -> ogr().GetName() << " should be: " << options.inputFile << "\n";
+    std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << options.inputFile << "\n";
     if (output)
       {
-      std::cout << "output: " << output -> ogr().GetName() << " should be: " << options.outputFile << "\n";
+      std::cout << "output: " << otb::ogr::version_proxy::GetFileListAsStringVector(&output->ogr())[0] << " should be: " << options.outputFile << "\n";
       }
     // std::cout << "\n";
 
diff --git a/Examples/Filtering/GeometriesFilter.cxx b/Examples/Filtering/GeometriesFilter.cxx
index 93d1b35..8150ece 100644
--- a/Examples/Filtering/GeometriesFilter.cxx
+++ b/Examples/Filtering/GeometriesFilter.cxx
@@ -73,10 +73,10 @@ int main (int argc, char **argv)
       = workingInplace ? input
       : outputIsStdout ? 0
       :                  otb::ogr::DataSource::New( outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly);
-    std::cout << "input: " << input -> ogr().GetName() << " should be: " << inputFile << "\n";
+    std::cout << "input: " << otb::ogr::version_proxy::GetFileListAsStringVector(&input->ogr())[0] << " should be: " << inputFile << "\n";
     if (output)
       {
-      std::cout << "output: " << output -> ogr().GetName() << " should be: " << outputFile << "\n";
+      std::cout << "output: " << otb::ogr::version_proxy::GetFileListAsStringVector(&output->ogr())[0] << " should be: " << outputFile << "\n";
       }
     // std::cout << "\n";
 
diff --git a/Examples/IO/CMakeLists.txt b/Examples/IO/CMakeLists.txt
index a3d9b90..b4395d4 100644
--- a/Examples/IO/CMakeLists.txt
+++ b/Examples/IO/CMakeLists.txt
@@ -30,8 +30,10 @@ target_link_libraries(ImageReadWrite ${OTB_LIBRARIES})
 add_executable(ImageSeriesIOExample ImageSeriesIOExample.cxx)
 target_link_libraries(ImageSeriesIOExample ${OTB_LIBRARIES})
 
+if(OTBlibkml_LOADED)
 add_executable(ImageToKmzAndMapFileProductExample ImageToKmzAndMapFileProductExample.cxx)
 target_link_libraries(ImageToKmzAndMapFileProductExample ${OTB_LIBRARIES})
+endif()
 
 add_executable(MetadataExample MetadataExample.cxx)
 target_link_libraries(MetadataExample ${OTB_LIBRARIES})
diff --git a/Examples/IO/test/CMakeLists.txt b/Examples/IO/test/CMakeLists.txt
index d75692e..720b162 100644
--- a/Examples/IO/test/CMakeLists.txt
+++ b/Examples/IO/test/CMakeLists.txt
@@ -43,6 +43,7 @@ otb_add_test(NAME prTeDEMHandlerExampleTest COMMAND ${OTB_TEST_DRIVER}
     0.001
 )
 
+if(OTBlibkml_LOADED)
 otb_add_test(NAME ioTeImageToKmzAndMapFileProductExample COMMAND ${OTB_TEST_DRIVER}
   Execute $<TARGET_FILE:ImageToKmzAndMapFileProductExample>
     ${OTB_DATA_ROOT}/Input/Haiti1_sr10.jpeg
@@ -78,6 +79,7 @@ otb_add_test(NAME ioTeImageToKmzAndMapFileProductExample COMMAND ${OTB_TEST_DRIV
     42.000000  232.000000 -72.426552 18.540876 0.000000
 )
 set_property(TEST ioTeImageToKmzAndMapFileProductExample PROPERTY RESOURCE_LOCK web_access)
+endif()
 
 otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER}
   --compare-image 10.0
diff --git a/Examples/Learning/CMakeLists.txt b/Examples/Learning/CMakeLists.txt
index 4963eca..cbf5126 100644
--- a/Examples/Learning/CMakeLists.txt
+++ b/Examples/Learning/CMakeLists.txt
@@ -12,6 +12,7 @@ target_link_libraries(SOMClassifierExample ${OTB_LIBRARIES})
 add_executable(SOMExample SOMExample.cxx)
 target_link_libraries(SOMExample ${OTB_LIBRARIES})
 
+if(OTBLibSVM_LOADED)
 add_executable(SVMImageClassificationExample SVMImageClassificationExample.cxx)
 target_link_libraries(SVMImageClassificationExample ${OTB_LIBRARIES})
 
@@ -29,13 +30,15 @@ target_link_libraries(SVMPointSetExample ${OTB_LIBRARIES})
 
 add_executable(SVMPointSetModelEstimatorExample SVMPointSetModelEstimatorExample.cxx)
 target_link_libraries(SVMPointSetModelEstimatorExample ${OTB_LIBRARIES})
+endif()
 
+if(OTBOpenCV_LOADED)
 add_executable(TrainMachineLearningModelFromImagesExample TrainMachineLearningModelFromImagesExample.cxx)
 target_link_libraries(TrainMachineLearningModelFromImagesExample ${OTB_LIBRARIES})
 
 add_executable(TrainMachineLearningModelFromSamplesExample TrainMachineLearningModelFromSamplesExample.cxx)
 target_link_libraries(TrainMachineLearningModelFromSamplesExample ${OTB_LIBRARIES})
-
+endif()
 
 if(BUILD_TESTING)
   add_subdirectory(test)
diff --git a/Examples/Learning/SEMModelEstimatorExample.cxx b/Examples/Learning/SEMModelEstimatorExample.cxx
index bb396e9..86f3e58 100644
--- a/Examples/Learning/SEMModelEstimatorExample.cxx
+++ b/Examples/Learning/SEMModelEstimatorExample.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) GET / ENST Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Examples/Learning/SOMExample.cxx b/Examples/Learning/SOMExample.cxx
index 056820d..3f56132 100644
--- a/Examples/Learning/SOMExample.cxx
+++ b/Examples/Learning/SOMExample.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Examples/Learning/SVMGenericKernelImageClassificationExample.cxx b/Examples/Learning/SVMGenericKernelImageClassificationExample.cxx
index e11095a..765fe15 100644
--- a/Examples/Learning/SVMGenericKernelImageClassificationExample.cxx
+++ b/Examples/Learning/SVMGenericKernelImageClassificationExample.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) GET / ENST Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Examples/Learning/SVMGenericKernelImageModelEstimatorExample.cxx b/Examples/Learning/SVMGenericKernelImageModelEstimatorExample.cxx
index 1e411f9..61494ba 100644
--- a/Examples/Learning/SVMGenericKernelImageModelEstimatorExample.cxx
+++ b/Examples/Learning/SVMGenericKernelImageModelEstimatorExample.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) GET / ENST Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Examples/Learning/test/CMakeLists.txt b/Examples/Learning/test/CMakeLists.txt
index d3918e2..71e5104 100644
--- a/Examples/Learning/test/CMakeLists.txt
+++ b/Examples/Learning/test/CMakeLists.txt
@@ -3,6 +3,7 @@ set(INPUTDATA ${OTB_DATA_ROOT}/Examples)
 
 # ------- SVMImageClassificationExampleTest----------
 
+if(OTBLibSVM_LOADED)
 otb_add_test(NAME leTeSVMImageClassificationExampleTest COMMAND ${OTB_TEST_DRIVER}
   --compare-n-images ${NOTOL} 1
     ${BASELINE}/ROI_QB_MUL_1_SVN_CLASS.png
@@ -26,18 +27,6 @@ otb_add_test(NAME leTeSVMImageEstimatorClassificationMultiExampleTest COMMAND ${
     ${TEMP}/ROI_QB_MUL_1_SVN_CLASS_MULTI_Rescaled.png
 )
 
-# ------- GenerateTrainingImageExampleTest----------
-
-otb_add_test(NAME leTeGenerateTrainingImageExampleTest COMMAND ${OTB_TEST_DRIVER}
-  --compare-n-images ${NOTOL} 1
-    ${BASELINE}/ROI_QB_MUL_4_training.png
-    ${TEMP}/ROI_QB_MUL_4_training.png
-  Execute $<TARGET_FILE:GenerateTrainingImageExample>
-    ${INPUTDATA}/ROI_QB_MUL_4.tif
-    ${INPUTDATA}/LearningROIs.txt
-    ${TEMP}/ROI_QB_MUL_4_training.png
-)
-
 # ------- SVMImageModelEstimatorExampleTest----------
 
 otb_add_test(NAME leTeSVMImageModelEstimatorExampleTest COMMAND ${OTB_TEST_DRIVER}
@@ -51,6 +40,18 @@ otb_add_test(NAME leTeSVMImageModelEstimatorExampleTest COMMAND ${OTB_TEST_DRIVE
     ${TEMP}/svm_image_model.svn
 )
 
+endif()
+# ------- GenerateTrainingImageExampleTest----------
+
+otb_add_test(NAME leTeGenerateTrainingImageExampleTest COMMAND ${OTB_TEST_DRIVER}
+  --compare-n-images ${NOTOL} 1
+    ${BASELINE}/ROI_QB_MUL_4_training.png
+    ${TEMP}/ROI_QB_MUL_4_training.png
+  Execute $<TARGET_FILE:GenerateTrainingImageExample>
+    ${INPUTDATA}/ROI_QB_MUL_4.tif
+    ${INPUTDATA}/LearningROIs.txt
+    ${TEMP}/ROI_QB_MUL_4_training.png
+)
 
 # ------- SOMExampleTest----------
 
diff --git a/Examples/OBIA/CMakeLists.txt b/Examples/OBIA/CMakeLists.txt
index 202bd7a..d2f7a79 100644
--- a/Examples/OBIA/CMakeLists.txt
+++ b/Examples/OBIA/CMakeLists.txt
@@ -12,8 +12,10 @@ target_link_libraries(KeepNObjects ${OTB_LIBRARIES})
 add_executable(LabelMapToVectorData LabelMapToVectorData.cxx)
 target_link_libraries(LabelMapToVectorData ${OTB_LIBRARIES})
 
+if(OTBMathParser_LOADED)
 add_executable(RadiometricAttributesLabelMapFilterExample RadiometricAttributesLabelMapFilterExample.cxx)
 target_link_libraries(RadiometricAttributesLabelMapFilterExample ${OTB_LIBRARIES})
+endif()
 
 add_executable(ShapeAttributeComputation ShapeAttributeComputation.cxx)
 target_link_libraries(ShapeAttributeComputation ${OTB_LIBRARIES})
diff --git a/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx b/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx
index 4d3a17a..239a5ac 100644
--- a/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx
+++ b/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx
@@ -74,7 +74,7 @@ int main(int argc, char * argv[])
   const unsigned int spatialRadius          = atoi(argv[7]);
   const double       rangeRadius            = atof(argv[8]);
   const unsigned int minRegionSize          = atoi(argv[9]);
-  const double       scale                  = atoi(argv[10]);
+  /* const double       scale                  = atoi(argv[10]); */
 
   const unsigned int Dimension = 2;
 
diff --git a/Examples/OBIA/test/CMakeLists.txt b/Examples/OBIA/test/CMakeLists.txt
index 83a32c6..f3c92b3 100644
--- a/Examples/OBIA/test/CMakeLists.txt
+++ b/Examples/OBIA/test/CMakeLists.txt
@@ -22,6 +22,7 @@ otb_add_test(NAME trTeOBIAShapeAttributeComputationTest COMMAND ${OTB_TEST_DRIVE
     ${TEMP}/OBIAShapeAttribute.txt
 )
 
+if(OTBMathParser_LOADED)
 otb_add_test(NAME trTeOBIARadiometricAttributesLabelMapFilterTest COMMAND ${OTB_TEST_DRIVER}
   --compare-image ${NOTOL}
     ${BASELINE}/OBIARadiometricAttributes.png
@@ -38,6 +39,7 @@ otb_add_test(NAME trTeOBIARadiometricAttributesLabelMapFilterTest COMMAND ${OTB_
     50
     1.0
 )
+endif()
 
 otb_add_test(NAME trTeLabelMapToVectorData COMMAND ${OTB_TEST_DRIVER}
   Execute $<TARGET_FILE:LabelMapToVectorData>
diff --git a/Examples/Patented/CMakeLists.txt b/Examples/Patented/CMakeLists.txt
index 07210c8..8648e95 100644
--- a/Examples/Patented/CMakeLists.txt
+++ b/Examples/Patented/CMakeLists.txt
@@ -3,18 +3,18 @@ project(PatentedExamples)
 add_executable(EstimateAffineTransformationExample EstimateAffineTransformationExample.cxx)
 target_link_libraries(EstimateAffineTransformationExample ${OTB_LIBRARIES})
 
+if (OTBSiftFast_LOADED)
 add_executable(SIFTDisparityMapEstimation SIFTDisparityMapEstimation.cxx)
 target_link_libraries(SIFTDisparityMapEstimation ${OTB_LIBRARIES})
 
 add_executable(SIFTExample SIFTExample.cxx)
 target_link_libraries(SIFTExample ${OTB_LIBRARIES})
 
-if (Module_OTBSiftFast)
-  add_executable(SIFTDensityExample SIFTDensityExample.cxx)
-  target_link_libraries(SIFTDensityExample ${OTB_LIBRARIES})
+add_executable(SIFTDensityExample SIFTDensityExample.cxx)
+target_link_libraries(SIFTDensityExample ${OTB_LIBRARIES})
 
-  add_executable(SIFTFastExample SIFTFastExample.cxx)
-  target_link_libraries(SIFTFastExample ${OTB_LIBRARIES})
+add_executable(SIFTFastExample SIFTFastExample.cxx)
+target_link_libraries(SIFTFastExample ${OTB_LIBRARIES})
 endif()
 
 if(BUILD_TESTING)
diff --git a/Examples/Patented/SIFTDensityExample.cxx b/Examples/Patented/SIFTDensityExample.cxx
index d5859f8..5c2044b 100644
--- a/Examples/Patented/SIFTDensityExample.cxx
+++ b/Examples/Patented/SIFTDensityExample.cxx
@@ -21,6 +21,7 @@
 #include "otbImage.h"
 #include "otbImageFileReader.h"
 #include "otbImageFileWriter.h"
+#include "itkUnaryFunctorImageFilter.h"
 #include "itkRescaleIntensityImageFilter.h"
 
 //  Software Guide : BeginCommandLineArgs
diff --git a/Examples/Projections/test/CMakeLists.txt b/Examples/Projections/test/CMakeLists.txt
index d1ad300..7964d86 100644
--- a/Examples/Projections/test/CMakeLists.txt
+++ b/Examples/Projections/test/CMakeLists.txt
@@ -48,7 +48,7 @@ otb_add_test(NAME prTeVectorDataProjectionExampleTest COMMAND ${OTB_TEST_DRIVER}
     ${BASELINE}/vectorDataProjectionExample.shp
     ${TEMP}/vectorDataProjectionExample.shp
   Execute $<TARGET_FILE:VectorDataProjectionExample>
-    ${INPUTDATA}/Capitole-Shadows.kml
+    ${OTB_DATA_ROOT}/Input/Capitole-Shadows.kml
     LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF}
     ${TEMP}/vectorDataProjectionExample.shp
 )
@@ -58,7 +58,7 @@ otb_add_test(NAME prTeGeometriesProjectionTest COMMAND ${OTB_TEST_DRIVER}
     ${BASELINE}/geometriesProjectionExample.shp
     ${TEMP}/geometriesProjectionExample.shp
   Execute $<TARGET_FILE:GeometriesProjectionExample>
-    ${INPUTDATA}/Capitole-Shadows.shp
+    ${OTB_DATA_ROOT}/Input/Capitole-Shadows.shp
     LARGEINPUT{QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF}
     ${TEMP}/geometriesProjectionExample.shp
 )
@@ -68,7 +68,7 @@ otb_add_test(NAME prTeEstimateRPCSensorModelExampleTest COMMAND ${OTB_TEST_DRIVE
   --compare-ascii ${EPSILON_4}
     ${BASELINE}/otbGCPsToRPCSensorModelImageFilterWithoutDEMOutput.txt
     ${TEMP}/otbGCPsToRPCSensorModelImageFilterWithoutDEMOutput.txt
-  --ignore-lines-with 5 PipelineMTime ImportImageContaine Source: Image Time:
+  --ignore-lines-with 6 PipelineMTime ImportImageContaine Source: Image Time: Pointer:
   Execute $<TARGET_FILE:EstimateRPCSensorModelExample>
     LARGEINPUT{SPOT4/RIO_DE_JANEIRO/IMAG_01.DAT}
     ${TEMP}/otbGCPsToRPCSensorModelImageFilterWithoutDEMOutput.txt
@@ -88,6 +88,10 @@ otb_add_test(NAME prTeEstimateRPCSensorModelExampleTest COMMAND ${OTB_TEST_DRIVE
     2803 1942 -22.958868 -42.808235 0.
     980 2734 -22.99534 -43.309672 0.
     713 2754 -23.007862 -43.365307 0.
+    72 2955 -23.012153 -43.541331 0.
+    2884 1898 -22.954691 -42.786188 0.
+    2539 47 -22.616041 -42.777877 0.
+    577 183 -22.551654 -43.271813 0.
 )
 
 otb_add_test(NAME prTePlaceNameToLonLatExampleTest COMMAND ${OTB_TEST_DRIVER}
diff --git a/Examples/Radiometry/CMakeLists.txt b/Examples/Radiometry/CMakeLists.txt
index 1c1e1bd..48c5d40 100644
--- a/Examples/Radiometry/CMakeLists.txt
+++ b/Examples/Radiometry/CMakeLists.txt
@@ -3,8 +3,11 @@ project(RadiometryExamples)
 add_executable(ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx)
 target_link_libraries(ARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter ${OTB_LIBRARIES})
 
+#OTBOpticalCalibration -> OTB6S
+if(OTB6S_LOADED)
 add_executable(AtmosphericCorrectionSequencement AtmosphericCorrectionSequencement.cxx)
 target_link_libraries(AtmosphericCorrectionSequencement ${OTB_LIBRARIES})
+endif()
 
 add_executable(AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx)
 target_link_libraries(AVIMultiChannelRAndGAndNIRVegetationIndexImageFilter ${OTB_LIBRARIES})
diff --git a/Examples/Radiometry/test/CMakeLists.txt b/Examples/Radiometry/test/CMakeLists.txt
index ff18563..b77c8c8 100644
--- a/Examples/Radiometry/test/CMakeLists.txt
+++ b/Examples/Radiometry/test/CMakeLists.txt
@@ -52,6 +52,7 @@ otb_add_test(NAME raTeNDVIRAndNIRVegetationIndexImageFilterTest COMMAND ${OTB_TE
     ${TEMP}/NDVIRAndNIRVegetationIndex4.tif
 )
 
+if(OTBOpticalCalibration_LOADED)
 otb_add_test(NAME raTeAtmosphericCorrectionSequencementTest COMMAND ${OTB_TEST_DRIVER}
   --compare-image ${EPSILON_8}
     ${BASELINE}/Example_RomaniaAtmosphericCorrectionSequencement.tif
@@ -82,3 +83,4 @@ otb_add_test(NAME raTeAtmosphericCorrectionSequencementTest COMMAND ${OTB_TEST_D
     2       # Radius;
     0.020   # pixel spacing in kilometers
 )
+endif()
\ No newline at end of file
diff --git a/Examples/Segmentation/CMakeLists.txt b/Examples/Segmentation/CMakeLists.txt
index 4fb4b89..c8cda53 100644
--- a/Examples/Segmentation/CMakeLists.txt
+++ b/Examples/Segmentation/CMakeLists.txt
@@ -24,8 +24,10 @@ target_link_libraries(OtsuMultipleThresholdImageFilter ${OTB_LIBRARIES})
 add_executable(OtsuThresholdImageFilter OtsuThresholdImageFilter.cxx)
 target_link_libraries(OtsuThresholdImageFilter ${OTB_LIBRARIES})
 
-add_executable(StreamingMeanShiftSegmentation StreamingMeanShiftSegmentation.cxx)
-target_link_libraries(StreamingMeanShiftSegmentation ${OTB_LIBRARIES})
+if(OTBMathParser_LOADED)
+  add_executable(StreamingMeanShiftSegmentation StreamingMeanShiftSegmentation.cxx)
+  target_link_libraries(StreamingMeanShiftSegmentation ${OTB_LIBRARIES})
+endif()
 
 add_executable(VectorConfidenceConnected VectorConfidenceConnected.cxx)
 target_link_libraries(VectorConfidenceConnected ${OTB_LIBRARIES})
diff --git a/Examples/Segmentation/test/CMakeLists.txt b/Examples/Segmentation/test/CMakeLists.txt
index d43f19e..37d36f1 100644
--- a/Examples/Segmentation/test/CMakeLists.txt
+++ b/Examples/Segmentation/test/CMakeLists.txt
@@ -272,7 +272,7 @@ otb_add_test(NAME seTeLabelizeNeighborhoodConnectedImageFilterTest COMMAND ${OTB
 
 
 # ------- StreamingMeanShiftSegmentationTest ----------
-
+if(OTBMathParser_LOADED)
 otb_add_test(NAME seTeStreamingMeanShiftSegmentationTest COMMAND ${OTB_TEST_DRIVER}
   # --compare-ogr ${NOTOL}
   # ${BASELINE_FILES}/seTeStreamingMeanShiftSegmentationTest.shp
@@ -291,3 +291,4 @@ otb_add_test(NAME seTeStreamingMeanShiftSegmentationTest COMMAND ${OTB_TEST_DRIV
     1 #Simplify Flag
     0.2 #Simplification tolerance
 )
+endif()
\ No newline at end of file
diff --git a/Examples/Simulation/CMakeLists.txt b/Examples/Simulation/CMakeLists.txt
index ece736e..0e0bc86 100644
--- a/Examples/Simulation/CMakeLists.txt
+++ b/Examples/Simulation/CMakeLists.txt
@@ -1,14 +1,16 @@
 project(SimulationExamples)
 
+#OTBSimulation -> OTBOpticalCalibration -> OTB6S
+if(OTB6S_LOADED)
 add_executable(LAIAndPROSAILToSensorResponse LAIAndPROSAILToSensorResponse.cxx)
 target_link_libraries(LAIAndPROSAILToSensorResponse ${OTB_LIBRARIES})
 
-add_executable(LAIFromNDVIImageTransform LAIFromNDVIImageTransform.cxx)
-target_link_libraries(LAIFromNDVIImageTransform ${OTB_LIBRARIES})
-
 add_executable(ProsailModel ProsailModel.cxx)
 target_link_libraries(ProsailModel ${OTB_LIBRARIES})
+endif()
 
+add_executable(LAIFromNDVIImageTransform LAIFromNDVIImageTransform.cxx)
+target_link_libraries(LAIFromNDVIImageTransform ${OTB_LIBRARIES})
 
 if(BUILD_TESTING)
   add_subdirectory(test)
diff --git a/Examples/Simulation/test/CMakeLists.txt b/Examples/Simulation/test/CMakeLists.txt
index eed146c..9cb0323 100644
--- a/Examples/Simulation/test/CMakeLists.txt
+++ b/Examples/Simulation/test/CMakeLists.txt
@@ -3,6 +3,8 @@ set(INPUTDATA ${OTB_DATA_ROOT}/Examples)
 
 # ------- ProsailModelExampleTest ----------
 
+#OTBSimulation -> OTBOpticalCalibration -> OTB6S
+if(OTB6S_LOADED)
 otb_add_test(NAME siTvProsailModelExampleTest COMMAND ${OTB_TEST_DRIVER}
   --compare-ascii ${EPSILON_3}
     ${BASELINE}/siTvProsailModelExampleTest.txt
@@ -25,20 +27,6 @@ otb_add_test(NAME siTvProsailModelExampleTest COMMAND ${OTB_TEST_DRIVER}
     ${TEMP}/siTvProsailModelExampleTest.txt
 )
 
-
-otb_add_test(NAME siTvLAIFromNDVIImageTransfromExampleTest  COMMAND ${OTB_TEST_DRIVER}
-  --compare-image ${EPSILON_8}
-    ${OTB_DATA_ROOT}/Baseline/OTB/Images/raRAndNIRVegetationIndex_LAIFromNDVIFormosat2_verySmallFSATSWcRcNir.tif
-    ${TEMP}/siTvLAIFromNDVIImageTransfromExampleTest_verySmallFSATSW.tif
-  Execute $<TARGET_FILE:LAIFromNDVIImageTransform>
-    ${INPUTDATA}/verySmallFSATSW.tif
-    ${TEMP}/siTvLAIFromNDVIImageTransfromExampleTest_verySmallFSATSW.tif
-    ${TEMP}/verySmallFSATSW_visu.png
-    ${TEMP}/siTvLAIFromNDVIImageTransfromExampleTest_verySmallFSATSW_visu.png
-    1  # red
-    4  # nir
-)
-
 otb_add_test(NAME siTvLAIAndPROSAILToSensorResponseExampleTest  COMMAND ${OTB_TEST_DRIVER}
 --compare-image ${EPSILON_8}
   ${OTBAPP_BASELINE}/siTvLAIAndPROSAILToSensorResponseSmall.tif
@@ -54,3 +42,18 @@ Execute $<TARGET_FILE:LAIAndPROSAILToSensorResponse>
   5
   ${OTB_DATA_ROOT}/Input/
 )
+
+endif()
+
+otb_add_test(NAME siTvLAIFromNDVIImageTransfromExampleTest  COMMAND ${OTB_TEST_DRIVER}
+  --compare-image ${EPSILON_8}
+    ${OTB_DATA_ROOT}/Baseline/OTB/Images/raRAndNIRVegetationIndex_LAIFromNDVIFormosat2_verySmallFSATSWcRcNir.tif
+    ${TEMP}/siTvLAIFromNDVIImageTransfromExampleTest_verySmallFSATSW.tif
+  Execute $<TARGET_FILE:LAIFromNDVIImageTransform>
+    ${INPUTDATA}/verySmallFSATSW.tif
+    ${TEMP}/siTvLAIFromNDVIImageTransfromExampleTest_verySmallFSATSW.tif
+    ${TEMP}/verySmallFSATSW_visu.png
+    ${TEMP}/siTvLAIFromNDVIImageTransfromExampleTest_verySmallFSATSW_visu.png
+    1  # red
+    4  # nir
+)
diff --git a/Examples/Tutorials/ScalingPipeline.cxx b/Examples/Tutorials/ScalingPipeline.cxx
index 8ceaced..fcead9e 100644
--- a/Examples/Tutorials/ScalingPipeline.cxx
+++ b/Examples/Tutorials/ScalingPipeline.cxx
@@ -28,7 +28,7 @@
 // the result for proper display.
 //
 // We include the required header including the header
-// for the \doxygen{itk}{CannyEdgeImageFilter} and the
+// for the \doxygen{itk}{CannyEdgeDetectionImageFilter} and the
 // \doxygen{itk}{RescaleIntensityImageFilter}.
 //
 //  Software Guide : EndLatex
diff --git a/Modules/Adapters/BoostAdapters/include/otbStringUtils.h b/Modules/Adapters/BoostAdapters/include/otbStringUtils.h
new file mode 100644
index 0000000..57e0d32
--- /dev/null
+++ b/Modules/Adapters/BoostAdapters/include/otbStringUtils.h
@@ -0,0 +1,142 @@
+/*=========================================================================
+
+  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 otbStringUtils_h
+#define otbStringUtils_h
+
+
+#include <string>
+#include <vector>
+#include <limits>
+#include <stdexcept>
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/utility/enable_if.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
+#include <boost/utility/enable_if.hpp>
+#endif
+
+namespace otb
+{
+namespace Utils
+{
+template <typename Res, typename In >
+inline
+Res LexicalCast(In const& in, std::string const& kind) {
+    try
+    {
+        return boost::lexical_cast<Res>(in);
+    }
+    catch (boost::bad_lexical_cast &) {
+        std::ostringstream oss;
+        oss << "Cannot decode '" << in << "' as this is not a valid value for '" << kind << "'";
+        throw std::runtime_error(oss.str());
+    }
+}
+
+/**\ingroup Utils
+ * Converts a delimiter separated string into a collection of \c T's.
+ * \tparam Collection type. It shall define \c value_type and \c push_back()
+ * \param[out] ret output collection.
+ * \param[in] str  input string
+ * \param[in] errmsg a msg complement used to build the error message to
+be shown if there is \c lexical_cast exception. See \c
+otb:Utils::LexicalCast().
+ * \param delims  delimitter characters (space is default)
+ * \throw std::bad_alloc in case of exhausted memory
+ * \throw std::runtime_error in case an element from the input string
+cannot be converted into a valid \c T instance.
+ * \pre delims shall not be null (untested)
+ *
+ * \see \c otb::Utils::LexicalCast()
+ */
+template<typename T>
+void
+ConvertStringToVector(std::string const &str, T& ret, std::string const& errmsg, const char *  delims=" ")
+{
+  typedef std::vector<boost::iterator_range<std::string::const_iterator> > ListType;
+
+  ListType splitted;
+
+  boost::split(splitted, str, boost::is_any_of(delims));
+
+  for(size_t i = 0; i < splitted.size(); i++)
+    {
+    typename T::value_type value = LexicalCast<typename T::value_type> (splitted[i], errmsg);
+    ret.push_back(value);
+    }
+}
+
+/**\ingroup Utils
+ * split a given std::string of into key value based on given delimitter
+ * string. default delimitter is '='. If the string does not have a delimitter
+ * the key is set to input string and value is set to defValue.
+ * \param[in] str  input string
+ * \param key[out] An std::string reference where key will be stored
+ * \param value[out] a reference of \cT where value will be stored
+ * \param defValue[in] a default value if there is no delimitter fo
+ * \param[in] errmsg a msg complement used to build the error message to
+be shown if there is \c lexical_cast exception. See \cotb:Utils::LexicalCast().
+ * \param delims  delimitter characters (space is default)
+ * \throw std::bad_alloc in case of exhausted memory
+ * \throw std::runtime_error in case an element from the input string
+cannot be converted into a valid \c T instance.
+ * \pre delims shall not be null (untested)
+ *
+ * \see \c otb::Utils::LexicalCast()
+ */
+template<typename T>
+void SplitStringToSingleKeyValue(const std::string& str,
+                                 std::string& key, T& value, const T& defValue,
+                                 std::string const& errmsg, const std::string delims="=")
+{
+
+  typedef boost::iterator_range<std::string::const_iterator> BoostRangeIteratorType;
+  typedef std::list< BoostRangeIteratorType > ListType;
+
+  ListType splitted;
+
+  boost::split( splitted, str, boost::is_any_of(delims), boost::token_compress_on );
+
+  typename ListType::iterator it = splitted.begin();
+  BoostRangeIteratorType kIt = boost::trim_copy((*it));
+  key.assign( kIt.begin(), kIt.end());
+  ++it;
+
+  if( it != splitted.end())
+    {
+    value =  LexicalCast<T>(boost::trim_copy(*it), errmsg);
+    ++it;
+    }
+  else
+    {
+    value = defValue;
+    }
+}
+} // end namespace Utils
+} // end namespace otb
+
+#endif //otbStringUtils_h
diff --git a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx b/Modules/Adapters/BoostAdapters/include/otb_boost_expint_header.h
similarity index 55%
copy from Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
copy to Modules/Adapters/BoostAdapters/include/otb_boost_expint_header.h
index 45620f8..0a48515 100644
--- a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
+++ b/Modules/Adapters/BoostAdapters/include/otb_boost_expint_header.h
@@ -15,21 +15,17 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
+#ifndef otb_boost_expint_header_h
+#define otb_boost_expint_header_h
 
-#include "otbStreamingHistogramVectorImageFilter.h"
-#include "otbVectorImage.h"
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#include <boost/math/special_functions/expint.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <boost/math/special_functions/expint.hpp>
+#endif
 
-typedef otb::VectorImage<unsigned char>               VectorImageType;
-typedef otb::StreamingHistogramVectorImageFilter<VectorImageType>                SHVIFType;
 
-
-
-int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
-{
-
-  SHVIFType::Pointer SHVIFFilter = SHVIFType::New();
-
-  std::cout << SHVIFFilter << std::endl;
-
-  return EXIT_SUCCESS;
-}
+#endif
diff --git a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx b/Modules/Adapters/BoostAdapters/include/otb_boost_graph_header.h
similarity index 53%
copy from Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
copy to Modules/Adapters/BoostAdapters/include/otb_boost_graph_header.h
index 45620f8..66dee60 100644
--- a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
+++ b/Modules/Adapters/BoostAdapters/include/otb_boost_graph_header.h
@@ -15,21 +15,21 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-
-#include "otbStreamingHistogramVectorImageFilter.h"
-#include "otbVectorImage.h"
-
-typedef otb::VectorImage<unsigned char>               VectorImageType;
-typedef otb::StreamingHistogramVectorImageFilter<VectorImageType>                SHVIFType;
-
-
-
-int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
-{
-
-  SHVIFType::Pointer SHVIFFilter = SHVIFType::New();
-
-  std::cout << SHVIFFilter << std::endl;
-
-  return EXIT_SUCCESS;
-}
+#ifndef otb_boost_graph_header_h
+#define otb_boost_graph_header_h
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#pragma GCC diagnostic ignored "-Wcast-align"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#endif
+
+
+#endif
diff --git a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx b/Modules/Adapters/BoostAdapters/include/otb_boost_math_gamma_header.h
similarity index 55%
copy from Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
copy to Modules/Adapters/BoostAdapters/include/otb_boost_math_gamma_header.h
index 45620f8..19f4366 100644
--- a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
+++ b/Modules/Adapters/BoostAdapters/include/otb_boost_math_gamma_header.h
@@ -15,21 +15,17 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
+#ifndef otb_boost_math_gamma_header_h
+#define otb_boost_math_gamma_header_h
 
-#include "otbStreamingHistogramVectorImageFilter.h"
-#include "otbVectorImage.h"
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#include <boost/math/special_functions/gamma.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <boost/math/special_functions/gamma.hpp>
+#endif
 
-typedef otb::VectorImage<unsigned char>               VectorImageType;
-typedef otb::StreamingHistogramVectorImageFilter<VectorImageType>                SHVIFType;
 
-
-
-int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
-{
-
-  SHVIFType::Pointer SHVIFFilter = SHVIFType::New();
-
-  std::cout << SHVIFFilter << std::endl;
-
-  return EXIT_SUCCESS;
-}
+#endif
diff --git a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx b/Modules/Adapters/BoostAdapters/include/otb_boost_math_normal_header.h
similarity index 55%
copy from Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
copy to Modules/Adapters/BoostAdapters/include/otb_boost_math_normal_header.h
index 45620f8..f2c3250 100644
--- a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
+++ b/Modules/Adapters/BoostAdapters/include/otb_boost_math_normal_header.h
@@ -15,21 +15,17 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
+#ifndef otb_boost_math_normal_header_h
+#define otb_boost_math_normal_header_h
 
-#include "otbStreamingHistogramVectorImageFilter.h"
-#include "otbVectorImage.h"
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#include <boost/math/distributions/normal.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <boost/math/distributions/normal.hpp>
+#endif
 
-typedef otb::VectorImage<unsigned char>               VectorImageType;
-typedef otb::StreamingHistogramVectorImageFilter<VectorImageType>                SHVIFType;
 
-
-
-int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
-{
-
-  SHVIFType::Pointer SHVIFFilter = SHVIFType::New();
-
-  std::cout << SHVIFFilter << std::endl;
-
-  return EXIT_SUCCESS;
-}
+#endif
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx b/Modules/Adapters/BoostAdapters/include/otb_boost_string_header.h
similarity index 56%
copy from Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx
copy to Modules/Adapters/BoostAdapters/include/otb_boost_string_header.h
index 743b0b5..f85ff52 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx
+++ b/Modules/Adapters/BoostAdapters/include/otb_boost_string_header.h
@@ -15,20 +15,19 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-#include "otbWrapperInputImageParameter.h"
-#include "itksys/SystemTools.hxx"
-#include "otbWrapperTypes.h"
-#include "otbWrapperInputImageParameterMacros.h"
+#ifndef otb_boost_string_header_h
+#define otb_boost_string_header_h
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
+#pragma GCC diagnostic pop
+#else
 #include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/predicate.hpp>
+#endif
+
 
-namespace otb
-{
-namespace Wrapper
-{
-otbGetImageMacro(UInt8Image);
-otbGetImageMacro(UInt8VectorImage)
-otbGenericCastImageMacro(UInt8ImageType, SimpleCastImage, )
-otbGenericCastImageMacro(UInt8VectorImageType, SimpleCastImage, Vector)
-otbGenericCastImageMacro(UInt8ImageType, CastVectorImageFromImage, Vector)
-}
-}
+#endif
diff --git a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx b/Modules/Adapters/BoostAdapters/include/otb_boost_tokenizer_header.h
similarity index 55%
copy from Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
copy to Modules/Adapters/BoostAdapters/include/otb_boost_tokenizer_header.h
index 45620f8..9b89db4 100644
--- a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
+++ b/Modules/Adapters/BoostAdapters/include/otb_boost_tokenizer_header.h
@@ -15,21 +15,19 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-
-#include "otbStreamingHistogramVectorImageFilter.h"
-#include "otbVectorImage.h"
-
-typedef otb::VectorImage<unsigned char>               VectorImageType;
-typedef otb::StreamingHistogramVectorImageFilter<VectorImageType>                SHVIFType;
-
-
-
-int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
-{
-
-  SHVIFType::Pointer SHVIFFilter = SHVIFType::New();
-
-  std::cout << SHVIFFilter << std::endl;
-
-  return EXIT_SUCCESS;
-}
+#ifndef otb_boost_tokenizer_header_h
+#define otb_boost_tokenizer_header_h
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#include <boost/foreach.hpp>
+#include <boost/tokenizer.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <boost/foreach.hpp>
+#include <boost/tokenizer.hpp>
+#endif
+
+
+#endif
diff --git a/Modules/Adapters/CurlAdapters/otb-module.cmake b/Modules/Adapters/CurlAdapters/otb-module.cmake
index 9dfc3f7..fe31efd 100644
--- a/Modules/Adapters/CurlAdapters/otb-module.cmake
+++ b/Modules/Adapters/CurlAdapters/otb-module.cmake
@@ -10,6 +10,7 @@ otb_module(OTBCurlAdapters
 
   TEST_DEPENDS
     OTBTestKernel
+    OTBTinyXML
 
   DESCRIPTION
     "${DOCUMENTATION}"
diff --git a/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx b/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx
index b27994f..a44b6b2 100644
--- a/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx
+++ b/Modules/Adapters/CurlAdapters/src/otbCurlHelper.cxx
@@ -201,6 +201,8 @@ private:
 
 bool CurlHelper::TestUrlAvailability(const std::string& url) const
 {
+  (void)url;
+
 #ifdef OTB_USE_CURL
   // Set up a curl resource
   CurlResource::Pointer curlResource = CurlResource::New();
@@ -259,6 +261,7 @@ bool CurlHelper::IsCurlReturnHttpError(const std::string& url) const
 
   return false;
 #else
+  (void)url;
   otbMsgDevMacro(<< "Curl is not available, compile with OTB_USE_CURL to ON");
   return false;
 #endif
@@ -298,6 +301,8 @@ int CurlHelper::RetrieveUrlInMemory(const std::string& url, std::string& output)
   otbMsgDevMacro(<< " -> " << res);
   return res;
 #else
+  (void)url;
+  (void)output;
   otbMsgDevMacro(<< "Curl is not available, compile with OTB_USE_CURL to ON");
   return -1;
 #endif
@@ -341,6 +346,8 @@ int CurlHelper::RetrieveFile(const std::string& urlString, std::string filename)
   otbMsgDevMacro(<< " -> " << res);
   return res;
 #else
+  (void)urlString;
+  (void)filename;
   otbMsgDevMacro(<< "Curl is not available, compile with OTB_USE_CURL to ON");
   return -1;
 #endif
@@ -348,7 +355,7 @@ int CurlHelper::RetrieveFile(const std::string& urlString, std::string filename)
 
 int CurlHelper::RetrieveFileMulti(const std::vector<std::string>& listURLs,
                                   const std::vector<std::string>& listFilename,
-                                  int itkNotUsed(maxConnect)) const
+                                  int maxConnect) const
 {
 
 #ifdef OTB_USE_CURL
@@ -473,6 +480,7 @@ int CurlHelper::RetrieveFileMulti(const std::vector<std::string>& listURLs,
 
   return 0;
 #else
+  (void)maxConnect;
   //fallback on non curl multi
   otbMsgDevMacro(<< "Curl multi is not available, fallback on standard");
 
@@ -493,6 +501,9 @@ int CurlHelper::RetrieveFileMulti(const std::vector<std::string>& listURLs,
   return res;
 #endif
 #else
+  (void)maxConnect;
+  (void)listURLs;
+  (void)listFilename;
   otbMsgDevMacro(<< "Curl is not available, compile with OTB_USE_CURL to ON");
   return -1;
 #endif
diff --git a/Modules/Adapters/CurlAdapters/test/CMakeLists.txt b/Modules/Adapters/CurlAdapters/test/CMakeLists.txt
index 1d9503f..cfd45b3 100644
--- a/Modules/Adapters/CurlAdapters/test/CMakeLists.txt
+++ b/Modules/Adapters/CurlAdapters/test/CMakeLists.txt
@@ -14,11 +14,11 @@ otb_module_target_label(otbCurlAdaptersTestDriver)
 otb_add_test(NAME tsTvDataIsNightlyRevision COMMAND otbCurlAdaptersTestDriver
   otbIsNightlyRevision
   ${OTB_DATA_WC_REVISION}
-  http://hg.orfeo-toolbox.org/nightly/dataNightlyNumber )
+  https://git.orfeo-toolbox.org/otb-data.git/commit/refs/heads/nightly )
 set_property(TEST tsTvDataIsNightlyRevision PROPERTY RESOURCE_LOCK web_access)
 
 otb_add_test(NAME tsTvIsNightlyRevision COMMAND otbCurlAdaptersTestDriver
   otbIsNightlyRevision
   ${OTB_WC_REVISION}
-  http://hg.orfeo-toolbox.org/nightly/libNightlyNumber )
+  https://git.orfeo-toolbox.org/otb.git/commit/refs/heads/nightly )
 set_property(TEST tsTvIsNightlyRevision PROPERTY RESOURCE_LOCK web_access)
diff --git a/Modules/Adapters/CurlAdapters/test/otbIsNightlyRevision.cxx b/Modules/Adapters/CurlAdapters/test/otbIsNightlyRevision.cxx
index f69e914..8f17508 100644
--- a/Modules/Adapters/CurlAdapters/test/otbIsNightlyRevision.cxx
+++ b/Modules/Adapters/CurlAdapters/test/otbIsNightlyRevision.cxx
@@ -18,6 +18,7 @@
 #include <iostream>
 #include <fstream>
 
+#include "otb_tinyxml.h"
 #include "otbCurlHelper.h"
 
 int otbIsNightlyRevision(int argc, char * argv[])
@@ -33,8 +34,23 @@ int otbIsNightlyRevision(int argc, char * argv[])
 
   otb::CurlHelper::Pointer curl = otb::CurlHelper::New();
 
+  std::string curlOutput;
+  curl->RetrieveUrlInMemory(nightlyRevisionUrl, curlOutput);
+
   std::string nightlyRevision;
-  curl->RetrieveUrlInMemory(nightlyRevisionUrl, nightlyRevision);
+  TiXmlDocument doc;
+  doc.Parse(curlOutput.c_str());
+
+  TiXmlHandle docHandle(&doc);
+
+  TiXmlElement* commitChild = docHandle.FirstChild("html").FirstChild("body").Child("div",3).FirstChild("table").Child("tr",4).Child("td",1).Element();
+  if (commitChild)
+    {
+    if (strcmp(commitChild->Attribute("class"),"sha1") == 0)
+      {
+      nightlyRevision = std::string(commitChild->GetText());
+      }
+    }
 
   if (nightlyRevision == wcRevision)
     {
diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h
index 0a37948..ed6bf3d 100644
--- a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.h
@@ -32,8 +32,8 @@
 #include "itkObjectFactory.h" // that should have been included by itkMacro.h
 
 #include "otbOGRLayerWrapper.h"
+#include "otbOGRVersionProxy.h"
 
-class OGRDataSource;
 class OGRLayer;
 class OGRSpatialReference;
 class OGRGeometry;
@@ -46,7 +46,7 @@ namespace otb { namespace ogr {
  *
  * This class is meant to supercede \c otb::VectorData class.  It provides
  * an encapsulation of OGR classes. In that particular case, it's an
- * encapsulation of \c OGRDataSource.
+ * encapsulation of \c GDALDataset.
  *
  * \note Not meant to be inherited.
  * \note This class has an entity semantics: \em non-copyable, nor \em
@@ -77,10 +77,10 @@ public:
   //@{
   /** Default builder.
    * This builder function creates a new \c DataSource with its default
-   * constructor. The actual \c OGRDataSource is using the <em>in-memory</em>
+   * constructor. The actual \c GDALDataset is using the <em>in-memory</em>
    * \c OGRSFDriver: \c OGRMemDriver.
    *
-   * \throw itk::ExceptionObject if the inner \c OGRDataSource cannot be
+   * \throw itk::ExceptionObject if the inner \c GDALDataset cannot be
    * opened.
    *
    * \note \c OGRRegisterAll() is implicitly called on construction.
@@ -130,24 +130,24 @@ public:
    * \param[in] datasourcename OGR identifier of the data source
    * \param[in] mode     opening mode (read or read-write)
    * \return a newly created \c DataSource.
-   * \throw itk::ExceptionObject if the inner \c OGRDataSource cannot be
+   * \throw itk::ExceptionObject if the inner \c GDALDataset cannot be
    * opened.
    * \note \c OGRRegisterAll() is implicitly called on construction
-   * \see \c DataSource(OGRDataSource *)
+   * \see \c DataSource(GDALDataset *)
    */
   static Pointer New(std::string const& datasourcename, Modes::type mode = Modes::Read);
   /**
-   * Builder from a built \c OGRDataSource.
-   * \param[in,out] source  \c OGRDataSource already constructed.
+   * Builder from a built \c GDALDataset.
+   * \param[in,out] source  \c GDALDataset already constructed.
    * \return a newly created \c DataSource that assumes ownership of \c
    * source.
    * \throw Nothing
    * \note \c OGRRegisterAll() is supposed to have been called before building
    * \c source.
    * \note No condition is assumed on the non-nullity of \c source.
-   * \see \c DataSource(OGRDataSource *)
+   * \see \c DataSource(GDALDataset *)
    */
-  static Pointer New(OGRDataSource * sourcemode, Modes::type mode = Modes::Read);
+  static Pointer New(ogr::version_proxy::GDALDatasetType * sourcemode, Modes::type mode = Modes::Read);
   //@}
 
   /**\name Projection Reference property */
@@ -159,7 +159,7 @@ public:
   //@}
 
   /** Clears the data source.
-   * \post The \c OGRDataSource owned is destroyed with the dedicated function
+   * \post The \c GDALDataset owned is destroyed with the dedicated function
    * from OGR %API.
    * \post <tt>m_DataSource = 0</tt>
    */
@@ -274,17 +274,17 @@ public:
    *
    * This is a convenience function to setup a second data source with all the
    * meta information of another data source and use the same underlying \c
-   * OGRDataSource.
+   * GDALDataset.
    */
   virtual void Graft(const itk::DataObject *data);
 
   /**
    * Resets current data source with the one in parameter.
-   * \param[in,out] source source \c OGRDataSource that this instance will own.
+   * \param[in,out] source source \c GDALDataset that this instance will own.
    * \throw None
    * \post Assumes ownership of the \c source.
    */
-  void Reset(OGRDataSource * source);
+  void Reset(ogr::version_proxy::GDALDatasetType * source);
 
   /**\name Layers modification */
   //@{
@@ -309,7 +309,7 @@ public:
    * with \c CreateLayer(), you must use \c DeleteLayer().
    * \note The \c papszOptions parameter may later become a \c
    * std::vector<std::string>.
-   * \sa \c OGRDataSource::CreateLayer()
+   * \sa \c GDALDataset::CreateLayer()
    */
   Layer CreateLayer(
     std::string        const& name,
@@ -327,7 +327,7 @@ public:
    *
    * \pre The data source must support the delete operation.
    * \pre The index \c i must be in range [0, GetLayersCount()).
-   * \sa \c OGRDataSource::DeleteLayer()
+   * \sa \c GDALDataset::DeleteLayer()
    */
   void DeleteLayer(size_t i);
 
@@ -348,7 +348,7 @@ public:
    * with \c CreateLayer(), you must use \c DeleteLayer().
    * \note The \c papszOptions parameter may later become a \c
    * std::vector<std::string>.
-   * \sa \c OGRDataSource::CopyLayer()
+   * \sa \c GDALDataset::CopyLayer()
    */
   Layer CopyLayer(
     Layer            & srcLayer,
@@ -361,7 +361,7 @@ public:
    */
   //@{
   /** Returns the number of layers.
-   * \sa \c OGRDataSource::GetLayersCount()
+   * \sa \c GDALDataset::GetLayersCount()
    */
   int GetLayersCount() const;
 
@@ -437,8 +437,8 @@ public:
    * neither this wrapping.
    * \note The returned \c Layer will be automatically collected on its
    * destruction; i.e. unlike OGR API, no need to explicitly call \c
-   * OGRDataSource::ReleaseResultSet().
-   * \sa \c OGRDataSource::ExecuteSQL()
+   * GDALDataset::ReleaseResultSet().
+   * \sa \c GDALDataset::ExecuteSQL()
    */
   Layer ExecuteSQL(
     std::string const& statement,
@@ -461,32 +461,32 @@ public:
 
   /** Flushes all changes to disk.
    * \throw itd::ExceptionObject in case the flush operation failed.
-   * \sa \c OGRDataSource::SyncToDisk()
+   * \sa \c GDALDataset::SyncToDisk()
    */
   void SyncToDisk();
 
   /** Returns whether a capability is avalaible.
    * \param[in] capabilityName  name of the capability to check.
    * \throw None
-   * \sa \c OGRDataSource::TestCapability()
+   * \sa \c GDALDataset::TestCapability()
    */
   bool HasCapability(std::string const& capabilityName) const;
 
-  /** Access to raw \c OGRDataSource.
+  /** Access to raw \c GDALDataset.
    * This function provides an abstraction leak in case deeper control on the
-   * underlying \c OGRDataSource is required.
-   * \pre The underlying \c OGRDataSource must be valid, i.e.
+   * underlying \c GDALDataset is required.
+   * \pre The underlying \c GDALDataset must be valid, i.e.
    * <tt>m_DataSource != 0</tt>, an assertion is fired otherwise.
-   * \warning You must under no circonstance try to delete the \c OGRDataSource
+   * \warning You must under no circonstance try to delete the \c GDALDataset
    * obtained this way.
    */
-  OGRDataSource & ogr();
+    ogr::version_proxy::GDALDatasetType & ogr();
 
 protected:
   /** Default constructor.
-   * The actual \c OGRDataSource is using the <em>in-memory</em> \c
+   * The actual \c GDALDataset is using the <em>in-memory</em> \c
    * OGRSFDriver: \c OGRMemDriver.
-   * \throw itk::ExceptionObject if the inner \c OGRDataSource cannot be
+   * \throw itk::ExceptionObject if the inner \c GDALDataset cannot be
    * opened.
    *
    * \note \c OGRRegisterAll() is implicitly called on construction
@@ -496,9 +496,9 @@ protected:
   /** Init constructor.
    * \post The newly constructed object owns the \c source parameter.
    */
-  DataSource(OGRDataSource * source, Modes::type mode);
+  DataSource(ogr::version_proxy::GDALDatasetType * source, Modes::type mode);
   /** Destructor.
-   * \post The \c OGRDataSource owned is released (if not null).
+   * \post The \c GDALDataset owned is released (if not null).
    */
   virtual ~DataSource();
 
@@ -516,7 +516,7 @@ private:
    * \pre The layer must available, 0 is returned otherwise.
    * \throw None
    * \internal this function is a simple encapsulation of \c
-   * OGRDataSource::GetLayer().
+   * GDALDataset::GetLayer().
    */
   OGRLayer* GetLayerUnchecked(size_t i);
   /** @copydoc OGRLayer* otb::ogr::DataSource::GetLayerUnchecked(size_t i)
@@ -529,8 +529,11 @@ private:
   size_t GetLayerID(std::string const& name) const;
   int GetLayerIDUnchecked(std::string const& name) const;
 
+  /** Get a string describing the dataset */
+  std::string GetDatasetDescription() const;
+    
 private:
-  OGRDataSource  *m_DataSource;
+  ogr::version_proxy::GDALDatasetType *m_DataSource;
   Modes::type    m_OpenMode;
   int            m_FirstModifiableLayerID;
   }; // end class DataSource
diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.txx
index d9f240e..3ae9e89 100644
--- a/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.txx
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRDataSourceWrapper.txx
@@ -38,9 +38,9 @@
 // to the compilation mode of the client code.
 
 inline
-OGRDataSource & otb::ogr::DataSource::ogr()
+otb::ogr::version_proxy::GDALDatasetType & otb::ogr::DataSource::ogr()
 {
-  assert(m_DataSource && "OGRDataSource not initialized");
+  assert(m_DataSource && "GDALDataset not initialized");
   return *m_DataSource;
 }
 
diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.h
index a7c24b8..e9680d5 100644
--- a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.h
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.h
@@ -188,21 +188,21 @@ public:
    * \invariant <tt>m_Feature != 0</tt>
    * \sa \c OGRFeature::GetFieldCount()
    */
-  size_t GetSize() const;
+  int GetSize() const;
   /**
    * Read-Write access to the i-th field.
    * \invariant <tt>m_Feature != 0</tt>
    * \pre <tt>index < GetSize()</tt>
    * \throw None
    */
-  Field       operator[](size_t index);
+  Field       operator[](int index);
   /**
    * Read-only access to the i-th field.
    * \invariant <tt>m_Feature != 0</tt>
    * \pre <tt>index < GetSize()</tt>
    * \throw None
    */
-  Field const operator[](size_t index) const;
+  Field const operator[](int index) const;
   /**
    * Read-Write access to a field by name.
    * \invariant <tt>m_Feature != 0</tt>
@@ -221,7 +221,7 @@ public:
    * \throw None
    * \sa \c OGRFeature::GetFieldDefnRef()
    */
-  FieldDefn   GetFieldDefn(size_t index) const;
+  FieldDefn   GetFieldDefn(int index) const;
   /** Accessor to the definition of a field gven its name.
    * \invariant <tt>m_Feature != 0</tt>
    * \throw itk::ExceptionObject if no field named \c name exists.
@@ -314,9 +314,9 @@ private:
   void               UncheckedSetFrom(Feature const& rhs, int *map, bool mustForgive = true);
   void               UncheckedSetFrom(Feature const& rhs, bool mustForgive = true);
   void               UncheckedPrintSelf(std::ostream &os, itk::Indent indent) const;
-  Field              UncheckedGetElement(size_t index);
+  Field              UncheckedGetElement(int index);
   Field              UncheckedGetElement(std::string const& name);
-  FieldDefn          UncheckedGetFieldDefn(size_t index) const;
+  FieldDefn          UncheckedGetFieldDefn(int index) const;
   FieldDefn          UncheckedGetFieldDefn(std::string const& name) const;
   int                UncheckedGetFieldIndex(std::string const& name) const;
   long               UncheckedGetFID() const;
diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx
index f2200dd..fbc144d 100644
--- a/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRFeatureWrapper.txx
@@ -66,14 +66,14 @@ void otb::ogr::Feature::SetFrom(Feature const& rhs, int * map, bool mustForgive)
 /*================================[ Fields ]=================================*/
 /*===========================================================================*/
 inline
-otb::ogr::Field otb::ogr::Feature::operator[](size_t index)
+otb::ogr::Field otb::ogr::Feature::operator[](int index)
 {
   assert(index < GetSize() && "out of range field-index."); // also calls CheckInvariants();
   return UncheckedGetElement(index);
 }
 
 inline
-otb::ogr::Field const otb::ogr::Feature::operator[](size_t index) const
+otb::ogr::Field const otb::ogr::Feature::operator[](int index) const
 {
   return const_cast<Feature*>(this)->operator[](index);
 }
@@ -92,7 +92,7 @@ otb::ogr::Field const otb::ogr::Feature::operator[](std::string const& name) con
 }
 
 inline
-otb::ogr::FieldDefn otb::ogr::Feature::GetFieldDefn(size_t index) const
+otb::ogr::FieldDefn otb::ogr::Feature::GetFieldDefn(int index) const
 {
   assert(index < GetSize() && "out of range field-index."); // also calls CheckInvariants();
   return UncheckedGetFieldDefn(index);
@@ -143,10 +143,12 @@ inline
 void otb::ogr::Feature::SetGeometryDirectly(UniqueGeometryPtr geometry)
 {
   CheckInvariants();
+#if !defined(NDEBUG)
   OGRGeometry * g = geometry.get();
+#endif
   UncheckedSetGeometryDirectly(otb::move(geometry));
-  itkAssertOrThrowMacro((m_Feature->GetGeometryRef() == g), "The new geometry hasn't been set as expected");
-  itkAssertOrThrowMacro(!geometry, "UniqueGeometryPtr hasn't released its pointer");
+  assert((m_Feature->GetGeometryRef() == g) && "The new geometry hasn't been set as expected");
+  assert(!geometry && "UniqueGeometryPtr hasn't released its pointer");
 }
 
 inline
diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.h
index cfe17bc..2f1ad0c 100644
--- a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.h
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.h
@@ -25,7 +25,6 @@ class OGRFeature;
 #include "ogr_core.h" // OGR enums
 #include "itkIndent.h"
 
-
 namespace otb { namespace ogr {
 
 /*===========================================================================*/
@@ -101,7 +100,7 @@ public:
    * \param[in] index  Index of the field in the \c Feature.
    * \throw None
    */
-  Field(Feature & feature, size_t index);
+  Field(Feature & feature, int index);
   /// %Field definition accessor.
   FieldDefn const& GetDefinition() const
     { return m_Definition; }
@@ -167,6 +166,7 @@ public:
 
   /** \copydoc Field::ogr() const */
   OGRField & ogr();
+    
 private:
   /**\name Unchecked definitions
    * All the definitions that follow do the real work. However, they are not the
@@ -201,10 +201,12 @@ private:
    * All the fields decoding is at the wrong place (\c OGRFeature instead of
    * \c OGRField) => need for an index.
    */
-  size_t                          m_index;
+   
+  int        m_index;
 };
 
-} } // end namespace otb::ogr
+} 
+} // end namespace otb::ogr
 
 #ifndef OTB_MANUAL_INSTANTIATION
 #include "otbOGRFieldWrapper.txx"
diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx
index 673ae0f..abd5a66 100644
--- a/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRFieldWrapper.txx
@@ -23,6 +23,7 @@
 /*===============================[ Includes ]================================*/
 /*===========================================================================*/
 #include "otbOGRFieldWrapper.h"
+#include "otbConfigure.h"
 #include <cassert>
 #include <vector>
 #include <boost/mpl/map.hpp>
@@ -39,7 +40,7 @@
 // #include "boost/type_traits/is_array.hpp"
 #include "boost/type_traits/is_contiguous.h" // from OTB actually
 
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #include "ogr_feature.h"  // OGRFeature::*field_getters
@@ -84,6 +85,10 @@ typedef boost::mpl::map
   , pair<char*                   , int_<OFTString> >
   , pair<char const*             , int_<OFTString> >
   , pair<std::vector<std::string>, int_<OFTStringList> >
+  #ifdef OTB_USE_GDAL_20
+    , pair<GIntBig, int_<OFTInteger64> >
+    , pair<std::vector<GIntBig>, int_<OFTInteger64List> >
+  #endif
   // OFTBinary
   // OFTDate
   // OFTTime
@@ -312,6 +317,10 @@ typedef map
   , pair<int_<OFTRealList>,    MemberContainerGetterPtr<double, &OGRFeature::GetFieldAsDoubleList> >
   , pair<int_<OFTString>,      MemberGetterPtr<char const*,     &OGRFeature::GetFieldAsString, std::string> >
   , pair<int_<OFTStringList>,  StringListMemberGetterPtr<std::vector<std::string> > >
+  #ifdef OTB_USE_GDAL_20
+  , pair<int_<OFTInteger64>, MemberGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64> >
+  , pair<int_<OFTInteger64List>, MemberContainerGetterPtr<GIntBig, &OGRFeature::GetFieldAsInteger64List> >
+  #endif
   > FieldGetters_Map;
 
 /**\ingroup GeometryInternals
@@ -327,6 +336,10 @@ typedef map
   , pair<int_<OFTRealList>,    MemberContainerSetterPtr<double, &OGRFeature::SetField> >
   , pair<int_<OFTString>,      MemberSetterPtr<char const*,     &OGRFeature::SetField/*, std::string*/> >
   , pair<int_<OFTStringList>,  StringListMemberSetterPtr<std::vector<std::string> > >
+  #ifdef OTB_USE_GDAL_20
+  , pair<int_<OFTInteger64>, MemberSetterPtr<GIntBig, &OGRFeature::SetField> >
+  , pair<int_<OFTInteger64List>, MemberContainerSetterPtr<const GIntBig, &OGRFeature::SetField> >
+  #endif
   > FieldSetters_Map;
 
 /**\ingroup GeometryInternals
@@ -373,7 +386,7 @@ inline
 void otb::ogr::Field::CheckInvariants() const
 {
   assert(m_Feature && "OGR Fields must be associated to a valid feature");
-  assert(int(m_index) < m_Feature->GetFieldCount() && "Out-of-range index for a OGR field");
+  assert(m_index < m_Feature->GetFieldCount() && "Out-of-range index for a OGR field");
   assert(m_Feature->GetFieldDefnRef(m_index) && "No definition available for the OGR field");
 }
 
diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h b/Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h
index 007229f..d60c47d 100644
--- a/Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRLayerWrapper.h
@@ -24,11 +24,11 @@ PURPOSE.  See the above copyright notices for more information.
 #include <boost/utility/enable_if.hpp>
 // #include "itkIndent.h", included from field
 #include "otbOGRFeatureWrapper.h"
+#include "otbOGRVersionProxy.h"
 
 // #include "ogr_core.h" // OGRwkbGeometryType, included from feature -> field
 // Forward declarations
 class OGRLayer;
-class OGRDataSource;
 class OGRGeometry;
 class OGRFeatureDefn;
 
@@ -94,7 +94,7 @@ public:
   /**
    * Init constructor for layers that need to be released.
    * \param layer  \c OGRLayer owned by the client code.
-   * \param sourceInChargeOfLifeTime  reference to the actual \c OGRDataSource
+   * \param sourceInChargeOfLifeTime  reference to the actual \c GDALDataset
    * that knows how to release the layer.
    * \post In this case, \c m_datasource is left null: we suppose (for now, that
    * the layer won't need access to the datasource meta-information).
@@ -105,7 +105,7 @@ public:
    * OGRDataSource::ExecuteSQL(). It's actually the constructor called by \c
    * DataSource::ExecuteSQL().
    */
-  Layer(OGRLayer* layer, OGRDataSource& sourceInChargeOfLifeTime, bool modifiable);
+    Layer(OGRLayer* layer, otb::ogr::version_proxy::GDALDatasetType& sourceInChargeOfLifeTime, bool modifiable);
   //@}
 
   /**\name Features collection */
@@ -377,11 +377,11 @@ public:
    * \sa \c feature_iter
    * Depending of the actual driver (i.e. \c OGRDriver), this may be done in O(N).
    */
-  const_iterator cstart_at(size_t index) const;
+  const_iterator cstart_at(GIntBig index) const;
   /** \copydoc cstart_at */
-  const_iterator start_at (size_t index) const { return cstart_at(index); }
+  const_iterator start_at (GIntBig index) const { return cstart_at(index); }
   /** \copydoc cstart_at */
-  iterator       start_at (size_t index);
+  iterator       start_at (GIntBig index);
   //@}
 
   /**\name Features definition
@@ -426,7 +426,7 @@ public:
    * \pre To be available, this function requires OTB to be compiled against OGR
    * v1.9.0 at least.
    */
-  void DeleteField(size_t fieldIndex);
+  void DeleteField(int fieldIndex);
 
   /**
    * Changes the definition of the i-th field.
diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h
new file mode 100644
index 0000000..6db10d5
--- /dev/null
+++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h
@@ -0,0 +1,186 @@
+/*=========================================================================
+
+  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 __otbOGRVersionProxy_h
+#define __otbOGRVersionProxy_h
+
+#include <string>
+#include <vector>
+#include "otbConfigure.h"
+
+#ifdef OTB_USE_GDAL_20
+class GDALDataset;
+class GDALDriver;
+#else
+class OGRDataSource;
+class OGRSFDriver;
+#endif
+
+namespace otb
+{
+namespace ogr
+{
+namespace version_proxy
+{
+
+/** 
+ * This namespace holds proxy functions hiding interface changes in gdal 2.0 
+ *
+ * This namespace holds proxy functions hiding interface changes in OGR
+ * dataset between gdal 1.x (x>10) and gdal 2.x. It defines a common
+ * interface that should be used in place of calling directly the
+ * wrapped gdal functions.
+ * 
+ * Whenever GDALDataset and GDALDriver have to be used to open a
+ * vector dataset (or OGRDataSource an OGRSFDriver for gdal 1.x), one
+ * should use ogr::version_proxy types GDALDatasetType and
+ * GDALDriverType.
+ * 
+ * See function documentation for details.
+ */
+
+  #ifdef OTB_USE_GDAL_20
+  typedef GDALDataset GDALDatasetType;
+  typedef GDALDriver GDALDriverType;
+  #else
+  typedef OGRDataSource GDALDatasetType;
+  typedef OGRSFDriver   GDALDriverType;
+#endif
+
+  /** 
+   * This function opens a file, possibly in read-only mode, and returns
+   * a dataset.
+   *
+   * Calls OGRSFDriverRegistrar::Open for gdal 1.x implementation and GDALopenEx for
+   * gdal 2.x implementation.
+
+   * \param filename Filename of the file to open
+   * \param readOnly: If true, dataset is open in read-only mode.
+   * \return NULL if file could not be open.
+   */ 
+  GDALDatasetType * Open(const char * filename, bool readOnly = true);
+
+  /**
+   * This function closes a dataset.
+   *
+   * Calls OGRDataSource::DestroyDataSource for gdal 1.x
+   * implementation and GDALClose for gdal 2.x implementation.
+   *
+   * \param dataset Pointer to the dataset to close. Will not be
+   * checked for null pointer.
+   */
+  void Close(GDALDatasetType * dataset);
+
+  /**
+   * This function creates a new dataset.
+   *
+   * Calls OGRSFDriver::CreateDataSource for gdal 1.x implementation
+   * and GDALDriver::Create with (0,0) raster size for gdal 2.x
+   * implementation
+   * 
+   * \param driver Pointer to the driver used for creation. Will not
+   * be checked for null pointer.
+   *
+   * \param name Name of the dataset to create.
+   * 
+   * \return NULL if dataset could not be created.
+   */
+  GDALDatasetType * Create(GDALDriverType * driver, const char * name);
+
+
+  /**
+   * This function physically deletes an existing dataset.
+   * 
+   * Calls OGRDataSource::DeleteDataSource for gdal 1.x implementation
+   * and GDALDriver::Delete for gdal 2.x implementation.
+   *
+   * \param name Name of the dataset to destroy.
+   */ 
+  bool Delete(const char * name);
+
+  /**
+   * This function returns a pointer to the driver from its name.
+   * 
+   * Calls OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName() for
+   * gdal 1.x implementation and
+   * GetGDALDriverManager()->GetDriverByName() for gdal 2.x
+   * implementation.
+   * 
+   * \param name Name of the driver to retrieve
+   * 
+   * \return NULL if no driver could be retrieved.
+   */
+  GDALDriverType *  GetDriverByName(const char * name);
+
+
+  std::string GetDriverNameFromDataSource(const GDALDatasetType * ds);
+
+  /**
+   * Sync dataset to disk.
+   *
+   * Calls OGRDataSource::SyncToDisk() for gdal 1.x implementation and
+   * GDALDataset::FlushCache() for gdal 2.x  implementation.
+   *
+   * \param dataset Pointer to the dataset to sync. Will not be
+   * checked for null pointer.
+   *
+   * \return True if sync went on without any error.
+   */
+  bool SyncToDisk(GDALDatasetType * dataset);
+
+  /**
+   * \return The name of the dataset class behind the implementation
+   * (OGRDataSource for gdal 1.x and GdalDataset for gdal 2.x)
+   */
+  std::string GetDatasetClassName();
+
+  /**
+   * \return The name of the driver class behind the implementation
+   * (OGRSFDriver for gdal 1.x and GDALDriver for gdal 2.x)
+   */
+  std::string GetDriverClassName();
+
+  /**
+   * Return the list of files composing the dataset.
+   * 
+   * Calls OGRDataSource::GetName() and wrap in string vector for gdal
+   * 1.x implementation, and GDALDataset::GetFileList and wrap in
+   * string vector for gdal 2.x implementation.
+   *  
+   * \param dataset Pointer to the dataset to get the file list from. Will not be
+   * checked for null pointer.
+   * 
+   * \return A vector of string containing the list of files.
+   */
+  std::vector<std::string> GetFileListAsStringVector(GDALDatasetType * dataset);
+
+  /** 
+   * Return the list of available drivers.
+   *
+   * Calls OGRSFDriverRegistrar::GetRegistrar() for gdal 1.x
+   * implementation and GetGDALDriverManager() for gdal 2.x
+   * implementation.
+   *
+   * \return A vector of string containing the list of available drivers.
+   */  
+  std::vector<std::string> GetAvailableDriversAsStringVector();
+
+}
+}
+} // end namespace otb
+
+#endif
diff --git a/Modules/Adapters/GdalAdapters/src/CMakeLists.txt b/Modules/Adapters/GdalAdapters/src/CMakeLists.txt
index 87e83c5..a052f01 100644
--- a/Modules/Adapters/GdalAdapters/src/CMakeLists.txt
+++ b/Modules/Adapters/GdalAdapters/src/CMakeLists.txt
@@ -10,6 +10,12 @@ set(OTBGdalAdapters_SRC
   otbOGRDataSourceWrapper.cxx
   )
 
+if(OTB_USE_GDAL_20)
+  set(OTBGdalAdapters_SRC ${OTBGdalAdapters_SRC} otbOGRVersionProxy2x.cxx)
+else(Otb_use_gdal_20)
+  set(OTBGdalAdapters_SRC ${OTBGdalAdapters_SRC} otbOGRVersionProxy1x.cxx)
+endif(OTB_USE_GDAL_20)
+
 add_library(OTBGdalAdapters ${OTBGdalAdapters_SRC})
 target_link_libraries(OTBGdalAdapters 
   ${OTBBoost_LIBRARIES}
diff --git a/Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx b/Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx
index 0d0a14d..bec8f7a 100644
--- a/Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbGeometriesToGeometriesFilter.cxx
@@ -259,7 +259,7 @@ void otb::FieldCopyTransformation::fieldsTransform(
   // two fields: "Description" and "Name"
   //assert(inFeature.GetSize() == outFeature.GetSize());
 
-  for (size_t i=0,N=inFeature.GetSize(); i!=N; ++i)
+  for (int i=0,N=inFeature.GetSize(); i!=N; ++i)
     {
     int const indexNewField = m_SourceToDestFieldIndicesMap[i];
     outFeature[indexNewField].Assign(inFeature[i]);
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
index d2be6f3..891c22b 100644
--- a/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRDataSourceWrapper.cxx
@@ -34,7 +34,6 @@
 #include "otbOGRDriversInit.h"
 #include "otbSystem.h"
 // OGR includes
-#include "ogrsf_frmts.h"
 
 /*===========================================================================*/
 /*=======================[ construction/destruction ]========================*/
@@ -45,13 +44,13 @@ bool otb::ogr::DataSource::Clear()
   return true;
 }
 
-void otb::ogr::DataSource::Reset(OGRDataSource * source)
+void otb::ogr::DataSource::Reset(otb::ogr::version_proxy::GDALDatasetType * source)
 {
   if (m_DataSource) {
     // OGR makes a pointless check for non-nullity in
-    // OGRDataSource::DestroyDataSource (pointless because "delete 0" is
+    // GDALDataset::DestroyDataSource (pointless because "delete 0" is
     // perfectly valid -> it's a no-op)
-    OGRDataSource::DestroyDataSource(m_DataSource); // void, noexcept
+    ogr::version_proxy::Close(m_DataSource); // void, noexcept
   }
   m_DataSource = source;
 }
@@ -119,16 +118,15 @@ otb::ogr::DataSource::DataSource()
 {
   Drivers::Init();
 
-  OGRSFDriver * d = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName("Memory");
+  ogr::version_proxy::GDALDriverType * d = ogr::version_proxy::GetDriverByName("Memory");
   assert(d && "OGR Memory driver not found");
-  m_DataSource = d->CreateDataSource("in-memory");
+  m_DataSource = ogr::version_proxy::Create(d,"in-memory");
   if (!m_DataSource) {
     itkExceptionMacro(<< "Failed to create OGRMemDataSource: " << CPLGetLastErrorMsg());
   }
-  m_DataSource->SetDriver(d);
 }
 
-otb::ogr::DataSource::DataSource(OGRDataSource * source, Modes::type mode)
+otb::ogr::DataSource::DataSource(otb::ogr::version_proxy::GDALDatasetType * source, Modes::type mode)
 : m_DataSource(source),
   m_OpenMode(mode),
   m_FirstModifiableLayerID(0)
@@ -140,14 +138,14 @@ otb::ogr::DataSource::Pointer otb::ogr::DataSource::OpenDataSource(std::string c
 {
   bool update = (mode != Modes::Read);
 
-  OGRDataSource * source = OGRSFDriverRegistrar::Open(datasourceName.c_str(), update);
+  ogr::version_proxy::GDALDatasetType * source = ogr::version_proxy::Open(datasourceName.c_str(),!update);
   if (!source)
     {
     // In read mode, this is a failure
     // In write mode (Overwrite and Update), create the data source transparently
     if (mode == Modes::Read)
       {
-      itkGenericExceptionMacro(<< "Failed to open OGRDataSource file "
+      itkGenericExceptionMacro(<< "Failed to open GDALDataset file "
         << datasourceName<<" : " << CPLGetLastErrorMsg());
       }
 
@@ -159,48 +157,30 @@ otb::ogr::DataSource::Pointer otb::ogr::DataSource::OpenDataSource(std::string c
         <<datasourceName<<">.");
       }
 
-    OGRSFDriver * d = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driverName);
+    ogr::version_proxy::GDALDriverType * d = ogr::version_proxy::GetDriverByName(driverName);
 
     if(!d)
       {
       itkGenericExceptionMacro(<<"Could not create OGR driver "<<driverName<<", check your OGR configuration for available drivers.");
       }
 
-    source = d->CreateDataSource(datasourceName.c_str());
+    source = ogr::version_proxy::Create(d,datasourceName.c_str());
     if (!source) {
-      itkGenericExceptionMacro(<< "Failed to create OGRDataSource <"<<datasourceName
+      itkGenericExceptionMacro(<< "Failed to create GDALDataset <"<<datasourceName
         <<"> (driver name: <" << driverName<<">: " << CPLGetLastErrorMsg());
     }
-    source->SetDriver(d);
     }
   return otb::ogr::DataSource::New(source, mode);
 }
 
 void DeleteDataSource(std::string const& datasourceName)
 {
-  // Attempt to delete the datasource if it already exists
-  OGRDataSource * poDS = OGRSFDriverRegistrar::Open(datasourceName.c_str(), TRUE);
-
-  if (poDS != NULL)
+  bool ret = otb::ogr::version_proxy::Delete(datasourceName.c_str());
+  if (!ret)
     {
-    OGRSFDriver * ogrDriver = poDS->GetDriver();
-    OGRDataSource::DestroyDataSource(poDS);
-    //Erase the data if possible
-    if (ogrDriver->TestCapability(ODrCDeleteDataSource))
-      {
-      //Delete datasource
-      OGRErr ret = ogrDriver->DeleteDataSource(datasourceName.c_str());
-      if (ret != OGRERR_NONE)
-        {
-        itkGenericExceptionMacro(<< "Deletion of data source " << datasourceName
-                        << " failed: " << CPLGetLastErrorMsg());
-        }
-      }
-    else
-      {
-      itkGenericExceptionMacro(<< "Cannot delete data source " << datasourceName);
-      }
-    } // if (poDS != NULL)
+    itkGenericExceptionMacro(<< "Deletion of data source " << datasourceName
+                             << " failed: " << CPLGetLastErrorMsg());
+    }
 }
 
 otb::ogr::DataSource::Pointer
@@ -213,7 +193,14 @@ otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode)
 
   Drivers::Init();
 
-  if (mode == Modes::Overwrite)
+  ogr::version_proxy::GDALDatasetType * ds = ogr::version_proxy::Open(datasourceName.c_str(),true);
+
+  bool ds_exists = (ds!=NULL);
+
+  ogr::version_proxy::Close(ds);
+  
+
+  if (ds_exists && mode == Modes::Overwrite)
     {
     DeleteDataSource(datasourceName);
     }
@@ -223,7 +210,7 @@ otb::ogr::DataSource::New(std::string const& datasourceName, Modes::type mode)
 
 /*static*/
 otb::ogr::DataSource::Pointer
-otb::ogr::DataSource::New(OGRDataSource * source, Modes::type mode)
+otb::ogr::DataSource::New(otb::ogr::version_proxy::GDALDatasetType * source, Modes::type mode)
 {
   Pointer res = new DataSource(source, mode);
   res->UnRegister();
@@ -271,7 +258,7 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer(
   if (m_OpenMode == Modes::Read)
     {
     otb::ogr::Layer l = GetLayerChecked(name); // will throw if not existing
-    itkGenericOutputMacro(<< "Requesting layer creation in read-only OGRDataSource. Returning the existing layer");
+    itkGenericOutputMacro(<< "Requesting layer creation in read-only GDALDataset. Returning the existing layer");
     return l;
     }
 
@@ -292,9 +279,9 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer(
     OGRLayer * ol = m_DataSource->CreateLayer(
       name.c_str(), poSpatialRef, eGType, otb::ogr::StringListConverter(papszOptions).to_ogr());
     if (!ol)
-      {
+      { 
       itkGenericExceptionMacro(<< "Failed to create the layer <"<<name
-        << "> in the OGRDataSource file <" << m_DataSource->GetName()
+                               << "> in the GDALDataset file <" << GetDatasetDescription()
         <<">: " << CPLGetLastErrorMsg());
       }
 
@@ -317,7 +304,7 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer(
       if (!ol)
         {
         itkGenericExceptionMacro(<< "Failed to create the layer <"<<name
-          << "> in the OGRDataSource file <" << m_DataSource->GetName()
+                                 << "> in the GDALDataset file <" <<  GetDatasetDescription()
           <<">: " << CPLGetLastErrorMsg());
         }
 
@@ -329,7 +316,7 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer(
   case Modes::Update_LayerCreateOnly:
     {
     // The layer exists. Returns it
-    // It will be non-modifiable if already existing at OGRDataSource creation time
+    // It will be non-modifiable if already existing at GDALDataset creation time
     if (layer)
       {
       return layer;
@@ -341,7 +328,7 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer(
     if (!ol)
       {
       itkGenericExceptionMacro(<< "Failed to create the layer <"<<name
-        << "> in the OGRDataSource file <" << m_DataSource->GetName()
+                               << "> in the GDALDataset file <" <<  GetDatasetDescription()
         <<">: " << CPLGetLastErrorMsg());
       }
 
@@ -351,11 +338,11 @@ otb::ogr::Layer otb::ogr::DataSource::CreateLayer(
     break;
   default :
     assert(false && "Should never be there");
-    itkGenericExceptionMacro(<< "OGRDataSource opening mode not supported");
+    itkGenericExceptionMacro(<< "GDALDataset opening mode not supported");
     break;
   }
 
-  itkGenericExceptionMacro(<< "OGRDataSource opening mode not supported");
+  itkGenericExceptionMacro(<< "GDALDataset opening mode not supported");
   return Layer(0, false); // keep compiler happy
 }
 
@@ -369,11 +356,11 @@ otb::ogr::Layer otb::ogr::DataSource::CopyLayer(
   switch (m_OpenMode)
   {
     case Modes::Invalid:
-      assert(false && "Invalid OGRDataSource opening mode");
-      itkGenericExceptionMacro(<< "Invalid OGRDataSource opening mode");
+      assert(false && "Invalid GDALDataset opening mode");
+      itkGenericExceptionMacro(<< "Invalid GDALDataset opening mode");
       break;
     case Modes::Read:
-      itkGenericExceptionMacro(<< "OGRDataSource is opened in Read mode : cannot create a layer");
+      itkGenericExceptionMacro(<< "GDALDataset is opened in Read mode : cannot create a layer");
       break;
     default:
       break;
@@ -382,10 +369,10 @@ otb::ogr::Layer otb::ogr::DataSource::CopyLayer(
   OGRLayer * l0 = &srcLayer.ogr();
   OGRLayer * ol = m_DataSource->CopyLayer(l0, newName.c_str(), papszOptions);
   if (!ol)
-    {
+    {    
     itkGenericExceptionMacro(<< "Failed to copy the layer <"
       << srcLayer.GetName() << "> into the new layer <" <<newName
-      << "> in the OGRDataSource file <" << m_DataSource->GetName()
+                             << "> in the GDALDataset file <" <<  GetDatasetDescription()
       <<">: " << CPLGetLastErrorMsg());
     }
   const bool modifiable = true;
@@ -400,14 +387,14 @@ void otb::ogr::DataSource::DeleteLayer(size_t i)
   switch (m_OpenMode)
   {
     case Modes::Invalid:
-      assert(false && "Invalid OGRDataSource opening mode");
-      itkGenericExceptionMacro(<< "Invalid OGRDataSource opening mode");
+      assert(false && "Invalid GDALDataset opening mode");
+      itkGenericExceptionMacro(<< "Invalid GDALDataset opening mode");
       break;
     case Modes::Read:
-      itkGenericExceptionMacro(<< "OGRDataSource is opened in Read mode : cannot delete a layer");
+      itkGenericExceptionMacro(<< "GDALDataset is opened in Read mode : cannot delete a layer");
       break;
     case Modes::Update_LayerCreateOnly:
-      itkGenericExceptionMacro(<< "OGRDataSource is opened in Update_LayerCreateOnly mode : cannot delete a layer");
+      itkGenericExceptionMacro(<< "GDALDataset is opened in Update_LayerCreateOnly mode : cannot delete a layer");
       break;
     default:
       break;
@@ -415,15 +402,15 @@ void otb::ogr::DataSource::DeleteLayer(size_t i)
 
   const int nb_layers = GetLayersCount();
   if (int(i) >= nb_layers)
-    {
-    itkExceptionMacro(<< "Cannot delete " << i << "th layer in the OGRDataSource <"
-      << m_DataSource->GetName() << "> as it contains only " << nb_layers << "layers.");
+    {      
+    itkExceptionMacro(<< "Cannot delete " << i << "th layer in the GDALDataset <"
+                      <<  GetDatasetDescription() << "> as it contains only " << nb_layers << "layers.");
     }
   const OGRErr err = m_DataSource->DeleteLayer(int(i));
   if (err != OGRERR_NONE)
     {
-    itkExceptionMacro(<< "Cannot delete " << i << "th layer in the OGRDataSource <"
-      << m_DataSource->GetName() << ">: " << CPLGetLastErrorMsg());
+    itkExceptionMacro(<< "Cannot delete " << i << "th layer in the GDALDataset <"
+                      <<  GetDatasetDescription() << ">: " << CPLGetLastErrorMsg());
     }
 }
 
@@ -478,9 +465,9 @@ size_t otb::ogr::DataSource::GetLayerID(std::string const& name) const
 {
   int const id = GetLayerIDUnchecked(name);
   if (id < 0)
-    {
+    {    
     itkExceptionMacro( << "Cannot fetch any layer named <" << name
-      << "> in the OGRDataSource <" << m_DataSource->GetName() << ">: "
+                       << "> in the GDALDataset <" <<  GetDatasetDescription() << ">: "
       << CPLGetLastErrorMsg());
     }
   return 0; // keep compiler happy
@@ -491,15 +478,15 @@ otb::ogr::Layer otb::ogr::DataSource::GetLayerChecked(size_t i)
   assert(m_DataSource && "Datasource not initialized");
   const int nb_layers = GetLayersCount();
   if (int(i) >= nb_layers)
-    {
-    itkExceptionMacro(<< "Cannot fetch " << i << "th layer in the OGRDataSource <"
-      << m_DataSource->GetName() << "> as it contains only " << nb_layers << "layers.");
+    {    
+    itkExceptionMacro(<< "Cannot fetch " << i << "th layer in the GDALDataset <"
+                      << GetDatasetDescription() << "> as it contains only " << nb_layers << "layers.");
     }
   OGRLayer * layer_ptr = m_DataSource->GetLayer(int(i));
   if (!layer_ptr)
     {
-    itkExceptionMacro( << "Unexpected error: cannot fetch " << i << "th layer in the OGRDataSource <"
-      << m_DataSource->GetName() << ">: " << CPLGetLastErrorMsg());
+    itkExceptionMacro( << "Unexpected error: cannot fetch " << i << "th layer in the GDALDataset <"
+                       << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg());
     }
   return otb::ogr::Layer(layer_ptr, IsLayerModifiable(i));
 }
@@ -525,7 +512,7 @@ otb::ogr::Layer otb::ogr::DataSource::GetLayerChecked(std::string const& name)
   if (!layer_ptr)
     {
     itkExceptionMacro( << "Cannot fetch any layer named <" << name
-      << "> in the OGRDataSource <" << m_DataSource->GetName() << ">: "
+      << "> in the GDALDataset <" << GetDatasetDescription() << ">: "
       << CPLGetLastErrorMsg());
     }
   return otb::ogr::Layer(layer_ptr, IsLayerModifiable(name));
@@ -550,10 +537,10 @@ otb::ogr::Layer otb::ogr::DataSource::ExecuteSQL(
     {
 #if defined(PREFER_EXCEPTION)
     itkExceptionMacro( << "Unexpected error: cannot execute the SQL request <" << statement
-      << "> in the OGRDataSource <" << m_DataSource->GetName() << ">: " << CPLGetLastErrorMsg());
+      << "> in the GDALDataset <" <<  GetDatasetDescription() << ">: " << CPLGetLastErrorMsg());
 #else
     // Cannot use the deleter made for result sets obtained from
-    // OGRDataSource::ExecuteSQL because it checks for non-nullity....
+    // GDALDataset::ExecuteSQL because it checks for non-nullity....
     // *sigh*
     return otb::ogr::Layer(0, modifiable);
 #endif
@@ -699,10 +686,22 @@ bool otb::ogr::DataSource::HasCapability(std::string const& capabilityName) cons
 void otb::ogr::DataSource::SyncToDisk()
 {
   assert(m_DataSource && "Datasource not initialized");
-  const OGRErr res= m_DataSource->SyncToDisk();
-  if (res != OGRERR_NONE)
+  bool ret = otb::ogr::version_proxy::SyncToDisk(m_DataSource);
+
+  if(!ret)
     {
     itkExceptionMacro( << "Cannot flush the pending of the OGRDataSource <"
-      << m_DataSource->GetName() << ">: " << CPLGetLastErrorMsg());
+                       << GetDatasetDescription() << ">: " << CPLGetLastErrorMsg());
     }
 }
+
+
+std::string otb::ogr::DataSource::GetDatasetDescription() const
+{
+  std::vector<std::string> files = otb::ogr::version_proxy::GetFileListAsStringVector(m_DataSource);
+  std::string description = "";
+  for(std::vector<std::string>::const_iterator it = files.begin();it!=files.end();++it)
+    description+=(*it)+", ";
+
+  return description;
+}
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx
index 7fc79a8..2058bb2 100644
--- a/Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRFeatureWrapper.cxx
@@ -22,7 +22,7 @@
 #include "otbOGRFeatureWrapper.h"
 #include <boost/bind.hpp>
 #include <boost/make_shared.hpp>
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #include "ogr_feature.h"
@@ -33,6 +33,7 @@
 #include "cpl_error.h"
 #include "itkMacro.h"
 
+
 /*===========================================================================*/
 /*======================[ Construction / Destruction ]=======================*/
 /*===========================================================================*/
@@ -91,11 +92,11 @@ void otb::ogr::Feature::UncheckedSetFrom(Feature const& rhs, int * map, bool mus
 /*===========================================================================*/
 void otb::ogr::Feature::UncheckedPrintSelf(std::ostream & os, itk::Indent indent) const
 {
-  const size_t nbFields = m_Feature->GetFieldCount();
+  const int nbFields = m_Feature->GetFieldCount();
   os << indent << "+";
   os << " " << nbFields << " fields\n";
   indent = indent.GetNextIndent();
-  for (size_t i=0; i!=nbFields; ++i)
+  for (int i=0; i!=nbFields; ++i)
     {
     assert(ogr().GetFieldDefnRef(i) && "No definition associated to the i-th field");
     Field const& field = (*this)[i];
@@ -120,11 +121,11 @@ bool otb::ogr::operator==(otb::ogr::Feature const& lhs, otb::ogr::Feature const&
 /*===========================================================================*/
 /*================================[ Fields ]=================================*/
 /*===========================================================================*/
-size_t otb::ogr::Feature::GetSize() const {
+int otb::ogr::Feature::GetSize() const {
   return ogr().GetFieldCount();
 }
 
-otb::ogr::Field otb::ogr::Feature::UncheckedGetElement(size_t index)
+otb::ogr::Field otb::ogr::Feature::UncheckedGetElement(int index)
 {
   Field field(*this, index);
   return field;
@@ -136,7 +137,7 @@ otb::ogr::Field otb::ogr::Feature::UncheckedGetElement(std::string const& name)
   return this->operator[](index);
 }
 
-otb::ogr::FieldDefn otb::ogr::Feature::UncheckedGetFieldDefn(size_t index) const
+otb::ogr::FieldDefn otb::ogr::Feature::UncheckedGetFieldDefn(int index) const
 {
   return FieldDefn(*m_Feature->GetFieldDefnRef(index));
 }
@@ -151,7 +152,9 @@ otb::ogr::FieldDefn otb::ogr::Feature::UncheckedGetFieldDefn(std::string const&
   return this->GetFieldDefn(index);
 }
 
-int otb::ogr::Feature::UncheckedGetFieldIndex(std::string const& name) const
+int
+otb::ogr::Feature
+::UncheckedGetFieldIndex(std::string const& name) const
 {
   const int index = m_Feature->GetFieldIndex(name.c_str());
   if (index < 0)
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRFieldWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRFieldWrapper.cxx
index 660644b..24a5bd3 100644
--- a/Modules/Adapters/GdalAdapters/src/otbOGRFieldWrapper.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRFieldWrapper.cxx
@@ -19,7 +19,7 @@
 /*===========================================================================*/
 /*===============================[ Includes ]================================*/
 /*===========================================================================*/
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #include "ogr_feature.h"
@@ -114,7 +114,7 @@ std::ostream & otb::ogr::operator<<(std::ostream & os, otb::ogr::FieldDefn const
 /*=================================[ Field ]=================================*/
 /*===========================================================================*/
 
-otb::ogr::Field::Field(otb::ogr::Feature & feature, size_t index)
+otb::ogr::Field::Field(otb::ogr::Feature & feature, int index)
 : m_Definition(*feature.ogr().GetFieldDefnRef(index))
 , m_Feature(feature.sptr())
 , m_index(index)
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx
index 6942ef4..b37eb9b 100644
--- a/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRLayerWrapper.cxx
@@ -24,13 +24,13 @@
 #include <boost/bind.hpp>
 #include <boost/foreach.hpp>
 
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
-#include "ogrsf_frmts.h" // OGRDataSource & OGRLayer
+#include "gdal_priv.h"// GDALDataset
 #pragma GCC diagnostic pop
 #else
-#include "ogrsf_frmts.h" // OGRDataSource & OGRLayer
+#include "gdal_priv.h" // GDALDataset
 #endif
 
 #include "otbOGRDataSourceWrapper.h"
@@ -60,8 +60,8 @@ otb::ogr::Layer::Layer(OGRLayer* layer, bool modifiable)
 {
 }
 
-otb::ogr::Layer::Layer(OGRLayer* layer, OGRDataSource& sourceInChargeOfLifeTime, bool modifiable)
-:   m_Layer(layer,  boost::bind(&OGRDataSource::ReleaseResultSet, boost::ref(sourceInChargeOfLifeTime), _1))
+otb::ogr::Layer::Layer(OGRLayer* layer, otb::ogr::version_proxy::GDALDatasetType& sourceInChargeOfLifeTime, bool modifiable)
+:   m_Layer(layer,  boost::bind(&otb::ogr::version_proxy::GDALDatasetType::ReleaseResultSet, boost::ref(sourceInChargeOfLifeTime), _1))
   , m_Modifiable(modifiable)
 {
   assert(layer && "A null OGRlayer cannot belong to an OGRDataSource" );
@@ -98,14 +98,14 @@ otb::ogr::Layer::const_iterator otb::ogr::Layer::cbegin() const
   return const_iterator(*const_cast <Layer*>(this));
 }
 
-otb::ogr::Layer::iterator otb::ogr::Layer::start_at(size_t index)
+otb::ogr::Layer::iterator otb::ogr::Layer::start_at(GIntBig index)
 {
   assert(m_Layer && "OGRLayer not initialized");
   m_Layer->SetNextByIndex(index);
   return iterator(*this);
 }
 
-otb::ogr::Layer::const_iterator otb::ogr::Layer::cstart_at(size_t index) const
+otb::ogr::Layer::const_iterator otb::ogr::Layer::cstart_at(GIntBig index) const
 {
   assert(m_Layer && "OGRLayer not initialized");
   m_Layer->SetNextByIndex(index);
@@ -320,7 +320,7 @@ void otb::ogr::Layer::CreateField(
     }
 }
 
-void otb::ogr::Layer::DeleteField(size_t fieldIndex)
+void otb::ogr::Layer::DeleteField(int fieldIndex)
 {
   assert(m_Layer && "OGRLayer not initialized");
 
@@ -334,7 +334,7 @@ void otb::ogr::Layer::DeleteField(size_t fieldIndex)
   itkGenericExceptionMacro("OGRLayer::DeleteField is not supported by OGR v"
     << GDAL_VERSION_NUM << ". Upgrade to a version >= 1.9.0, and recompile OTB.")
 #else
-  const OGRErr res = m_Layer->DeleteField(int(fieldIndex));
+  const OGRErr res = m_Layer->DeleteField(fieldIndex);
   if (res != OGRERR_NONE)
     {
     itkGenericExceptionMacro(<< "Cannot delete the "<<fieldIndex << "th field in the layer <"
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx
new file mode 100644
index 0000000..6020ec3
--- /dev/null
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx
@@ -0,0 +1,129 @@
+/*=========================================================================
+
+  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 "otbOGRVersionProxy.h"
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#include "ogrsf_frmts.h"
+#pragma GCC diagnostic pop
+#else
+#include "ogrsf_frmts.h"
+#endif
+
+namespace otb
+{
+namespace ogr
+{
+namespace version_proxy
+{
+
+GDALDatasetType * Open(const char * filename, bool readOnly)
+{
+  return OGRSFDriverRegistrar::Open(filename,!readOnly);
+}
+
+void Close(GDALDatasetType * dataset)
+{
+  OGRDataSource::DestroyDataSource(dataset);
+}
+
+GDALDatasetType * Create(GDALDriverType * driver, const char * name)
+{
+  GDALDatasetType * ds = driver->CreateDataSource(name);
+
+  if(ds)
+    ds->SetDriver(driver);
+
+  return ds;
+}
+
+bool Delete(const char * name)
+{
+  // Open dataset
+  GDALDatasetType * poDS = Open(name,false);
+  GDALDriverType * poDriver = NULL;
+  if(poDS)
+    {
+    poDriver = poDS->GetDriver();
+    Close(poDS);
+    }
+
+  if(poDriver && poDriver->TestCapability(ODrCDeleteDataSource))
+    {
+
+    OGRErr ret = poDriver->DeleteDataSource(name);
+    return (ret == OGRERR_NONE);
+    }
+
+  return false;
+}
+
+GDALDriverType *  GetDriverByName(const char * name)
+{
+  return OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(name);
+}
+
+std::string GetDatasetClassName()
+{
+  return std::string("OGRDataSource");
+}
+
+std::string GetDriverClassName()
+{
+  return std::string("OGRSFDriver");
+}
+
+std::vector<std::string> GetFileListAsStringVector(GDALDatasetType * dataset)
+{
+  std::vector<std::string> ret;
+
+  ret.push_back(std::string(dataset->GetName()));
+
+  return ret;
+}
+
+bool SyncToDisk(GDALDatasetType * dataset)
+{
+  const OGRErr res= dataset->SyncToDisk();
+
+  return (res == OGRERR_NONE);
+}
+
+std::vector<std::string> GetAvailableDriversAsStringVector()
+{
+  std::vector<std::string> ret;
+
+  int nbDrivers = OGRSFDriverRegistrar::GetRegistrar()->GetDriverCount();
+
+  for(int i = 0; i < nbDrivers;++i)
+    {
+    ret.push_back(OGRSFDriverRegistrar::GetRegistrar()->GetDriver(i)->GetName());
+    }
+
+  return ret;
+}
+
+std::string GetDriverNameFromDataSource(const GDALDatasetType * ds)
+{
+  return std::string(const_cast<GDALDatasetType *>(ds)->GetDriver()->GetName());
+}
+
+}
+}
+} // end namespace
diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx
new file mode 100644
index 0000000..a7ed8e3
--- /dev/null
+++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx
@@ -0,0 +1,162 @@
+/*=========================================================================
+
+  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 "otbOGRVersionProxy.h"
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#include "gdal_priv.h"
+#pragma GCC diagnostic pop
+#else
+#include "gdal_priv.h"
+#endif
+
+
+namespace otb
+{
+namespace ogr
+{
+namespace version_proxy
+{
+
+GDALDatasetType * Open(const char * filename, bool readOnly)
+{
+  return (GDALDatasetType *)GDALOpenEx(filename, (readOnly? GDAL_OF_READONLY : GDAL_OF_UPDATE) | GDAL_OF_VECTOR,NULL,NULL,NULL);
+}
+
+void Close(GDALDatasetType * dataset)
+{
+  GDALClose(dataset);
+}
+
+GDALDatasetType * Create(GDALDriverType * driver, const char * name)
+{
+  return driver->Create(name,0,0,0,GDT_Unknown,NULL);
+}
+
+bool Delete(const char * name)
+{
+  // Open dataset
+  GDALDatasetType * poDS = otb::ogr::version_proxy::Open(name,false);
+  GDALDriverType * poDriver = NULL;
+  if(poDS)
+    {
+    poDriver = poDS->GetDriver();
+    Close(poDS);
+    }
+
+  if(poDriver)
+    {
+    OGRErr ret = poDriver->Delete(name);
+
+    return (ret == OGRERR_NONE);
+    }
+  return false;
+}
+
+GDALDriverType *  GetDriverByName(const char * name)
+{
+  return GetGDALDriverManager()->GetDriverByName(name);
+}
+
+std::string GetDatasetClassName()
+{
+  return std::string("GDALDataset");
+}
+
+std::string GetDriverClassName()
+{
+  return std::string("GDALDriver");
+}
+
+namespace raii
+{
+// This class is used in the next function, so as to prevent any
+// ressource leak on char ** returned by dataset->GetFileList()
+class CharPPCapsule
+{
+public:
+  CharPPCapsule(char ** in)
+    : m_P(in)
+  {}
+
+  const char ** P() const
+  {
+    return const_cast<const char **>(m_P);
+  }
+
+  ~CharPPCapsule()
+  {
+    if(m_P)
+      CSLDestroy(m_P);
+  }
+
+private:
+  char ** m_P;
+};
+}
+
+std::vector<std::string> GetFileListAsStringVector(GDALDatasetType * dataset)
+{
+  std::vector<std::string> ret;
+
+  raii::CharPPCapsule capsule(dataset->GetFileList());
+
+  std::string files_str="";
+
+  if(capsule.P())
+    {
+    unsigned int i = 0;
+    while(capsule.P()[i]!=NULL)
+      {
+      ret.push_back(std::string(capsule.P()[i]));
+      ++i;
+      }
+    }
+  return ret;
+}
+
+bool SyncToDisk(GDALDatasetType * dataset)
+{
+  dataset->FlushCache();
+
+  return true;
+}
+
+std::vector<std::string> GetAvailableDriversAsStringVector()
+{
+  std::vector<std::string> ret;
+
+  int nbDrivers = GetGDALDriverManager()->GetDriverCount();
+
+  for(int i = 0; i < nbDrivers;++i)
+    {
+    ret.push_back(GDALGetDriverShortName(GetGDALDriverManager()->GetDriver(i)));
+    }
+
+  return ret;
+}
+
+std::string GetDriverNameFromDataSource(const GDALDatasetType * ds)
+{
+  return std::string(const_cast<GDALDatasetType *>(ds)->GetDriverName());
+}
+
+}
+}
+} // end namespace
diff --git a/Modules/Adapters/GdalAdapters/test/otbOGRDataSourceWrapperNew.cxx b/Modules/Adapters/GdalAdapters/test/otbOGRDataSourceWrapperNew.cxx
index 165e6ec..b201eb3 100644
--- a/Modules/Adapters/GdalAdapters/test/otbOGRDataSourceWrapperNew.cxx
+++ b/Modules/Adapters/GdalAdapters/test/otbOGRDataSourceWrapperNew.cxx
@@ -23,7 +23,7 @@
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 #include <boost/foreach.hpp>
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 #include "itksys/SystemTools.hxx"
 #include "otbOGRDataSourceWrapper.h"
 
@@ -124,22 +124,22 @@ BOOST_AUTO_TEST_CASE(OGRDataSource_new_shp)
     }
 
   const std::string k_shp = boost::unit_test::framework::master_test_suite().argv[1];
-  const std::string k_one = k_shp;
+  const std::string k_one_ = k_shp;
   ogr::DataSource::Pointer ds = ogr::DataSource::New(k_shp+".shp", ogr::DataSource::Modes::Overwrite);
 
   BOOST_CHECK_EQUAL(ds->GetLayersCount(), 0);
-  ogr::Layer l = ds -> CreateLayer(k_one);
+  ogr::Layer l = ds -> CreateLayer(k_one_);
   BOOST_CHECK_EQUAL(ds->GetLayersCount(), 1);
   BOOST_CHECK_EQUAL(l.GetFeatureCount(false), 0);
   BOOST_CHECK_EQUAL(l.GetFeatureCount(true), 0);
   ogr::Layer l0 = ds->GetLayerChecked(0);
   BOOST_CHECK_THROW(ds->GetLayerChecked(1), itk::ExceptionObject);
-  BOOST_CHECK_EQUAL(l.GetName(), k_one);
-  BOOST_CHECK_EQUAL(l0.GetName(), k_one);
-  BOOST_CHECK_EQUAL(l0.GetName(), k_one);
+  BOOST_CHECK_EQUAL(l.GetName(), k_one_);
+  BOOST_CHECK_EQUAL(l0.GetName(), k_one_);
+  BOOST_CHECK_EQUAL(l0.GetName(), k_one_);
 
-  BOOST_CHECK_EQUAL(ds->GetLayer(k_one).GetName(), k_one);
-  BOOST_CHECK_EQUAL(ds->GetLayerChecked(k_one).GetName(), k_one);
+  BOOST_CHECK_EQUAL(ds->GetLayer(k_one_).GetName(), k_one_);
+  BOOST_CHECK_EQUAL(ds->GetLayerChecked(k_one_).GetName(), k_one_);
   BOOST_ASSERT(! ds->GetLayer(k_two));
   BOOST_CHECK_THROW(ds->GetLayerChecked(k_two), itk::ExceptionObject);
 
@@ -713,9 +713,9 @@ BOOST_AUTO_TEST_CASE(Add_n_Read_Fields)
   l.CreateField(k_f5);
 
   ogr::Feature g0(defn);
-  const size_t NbFields = defn.GetFieldCount();
+  const int NbFields = defn.GetFieldCount();
   BOOST_CHECK_EQUAL(NbFields, g0.GetSize());
-  for (size_t i=0; i!=NbFields; ++i)
+  for (int i=0; i!=NbFields; ++i)
     {
     BOOST_ASSERT(!g0[i].HasBeenSet());
     }
diff --git a/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h b/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h
index 528144e..7e51a0c 100644
--- a/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h
+++ b/Modules/Adapters/OSSIMAdapters/include/otbDEMHandler.h
@@ -107,9 +107,29 @@ public:
   /** return true if the directoty contain DEM */
   virtual bool IsValidDEMDirectory(const char* DEMDirectory);
 
-  /** Open geoid file. */
-  virtual void OpenGeoidFile(const char* geoidFile);
-  virtual void OpenGeoidFile(const std::string& geoidFile);
+  /**
+   * \brief Open geoid file given its filename or throw an exception
+   * if geoid-file could not be loaded.
+   *
+   * \param geoidFile The filename of the geoid-file.
+   *
+   * \return <code>true</code> if geoid file has been changed or
+   * <code>false</code> if geod-file have been set before and could
+   * not be changed.
+   */
+  virtual bool OpenGeoidFile(const char* geoidFile);
+
+  /**
+   * \brief Open geoid file given its filename or throw an exception
+   * if geoid-file could not be loaded.
+   *
+   * \param geoidFile The filename of the geoid-file.
+   *
+   * \return <code>true</code> if geoid file has been changed or
+   * <code>false</code> if geod-file have been set before and could
+   * not be changed.
+   */
+  virtual bool OpenGeoidFile(const std::string& geoidFile);
 
   /** Compute the height above MSL(Mean Sea Level) of a geographic point. */
   virtual double GetHeightAboveMSL(double lon, double lat) const;
@@ -125,6 +145,11 @@ public:
   /** Set the default height above ellipsoid in case no information is available*/
   double GetDefaultHeightAboveEllipsoid() const;
 
+  /**
+   * \return The number of elevation databases in the
+   * <code>ossimElevManager</code>.
+   */
+  unsigned int GetDEMCount() const;
 
   /** Get DEM directory */
   std::string GetDEMDirectory(unsigned int idx = 0) const;
@@ -132,14 +157,18 @@ public:
   /** Get Goid file */
   std::string GetGeoidFile() const;
 
+  /**
+   * \brief Remove all the ossimElevationDatabases from the
+   * <code>ossimElevManager</code>.
+   */
+  void ClearDEMs();
+
 protected:
   DEMHandler();
   virtual ~DEMHandler() {}
 
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
-  ossimElevManager* m_ElevManager;
-
   // Ossim does not allow to retrieve the geoid file path
   // We therefore must keep it on our side
   std::string m_GeoidFile;
diff --git a/Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h b/Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h
index a21dc62..7f1c9f2 100644
--- a/Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h
+++ b/Modules/Adapters/OSSIMAdapters/include/otbImageKeywordlist.h
@@ -81,6 +81,7 @@ public:
   //{return "ImageKeywordlist"; }
 
   typedef std::map<std::string, std::string> KeywordlistMap;
+  typedef KeywordlistMap::size_type KeywordlistMapSizeType;
 
   /** Get the internal map container */
   const KeywordlistMap& GetKeywordlist() const
@@ -94,8 +95,8 @@ public:
   {
     m_Keywordlist.clear();
   }
-
-  unsigned int GetSize(void) const
+ 
+  KeywordlistMapSizeType GetSize(void) const
   {
     return m_Keywordlist.size();
   }
diff --git a/Modules/Adapters/OSSIMAdapters/include/otbMetaDataKey.h b/Modules/Adapters/OSSIMAdapters/include/otbMetaDataKey.h
index db914a7..d1a031b 100644
--- a/Modules/Adapters/OSSIMAdapters/include/otbMetaDataKey.h
+++ b/Modules/Adapters/OSSIMAdapters/include/otbMetaDataKey.h
@@ -67,6 +67,9 @@ namespace MetaDataKey
   extern char const* TileHintX;
   extern char const* TileHintY;
 
+  extern char const * NoDataValueAvailable;
+  extern char const * NoDataValue;
+
 
   enum  KeyType
     {
@@ -77,6 +80,7 @@ namespace MetaDataKey
     TVECTOR,
     TOSSIMKEYWORDLIST,
     TVECTORDATAKEYWORDLIST,
+    TBOOLVECTOR
     };
   /*
   typedef struct
@@ -102,6 +106,7 @@ namespace MetaDataKey
   KeyType GetKeyType(const std::string& name);
 
   typedef std::vector<double>               VectorType;
+  typedef std::vector<bool>                 BoolVectorType;
   typedef itk::VariableLengthVector<double> VariableLengthVectorType;
 }
 
diff --git a/Modules/Adapters/OSSIMAdapters/include/otbRPCProjectionAdapter.h b/Modules/Adapters/OSSIMAdapters/include/otbRPCProjectionAdapter.h
deleted file mode 100644
index 084fc51..0000000
--- a/Modules/Adapters/OSSIMAdapters/include/otbRPCProjectionAdapter.h
+++ /dev/null
@@ -1,93 +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.
-
-=========================================================================*/
-#ifndef __otbRPCProjectionAdapter_h
-#define __otbRPCProjectionAdapter_h
-
-#include "vcl_deprecated_header.h"
-
-#include <vector>
-
-#include "itkObject.h"
-#include "itkObjectFactory.h"
-
-#include "itkPoint.h"
-#include "itkSize.h"
-
-
-class ossimRpcProjection;
-
-namespace otb {
-
-class ImageKeywordlist;
-
-/** \class RPCProjectionAdapter
- *  \brief Wrapper class for the ossim Rpc projection
- *
- * This class is used inside the GCPsToRPCSensorModelImageFilter and should not
- * be used directly outside.
- *
- * \deprecated Please use the RpcSolverAdapter class static methods instead
- *
- * \sa GCPsToRPCSensorModelImageFilter
- *
- * \ingroup OTBOSSIMAdapters
- **/
-
-class RPCProjectionAdapter: public itk::Object
-{
-public:
-  /** Standard class typedefs. */
-  typedef RPCProjectionAdapter          Self;
-  typedef itk::Object                   Superclass;
-  typedef itk::SmartPointer<Self>       Pointer;
-  typedef itk::SmartPointer<const Self> ConstPointer;
-
-  typedef itk::Point<double, 2>               Point2DType;
-  typedef itk::Point<double, 3>               Point3DType;
-  typedef std::pair<Point2DType, Point3DType> GCPType;
-  typedef std::vector<GCPType>                GCPsContainerType;
-
-  /** Method for creation through the object factory. */
-  itkNewMacro(Self);
-
-  /** Run-time type information (and related methods). */
-  itkTypeMacro(RPCProjectionAdapter, itk::Object);
-
-  void Solve(const GCPsContainerType& gcpContainer,
-             double& rmsError, ImageKeywordlist& otb_kwl);
-  void TransformPoint(double x, double y, double z,
-                      double& lon, double& lat, double& h) const;
-
-  void AddGroundRect( ImageKeywordlist& otb_kwl,
-                      itk::Point<double, 2> orig, itk::Size<2> size);
-
-protected:
-  RPCProjectionAdapter();
-  virtual ~RPCProjectionAdapter();
-
-private:
-  RPCProjectionAdapter(const Self &); //purposely not implemented
-  void operator =(const Self&); //purposely not implemented
-
-  /** RPC Projection */
-  ossimRpcProjection* m_RpcProjection;
-};
-
-} // namespace otb
-
-#endif
diff --git a/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt b/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt
index b7942a9..257cc63 100644
--- a/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt
+++ b/Modules/Adapters/OSSIMAdapters/src/CMakeLists.txt
@@ -6,7 +6,6 @@ set(OTBOSSIMAdapters_SRC
   otbPlatformPositionAdapter.cxx
   otbDEMConvertAdapter.cxx
   otbRPCSolverAdapter.cxx
-  otbRPCProjectionAdapter.cxx
   otbDateTimeAdapter.cxx
   otbMapProjectionAdapter.cxx
   otbFilterFunctionValues.cxx
@@ -15,7 +14,7 @@ set(OTBOSSIMAdapters_SRC
   )
 
 add_library(OTBOSSIMAdapters ${OTBOSSIMAdapters_SRC})
-target_link_libraries(OTBOSSIMAdapters 
+target_link_libraries(OTBOSSIMAdapters
   ${OTBGDAL_LIBRARIES}
   ${OTBCommon_LIBRARIES}
   ${OTBOssim_LIBRARIES}
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx
index 74616fd..0a60df2 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbDEMConvertAdapter.cxx
@@ -21,6 +21,11 @@
 #include "itkMacro.h"
 
 // OSSIM include
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/base/ossimKeywordNames.h"
 #include "ossim/base/ossimStdOutProgress.h"
 #include "ossim/base/ossimFilename.h"
@@ -35,6 +40,23 @@
 #include "ossim/imaging/ossimCacheTileSource.h"
 #include "ossim/imaging/ossimBandSelector.h"
 #include "ossim/imaging/ossimCibCadrgTileSource.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/base/ossimKeywordNames.h"
+#include "ossim/base/ossimStdOutProgress.h"
+#include "ossim/base/ossimFilename.h"
+#include "ossim/base/ossimKeywordlist.h"
+#include "ossim/imaging/ossimJpegWriter.h"
+#include "ossim/imaging/ossimImageHandler.h"
+#include "ossim/imaging/ossimImageSource.h"
+#include "ossim/imaging/ossimImageHandlerRegistry.h"
+#include "ossim/imaging/ossimImageWriterFactoryRegistry.h"
+#include "ossim/imaging/ossimImageWriterFactory.h"
+#include "ossim/imaging/ossimImageFileWriter.h"
+#include "ossim/imaging/ossimCacheTileSource.h"
+#include "ossim/imaging/ossimBandSelector.h"
+#include "ossim/imaging/ossimCibCadrgTileSource.h"
+#endif
 
 namespace otb
 {
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx b/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx
index 79b3524..0477ddc 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx
@@ -18,6 +18,13 @@
 #include "otbDEMHandler.h"
 #include "otbMacro.h"
 
+#include <cassert>
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/elevation/ossimElevManager.h"
 #include "ossim/base/ossimGeoidManager.h"
 #include "ossim/base/ossimFilename.h"
@@ -25,6 +32,18 @@
 #include "ossim/base/ossimGeoidEgm96.h"
 #include "ossim/base/ossimRefPtr.h"
 #include <ossim/elevation/ossimImageElevationDatabase.h>
+#pragma GCC diagnostic pop
+#else
+#include "ossim/elevation/ossimElevManager.h"
+#include "ossim/base/ossimGeoidManager.h"
+#include "ossim/base/ossimFilename.h"
+#include "ossim/base/ossimDirectory.h"
+#include "ossim/base/ossimGeoidEgm96.h"
+#include "ossim/base/ossimRefPtr.h"
+#include <ossim/elevation/ossimImageElevationDatabase.h>
+#endif
+
+
 
 namespace otb
 {
@@ -49,23 +68,25 @@ DEMHandler::Pointer DEMHandler::Instance()
 
 DEMHandler
 ::DEMHandler() :
-  m_ElevManager(ossimElevManager::instance()),
   m_GeoidFile(""),
   m_DefaultHeightAboveEllipsoid(0)
 {
-  m_ElevManager->setDefaultHeightAboveEllipsoid(m_DefaultHeightAboveEllipsoid);
+  assert( ossimElevManager::instance()!=NULL );
+
+  ossimElevManager::instance()->setDefaultHeightAboveEllipsoid(m_DefaultHeightAboveEllipsoid);
   // Force geoid fallback
-  m_ElevManager->setUseGeoidIfNullFlag(true);
+  ossimElevManager::instance()->setUseGeoidIfNullFlag(true);
 }
 
 void
 DEMHandler
 ::OpenDEMDirectory(const char* DEMDirectory)
 {
-  ossimFilename ossimDEMDir;
-  ossimDEMDir = ossimFilename(DEMDirectory);
+  assert( ossimElevManager::instance()!=NULL );
 
-  if (!m_ElevManager->loadElevationPath(ossimDEMDir))
+  ossimFilename ossimDEMDir( DEMDirectory );
+
+  if (!ossimElevManager::instance()->loadElevationPath(ossimDEMDir))
     {
     // In ossim elevation database factory code, the
     // ossimImageElevationDatabase is explicitly disabled by a #if 0
@@ -82,11 +103,22 @@ DEMHandler
     else
       {
       otbMsgDevMacro(<< "DEM directory contains general elevation image files: " << ossimDEMDir);
-      m_ElevManager->addDatabase(imageElevationDatabase.get());
+      ossimElevManager::instance()->addDatabase(imageElevationDatabase.get());
       }
     }
 }
 
+
+void
+DEMHandler
+::ClearDEMs()
+{
+  assert( ossimElevManager::instance()!=NULL );
+
+  ossimElevManager::instance()->clear();
+}
+
+
 void
 DEMHandler
 ::OpenDEMDirectory(const std::string& DEMDirectory)
@@ -98,8 +130,10 @@ bool
 DEMHandler
 ::IsValidDEMDirectory(const char* DEMDirectory)
 {
+  assert( ossimElevManager::instance()!=NULL );
+
   //Try to load elevation source
-  bool result = m_ElevManager->loadElevationPath(DEMDirectory);
+  bool result = ossimElevManager::instance()->loadElevationPath(DEMDirectory);
 
   if (!result)
     {
@@ -111,7 +145,7 @@ DEMHandler
   return result;
 }
 
-void
+bool
 DEMHandler
 ::OpenGeoidFile(const char* geoidFile)
 {
@@ -131,22 +165,31 @@ DEMHandler
 
       // The previous flag will be ignored if
       // defaultHeightAboveEllipsoid is not NaN
-      m_ElevManager->setDefaultHeightAboveEllipsoid(ossim::nan());
+      assert( ossimElevManager::instance()!=NULL );
+
+      ossimElevManager::instance()->setDefaultHeightAboveEllipsoid(ossim::nan());
 
+      return true;
       }
     else
       {
       otbMsgDevMacro(<< "Failure opening geoid");
       geoidPtr.release();
+
+      itkExceptionMacro( << "Failed to open geoid file: '" << geoidFile << "'" );
+
+      return false;
       }
     }
+
+  return false;
 }
 
-void
+bool
 DEMHandler
 ::OpenGeoidFile(const std::string& geoidFile)
 {
-  OpenGeoidFile(geoidFile.c_str());
+  return OpenGeoidFile(geoidFile.c_str());
 }
 
 double
@@ -155,9 +198,14 @@ DEMHandler
 {
   double   height;
   ossimGpt ossimWorldPoint;
+
   ossimWorldPoint.lon = lon;
   ossimWorldPoint.lat = lat;
-  height = m_ElevManager->getHeightAboveMSL(ossimWorldPoint);
+
+  assert( ossimElevManager::instance()!=NULL );
+
+  height = ossimElevManager::instance()->getHeightAboveMSL(ossimWorldPoint);
+
   return height;
 }
 
@@ -174,9 +222,13 @@ DEMHandler
 {
   double   height;
   ossimGpt ossimWorldPoint;
+
   ossimWorldPoint.lon = lon;
   ossimWorldPoint.lat = lat;
-  height = m_ElevManager->getHeightAboveEllipsoid(ossimWorldPoint);
+
+  assert( ossimElevManager::instance()!=NULL );
+
+  height = ossimElevManager::instance()->getHeightAboveEllipsoid(ossimWorldPoint);
 
   return height;
 }
@@ -195,7 +247,10 @@ DEMHandler
   // Ossim does not allow to retrieve the default height above
   // ellipsoid We therefore must keep it on our side
   m_DefaultHeightAboveEllipsoid = h;
-  m_ElevManager->setDefaultHeightAboveEllipsoid(h);
+
+  assert( ossimElevManager::instance()!=NULL );
+
+  ossimElevManager::instance()->setDefaultHeightAboveEllipsoid(h);
 }
 
 double
@@ -207,13 +262,24 @@ DEMHandler
   return m_DefaultHeightAboveEllipsoid;
 }
 
+unsigned int
+DEMHandler
+::GetDEMCount() const
+{
+  assert( ossimElevManager::instance()!=NULL );
+
+  return ossimElevManager::instance()->getNumberOfElevationDatabases();
+}
+
 std::string DEMHandler::GetDEMDirectory(unsigned int idx) const
 {
   std::string demDir = "";
 
-  if(m_ElevManager->getNumberOfElevationDatabases() > 0)
+  if(ossimElevManager::instance()->getNumberOfElevationDatabases() > 0)
     {
-    demDir = m_ElevManager->getElevationDatabase(idx)->getConnectionString().string();
+    assert( ossimElevManager::instance()!=NULL );
+
+    demDir = ossimElevManager::instance()->getElevationDatabase(idx)->getConnectionString().string();
     }
   return demDir;
 }
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbEllipsoidAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbEllipsoidAdapter.cxx
index 44eecbf..3141cb4 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbEllipsoidAdapter.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbEllipsoidAdapter.cxx
@@ -18,7 +18,18 @@
 
 #include "otbEllipsoidAdapter.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/base/ossimEllipsoid.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/base/ossimEllipsoid.h"
+#endif
+
+
 
 namespace otb
 {
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx
index a958d4f..b0fa03d 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbGeometricSarSensorModelAdapter.cxx
@@ -21,10 +21,22 @@
 #include "otbMacro.h"
 #include "otbImageKeywordlist.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/ossimGeometricSarSensorModel.h"
 #include "ossim/projection/ossimProjection.h"
 #include "ossim/ossimPluginProjectionFactory.h"
 #include "ossim/otb/JSDDateTime.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/ossimGeometricSarSensorModel.h"
+#include "ossim/projection/ossimProjection.h"
+#include "ossim/ossimPluginProjectionFactory.h"
+#include "ossim/otb/JSDDateTime.h"
+#endif
 
 
 namespace otb {
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx b/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx
index 930da01..1e506fd 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx
@@ -23,6 +23,11 @@
 
 #include "gdal_priv.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/base/ossimKeywordlist.h"
 #include "ossim/base/ossimString.h"
 #include "ossim/ossimPluginProjectionFactory.h"
@@ -30,6 +35,16 @@
 #include "ossim/ossimTileMapModel.h"
 #include "ossim/projection/ossimProjectionFactoryRegistry.h"
 #include "ossim/projection/ossimRpcModel.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/base/ossimKeywordlist.h"
+#include "ossim/base/ossimString.h"
+#include "ossim/ossimPluginProjectionFactory.h"
+#include "ossim/imaging/ossimImageHandlerRegistry.h"
+#include "ossim/ossimTileMapModel.h"
+#include "ossim/projection/ossimProjectionFactoryRegistry.h"
+#include "ossim/projection/ossimRpcModel.h"
+#endif
 
 #include "otbSensorModelAdapter.h"
 
@@ -93,7 +108,7 @@ GetMetadataByKey(const std::string& key) const
     itkGenericExceptionMacro(<< "Keywordlist has no output with key " << key);
     }
 
-  // Then if everything is ok, return the ossinString
+  // Then if everything is ok, return the ossimString
   return it->second;
 }
 
@@ -102,6 +117,8 @@ ImageKeywordlist::
 HasKey(const std::string& key) const
 {
   KeywordlistMap::const_iterator it = m_Keywordlist.find(key);
+
+
   return (it != m_Keywordlist.end());
 }
 
@@ -137,38 +154,51 @@ bool
 ImageKeywordlist::
 convertToGDALRPC(GDALRPCInfo &rpc) const
 {
-  ossimKeywordlist geom_kwl;
-  this->convertToOSSIMKeywordlist(geom_kwl);
-  
-  ossimRefPtr<ossimRpcModel> rpcModel = new ossimRpcModel;
-  if (rpcModel->loadState(geom_kwl))
-    {
-    ossimRpcModel::rpcModelStruct ossimRpcStruct;
-    rpcModel->getRpcParameters(ossimRpcStruct);
-    
-    if (ossimRpcStruct.type == 'B')
+   /* ossimRpcModel::loadState() actually expects certain keyword values to be
+    * present in the keywordlist. So We check a single keyword value
+    * (polynomial_format) first.  Even though it is not enough to ensure a valid
+    * ossimRpcModel by checking for presence of one single key but atleast we
+    * are sure about not to create an ossimRpcModel.
+    *
+    * The current mechanism creates ossimRpcModel instance, calls loadState()
+    * and fails. The below check for 'polynomial_format' save us from creating
+    * an ossimRpcModel which will be invalid if the 'polynomial_format' is not
+    * present.
+    */
+   if( m_Keywordlist.find("polynomial_format") != m_Keywordlist.end() )
+   {
+      ossimKeywordlist geom_kwl;
+      this->convertToOSSIMKeywordlist(geom_kwl);
+
+      ossimRefPtr<ossimRpcModel> rpcModel = new ossimRpcModel;
+      if (rpcModel->loadState(geom_kwl))
       {
-      rpc.dfSAMP_OFF = ossimRpcStruct.sampOffset;
-      rpc.dfLINE_OFF = ossimRpcStruct.lineOffset;
-      rpc.dfSAMP_SCALE = ossimRpcStruct.sampScale;
-      rpc.dfLINE_SCALE = ossimRpcStruct.lineScale;
-      rpc.dfLAT_OFF = ossimRpcStruct.latOffset;
-      rpc.dfLONG_OFF = ossimRpcStruct.lonOffset;
-      rpc.dfHEIGHT_OFF = ossimRpcStruct.hgtOffset;
-      rpc.dfLAT_SCALE = ossimRpcStruct.latScale;
-      rpc.dfLONG_SCALE = ossimRpcStruct.lonScale;
-      rpc.dfHEIGHT_SCALE = ossimRpcStruct.hgtScale;
-      
-      memcpy(rpc.adfLINE_NUM_COEFF, ossimRpcStruct.lineNumCoef, sizeof(double) * 20);
-      memcpy(rpc.adfLINE_DEN_COEFF, ossimRpcStruct.lineDenCoef, sizeof(double) * 20);
-      memcpy(rpc.adfSAMP_NUM_COEFF, ossimRpcStruct.sampNumCoef, sizeof(double) * 20);
-      memcpy(rpc.adfSAMP_DEN_COEFF, ossimRpcStruct.sampDenCoef, sizeof(double) * 20);
-      
-      return true;
+         ossimRpcModel::rpcModelStruct ossimRpcStruct;
+         rpcModel->getRpcParameters(ossimRpcStruct);
+
+         if (ossimRpcStruct.type == 'B')
+         {
+            rpc.dfSAMP_OFF = ossimRpcStruct.sampOffset;
+            rpc.dfLINE_OFF = ossimRpcStruct.lineOffset;
+            rpc.dfSAMP_SCALE = ossimRpcStruct.sampScale;
+            rpc.dfLINE_SCALE = ossimRpcStruct.lineScale;
+            rpc.dfLAT_OFF = ossimRpcStruct.latOffset;
+            rpc.dfLONG_OFF = ossimRpcStruct.lonOffset;
+            rpc.dfHEIGHT_OFF = ossimRpcStruct.hgtOffset;
+            rpc.dfLAT_SCALE = ossimRpcStruct.latScale;
+            rpc.dfLONG_SCALE = ossimRpcStruct.lonScale;
+            rpc.dfHEIGHT_SCALE = ossimRpcStruct.hgtScale;
+
+            memcpy(rpc.adfLINE_NUM_COEFF, ossimRpcStruct.lineNumCoef, sizeof(double) * 20);
+            memcpy(rpc.adfLINE_DEN_COEFF, ossimRpcStruct.lineDenCoef, sizeof(double) * 20);
+            memcpy(rpc.adfSAMP_NUM_COEFF, ossimRpcStruct.sampNumCoef, sizeof(double) * 20);
+            memcpy(rpc.adfSAMP_DEN_COEFF, ossimRpcStruct.sampDenCoef, sizeof(double) * 20);
+
+            return true;
+         }
       }
-    }
-  
-  return false;
+   }
+   return false;
 }
 
 void
@@ -218,6 +248,7 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
       because the default include factory contains ossimQuickbirdTiffTileSource. */
   ossimProjection * projection = ossimplugins::ossimPluginProjectionFactory::instance()
                                  ->createProjection(ossimFilename(filename.c_str()), 0);
+
   if (projection)
     {
     otbMsgDevMacro(<< "OSSIM plugin projection instantiated ! ");
@@ -228,6 +259,7 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
     // Free memory
     delete projection;
     projection = 0;
+
     }
 
   /***********************************************/
@@ -253,7 +285,7 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
           hasMetaData = projection->saveState(geom_kwl);
           }
         }
-      
+
       // if the handler has found a sensor model, copy the tags found
       if (hasMetaData && dynamic_cast<ossimSensorModel*>(projection))
         {
@@ -268,7 +300,7 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
       delete handler;
       }
     }
-  
+
   /**********************************************************/
   /* Third try : look for external geom file and RPC tags   */
   /**********************************************************/
@@ -277,14 +309,14 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
     // If still no metadata, try the ".geom" file
     ossimFilename ossimGeomFile = ossimFilename(filename).setExtension(".geom");
     otb_kwl = ReadGeometryFromGEOMFile(ossimGeomFile);
-    
+
     // also check any RPC tags
     ImageKeywordlist rpc_kwl;
     if (checkRpcTag)
       {
       rpc_kwl = ReadGeometryFromRPCTag(filename);
       }
-     
+
     if (otb_kwl.HasKey("type"))
       {
       // external geom has a "type" keyword
@@ -298,7 +330,7 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
           {
           rpc_kwl.ClearMetadataByKey("type");
           }
-        
+
         ossimKeywordlist ossim_test_kwl;
         otb_kwl.convertToOSSIMKeywordlist(ossim_test_kwl);
         testProj = ossimProjectionFactoryRegistry::instance()
@@ -310,7 +342,7 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
           }
         }
       }
-      
+
     // copy keywords found in RPC tags if the external geom is not valid
     if (!hasMetaData && rpc_kwl.GetSize() > 0)
       {
@@ -344,7 +376,7 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag)
   // We then verify it is a valid sensor model by using otb::SensorModelAdapter
   // which uses ossimSensorModelFactory and ossimPluginProjectionFactory internally,
   // thus by-passing the need for a valid ossimImageHandler.
-  
+
   if (!hasMetaData)
     {
     otbMsgDevMacro(<< "OSSIM MetaData not present ! ");
@@ -398,7 +430,7 @@ ReadGeometryFromRPCTag(const std::string& filename)
 {
   ossimKeywordlist geom_kwl;
   ImageKeywordlist otb_kwl;
-  
+
   //  try to use GeoTiff RPC tag if present.
   // Warning : RPC in subdatasets are not supported
   GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), NULL);
@@ -407,7 +439,7 @@ ReadGeometryFromRPCTag(const std::string& filename)
     // If no driver has identified the dataset, don't try to open it and exit
     return otb_kwl;
     }
-  
+
   GDALDatasetH datasetH = GDALOpen(filename.c_str(), GA_ReadOnly);
   if (datasetH != NULL)
     {
@@ -420,7 +452,7 @@ ReadGeometryFromRPCTag(const std::string& filename)
       std::vector<double> lineDenCoefs;
       std::vector<double> sampNumCoefs;
       std::vector<double> sampDenCoefs;
-      
+
       for (unsigned int k=0; k<20; ++k)
         {
         lineNumCoefs.push_back(rpcStruct.adfLINE_NUM_COEFF[k]);
@@ -428,7 +460,7 @@ ReadGeometryFromRPCTag(const std::string& filename)
         sampNumCoefs.push_back(rpcStruct.adfSAMP_NUM_COEFF[k]);
         sampDenCoefs.push_back(rpcStruct.adfSAMP_DEN_COEFF[k]);
         }
-      
+
       ossimRefPtr<ossimRpcModel> rpcModel = new ossimRpcModel;
       rpcModel->setAttributes( rpcStruct.dfSAMP_OFF,
                               rpcStruct.dfLINE_OFF,
@@ -444,10 +476,10 @@ ReadGeometryFromRPCTag(const std::string& filename)
                               sampDenCoefs,
                               lineNumCoefs,
                               lineDenCoefs);
-      
+
       double errorBias = 0.0;
       double errorRand = 0.0;
-      
+
       // setup other metadata
       rpcModel->setPositionError(errorBias,errorRand,true);
       ossimDrect rectangle(0.0,
@@ -455,38 +487,38 @@ ReadGeometryFromRPCTag(const std::string& filename)
                           static_cast<double>(dataset->GetRasterXSize()-1),
                           static_cast<double>(dataset->GetRasterYSize()-1));
       rpcModel->setImageRect(rectangle);
-      
+
       ossimDpt size;
       size.line = rectangle.height();
       size.samp = rectangle.width();
       rpcModel->setImageSize(size);
-      
+
       // Compute 4 corners and reference point
       rpcModel->updateModel();
       double heightOffset = rpcStruct.dfHEIGHT_OFF;
       ossimGpt ulGpt, urGpt, lrGpt, llGpt;
       ossimGpt refGndPt;
-      
+
       rpcModel->lineSampleHeightToWorld(rectangle.ul(), heightOffset, ulGpt);
       rpcModel->lineSampleHeightToWorld(rectangle.ur(), heightOffset, urGpt);
       rpcModel->lineSampleHeightToWorld(rectangle.lr(), heightOffset, lrGpt);
       rpcModel->lineSampleHeightToWorld(rectangle.ll(), heightOffset, llGpt);
       rpcModel->setGroundRect(ulGpt,urGpt,lrGpt,llGpt);
-      
+
       rpcModel->lineSampleHeightToWorld(rectangle.midPoint(), heightOffset, refGndPt);
       rpcModel->setRefGndPt(refGndPt);
-      
+
       // compute ground sampling distance
       try
         {
         // Method can throw ossimException.
         rpcModel->computeGsd();
         }
-      catch (const ossimException& e)
+      catch (const ossimException& itkNotUsed(e))
         {
         otbMsgDevMacro(<< "OSSIM Compute ground sampling distance FAILED ! ");
         }
-      
+
       if (rpcModel->saveState(geom_kwl))
         {
         otb_kwl.SetKeywordlist(geom_kwl);
@@ -494,7 +526,7 @@ ReadGeometryFromRPCTag(const std::string& filename)
       }
     GDALClose(datasetH);
     }
-  
+
   return otb_kwl;
 }
 
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx
index 93f82dd..b617971 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbMapProjectionAdapter.cxx
@@ -23,6 +23,11 @@
 #include "otbMacro.h"
 #include "otbUtils.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/projection/ossimMapProjection.h"
 #include "ossim/projection/ossimMapProjectionFactory.h"
 #include "ossim/base/ossimGpt.h"
@@ -32,16 +37,36 @@
 #include "ossim/base/ossimEllipsoidFactory.h"
 #include "ossim/base/ossimString.h"
 #include "gdal/ossimOgcWktTranslator.h"
-
 #include "ossim/projection/ossimUtmProjection.h"
 #include "ossim/projection/ossimLambertConformalConicProjection.h"
 #include "ossim/projection/ossimTransMercatorProjection.h"
 #include "ossim/projection/ossimEckert4Projection.h"
 #include "ossim/projection/ossimMollweidProjection.h"
 #include "ossim/projection/ossimSinusoidalProjection.h"
-
 #include "ossim/support_data/ossimSpaceImagingGeom.h"
 #include "ossim/base/ossimKeywordNames.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/projection/ossimMapProjection.h"
+#include "ossim/projection/ossimMapProjectionFactory.h"
+#include "ossim/base/ossimGpt.h"
+#include "ossim/base/ossimDpt.h"
+#include "ossim/projection/ossimProjection.h"
+#include "ossim/base/ossimEllipsoid.h"
+#include "ossim/base/ossimEllipsoidFactory.h"
+#include "ossim/base/ossimString.h"
+#include "gdal/ossimOgcWktTranslator.h"
+#include "ossim/projection/ossimUtmProjection.h"
+#include "ossim/projection/ossimLambertConformalConicProjection.h"
+#include "ossim/projection/ossimTransMercatorProjection.h"
+#include "ossim/projection/ossimEckert4Projection.h"
+#include "ossim/projection/ossimMollweidProjection.h"
+#include "ossim/projection/ossimSinusoidalProjection.h"
+#include "ossim/support_data/ossimSpaceImagingGeom.h"
+#include "ossim/base/ossimKeywordNames.h"
+
+#endif
+
 
 
 namespace otb
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbMetaDataKey.cxx b/Modules/Adapters/OSSIMAdapters/src/otbMetaDataKey.cxx
index e2d4d53..8e3a67a 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbMetaDataKey.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbMetaDataKey.cxx
@@ -59,6 +59,9 @@ char const* CacheSizeInBytes = "CacheSizeInBytes";
 
 char const* TileHintX = "TileHintX";
 char const* TileHintY = "TileHintY";
+
+char const * NoDataValueAvailable = "NoDataValueAvailable";
+char const * NoDataValue = "NoDataValue";
 }
 
 const MetaDataKey::KeyTypeDef Types[] =
@@ -86,7 +89,9 @@ const MetaDataKey::KeyTypeDef Types[] =
   MetaDataKey::KeyTypeDef(MetaDataKey::SubDatasetIndex,                   MetaDataKey::TENTIER),
   MetaDataKey::KeyTypeDef(MetaDataKey::CacheSizeInBytes,                  MetaDataKey::TENTIER),
   MetaDataKey::KeyTypeDef(MetaDataKey::TileHintX,                         MetaDataKey::TENTIER),
-  MetaDataKey::KeyTypeDef(MetaDataKey::TileHintY,                         MetaDataKey::TENTIER)
+  MetaDataKey::KeyTypeDef(MetaDataKey::TileHintY,                         MetaDataKey::TENTIER),
+  MetaDataKey::KeyTypeDef(MetaDataKey::NoDataValueAvailable,              MetaDataKey::TVECTOR),
+  MetaDataKey::KeyTypeDef(MetaDataKey::NoDataValue,                       MetaDataKey::TVECTOR)
   };
 
 MetaDataKey::KeyType MetaDataKey::GetKeyType(const std::string& name)
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbRPCProjectionAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbRPCProjectionAdapter.cxx
deleted file mode 100644
index 61950e8..0000000
--- a/Modules/Adapters/OSSIMAdapters/src/otbRPCProjectionAdapter.cxx
+++ /dev/null
@@ -1,161 +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 "otbRPCProjectionAdapter.h"
-#include "otbImageKeywordlist.h"
-
-#include "ossim/projection/ossimRpcProjection.h"
-#include "ossim/projection/ossimProjection.h"
-#include "ossim/projection/ossimRpcSolver.h"
-#include "ossim/imaging/ossimImageGeometry.h"
-
-namespace otb
-{
-
-RPCProjectionAdapter::RPCProjectionAdapter()
-{
-  // Create projection
-  m_RpcProjection = new ossimRpcProjection();
-}
-
-RPCProjectionAdapter::~RPCProjectionAdapter()
-{
-  if (m_RpcProjection != NULL)
-    {
-    delete m_RpcProjection;
-    }
-}
-
-void
-RPCProjectionAdapter::TransformPoint(double x, double y, double z,
-                                     double& lon, double& lat, double& h) const
-{
-  if (m_RpcProjection == NULL)
-    {
-    lon = 0.0;
-    lat = 0.0;
-    h = 0.0;
-    return;
-    }
-  ossimDpt spoint( internal::ConvertToOSSIMFrame(x),
-                   internal::ConvertToOSSIMFrame(y));
-  ossimGpt gpoint;
-  gpoint.hgt = z;
-
-  m_RpcProjection->lineSampleToWorld(spoint, gpoint);
-  lon = gpoint.lon;
-  lat = gpoint.lat;
-  h = gpoint.hgt;
-}
-
-void
-RPCProjectionAdapter::Solve(const GCPsContainerType& gcpContainer,
-                            double& rmsError, ImageKeywordlist& otb_kwl)
-{
-  // TODO: for now, this is a simple transfer of what was done in the
-  // GCPsToRPCSensorModelImageFilter. We might find some way to improve that.
-
-  // The vector where geo and sensor points are stored
-  std::vector<ossimDpt> sensorPoints;
-  std::vector<ossimGpt> geoPoints;
-
-  // Temporary points variable
-  ossimDpt sensorPoint;
-  ossimGpt geoPoint;
-
-  // Retrieve the additional GCPs
-  GCPsContainerType::const_iterator gcpIt;
-  for (gcpIt = gcpContainer.begin(); gcpIt != gcpContainer.end(); ++gcpIt)
-    {
-    // Fill sensor point
-    sensorPoint = ossimDpt( internal::ConvertToOSSIMFrame(gcpIt->first[0]),
-                            internal::ConvertToOSSIMFrame(gcpIt->first[1]));
-
-    // Fill geo point (lat, lon, elev)
-    geoPoint =  ossimGpt(gcpIt->second[1], gcpIt->second[0], gcpIt->second[2]);
-
-    // Add the sensor point to the list
-    sensorPoints.push_back(sensorPoint);
-
-    // Add the geo point to the list
-    geoPoints.push_back(geoPoint);
-    }
-
-  // Build the ossim rpc solver
-  ossimRefPtr<ossimRpcSolver> rpcSolver = new ossimRpcSolver(true, false);
-
-  // Call the solve method
-  rpcSolver->solveCoefficients(sensorPoints, geoPoints);
-
-  rmsError = rpcSolver->getRmsError();
-
-  // Retrieve the output RPC projection
-  ossimRefPtr<ossimRpcModel> rpcModel = dynamic_cast<ossimRpcModel*>(rpcSolver->createRpcModel()->getProjection());
-
-  // Compute projection
-  m_RpcProjection = dynamic_cast<ossimRpcProjection*>(
-                                                      rpcSolver->createRpcProjection()->getProjection());
-
-  // Add spacings
-  rpcModel->setMetersPerPixel( m_RpcProjection->getMetersPerPixel() );
-
-  // Export the sensor model in an ossimKeywordlist
-  ossimKeywordlist geom_kwl;
-  rpcModel->saveState(geom_kwl);
-
-  ossimKeywordlist kwl;
-  m_RpcProjection->saveState(kwl);
-
-  // Build an otb::ImageKeywordList
-  otb_kwl.SetKeywordlist(geom_kwl);
-}
-
-
-void
-RPCProjectionAdapter
-::AddGroundRect( ImageKeywordlist& otb_kwl,
-                 itk::Point<double, 2> orig, itk::Size<2> size)
-{
-  ossimGpt ul, ll, ur, lr;
-   // Upper left
-  ossimDpt imagePoint( internal::ConvertToOSSIMFrame(orig[0]),
-                       internal::ConvertToOSSIMFrame(orig[1]));
-  m_RpcProjection->lineSampleToWorld(imagePoint, ul);
-  // Upper right
-  imagePoint.x += static_cast<double>(size[0]) - 1.0;
-  m_RpcProjection->lineSampleToWorld(imagePoint, ur);
-  // Lower right
-  imagePoint.y += static_cast<double>(size[0]) - 1.0;
-  m_RpcProjection->lineSampleToWorld(imagePoint, lr);
-  // Lower left
-  imagePoint.x += - static_cast<double>(size[0]) + 1.0;
-  m_RpcProjection->lineSampleToWorld(imagePoint, ll);
-
-
-  ossimKeywordlist geom_kwl;
-  otb_kwl.convertToOSSIMKeywordlist(geom_kwl);
-
-  ossimRefPtr<ossimRpcModel> rpcModel = new ossimRpcModel;
-  rpcModel->loadState( geom_kwl );
-  rpcModel->setGroundRect(ul, ur, lr, ll);
-  rpcModel->saveState(geom_kwl);
-  otb_kwl.SetKeywordlist(geom_kwl);
-}
-
-
-} // namespace otb
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbRPCSolverAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbRPCSolverAdapter.cxx
index c54c8d8..d20e208 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbRPCSolverAdapter.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbRPCSolverAdapter.cxx
@@ -20,10 +20,23 @@
 #include "otbImageKeywordlist.h"
 #include "otbMacro.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/projection/ossimRpcSolver.h"
 #include "ossim/projection/ossimProjection.h"
 #include "ossim/projection/ossimRpcProjection.h"
 #include "ossim/imaging/ossimImageGeometry.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/projection/ossimRpcSolver.h"
+#include "ossim/projection/ossimProjection.h"
+#include "ossim/projection/ossimRpcProjection.h"
+#include "ossim/imaging/ossimImageGeometry.h"
+#endif
+
 
 namespace otb
 {
diff --git a/Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx
index ea77605..8f9ef69 100644
--- a/Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx
+++ b/Modules/Adapters/OSSIMAdapters/src/otbSensorModelAdapter.cxx
@@ -23,6 +23,11 @@
 #include "otbMacro.h"
 #include "otbImageKeywordlist.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wshadow"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
 #include "ossim/projection/ossimProjection.h"
 #include "ossim/projection/ossimSensorModelFactory.h"
 #include "ossim/projection/ossimSensorModel.h"
@@ -30,6 +35,18 @@
 #include "ossim/ossimPluginProjectionFactory.h"
 #include "ossim/base/ossimTieGptSet.h"
 
+#pragma GCC diagnostic pop
+#else
+#include "ossim/projection/ossimProjection.h"
+#include "ossim/projection/ossimSensorModelFactory.h"
+#include "ossim/projection/ossimSensorModel.h"
+#include "ossim/projection/ossimRpcProjection.h"
+#include "ossim/ossimPluginProjectionFactory.h"
+#include "ossim/base/ossimTieGptSet.h"
+
+#endif
+
+
 namespace otb
 {
 
@@ -201,17 +218,17 @@ double SensorModelAdapter::Optimize()
   if(m_SensorModel != NULL)
     {
     // try to retrieve a sensor model
-    
+
     ossimSensorModel * sensorModel = NULL;
 	sensorModel = dynamic_cast<ossimSensorModel *>(m_SensorModel);
-    
+
     ossimRpcProjection * simpleRpcModel = NULL;
     simpleRpcModel = dynamic_cast<ossimRpcProjection *>(m_SensorModel);
-    
+
      //Handle expections
 	 if ( (sensorModel == NULL ) && (simpleRpcModel == NULL ) )
 		itkExceptionMacro(<< "Optimize(): error, both dynamic_cast from ossimProjection* to ossimSensorModel* / ossimRpcProjection* failed.");
-    
+
 
     if(sensorModel != NULL )
       {
@@ -223,8 +240,8 @@ double SensorModelAdapter::Optimize()
 		  	// Call optimize fit
 			precision  = simpleRpcModel->optimizeFit(*m_TiePoints);
 	  }
-		
-	
+
+
     }
 
   // Return the precision
@@ -255,10 +272,10 @@ bool SensorModelAdapter::WriteGeomFile(const std::string & outfile)
     // try to retrieve a sensor model
     ossimSensorModel * sensorModel = NULL;
     sensorModel = dynamic_cast<ossimSensorModel *>(m_SensorModel);
-    
+
     ossimRpcProjection * simpleRpcModel = NULL;
     simpleRpcModel = dynamic_cast<ossimRpcProjection *>(m_SensorModel);
-    
+
 	//Handle expections
 	if ( (sensorModel == NULL ) && (simpleRpcModel == NULL ) )
 		itkExceptionMacro(<< "Optimize(): error, both dynamic_cast from ossimProjection* to ossimSensorModel* / ossimRpcProjection* failed.");
@@ -276,8 +293,8 @@ bool SensorModelAdapter::WriteGeomFile(const std::string & outfile)
 			// Save state
 			success = simpleRpcModel->saveState(geom);
 	  }
-    
-    
+
+
     if(success)
       {
 			return geom.write(outfile.c_str());
diff --git a/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt b/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt
index d116087..42440cd 100644
--- a/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt
+++ b/Modules/Adapters/OSSIMAdapters/test/CMakeLists.txt
@@ -441,6 +441,7 @@ otb_add_test(NAME uaTvDEMHandler_AboveEllipsoid_SRTM_BadGeoid COMMAND otbOSSIMAd
   339.513
   0.001
   )
+set_property(TEST uaTvDEMHandler_AboveEllipsoid_SRTM_BadGeoid PROPERTY WILL_FAIL true)
 
 otb_add_test(NAME uaTvDEMHandler_AboveMSL_SRTM_NoGeoid_NoData COMMAND otbOSSIMAdaptersTestDriver
   otbDEMHandlerTest
diff --git a/Modules/Adapters/OSSIMAdapters/test/otbDEMHandlerTest.cxx b/Modules/Adapters/OSSIMAdapters/test/otbDEMHandlerTest.cxx
index 9987db6..09ab37c 100644
--- a/Modules/Adapters/OSSIMAdapters/test/otbDEMHandlerTest.cxx
+++ b/Modules/Adapters/OSSIMAdapters/test/otbDEMHandlerTest.cxx
@@ -59,7 +59,19 @@ int otbDEMHandlerTest(int argc, char * argv[])
 
   if(geoid != "no")
     {
-    demHandler->OpenGeoidFile(geoid);
+    try
+      {
+      demHandler->OpenGeoidFile(geoid);
+      }
+    catch( const std::exception & exception )
+      {
+      std::cout
+	<< "Exception thrown while opening geod-file '" << geoid << "':" << std::endl
+	<< exception.what();
+
+      fail = true;
+      }
+
     std::cout<<"GetGeoidFile() = "<<demHandler->GetGeoidFile()<<std::endl;
     }
 
diff --git a/Modules/Adapters/OSSIMAdapters/test/otbImageKeywordlist.cxx b/Modules/Adapters/OSSIMAdapters/test/otbImageKeywordlist.cxx
index c220934..130d128 100644
--- a/Modules/Adapters/OSSIMAdapters/test/otbImageKeywordlist.cxx
+++ b/Modules/Adapters/OSSIMAdapters/test/otbImageKeywordlist.cxx
@@ -24,9 +24,22 @@
 #include "otbImageKeywordlist.h"
 
 #include "ossim/base/ossimKeywordlist.h"
+
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include "ossim/projection/ossimProjection.h"
 #include "ossim/projection/ossimProjectionFactoryRegistry.h"
 #include "ossim/base/ossimFilename.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/projection/ossimProjection.h"
+#include "ossim/projection/ossimProjectionFactoryRegistry.h"
+#include "ossim/base/ossimFilename.h"
+#endif
+
+
 
 #include "ossim/ossimPluginProjectionFactory.h"
 
diff --git a/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest2.cxx b/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest2.cxx
index 131d07c..a0a4d9c 100644
--- a/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest2.cxx
+++ b/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest2.cxx
@@ -19,8 +19,18 @@
 #include <fstream>
 #include <cstdlib>
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/elevation/ossimElevManager.h"
 #include "ossim/base/ossimFilename.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/elevation/ossimElevManager.h"
+#include "ossim/base/ossimFilename.h"
+#endif
 
 #include "itkPoint.h"
 
diff --git a/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest4.cxx b/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest4.cxx
index 3ae4b62..438d091 100644
--- a/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest4.cxx
+++ b/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest4.cxx
@@ -20,8 +20,18 @@
 #include <fstream>
 #include <sstream>
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/elevation/ossimElevManager.h"
 #include "ossim/base/ossimFilename.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/elevation/ossimElevManager.h"
+#include "ossim/base/ossimFilename.h"
+#endif
 
 int otbOssimElevManagerTest4(int argc, char* argv[])
 {
diff --git a/Modules/Adapters/OSSIMAdapters/test/otbOssimJpegFileRessourceLeakTest.cxx b/Modules/Adapters/OSSIMAdapters/test/otbOssimJpegFileRessourceLeakTest.cxx
index 4376479..108d2b6 100644
--- a/Modules/Adapters/OSSIMAdapters/test/otbOssimJpegFileRessourceLeakTest.cxx
+++ b/Modules/Adapters/OSSIMAdapters/test/otbOssimJpegFileRessourceLeakTest.cxx
@@ -18,9 +18,21 @@
 #include <stdlib.h>
 #include <iostream>
 
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
+#include <ossim/imaging/ossimImageHandler.h>
+#include <ossim/imaging/ossimImageHandlerRegistry.h>
+#include <ossim/base/ossimFilename.h>
+#pragma GCC diagnostic pop
+#else
 #include <ossim/imaging/ossimImageHandler.h>
 #include <ossim/imaging/ossimImageHandlerRegistry.h>
 #include <ossim/base/ossimFilename.h>
+#endif
 
 // This test demonstrate that handler->close() does not release the file descriptor for jpeg files.
 
diff --git a/Modules/Applications/AppClassification/app/CMakeLists.txt b/Modules/Applications/AppClassification/app/CMakeLists.txt
index 7613f5a..692aa71 100644
--- a/Modules/Applications/AppClassification/app/CMakeLists.txt
+++ b/Modules/Applications/AppClassification/app/CMakeLists.txt
@@ -65,16 +65,19 @@ otb_create_application(
   SOURCES        otbKMeansClassification.cxx
   LINK_LIBRARIES ${${otb-module}_LIBRARIES})
 
-set(TrainImagesClassifier_SRC 
-  otbTrainSVM.cxx  otbTrainBoost.cxx otbTrainDecisionTree.cxx
-  otbTrainGradientBoostedTree.cxx otbTrainNeuralNetwork.cxx
-  otbTrainNormalBayes.cxx otbTrainRandomForests.cxx otbTrainKNN.cxx
-  otbTrainLibSVM.cxx
-  otbTrainImagesClassifier.cxx)
-
 otb_create_application(
   NAME           TrainImagesClassifier
-  SOURCES        ${TrainImagesClassifier_SRC}
+  SOURCES        otbTrainImagesClassifier.cxx
+  LINK_LIBRARIES ${${otb-module}_LIBRARIES})
+
+otb_create_application(
+  NAME           TrainRegression
+  SOURCES        otbTrainRegression.cxx
+  LINK_LIBRARIES ${${otb-module}_LIBRARIES})
+
+otb_create_application(
+  NAME           PredictRegression
+  SOURCES        otbPredictRegression.cxx
   LINK_LIBRARIES ${${otb-module}_LIBRARIES})
 
 otb_create_application(
diff --git a/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx b/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx
index 1ecd2c9..4e000cd 100644
--- a/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx
+++ b/Modules/Applications/AppClassification/app/otbClassificationMapRegularization.cxx
@@ -78,7 +78,7 @@ private:
 
     AddParameter(ParameterType_OutputImage, "io.out",  "Output regularized image");
     SetParameterDescription( "io.out", "The output regularized labeled image.");
-    SetParameterOutputImagePixelType( "io.out", ImagePixelType_uint8);
+    SetDefaultOutputPixelType( "io.out", ImagePixelType_uint8);
 
 
     AddParameter(ParameterType_Group,"ip","Regularization parameters");
diff --git a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx
index a2dac49..f48ec15 100644
--- a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx
+++ b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx
@@ -140,7 +140,7 @@ private:
         variance[itBand] += (size[0] * size[1] - 1) * (statsEstimator->GetCovariance())(itBand, itBand);
         }
       //Increment nbSamples
-      nbSamples += size[0] * size[1] * nbBands;
+      nbSamples += size[0] * size[1];
       }
 
     //Divide by the number of input images to get the mean over all layers
diff --git a/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx
index 10c2b51..096a70c 100644
--- a/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx
+++ b/Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx
@@ -54,10 +54,10 @@ private:
     SetDocSeeAlso("OGRLayerClassifier,TrainOGRLayersClassifier");
     AddDocTag(Tags::Segmentation);
 
-    AddParameter(ParameterType_InputFilename, "inshp", "Name of the input shapefile");
+    AddParameter(ParameterType_InputVectorData, "inshp", "Name of the input shapefile");
     SetParameterDescription("inshp","Name of the input shapefile");
 
-    AddParameter(ParameterType_InputFilename, "outstats", "XML file containing mean and variance of each feature.");
+    AddParameter(ParameterType_OutputFilename, "outstats", "XML file containing mean and variance of each feature.");
     SetParameterDescription("outstats", "XML file containing mean and variance of each feature.");
 
     AddParameter(ParameterType_ListView,  "feat", "List of features to consider for statistics.");
diff --git a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx
index e2920b3..2f8a942 100644
--- a/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx
+++ b/Modules/Applications/AppClassification/app/otbDSFuzzyModelEstimation.cxx
@@ -166,7 +166,7 @@ private:
     MandatoryOff("optobs");
 
     AddParameter(ParameterType_OutputFilename,"out","Output filename");
-    SetParameterDescription("out","Output model file name (xml file) contains the optimal model to perform informations fusion.");
+    SetParameterDescription("out","Output model file name (xml file) contains the optimal model to perform information fusion.");
 
     // Doc example parameter settings
     SetDocExampleParameterValue("psin", "cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp");
diff --git a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx
index 848d41b..f518994 100644
--- a/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx
+++ b/Modules/Applications/AppClassification/app/otbFusionOfClassifications.cxx
@@ -156,6 +156,7 @@ private:
 
     AddParameter(ParameterType_OutputImage,"out","The output classification image");
     SetParameterDescription("out","The output classification image resulting from the fusion of the input classification images.");
+    SetDefaultOutputPixelType("out",ImagePixelType_uint8);
 
     // Doc example parameter settings
     SetDocExampleParameterValue("il", "classification1.tif classification2.tif classification3.tif");
diff --git a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx b/Modules/Applications/AppClassification/app/otbImageClassifier.cxx
index 07a8a35..ba23a0d 100644
--- a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx
+++ b/Modules/Applications/AppClassification/app/otbImageClassifier.cxx
@@ -59,6 +59,7 @@ public:
   typedef ClassificationFilterType::ValueType                                                  ValueType;
   typedef ClassificationFilterType::LabelType                                                  LabelType;
   typedef otb::MachineLearningModelFactory<ValueType, LabelType>                               MachineLearningModelFactoryType;
+  typedef ClassificationFilterType::ConfidenceImageType                                        ConfidenceImageType;
 
 private:
   void DoInit()
@@ -92,7 +93,22 @@ private:
 
     AddParameter(ParameterType_OutputImage, "out",  "Output Image");
     SetParameterDescription( "out", "Output image containing class labels");
-    SetParameterOutputImagePixelType( "out", ImagePixelType_uint8);
+    SetDefaultOutputPixelType( "out", ImagePixelType_uint8);
+
+    AddParameter(ParameterType_OutputImage, "confmap",  "Confidence map");
+    SetParameterDescription( "confmap", "Confidence map of the produced classification. The confidence index depends on the model : \n"
+      "  - LibSVM : difference between the two highest probabilities (needs a model with probability estimates, so that classes probabilities can be computed for each sample)\n"
+      "  - OpenCV\n"
+      "    * Boost : sum of votes\n"
+      "    * DecisionTree : (not supported)\n"
+      "    * GradientBoostedTree : (not supported)\n"
+      "    * KNearestNeighbors : number of neighbors with the same label\n"
+      "    * NeuralNetwork : difference between the two highest responses\n"
+      "    * NormalBayes : (not supported)\n"
+      "    * RandomForest : Confidence (proportion of votes for the majority class). Margin (normalized difference of the votes of the 2 majority classes) is not available for now.\n"
+      "    * SVM : distance to margin (only works for 2-class models)\n");
+    SetDefaultOutputPixelType( "confmap", ImagePixelType_double);
+    MandatoryOff("confmap");
 
     AddRAMParameter();
 
@@ -171,6 +187,21 @@ private:
       }
 
     SetParameterOutputImage<OutputImageType>("out", m_ClassificationFilter->GetOutput());
+
+    // output confidence map
+    if (IsParameterEnabled("confmap") && HasValue("confmap"))
+      {
+      m_ClassificationFilter->SetUseConfidenceMap(true);
+      if (m_Model->HasConfidenceIndex())
+        {
+        SetParameterOutputImage<ConfidenceImageType>("confmap",m_ClassificationFilter->GetOutputConfidence());
+        }
+      else
+        {
+        otbAppLogWARNING("Confidence map requested but the classifier doesn't support it!");
+        this->DisableParameter("confmap");
+        }
+      }
   }
 
   ClassificationFilterType::Pointer m_ClassificationFilter;
diff --git a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
index 4844205..c7ba58f 100644
--- a/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
+++ b/Modules/Applications/AppClassification/app/otbKMeansClassification.cxx
@@ -181,6 +181,7 @@ private:
     SetParameterDescription("in", "Input image to classify.");
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription("out", "Output image containing the class indexes.");
+    SetDefaultOutputPixelType("out",ImagePixelType_uint8);
 
     AddRAMParameter();
 
diff --git a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx
index 21cdb07..0eda56b 100644
--- a/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx
+++ b/Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx
@@ -63,7 +63,7 @@ private:
     SetDocSeeAlso("ComputeOGRLayersFeaturesStatistics,TrainOGRLayersClassifier");
     AddDocTag(Tags::Segmentation);
   
-    AddParameter(ParameterType_InputFilename, "inshp", "Name of the input shapefile");
+    AddParameter(ParameterType_InputVectorData, "inshp", "Name of the input shapefile");
     SetParameterDescription("inshp","Name of the input shapefile");
 
     AddParameter(ParameterType_InputFilename, "instats", "XML file containing mean and variance of each feature.");
@@ -122,8 +122,8 @@ private:
 
   void DoExecute()
   {
-	  
-	#ifdef OTB_USE_LIBSVM 
+      
+    #ifdef OTB_USE_LIBSVM 
     clock_t tic = clock();
 
     std::string shapefile = GetParameterString("inshp").c_str();
@@ -221,8 +221,8 @@ private:
     otbAppLogINFO( "Elapsed: "<< ((double)(toc - tic) / CLOCKS_PER_SEC)<<" seconds.");
         
     #else
-	otbAppLogFATAL("Module LIBSVM is not installed. You should consider turning OTB_USE_LIBSVM on during cmake configuration.");
-	#endif
+    otbAppLogFATAL("Module LIBSVM is not installed. You should consider turning OTB_USE_LIBSVM on during cmake configuration.");
+    #endif
     
   }
 
diff --git a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx b/Modules/Applications/AppClassification/app/otbPredictRegression.cxx
similarity index 53%
copy from Modules/Applications/AppClassification/app/otbImageClassifier.cxx
copy to Modules/Applications/AppClassification/app/otbPredictRegression.cxx
index 07a8a35..413d70f 100644
--- a/Modules/Applications/AppClassification/app/otbImageClassifier.cxx
+++ b/Modules/Applications/AppClassification/app/otbPredictRegression.cxx
@@ -18,6 +18,7 @@
 #include "otbWrapperApplication.h"
 #include "otbWrapperApplicationFactory.h"
 
+#include "itkUnaryFunctorImageFilter.h"
 #include "otbChangeLabelImageFilter.h"
 #include "otbStandardWriterWatcher.h"
 #include "otbStatisticsXMLFileReader.h"
@@ -29,14 +30,52 @@
 
 namespace otb
 {
+namespace Functor
+{
+/**
+ * simple affine function : y = ax+b
+ */
+template<class TInput, class TOutput>
+class AffineFunctor
+{
+public:
+  typedef double InternalType;
+  
+  // constructor
+  AffineFunctor() : m_A(1.0),m_B(0.0) {}
+  
+  // destructor
+  virtual ~AffineFunctor() {}
+  
+  void SetA(InternalType a)
+    {
+    m_A = a;
+    }
+  
+  void SetB(InternalType b)
+    {
+    m_B = b;
+    }
+  
+  inline TOutput operator()(const TInput & x) const
+    {
+    return static_cast<TOutput>( static_cast<InternalType>(x)*m_A + m_B);
+    }
+private:
+  InternalType m_A;
+  InternalType m_B;
+};
+  
+}
+
 namespace Wrapper
 {
 
-class ImageClassifier : public Application
+class PredictRegression : public Application
 {
 public:
   /** Standard class typedefs. */
-  typedef ImageClassifier            Self;
+  typedef PredictRegression             Self;
   typedef Application                   Superclass;
   typedef itk::SmartPointer<Self>       Pointer;
   typedef itk::SmartPointer<const Self> ConstPointer;
@@ -44,15 +83,18 @@ public:
   /** Standard macro */
   itkNewMacro(Self);
 
-  itkTypeMacro(ImageClassifier, otb::Application);
+  itkTypeMacro(PredictRegression, otb::Application);
 
   /** Filters typedef */
-  typedef UInt16ImageType                                                                      OutputImageType;
   typedef UInt8ImageType                                                                       MaskImageType;
   typedef itk::VariableLengthVector<FloatVectorImageType::InternalPixelType>                   MeasurementType;
   typedef otb::StatisticsXMLFileReader<MeasurementType>                                        StatisticsReader;
   typedef otb::ShiftScaleVectorImageFilter<FloatVectorImageType, FloatVectorImageType>         RescalerType;
-  typedef otb::ImageClassificationFilter<FloatVectorImageType, OutputImageType, MaskImageType> ClassificationFilterType;
+  typedef itk::UnaryFunctorImageFilter<
+      FloatImageType,
+      FloatImageType,
+      otb::Functor::AffineFunctor<float,float> >                                               OutputRescalerType;
+  typedef otb::ImageClassificationFilter<FloatVectorImageType, FloatImageType, MaskImageType>  ClassificationFilterType;
   typedef ClassificationFilterType::Pointer                                                    ClassificationFilterPointerType;
   typedef ClassificationFilterType::ModelType                                                  ModelType;
   typedef ModelType::Pointer                                                                   ModelPointerType;
@@ -63,36 +105,61 @@ public:
 private:
   void DoInit()
   {
-    SetName("ImageClassifier");
-    SetDescription("Performs a classification of the input image according to a model file.");
+    SetName("PredictRegression");
+    SetDescription("Performs a prediction of the input image according to a regression model file.");
 
     // Documentation
-    SetDocName("Image Classification");
-    SetDocLongDescription("This application performs an image classification based on a model file produced by the TrainImagesClassifier application. Pixels of the output image will contain the class labels decided by the classifier (maximal class label = 65535). The input pixels can be optionally centered and reduced according to the statistics file produced by the ComputeImagesStatistics application. An optional input mask can be provided, in which case only input image pixels whose co [...]
-
-    SetDocLimitations("The input image must have the same type, order and number of bands than the images used to produce the statistics file and the SVM model file. If a statistics file was used during training by the TrainImagesClassifier, it is mandatory to use the same statistics file for classification. If an input mask is used, its size must match the input image size.");
+    SetDocName("Predict Regression");
+    SetDocLongDescription("This application predict output values from an input"
+                          " image, based on a regression model file produced by"
+                          " the TrainRegression application. Pixels of the "
+                          "output image will contain the predicted values from"
+                          "the regression model (single band). The input pixels"
+                          " can be optionally centered and reduced according "
+                          "to the statistics file produced by the "
+                          "ComputeImagesStatistics application. An optional "
+                          "input mask can be provided, in which case only "
+                          "input image pixels whose corresponding mask value "
+                          "is greater than 0 will be processed. The remaining"
+                          " of pixels will be given the value 0 in the output"
+                          " image.");
+
+    SetDocLimitations("The input image must contain the feature bands used for"
+                      " the model training (without the predicted value). "
+                      "If a statistics file was used during training by the "
+                      "TrainRegression, it is mandatory to use the same "
+                      "statistics file for prediction. If an input mask is "
+                      "used, its size must match the input image size.");
     SetDocAuthors("OTB-Team");
-    SetDocSeeAlso("TrainImagesClassifier, ValidateImagesClassifier, ComputeImagesStatistics");
+    SetDocSeeAlso("TrainRegression, ComputeImagesStatistics");
 
     AddDocTag(Tags::Learning);
 
     AddParameter(ParameterType_InputImage, "in",  "Input Image");
-    SetParameterDescription( "in", "The input image to classify.");
+    SetParameterDescription( "in", "The input image to predict.");
+
+    // TODO : use CSV input/output ?
 
     AddParameter(ParameterType_InputImage,  "mask",   "Input Mask");
-    SetParameterDescription( "mask", "The mask allows to restrict classification of the input image to the area where mask pixel values are greater than 0.");
+    SetParameterDescription( "mask", "The mask allows to restrict "
+      "classification of the input image to the area where mask pixel values "
+      "are greater than 0.");
     MandatoryOff("mask");
 
     AddParameter(ParameterType_InputFilename, "model", "Model file");
-    SetParameterDescription("model", "A model file (produced by TrainImagesClassifier application, maximal class label = 65535).");
+    SetParameterDescription("model", "A regression model file (produced by "
+      "TrainRegression application).");
 
     AddParameter(ParameterType_InputFilename, "imstat", "Statistics file");
-    SetParameterDescription("imstat", "A XML file containing mean and standard deviation to center and reduce samples before classification (produced by ComputeImagesStatistics application).");
+    SetParameterDescription("imstat", "A XML file containing mean and standard"
+      " deviation to center and reduce samples before prediction "
+      "(produced by ComputeImagesStatistics application). If this file contains"
+      "one more band than the sample size, the last stat of last band will be"
+      "applied to expand the output predicted value");
     MandatoryOff("imstat");
 
     AddParameter(ParameterType_OutputImage, "out",  "Output Image");
-    SetParameterDescription( "out", "Output image containing class labels");
-    SetParameterOutputImagePixelType( "out", ImagePixelType_uint8);
+    SetParameterDescription( "out", "Output image containing predicted values");
 
     AddRAMParameter();
 
@@ -113,6 +180,7 @@ private:
     // Load input image
     FloatVectorImageType::Pointer inImage = GetParameterImage("in");
     inImage->UpdateOutputInformation();
+    unsigned int nbFeatures = inImage->GetNumberOfComponentsPerPixel();
 
     // Load svm model
     otbAppLogINFO("Loading model");
@@ -125,28 +193,47 @@ private:
       }
 
     m_Model->Load(GetParameterString("model"));
+    m_Model->SetRegressionMode(true);
     otbAppLogINFO("Model loaded");
 
-    // Normalize input image (optional)
-    StatisticsReader::Pointer  statisticsReader = StatisticsReader::New();
-    MeasurementType  meanMeasurementVector;
-    MeasurementType  stddevMeasurementVector;
-    m_Rescaler = RescalerType::New();
-
     // Classify
     m_ClassificationFilter = ClassificationFilterType::New();
     m_ClassificationFilter->SetModel(m_Model);
+    
+    FloatImageType::Pointer outputImage = m_ClassificationFilter->GetOutput();
 
     // Normalize input image if asked
     if(IsParameterEnabled("imstat")  )
       {
       otbAppLogINFO("Input image normalization activated.");
+      // Normalize input image (optional)
+      StatisticsReader::Pointer  statisticsReader = StatisticsReader::New();
+      MeasurementType  meanMeasurementVector;
+      MeasurementType  stddevMeasurementVector;
+      m_Rescaler = RescalerType::New();
       // Load input image statistics
       statisticsReader->SetFileName(GetParameterString("imstat"));
       meanMeasurementVector   = statisticsReader->GetStatisticVectorByName("mean");
       stddevMeasurementVector = statisticsReader->GetStatisticVectorByName("stddev");
       otbAppLogINFO( "mean used: " << meanMeasurementVector );
       otbAppLogINFO( "standard deviation used: " << stddevMeasurementVector );
+      if (meanMeasurementVector.Size() == nbFeatures + 1)
+        {
+        double outMean = meanMeasurementVector[nbFeatures];
+        double outStdDev = stddevMeasurementVector[nbFeatures];
+        meanMeasurementVector.SetSize(nbFeatures,false);
+        stddevMeasurementVector.SetSize(nbFeatures,false);
+        m_OutRescaler = OutputRescalerType::New();
+        m_OutRescaler->SetInput(m_ClassificationFilter->GetOutput());
+        m_OutRescaler->GetFunctor().SetA(outStdDev);
+        m_OutRescaler->GetFunctor().SetB(outMean);
+        outputImage = m_OutRescaler->GetOutput();
+        }
+      else if (meanMeasurementVector.Size() != nbFeatures)
+        {
+        otbAppLogFATAL("Wrong number of components in statistics file : "<<meanMeasurementVector.Size());
+        }
+        
       // Rescale vector image
       m_Rescaler->SetScale(stddevMeasurementVector);
       m_Rescaler->SetShift(meanMeasurementVector);
@@ -170,16 +257,19 @@ private:
       m_ClassificationFilter->SetInputMask(inMask);
       }
 
-    SetParameterOutputImage<OutputImageType>("out", m_ClassificationFilter->GetOutput());
+    SetParameterOutputImage<FloatImageType>("out", outputImage);
+
   }
 
   ClassificationFilterType::Pointer m_ClassificationFilter;
   ModelPointerType m_Model;
   RescalerType::Pointer m_Rescaler;
+  OutputRescalerType::Pointer m_OutRescaler;
+
 };
 
 
 }
 }
 
-OTB_APPLICATION_EXPORT(otb::Wrapper::ImageClassifier)
+OTB_APPLICATION_EXPORT(otb::Wrapper::PredictRegression)
diff --git a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx
index 9d9dd94..5e3daf1 100644
--- a/Modules/Applications/AppClassification/app/otbSOMClassification.cxx
+++ b/Modules/Applications/AppClassification/app/otbSOMClassification.cxx
@@ -87,6 +87,7 @@ private:
 
     AddParameter(ParameterType_OutputImage,  "out",   "OutputImage");
     SetParameterDescription("out", "Output classified image (each pixel contains the index of its corresponding vector in the SOM).");
+    SetDefaultOutputPixelType("out",ImagePixelType_uint8);
 
     AddParameter(ParameterType_InputImage,  "vm",   "ValidityMask");
     SetParameterDescription("vm", "Validity mask (only pixels corresponding to a mask value greater than 0 will be used for learning)");
diff --git a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx
index 1b9358f..de1520d 100644
--- a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx
+++ b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.cxx
@@ -14,15 +14,95 @@
  PURPOSE.  See the above copyright notices for more information.
 
  =========================================================================*/
+#include "otbLearningApplicationBase.h"
+#include "otbWrapperApplicationFactory.h"
 
-#include "otbTrainImagesClassifier.h"
+#include "otbListSampleGenerator.h"
+
+// Statistic XML Reader
+#include "otbStatisticsXMLFileReader.h"
+
+// Validation
+#include "otbConfusionMatrixCalculator.h"
+
+#include "itkTimeProbe.h"
+#include "otbStandardFilterWatcher.h"
+
+// Normalize the samples
+#include "otbShiftScaleSampleListFilter.h"
+
+// List sample concatenation
+#include "otbConcatenateSampleListFilter.h"
+
+// Balancing ListSample
+#include "otbListSampleToBalancedListSampleFilter.h"
+
+// VectorData projection filter
+
+// Extract a ROI of the vectordata
+#include "otbVectorDataIntoImageProjectionFilter.h"
+
+// Elevation handler
+#include "otbWrapperElevationParametersHandler.h"
 
 namespace otb
 {
 namespace Wrapper
 {
 
-void TrainImagesClassifier::DoInit()
+class TrainImagesClassifier: public LearningApplicationBase<float,int>
+{
+public:
+  /** Standard class typedefs. */
+  typedef TrainImagesClassifier Self;
+  typedef LearningApplicationBase<float,int> Superclass;
+  typedef itk::SmartPointer<Self> Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+
+  /** Standard macro */
+  itkNewMacro(Self)
+
+  itkTypeMacro(TrainImagesClassifier, otb::Wrapper::LearningApplicationBase)
+  
+  typedef Superclass::SampleType              SampleType;
+  typedef Superclass::ListSampleType          ListSampleType;
+  typedef Superclass::TargetSampleType        TargetSampleType;
+  typedef Superclass::TargetListSampleType    TargetListSampleType;
+  
+  typedef Superclass::SampleImageType         SampleImageType;
+  typedef SampleImageType::PixelType          PixelType;
+
+  // SampleList manipulation
+  typedef otb::ListSampleGenerator<SampleImageType, VectorDataType> ListSampleGeneratorType;
+
+  typedef otb::Statistics::ConcatenateSampleListFilter<ListSampleType> ConcatenateListSampleFilterType;
+  typedef otb::Statistics::ConcatenateSampleListFilter<TargetListSampleType> ConcatenateLabelListSampleFilterType;
+
+  // Statistic XML file Reader
+  typedef otb::StatisticsXMLFileReader<SampleType> StatisticsReader;
+
+  // Enhance List Sample  typedef otb::Statistics::ListSampleToBalancedListSampleFilter<ListSampleType, LabelListSampleType>      BalancingListSampleFilterType;
+  typedef otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType> ShiftScaleFilterType;
+ 
+  // Estimate performance on validation sample
+  typedef otb::ConfusionMatrixCalculator<TargetListSampleType, TargetListSampleType> ConfusionMatrixCalculatorType;
+  typedef ConfusionMatrixCalculatorType::ConfusionMatrixType ConfusionMatrixType;
+  typedef ConfusionMatrixCalculatorType::MapOfIndicesType MapOfIndicesType;
+  typedef ConfusionMatrixCalculatorType::ClassLabelType ClassLabelType;
+
+  // VectorData projection filter
+  typedef otb::VectorDataProjectionFilter<VectorDataType, VectorDataType> VectorDataProjectionFilterType;
+
+  // Extract ROI
+  typedef otb::VectorDataIntoImageProjectionFilter<VectorDataType, SampleImageType> VectorDataReprojectionType;
+
+protected:
+  //using Superclass::AddParameter;
+  //friend void InitSVMParams(TrainImagesClassifier & app);
+
+private:
+  
+void DoInit()
 {
   SetName("TrainImagesClassifier");
   SetDescription(
@@ -46,8 +126,6 @@ void TrainImagesClassifier::DoInit()
   SetDocAuthors("OTB-Team");
   SetDocSeeAlso("OpenCV documentation for machine learning http://docs.opencv.org/modules/ml/doc/ml.html ");
 
-  AddDocTag(Tags::Learning);
-
   //Group IO
   AddParameter(ParameterType_Group, "io", "Input and output data");
   SetParameterDescription("io", "This group of parameters allows to set input and output data.");
@@ -101,24 +179,7 @@ void TrainImagesClassifier::DoInit()
   SetParameterDescription("sample.vfn", "Name of the field used to discriminate class labels in the input vector data files.");
   SetParameterString("sample.vfn", "Class");
 
-  AddParameter(ParameterType_Choice, "classifier", "Classifier to use for the training");
-  SetParameterDescription("classifier", "Choice of the classifier to use for the training.");
-
-  //Group LibSVM
-#ifdef OTB_USE_LIBSVM 
-  InitLibSVMParams();
-#endif
-
-#ifdef OTB_USE_OPENCV
-  InitSVMParams();
-  InitBoostParams();
-  InitDecisionTreeParams();
-  InitGradientBoostedTreeParams();
-  InitNeuralNetworkParams();
-  InitNormalBayesParams();
-  InitRandomForestsParams();
-  InitKNNParams();
-#endif
+  Superclass::DoInit();
 
   AddRANDParameter();
   // Doc example parameter settings
@@ -136,15 +197,14 @@ void TrainImagesClassifier::DoInit()
   SetDocExampleParameterValue("classifier.libsvm.opt", "false");
   SetDocExampleParameterValue("io.out", "svmModelQB1.txt");
   SetDocExampleParameterValue("io.confmatout", "svmConfusionMatrixQB1.csv");
-}
+}  
 
-void TrainImagesClassifier::DoUpdateParameters()
+void DoUpdateParameters()
 {
   // Nothing to do here : all parameters are independent
 }
 
-
-void TrainImagesClassifier::LogConfusionMatrix(ConfusionMatrixCalculatorType* confMatCalc)
+void LogConfusionMatrix(ConfusionMatrixCalculatorType* confMatCalc)
 {
   ConfusionMatrixCalculatorType::ConfusionMatrixType matrix = confMatCalc->GetConfusionMatrix();
 
@@ -215,24 +275,7 @@ void TrainImagesClassifier::LogConfusionMatrix(ConfusionMatrixCalculatorType* co
   otbAppLogINFO("Confusion matrix (rows = reference labels, columns = produced labels):\n" << os.str());
 }
 
-void TrainImagesClassifier::Classify(ListSampleType::Pointer validationListSample, LabelListSampleType::Pointer predictedList)
-{
-  //Classification
-  ModelPointerType model = MachineLearningModelFactoryType::CreateMachineLearningModel(GetParameterString("io.out"),
-                                                                                       MachineLearningModelFactoryType::ReadMode);
-
-  if (model.IsNull())
-    {
-    otbAppLogFATAL(<< "Error when loading model " << GetParameterString("io.out"));
-    }
-
-  model->Load(GetParameterString("io.out"));
-  model->SetInputListSample(validationListSample);
-  model->SetTargetListSample(predictedList);
-  model->PredictAll();
-}
-
-void TrainImagesClassifier::DoExecute()
+void DoExecute()
 {
   GetLogger()->Debug("Entering DoExecute\n");
   //Create training and validation for list samples and label list samples
@@ -243,8 +286,8 @@ void TrainImagesClassifier::DoExecute()
     ConcatenateLabelListSampleFilterType::New();
   ConcatenateListSampleFilterType::Pointer concatenateValidationSamples = ConcatenateListSampleFilterType::New();
 
-  MeasurementType meanMeasurementVector;
-  MeasurementType stddevMeasurementVector;
+  SampleType meanMeasurementVector;
+  SampleType stddevMeasurementVector;
 
   //--------------------------
   // Load measurements from images
@@ -358,7 +401,7 @@ void TrainImagesClassifier::DoExecute()
     }
 
   ListSampleType::Pointer listSample;
-  LabelListSampleType::Pointer labelListSample;
+  TargetListSampleType::Pointer labelListSample;
   //--------------------------
   // Balancing training sample (if needed)
   // if (IsParameterEnabled("sample.b"))
@@ -384,9 +427,9 @@ void TrainImagesClassifier::DoExecute()
   //--------------------------
   // Split the data set into training/validation set
   ListSampleType::Pointer trainingListSample = listSample;
-  LabelListSampleType::Pointer trainingLabeledListSample = labelListSample;
+  TargetListSampleType::Pointer trainingLabeledListSample = labelListSample;
 
-  LabelListSampleType::Pointer validationLabeledListSample = concatenateValidationLabels->GetOutput();
+  TargetListSampleType::Pointer validationLabeledListSample = concatenateValidationLabels->GetOutput();
   otbAppLogINFO("Size of training set: " << trainingListSample->Size());
   otbAppLogINFO("Size of validation set: " << validationListSample->Size());
   otbAppLogINFO("Size of labeled training set: " << trainingLabeledListSample->Size());
@@ -395,88 +438,14 @@ void TrainImagesClassifier::DoExecute()
   //--------------------------
   // Estimate model
   //--------------------------
-  LabelListSampleType::Pointer predictedList = LabelListSampleType::New();
-  const std::string classifierType = GetParameterString("classifier");
-
-  if (classifierType == "libsvm")
-    {
-	#ifdef OTB_USE_LIBSVM
-    TrainLibSVM(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module LIBSVM is not installed. You should consider turning OTB_USE_LIBSVM on during cmake configuration.");
-    #endif
-    }
-  else if (classifierType == "svm")
-    {
-	#ifdef OTB_USE_OPENCV
-    TrainSVM(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
-    #endif
-    }
-  else if (classifierType == "boost")
-    {
-	#ifdef OTB_USE_OPENCV
-    TrainBoost(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
-    #endif
-    }
-  else if (classifierType == "dt")
-    {
-	#ifdef OTB_USE_OPENCV
-    TrainDecisionTree(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
-    #endif
-    }
-  else if (classifierType == "gbt")
-    {
-	#ifdef OTB_USE_OPENCV
-    TrainGradientBoostedTree(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
-    #endif
-    }
-  else if (classifierType == "ann")
-    {
-	#ifdef OTB_USE_OPENCV
-    TrainNeuralNetwork(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
-    #endif
-    }
-  else if (classifierType == "bayes")
-    {
-	#ifdef OTB_USE_OPENCV
-    TrainNormalBayes(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
-    #endif
-    }
-  else if (classifierType == "rf")
-    {
-	#ifdef OTB_USE_OPENCV
-    TrainRandomForests(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
-    #endif
-    }
-  else if (classifierType == "knn")
-    {
-	#ifdef OTB_USE_OPENCV
-    TrainKNN(trainingListSample, trainingLabeledListSample);
-    #else
-    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
-    #endif
-    }
-
+  this->Train(trainingListSample,trainingLabeledListSample,GetParameterString("io.out"));
 
   //--------------------------
   // Performances estimation
   //--------------------------
+  TargetListSampleType::Pointer predictedList = TargetListSampleType::New();
   ListSampleType::Pointer performanceListSample=ListSampleType::New();
-  LabelListSampleType::Pointer performanceLabeledListSample=LabelListSampleType::New();
+  TargetListSampleType::Pointer performanceLabeledListSample=TargetListSampleType::New();
 
   //Test the input validation set size
   if(validationLabeledListSample->Size() != 0)
@@ -491,7 +460,7 @@ void TrainImagesClassifier::DoExecute()
     performanceLabeledListSample = trainingLabeledListSample;
     }
 
-    Classify(performanceListSample, predictedList);
+    this->Classify(performanceListSample, predictedList, GetParameterString("io.out"));
 
     ConfusionMatrixCalculatorType::Pointer confMatCalc = ConfusionMatrixCalculatorType::New();
 
@@ -605,11 +574,12 @@ void TrainImagesClassifier::DoExecute()
       } // END if (this->HasValue("io.confmatout"))
 
   // TODO: implement hyperplane distance classifier and performance validation (cf. object detection) ?
-
 }
 
+  VectorDataReprojectionType::Pointer vdreproj;
+};
 
-}
-}
+} // end namespace Wrapper
+} // end namespace otb
 
 OTB_APPLICATION_EXPORT(otb::Wrapper::TrainImagesClassifier)
diff --git a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.h b/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.h
deleted file mode 100644
index 235613f..0000000
--- a/Modules/Applications/AppClassification/app/otbTrainImagesClassifier.h
+++ /dev/null
@@ -1,198 +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 "otbConfigure.h"
-
-#include "otbWrapperApplicationFactory.h"
-
-#include <iostream>
-
-//Image
-#include "otbVectorImage.h"
-#include "otbVectorData.h"
-#include "otbListSampleGenerator.h"
-
-// ListSample
-#include "itkVariableLengthVector.h"
-
-//Estimator
-#include "otbMachineLearningModelFactory.h"
-
-#ifdef OTB_USE_OPENCV
-# include "otbKNearestNeighborsMachineLearningModel.h"
-# include "otbRandomForestsMachineLearningModel.h"
-# include "otbSVMMachineLearningModel.h"
-# include "otbBoostMachineLearningModel.h"
-# include "otbDecisionTreeMachineLearningModel.h"
-# include "otbGradientBoostedTreeMachineLearningModel.h"
-# include "otbNormalBayesMachineLearningModel.h"
-# include "otbNeuralNetworkMachineLearningModel.h"
-#endif
-
-#ifdef OTB_USE_LIBSVM 
-#include "otbLibSVMMachineLearningModel.h"
-#endif
-
-// Statistic XML Reader
-#include "otbStatisticsXMLFileReader.h"
-
-// Validation
-#include "otbConfusionMatrixCalculator.h"
-
-#include "itkTimeProbe.h"
-#include "otbStandardFilterWatcher.h"
-
-// Normalize the samples
-#include "otbShiftScaleSampleListFilter.h"
-
-// List sample concatenation
-#include "otbConcatenateSampleListFilter.h"
-
-// Balancing ListSample
-#include "otbListSampleToBalancedListSampleFilter.h"
-
-// VectorData projection filter
-
-// Extract a ROI of the vectordata
-#include "otbVectorDataIntoImageProjectionFilter.h"
-
-// Elevation handler
-#include "otbWrapperElevationParametersHandler.h"
-
-namespace otb
-{
-namespace Wrapper
-{
-
-class TrainImagesClassifier: public Application
-{
-public:
-  /** Standard class typedefs. */
-  typedef TrainImagesClassifier Self;
-  typedef Application Superclass;
-  typedef itk::SmartPointer<Self> Pointer;
-  typedef itk::SmartPointer<const Self> ConstPointer;
-
-  /** Standard macro */
-  itkNewMacro(Self)
-
-  itkTypeMacro(TrainImagesClassifier, otb::Application)
-
-  typedef FloatVectorImageType::PixelType         PixelType;
-  typedef FloatVectorImageType::InternalPixelType InternalPixelType;
-
-  // Training vectordata
-  typedef itk::VariableLengthVector<InternalPixelType> MeasurementType;
-
-  // SampleList manipulation
-  typedef otb::ListSampleGenerator<FloatVectorImageType, VectorDataType> ListSampleGeneratorType;
-
-  typedef ListSampleGeneratorType::ListSampleType ListSampleType;
-  typedef ListSampleGeneratorType::LabelType LabelType;
-  typedef ListSampleGeneratorType::ListLabelType LabelListSampleType;
-  typedef otb::Statistics::ConcatenateSampleListFilter<ListSampleType> ConcatenateListSampleFilterType;
-  typedef otb::Statistics::ConcatenateSampleListFilter<LabelListSampleType> ConcatenateLabelListSampleFilterType;
-
-  // Statistic XML file Reader
-  typedef otb::StatisticsXMLFileReader<MeasurementType> StatisticsReader;
-
-  // Enhance List Sample  typedef otb::Statistics::ListSampleToBalancedListSampleFilter<ListSampleType, LabelListSampleType>      BalancingListSampleFilterType;
-  typedef otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType> ShiftScaleFilterType;
-
-  // Machine Learning models
-  typedef otb::MachineLearningModelFactory<InternalPixelType, ListSampleGeneratorType::ClassLabelType> MachineLearningModelFactoryType;
-  typedef MachineLearningModelFactoryType::MachineLearningModelTypePointer ModelPointerType;
-  
-#ifdef OTB_USE_OPENCV
-  typedef otb::RandomForestsMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> RandomForestType;
-  typedef otb::KNearestNeighborsMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> KNNType;
-  typedef otb::SVMMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> SVMType;
-  typedef otb::BoostMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> BoostType;
-  typedef otb::DecisionTreeMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> DecisionTreeType;
-  typedef otb::GradientBoostedTreeMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> GradientBoostedTreeType;
-  typedef otb::NeuralNetworkMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> NeuralNetworkType;
-  typedef otb::NormalBayesMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> NormalBayesType;
-#endif
-
-#ifdef OTB_USE_LIBSVM 
-  typedef otb::LibSVMMachineLearningModel<InternalPixelType, ListSampleGeneratorType::ClassLabelType> LibSVMType;
-#endif
- 
-  // Estimate performance on validation sample
-  typedef otb::ConfusionMatrixCalculator<LabelListSampleType, LabelListSampleType> ConfusionMatrixCalculatorType;
-  typedef ConfusionMatrixCalculatorType::ConfusionMatrixType ConfusionMatrixType;
-  typedef ConfusionMatrixCalculatorType::MapOfIndicesType MapOfIndicesType;
-  typedef ConfusionMatrixCalculatorType::ClassLabelType ClassLabelType;
-
-
-  // VectorData projection filter
-  typedef otb::VectorDataProjectionFilter<VectorDataType, VectorDataType> VectorDataProjectionFilterType;
-
-  // Extract ROI
-  typedef otb::VectorDataIntoImageProjectionFilter<VectorDataType, FloatVectorImageType> VectorDataReprojectionType;
-
-protected:
-  using Superclass::AddParameter;
-  friend void InitSVMParams(TrainImagesClassifier & app);
-
-private:
-  void DoInit();
-
-  void DoUpdateParameters();
-
-  void LogConfusionMatrix(ConfusionMatrixCalculatorType* confMatCalc);
-
-#ifdef OTB_USE_LIBSVM 
-  void InitLibSVMParams();
-#endif  
-  
-#ifdef OTB_USE_OPENCV
-  void InitBoostParams();
-  void InitSVMParams();
-  void InitDecisionTreeParams();
-  void InitGradientBoostedTreeParams();
-  void InitNeuralNetworkParams();
-  void InitNormalBayesParams();
-  void InitRandomForestsParams();
-  void InitKNNParams();
-#endif
-
-#ifdef OTB_USE_LIBSVM 
-  void TrainLibSVM(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-#endif 
-  
-#ifdef OTB_USE_OPENCV
-  void TrainBoost(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-  void TrainSVM(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-  void TrainDecisionTree(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-  void TrainGradientBoostedTree(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-  void TrainNeuralNetwork(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-  void TrainNormalBayes(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-  void TrainRandomForests(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-  void TrainKNN(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample);
-#endif
-
-  void Classify(ListSampleType::Pointer validationListSample, LabelListSampleType::Pointer predictedList);
-
-  void DoExecute();
-
-  VectorDataReprojectionType::Pointer vdreproj;
-};
-
-}
-}
-
-
diff --git a/Modules/Applications/AppClassification/app/otbTrainKNN.cxx b/Modules/Applications/AppClassification/app/otbTrainKNN.cxx
deleted file mode 100644
index bc31cd4..0000000
--- a/Modules/Applications/AppClassification/app/otbTrainKNN.cxx
+++ /dev/null
@@ -1,52 +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 "otbTrainImagesClassifier.h"
-
-
-namespace otb
-{
-namespace Wrapper
-{
-#ifdef OTB_USE_OPENCV
-  void TrainImagesClassifier::InitKNNParams()
-  {
-    AddChoice("classifier.knn", "KNN classifier");
-    SetParameterDescription("classifier.knn", "This group of parameters allows to set KNN classifier parameters. "
-        "See complete documentation here \\url{http://docs.opencv.org/modules/ml/doc/k_nearest_neighbors.html}.");
-
-    //K parameter
-    AddParameter(ParameterType_Int, "classifier.knn.k", "Number of Neighbors");
-    SetParameterInt("classifier.knn.k", 32);
-    SetParameterDescription("classifier.knn.k","The number of neighbors to use.");
-
-  }
-
-
-  void TrainImagesClassifier::TrainKNN(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample)
-  {
-    KNNType::Pointer knnClassifier = KNNType::New();
-    knnClassifier->SetInputListSample(trainingListSample);
-    knnClassifier->SetTargetListSample(trainingLabeledListSample);
-    knnClassifier->SetK(GetParameterInt("classifier.knn.k"));
-
-    knnClassifier->Train();
-    knnClassifier->Save(GetParameterString("io.out"));
-  }
-#endif
-} //end namespace wrapper
-} //end namespace otb
diff --git a/Modules/Applications/AppClassification/app/otbTrainLibSVM.cxx b/Modules/Applications/AppClassification/app/otbTrainLibSVM.cxx
deleted file mode 100644
index 458e5b8..0000000
--- a/Modules/Applications/AppClassification/app/otbTrainLibSVM.cxx
+++ /dev/null
@@ -1,84 +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 "otbTrainImagesClassifier.h"
-
-
-namespace otb
-{
-namespace Wrapper
-{
-#ifdef OTB_USE_LIBSVM
-  void TrainImagesClassifier::InitLibSVMParams()
-  {
-    AddChoice("classifier.libsvm", "LibSVM classifier");
-    SetParameterDescription("classifier.libsvm", "This group of parameters allows to set SVM classifier parameters.");
-    AddParameter(ParameterType_Choice, "classifier.libsvm.k", "SVM Kernel Type");
-    AddChoice("classifier.libsvm.k.linear", "Linear");
-    AddChoice("classifier.libsvm.k.rbf", "Gaussian radial basis function");
-    AddChoice("classifier.libsvm.k.poly", "Polynomial");
-    AddChoice("classifier.libsvm.k.sigmoid", "Sigmoid");
-    SetParameterString("classifier.libsvm.k", "linear");
-    SetParameterDescription("classifier.libsvm.k", "SVM Kernel Type.");
-    AddParameter(ParameterType_Float, "classifier.libsvm.c", "Cost parameter C");
-    SetParameterFloat("classifier.libsvm.c", 1.0);
-    SetParameterDescription(
-        "classifier.libsvm.c",
-        "SVM models have a cost parameter C (1 by default) to control the trade-off between training errors and forcing rigid margins.");
-    AddParameter(ParameterType_Empty, "classifier.libsvm.opt", "Parameters optimization");
-    MandatoryOff("classifier.libsvm.opt");
-    SetParameterDescription("classifier.libsvm.opt", "SVM parameters optimization flag.");
-  }
-
-
-  void TrainImagesClassifier::TrainLibSVM(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample)
-  {
-    LibSVMType::Pointer libSVMClassifier = LibSVMType::New();
-    libSVMClassifier->SetInputListSample(trainingListSample);
-    libSVMClassifier->SetTargetListSample(trainingLabeledListSample);
-    //SVM Option
-    //TODO : Add other options ?
-    if (IsParameterEnabled("classifier.libsvm.opt"))
-      {
-      libSVMClassifier->SetParameterOptimization(true);
-      }
-    libSVMClassifier->SetC(GetParameterFloat("classifier.libsvm.c"));
-
-    switch (GetParameterInt("classifier.libsvm.k"))
-      {
-      case 0: // LINEAR
-        libSVMClassifier->SetKernelType(LINEAR);
-        break;
-      case 1: // RBF
-        libSVMClassifier->SetKernelType(RBF);
-        break;
-      case 2: // POLY
-        libSVMClassifier->SetKernelType(POLY);
-        break;
-      case 3: // SIGMOID
-        libSVMClassifier->SetKernelType(SIGMOID);
-        break;
-      default: // DEFAULT = LINEAR
-        libSVMClassifier->SetKernelType(LINEAR);
-        break;
-      }
-    libSVMClassifier->Train();
-    libSVMClassifier->Save(GetParameterString("io.out"));
-  }
-#endif
-} //end namespace wrapper
-} //end namespace otb
diff --git a/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx b/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx
index e0a044a..96dfef7 100644
--- a/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx
+++ b/Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx
@@ -63,7 +63,7 @@ private:
     SetDocSeeAlso("OGRLayerClassifier,ComputeOGRLayersFeaturesStatistics");
     AddDocTag(Tags::Segmentation);
   
-    AddParameter(ParameterType_InputFilename, "inshp", "Name of the input shapefile");
+    AddParameter(ParameterType_InputVectorData, "inshp", "Name of the input shapefile");
     SetParameterDescription("inshp","Name of the input shapefile");
 
     AddParameter(ParameterType_InputFilename, "instats", "XML file containing mean and variance of each feature.");
@@ -121,7 +121,7 @@ private:
 
   void DoExecute()
   {
-	#ifdef OTB_USE_LIBSVM 
+    #ifdef OTB_USE_LIBSVM 
     clock_t tic = clock();
 
     std::string shapefile = GetParameterString("inshp");
@@ -203,9 +203,9 @@ private:
     otbAppLogINFO( "Elapsed: "<< ((double)(toc - tic) / CLOCKS_PER_SEC)<<" seconds.");
     
     #else
-	otbAppLogFATAL("Module LIBSVM is not installed. You should consider turning OTB_USE_LIBSVM on during cmake configuration.");
-	#endif
-	
+    otbAppLogFATAL("Module LIBSVM is not installed. You should consider turning OTB_USE_LIBSVM on during cmake configuration.");
+    #endif
+    
     }
 
 };
diff --git a/Modules/Applications/AppClassification/app/otbTrainRegression.cxx b/Modules/Applications/AppClassification/app/otbTrainRegression.cxx
new file mode 100644
index 0000000..a7852ef
--- /dev/null
+++ b/Modules/Applications/AppClassification/app/otbTrainRegression.cxx
@@ -0,0 +1,543 @@
+/*=========================================================================
+ 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 "otbLearningApplicationBase.h"
+#include "otbWrapperApplicationFactory.h"
+
+#include "otbListSampleGenerator.h"
+
+#include "otbImageToEnvelopeVectorDataFilter.h"
+#include "itkPreOrderTreeIterator.h"
+
+// Statistic XML Reader
+#include "otbStatisticsXMLFileReader.h"
+
+#include "itkTimeProbe.h"
+#include "otbStandardFilterWatcher.h"
+
+// Normalize the samples
+#include "otbShiftScaleSampleListFilter.h"
+
+// List sample concatenation
+#include "otbConcatenateSampleListFilter.h"
+
+// Balancing ListSample
+#include "otbListSampleToBalancedListSampleFilter.h"
+
+#include "itkMersenneTwisterRandomVariateGenerator.h"
+
+// Elevation handler
+#include "otbWrapperElevationParametersHandler.h"
+
+namespace otb
+{
+namespace Wrapper
+{
+
+class TrainRegression: public LearningApplicationBase<float,float>
+{
+public:
+  /** Standard class typedefs. */
+  typedef TrainRegression Self;
+  typedef LearningApplicationBase<float,float> Superclass;
+  typedef itk::SmartPointer<Self> Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+
+  /** Standard macro */
+  itkNewMacro(Self)
+
+  itkTypeMacro(TrainRegression, otb::Wrapper::LearningApplicationBase)
+  
+  typedef Superclass::SampleType              SampleType;
+  typedef Superclass::ListSampleType          ListSampleType;
+  typedef Superclass::TargetSampleType        TargetSampleType;
+  typedef Superclass::TargetListSampleType    TargetListSampleType;
+  
+  typedef Superclass::SampleImageType         SampleImageType;
+  typedef SampleImageType::PixelType          PixelType;
+
+  // SampleList manipulation
+  typedef otb::ListSampleGenerator<SampleImageType, VectorDataType> ListSampleGeneratorType;
+
+  typedef otb::Statistics::ConcatenateSampleListFilter<ListSampleType> ConcatenateListSampleFilterType;
+  typedef otb::Statistics::ConcatenateSampleListFilter<TargetListSampleType> ConcatenateLabelListSampleFilterType;
+
+  // Statistic XML file Reader
+  typedef otb::StatisticsXMLFileReader<SampleType> StatisticsReader;
+
+  // Enhance List Sample  typedef otb::Statistics::ListSampleToBalancedListSampleFilter<ListSampleType, LabelListSampleType>      BalancingListSampleFilterType;
+  typedef otb::Statistics::ShiftScaleSampleListFilter<ListSampleType, ListSampleType> ShiftScaleFilterType;
+
+  typedef otb::ImageToEnvelopeVectorDataFilter<SampleImageType,VectorDataType> EnvelopeFilterType;
+  
+  typedef itk::PreOrderTreeIterator<VectorDataType::DataTreeType> TreeIteratorType;
+
+  typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType;
+
+protected:
+  TrainRegression()
+    {
+    this->m_RegressionFlag = true;
+    }
+
+private:
+
+void DoInit()
+{
+  SetName("TrainRegression");
+  SetDescription(
+    "Train a classifier from multiple images to perform regression.");
+
+  // Documentation
+  SetDocName("Train a regression model");
+  SetDocLongDescription(
+    "This application trains a classifier from multiple input images or a csv "
+    "file, in order to perform regression. Predictors are composed of pixel "
+    "values in each band optionally centered and reduced using an XML "
+    "statistics file produced by the ComputeImagesStatistics application.\n "
+    "The output value for each predictor is assumed to be the last band "
+    "(or the last column for CSV files). Training and validation predictor "
+    "lists are built such that their size is inferior to maximum bounds given "
+    "by the user, and the proportion corresponds to the balance parameter. "
+    "Several classifier parameters can be set depending on the chosen "
+    "classifier. In the validation process, the mean square error is computed\n"
+    " This application is based on LibSVM and on OpenCV Machine Learning "
+    "classifiers, and is compatible with OpenCV 2.3.1 and later.");
+  SetDocLimitations("None");
+  SetDocAuthors("OTB-Team");
+  SetDocSeeAlso("OpenCV documentation for machine learning http://docs.opencv.org/modules/ml/doc/ml.html ");
+
+  //Group IO
+  AddParameter(ParameterType_Group, "io", "Input and output data");
+  SetParameterDescription("io", "This group of parameters allows to set input and output data.");
+  AddParameter(ParameterType_InputImageList, "io.il", "Input Image List");
+  SetParameterDescription("io.il", "A list of input images. First (n-1) bands should contain the predictor. The last band should contain the output value to predict.");
+  AddParameter(ParameterType_InputFilename, "io.csv", "Input CSV file");
+  SetParameterDescription("io.csv","Input CSV file containing the predictors, and the output values in last column. Only used when no input image is given");
+  MandatoryOff("io.csv");
+  
+  AddParameter(ParameterType_InputFilename, "io.imstat", "Input XML image statistics file");
+  MandatoryOff("io.imstat");
+  SetParameterDescription("io.imstat",
+                          "Input XML file containing the mean and the standard deviation of the input images.");
+  AddParameter(ParameterType_OutputFilename, "io.out", "Output regression model");
+  SetParameterDescription("io.out", "Output file containing the model estimated (.txt format).");
+  
+  AddParameter(ParameterType_Float,"io.mse","Mean Square Error");
+  SetParameterDescription("io.mse","Mean square error computed with the validation predictors");
+  SetParameterRole("io.mse",Role_Output);
+  DisableParameter("io.mse");
+
+  //Group Sample list
+  AddParameter(ParameterType_Group, "sample", "Training and validation samples parameters");
+  SetParameterDescription("sample",
+                          "This group of parameters allows to set training and validation sample lists parameters.");
+
+  AddParameter(ParameterType_Int, "sample.mt", "Maximum training predictors");
+  //MandatoryOff("mt");
+  SetDefaultParameterInt("sample.mt", 1000);
+  SetParameterDescription("sample.mt", "Maximum number of training predictors (default = 1000) (no limit = -1).");
+  
+  AddParameter(ParameterType_Int, "sample.mv", "Maximum validation predictors");
+  // MandatoryOff("mv");
+  SetDefaultParameterInt("sample.mv", 1000);
+  SetParameterDescription("sample.mv", "Maximum number of validation predictors (default = 1000) (no limit = -1).");
+
+  AddParameter(ParameterType_Float, "sample.vtr", "Training and validation sample ratio");
+  SetParameterDescription("sample.vtr",
+                          "Ratio between training and validation samples (0.0 = all training, 1.0 = all validation) (default = 0.5).");
+  SetParameterFloat("sample.vtr", 0.5);
+
+  Superclass::DoInit();
+
+  AddRANDParameter();
+
+  // Doc example parameter settings
+  SetDocExampleParameterValue("io.il", "training_dataset.tif");
+  SetDocExampleParameterValue("io.out", "regression_model.txt");
+  SetDocExampleParameterValue("io.imstat", "training_statistics.xml");
+  SetDocExampleParameterValue("classifier", "libsvm");
+}
+
+void DoUpdateParameters()
+{
+  if (HasValue("io.csv") && IsParameterEnabled("io.csv"))
+    {
+    MandatoryOff("io.il");
+    }
+  else
+    {
+    MandatoryOn("io.il");
+    }
+}
+
+void ParseCSVPredictors(std::string path, ListSampleType* outputList)
+{
+  std::ifstream ifs;
+  ifs.open(path.c_str());
+  unsigned int nbCols = 0;
+  char sep = '\t';
+  std::istringstream iss;
+  SampleType elem;
+  while(!ifs.eof())
+    {
+    std::string line;
+    std::getline(ifs,line);
+    // filter current line
+    while (!line.empty() && (line[0] == ' ' || line[0] == '\t'))
+      {
+      line.erase(line.begin());
+      }
+    while (!line.empty() && ( *(line.end()-1) == ' ' || *(line.end()-1) == '\t' || *(line.end()-1) == '\r'))
+      {
+      line.erase(line.end()-1);
+      }
+
+    // Avoid commented lines or too short ones
+    if (!line.empty() && line[0] != '#')
+      {
+      std::vector<itksys::String> words = itksys::SystemTools::SplitString(line.c_str(),sep);
+      if (nbCols == 0)
+        {
+        // detect separator and feature size
+        if (words.size() < 2)
+          {
+          sep = ' ';
+          words = itksys::SystemTools::SplitString(line.c_str(),sep);
+          }
+        if (words.size() < 2)
+          {
+          sep = ';';
+          words = itksys::SystemTools::SplitString(line.c_str(),sep);
+          }
+        if (words.size() < 2)
+          {
+          sep = ',';
+          words = itksys::SystemTools::SplitString(line.c_str(),sep);
+          }
+        if (words.size() < 2)
+          {
+          otbAppLogFATAL(<< "Can't parse CSV file : less than 2 columns or unknonw separator (knowns ones are tab, space, comma and semi-colon)");
+          }
+        nbCols = words.size();
+        elem.SetSize(nbCols,false);
+        outputList->SetMeasurementVectorSize(nbCols);
+        }
+      else if (words.size() != nbCols )
+        {
+        otbAppLogWARNING(<< "Skip CSV line, wrong number of columns : got "<<words.size() << ", expected "<<nbCols);
+        continue;
+        }
+      elem.Fill(0.0);
+      for (unsigned int i=0 ; i<nbCols ; ++i)
+        {
+        iss.str(words[i]);
+        iss >> elem[i];
+        }
+      outputList->PushBack(elem);
+      }
+    }
+  ifs.close();
+}
+
+void DoExecute()
+{
+  GetLogger()->Debug("Entering DoExecute\n");
+  //Create training and validation for list samples and label list samples
+  ConcatenateListSampleFilterType::Pointer concatenateTrainingSamples = ConcatenateListSampleFilterType::New();
+  ConcatenateListSampleFilterType::Pointer concatenateValidationSamples = ConcatenateListSampleFilterType::New();
+
+  SampleType meanMeasurementVector;
+  SampleType stddevMeasurementVector;
+
+  //--------------------------
+  // Load measurements from images
+  unsigned int nbBands = 0;
+  unsigned int nbFeatures = 0;
+  //Iterate over all input images
+
+  FloatVectorImageListType* imageList = GetParameterImageList("io.il");
+  
+  //Iterate over all input images
+  for (unsigned int imgIndex = 0; imgIndex < imageList->Size(); ++imgIndex)
+    {
+    FloatVectorImageType::Pointer image = imageList->GetNthElement(imgIndex);
+    image->UpdateOutputInformation();
+
+    if (imgIndex == 0)
+      {
+      nbBands = image->GetNumberOfComponentsPerPixel();
+      nbFeatures = static_cast<unsigned int>(static_cast<int>(nbBands) - 1);
+      if (nbBands < 2)
+        {
+        otbAppLogFATAL(<< "Need at least two bands per image, got "<<nbBands);
+        }
+      else
+        {
+        if (nbBands != image->GetNumberOfComponentsPerPixel())
+          {
+          otbAppLogFATAL(<< "Image has a different number of components than "
+            "the first one, expected "<<nbBands<<", got "<< image->GetNumberOfComponentsPerPixel());
+          }
+        }
+      }
+
+    // Extract image envelope to feed in sampleGenerator
+    EnvelopeFilterType::Pointer envelopeFilter = EnvelopeFilterType::New();
+    envelopeFilter->SetInput(image);
+    envelopeFilter->SetSamplingRate(0);
+    if (!image->GetProjectionRef().empty())
+      {
+      envelopeFilter->SetOutputProjectionRef(image->GetProjectionRef());
+      }
+
+    // Setup the DEM Handler
+    // otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev");
+    
+    envelopeFilter->Update();
+    
+    VectorDataType::Pointer envelope = envelopeFilter->GetOutput();
+    
+    TreeIteratorType itVector(envelope->GetDataTree());
+    for (itVector.GoToBegin(); !itVector.IsAtEnd(); ++itVector)
+      {
+      if (itVector.Get()->IsPolygonFeature())
+        {
+        itVector.Get()->SetFieldAsInt(std::string("class"),1);
+        }
+      }
+
+
+    //Sample list generator
+    ListSampleGeneratorType::Pointer sampleGenerator = ListSampleGeneratorType::New();
+
+    sampleGenerator->SetInput(image);
+    sampleGenerator->SetInputVectorData(envelope);
+
+    sampleGenerator->SetClassKey("class");
+    sampleGenerator->SetMaxTrainingSize(GetParameterInt("sample.mt"));
+    sampleGenerator->SetMaxValidationSize(GetParameterInt("sample.mv"));
+    sampleGenerator->SetValidationTrainingProportion(GetParameterFloat("sample.vtr"));
+    sampleGenerator->SetBoundByMin(false);
+    sampleGenerator->SetPolygonEdgeInclusion(true);
+
+    sampleGenerator->Update();
+
+    //Concatenate training and validation samples from the image
+    concatenateTrainingSamples->AddInput(sampleGenerator->GetTrainingListSample());
+    concatenateValidationSamples->AddInput(sampleGenerator->GetValidationListSample());
+    }
+
+  // if no input image, try CSV
+  if (imageList->Size() == 0)
+    {
+    if (HasValue("io.csv") && IsParameterEnabled("io.csv"))
+      {
+      ListSampleType::Pointer csvListSample = ListSampleType::New();
+      this->ParseCSVPredictors(this->GetParameterString("io.csv"), csvListSample);
+      unsigned int totalCSVSize = csvListSample->Size();
+      if (totalCSVSize == 0)
+        {
+        otbAppLogFATAL("No input image and empty CSV file. Missing input data");
+        }
+      nbBands = csvListSample->GetMeasurementVectorSize();
+      nbFeatures = static_cast<unsigned int>(static_cast<int>(nbBands) - 1);
+      ListSampleType::Pointer csvTrainListSample = ListSampleType::New();
+      ListSampleType::Pointer csvValidListSample = ListSampleType::New();
+      csvTrainListSample->SetMeasurementVectorSize(nbBands);
+      csvValidListSample->SetMeasurementVectorSize(nbBands);
+      double ratio = this->GetParameterFloat("sample.vtr");
+      int trainSize = static_cast<int>(static_cast<double>(totalCSVSize)*(1.0-ratio));
+      int validSize = static_cast<int>(static_cast<double>(totalCSVSize)*(ratio));
+      if (trainSize > this->GetParameterInt("sample.mt"))
+        {
+        trainSize = this->GetParameterInt("sample.mt");
+        }
+      if (validSize > this->GetParameterInt("sample.mv"))
+        {
+        validSize = this->GetParameterInt("sample.mv");
+        }
+      double probaTrain = static_cast<double>(trainSize)/static_cast<double>(totalCSVSize);
+      double probaValid = static_cast<double>(validSize)/static_cast<double>(totalCSVSize);
+
+      RandomGeneratorType::Pointer randomGenerator = RandomGeneratorType::GetInstance();
+      for (unsigned int i=0; i<totalCSVSize; ++i)
+        {
+        double random = randomGenerator->GetUniformVariate(0.0, 1.0);
+        if (random < probaTrain)
+          {
+          csvTrainListSample->PushBack(csvListSample->GetMeasurementVector(i));
+          }
+        else if (random < probaTrain + probaValid)
+          {
+          csvValidListSample->PushBack(csvListSample->GetMeasurementVector(i));
+          }
+        }
+      concatenateTrainingSamples->AddInput(csvTrainListSample);
+      concatenateValidationSamples->AddInput(csvValidListSample);
+      }
+    }
+
+  // Update
+  concatenateTrainingSamples->Update();
+  concatenateValidationSamples->Update();
+
+  if (concatenateTrainingSamples->GetOutput()->Size() == 0)
+    {
+    otbAppLogFATAL("No training samples, cannot perform training.");
+    }
+
+  if (concatenateValidationSamples->GetOutput()->Size() == 0)
+    {
+    otbAppLogWARNING("No validation samples.");
+    }
+
+  if (IsParameterEnabled("io.imstat"))
+    {
+    StatisticsReader::Pointer statisticsReader = StatisticsReader::New();
+    statisticsReader->SetFileName(GetParameterString("io.imstat"));
+    meanMeasurementVector = statisticsReader->GetStatisticVectorByName("mean");
+    stddevMeasurementVector = statisticsReader->GetStatisticVectorByName("stddev");
+    // handle stat file without output normalization
+    if (meanMeasurementVector.Size() == nbFeatures)
+      {
+      meanMeasurementVector.SetSize(nbBands,false);
+      meanMeasurementVector[nbFeatures] = 0.0;
+      stddevMeasurementVector.SetSize(nbBands,false);
+      stddevMeasurementVector[nbFeatures] = 1.0;
+      }
+    }
+  else
+    {
+    meanMeasurementVector.SetSize(nbBands);
+    meanMeasurementVector.Fill(0.);
+    stddevMeasurementVector.SetSize(nbBands);
+    stddevMeasurementVector.Fill(1.);
+    }
+
+  // Shift scale the samples
+  ShiftScaleFilterType::Pointer trainingShiftScaleFilter = ShiftScaleFilterType::New();
+  trainingShiftScaleFilter->SetInput(concatenateTrainingSamples->GetOutput());
+  trainingShiftScaleFilter->SetShifts(meanMeasurementVector);
+  trainingShiftScaleFilter->SetScales(stddevMeasurementVector);
+  trainingShiftScaleFilter->Update();
+
+  ListSampleType::Pointer rawValidationListSample=ListSampleType::New();
+
+  //Test if the validation test is empty
+  if ( concatenateValidationSamples->GetOutput()->Size() != 0 )
+    {
+    ShiftScaleFilterType::Pointer validationShiftScaleFilter = ShiftScaleFilterType::New();
+    validationShiftScaleFilter->SetInput(concatenateValidationSamples->GetOutput());
+    validationShiftScaleFilter->SetShifts(meanMeasurementVector);
+    validationShiftScaleFilter->SetScales(stddevMeasurementVector);
+    validationShiftScaleFilter->Update();
+    rawValidationListSample = validationShiftScaleFilter->GetOutput();
+    }
+
+  // Split between predictors and output values
+  ListSampleType::Pointer rawlistSample = trainingShiftScaleFilter->GetOutput();
+  ListSampleType::Pointer listSample = ListSampleType::New();
+  listSample->SetMeasurementVectorSize(nbFeatures);
+  listSample->Resize(rawlistSample->Size());
+  TargetListSampleType::Pointer labelListSample = TargetListSampleType::New();
+  labelListSample->SetMeasurementVectorSize(1);
+  labelListSample->Resize(rawlistSample->Size());
+  
+  ListSampleType::Pointer validationListSample = ListSampleType::New();
+  validationListSample->SetMeasurementVectorSize(nbFeatures);
+  validationListSample->Resize(rawValidationListSample->Size());
+  TargetListSampleType::Pointer validationLabeledListSample = TargetListSampleType::New();
+  validationLabeledListSample->SetMeasurementVectorSize(1);
+  validationLabeledListSample->Resize(rawValidationListSample->Size());
+  
+  ListSampleType::MeasurementVectorType elem;
+  TargetListSampleType::MeasurementVectorType outElem;
+  for (ListSampleType::InstanceIdentifier i=0; i<rawlistSample->Size() ; ++i)
+    {
+    elem = rawlistSample->GetMeasurementVector(i);
+    outElem[0] = elem[nbFeatures];
+    labelListSample->SetMeasurementVector(i,outElem);
+    elem.SetSize(nbFeatures,false);
+    listSample->SetMeasurementVector(i,elem);
+    }
+  for (ListSampleType::InstanceIdentifier i=0; i<rawValidationListSample->Size() ; ++i)
+    {
+    elem = rawValidationListSample->GetMeasurementVector(i);
+    outElem[0] = elem[nbFeatures];
+    validationLabeledListSample->SetMeasurementVector(i,outElem);
+    elem.SetSize(nbFeatures,false);
+    validationListSample->SetMeasurementVector(i,elem);
+    }
+  
+
+  otbAppLogINFO("Number of training samples: " << concatenateTrainingSamples->GetOutput()->Size());
+  //--------------------------
+  // Split the data set into training/validation set
+  ListSampleType::Pointer trainingListSample = listSample;
+  TargetListSampleType::Pointer trainingLabeledListSample = labelListSample;
+
+  otbAppLogINFO("Size of training set: " << trainingListSample->Size());
+  otbAppLogINFO("Size of validation set: " << validationListSample->Size());
+
+  //--------------------------
+  // Estimate model
+  //--------------------------
+  this->Train(trainingListSample,trainingLabeledListSample,GetParameterString("io.out"));
+
+  //--------------------------
+  // Performances estimation
+  //--------------------------
+  ListSampleType::Pointer performanceListSample;
+  TargetListSampleType::Pointer predictedList = TargetListSampleType::New();
+  predictedList->SetMeasurementVectorSize(1);
+  TargetListSampleType::Pointer performanceLabeledListSample;
+
+  //Test the input validation set size
+  if(validationLabeledListSample->Size() != 0)
+    {
+    performanceListSample = validationListSample;
+    performanceLabeledListSample = validationLabeledListSample;
+    }
+  else
+    {
+    otbAppLogWARNING("The validation set is empty. The performance estimation is done using the input training set in this case.");
+    performanceListSample = trainingListSample;
+    performanceLabeledListSample = trainingLabeledListSample;
+    }
+
+  this->Classify(performanceListSample, predictedList, GetParameterString("io.out"));
+
+  otbAppLogINFO("Training performances");
+  double mse=0.0;
+  TargetListSampleType::MeasurementVectorType predictedElem;
+  for (TargetListSampleType::InstanceIdentifier i=0; i<performanceListSample->Size() ; ++i)
+    {
+    outElem = performanceLabeledListSample->GetMeasurementVector(i);
+    predictedElem = predictedList->GetMeasurementVector(i);
+    mse += (outElem[0] - predictedElem[0]) * (outElem[0] - predictedElem[0]);
+    }
+  mse /= static_cast<double>(performanceListSample->Size());
+  otbAppLogINFO("Mean Square Error = "<<mse);
+  this->SetParameterFloat("io.mse",mse);
+}
+
+};
+
+} // end namespace Wrapper
+} // end namespace otb
+
+OTB_APPLICATION_EXPORT(otb::Wrapper::TrainRegression)
diff --git a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h
new file mode 100644
index 0000000..c7edff5
--- /dev/null
+++ b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.h
@@ -0,0 +1,232 @@
+/*=========================================================================
+ 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 __otbLearningApplicationBase_h
+#define __otbLearningApplicationBase_h
+
+#include "otbConfigure.h"
+
+#include "otbWrapperApplication.h"
+
+#include <iostream>
+
+// ListSample
+#include "itkListSample.h"
+#include "itkVariableLengthVector.h"
+
+//Estimator
+#include "otbMachineLearningModelFactory.h"
+
+#ifdef OTB_USE_OPENCV
+# include "otbKNearestNeighborsMachineLearningModel.h"
+# include "otbRandomForestsMachineLearningModel.h"
+// OpenCV SVM implementation is buggy with linear kernel
+// Users should use the libSVM implementation instead.
+//# include "otbSVMMachineLearningModel.h"
+# include "otbBoostMachineLearningModel.h"
+# include "otbDecisionTreeMachineLearningModel.h"
+# include "otbGradientBoostedTreeMachineLearningModel.h"
+# include "otbNormalBayesMachineLearningModel.h"
+# include "otbNeuralNetworkMachineLearningModel.h"
+#endif
+
+#ifdef OTB_USE_LIBSVM 
+#include "otbLibSVMMachineLearningModel.h"
+#endif
+
+namespace otb
+{
+namespace Wrapper
+{
+
+/** \class LearningApplicationBase
+ *  \brief LearningApplicationBase is the base class for application that
+ *         use machine learning model.
+ *
+ * This base class offers a DoInit() method to initialize all the parameters
+ * related to machine learning models. They will all be in the choice parameter
+ * named "classifier". The class also offers generic Train() and Classify()
+ * methods. The classes derived from LearningApplicationBase only need these
+ * 3 methods to handle the machine learning model.
+ *
+ * There are multiple machine learning models in OTB, some imported from OpenCV,
+ * and one imported from LibSVM. They all have different parameters. The
+ * purpose of this class is to handle the creation of all parameters related to
+ * machine learning models (in DoInit() ), and to dispatch the calls to
+ * specific train functions in function Train().
+ *
+ * This class is templated over scalar types for input and output values.
+ * Typically, the input value type will be either float of double. The choice
+ * of an output value type depends on the learning mode. This base class
+ * supports both classification and regression modes. For classification
+ * (enabled by default), the output value type corresponds to a class
+ * identifier so integer types suit well. For regression, the output value
+ * should not be an integer type, but rather a floating point type. In addition,
+ * an application deriving this base class for regression should initialize
+ * the m_RegressionFlag to true in their constructor.
+ *
+ * \sa TrainImagesClassifier
+ * \sa TrainRegression
+ *
+ * \ingroup OTBAppClassification
+ */
+template <class TInputValue, class TOutputValue>
+class LearningApplicationBase: public Application
+{
+public:
+  /** Standard class typedefs. */
+  typedef LearningApplicationBase Self;
+  typedef Application             Superclass;
+  typedef itk::SmartPointer<Self> Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+
+  /** Standard macro */
+  itkTypeMacro(LearningApplicationBase, otb::Application)
+
+  typedef TInputValue                             InputValueType;
+  typedef TOutputValue                            OutputValueType;
+
+  typedef otb::VectorImage<InputValueType>        SampleImageType;
+  typedef typename SampleImageType::PixelType     PixelType;
+
+  // Machine Learning models
+  typedef otb::MachineLearningModelFactory<
+            InputValueType, OutputValueType>             ModelFactoryType;
+  typedef typename ModelFactoryType::MachineLearningModelTypePointer ModelPointerType;
+  typedef typename ModelFactoryType::MachineLearningModelType        ModelType;
+  
+  typedef typename ModelType::InputSampleType     SampleType;
+  typedef typename ModelType::InputListSampleType ListSampleType;
+  
+  typedef typename ModelType::TargetSampleType      TargetSampleType;
+  typedef typename ModelType::TargetListSampleType  TargetListSampleType;
+  typedef typename ModelType::TargetValueType       TargetValueType;
+  
+#ifdef OTB_USE_OPENCV
+  typedef otb::RandomForestsMachineLearningModel<InputValueType, OutputValueType> RandomForestType;
+  typedef otb::KNearestNeighborsMachineLearningModel<InputValueType, OutputValueType> KNNType;
+  // OpenCV SVM implementation is buggy with linear kernel
+  // Users should use the libSVM implementation instead.
+  // typedef otb::SVMMachineLearningModel<InputValueType, OutputValueType> SVMType;
+  typedef otb::BoostMachineLearningModel<InputValueType, OutputValueType> BoostType;
+  typedef otb::DecisionTreeMachineLearningModel<InputValueType, OutputValueType> DecisionTreeType;
+  typedef otb::GradientBoostedTreeMachineLearningModel<InputValueType, OutputValueType> GradientBoostedTreeType;
+  typedef otb::NeuralNetworkMachineLearningModel<InputValueType, OutputValueType> NeuralNetworkType;
+  typedef otb::NormalBayesMachineLearningModel<InputValueType, OutputValueType> NormalBayesType;
+#endif
+
+#ifdef OTB_USE_LIBSVM 
+  typedef otb::LibSVMMachineLearningModel<InputValueType, OutputValueType> LibSVMType;
+#endif
+ 
+protected:
+  LearningApplicationBase();
+
+  /** Generic method to train and save the machine learning model. This method
+   * uses specific train methods depending on the chosen model.*/
+  void Train(typename ListSampleType::Pointer trainingListSample,
+             typename TargetListSampleType::Pointer trainingLabeledListSample,
+             std::string modelPath);
+
+  /** Generic method to load a model file and use it to classify a sample list*/
+  void Classify(typename ListSampleType::Pointer validationListSample,
+                typename TargetListSampleType::Pointer predictedList,
+                std::string modelPath);
+
+  /** Init method that creates all the parameters for machine learning models */
+  void DoInit();
+
+  /** Flag to switch between classification and regression mode.
+   * False by default, child classes may change it in their constructor */
+  bool m_RegressionFlag;
+
+private:
+
+  /** Specific Init and Train methods for each machine learning model */
+  //@{
+#ifdef OTB_USE_LIBSVM 
+  void InitLibSVMParams();
+
+  void TrainLibSVM(typename ListSampleType::Pointer trainingListSample,
+                   typename TargetListSampleType::Pointer trainingLabeledListSample,
+                   std::string modelPath);
+#endif  
+
+#ifdef OTB_USE_OPENCV
+  void InitBoostParams();
+  // OpenCV SVM implementation is buggy with linear kernel
+  // Users should use the libSVM implementation instead.
+  // void InitSVMParams();
+  void InitDecisionTreeParams();
+  void InitGradientBoostedTreeParams();
+  void InitNeuralNetworkParams();
+  void InitNormalBayesParams();
+  void InitRandomForestsParams();
+  void InitKNNParams();
+
+  void TrainBoost(typename ListSampleType::Pointer trainingListSample,
+                  typename TargetListSampleType::Pointer trainingLabeledListSample,
+                  std::string modelPath);
+  // OpenCV SVM implementation is buggy with linear kernel
+  // Users should use the libSVM implementation instead.
+  // void TrainSVM(typename ListSampleType::Pointer trainingListSample,
+  //              typename TargetListSampleType::Pointer trainingLabeledListSample,
+  //              std::string modelPath);
+  void TrainDecisionTree(typename ListSampleType::Pointer trainingListSample,
+                         typename TargetListSampleType::Pointer trainingLabeledListSample,
+                         std::string modelPath);
+  void TrainGradientBoostedTree(typename ListSampleType::Pointer trainingListSample,
+                                typename TargetListSampleType::Pointer trainingLabeledListSample,
+                                std::string modelPath);
+  void TrainNeuralNetwork(typename ListSampleType::Pointer trainingListSample,
+                          typename TargetListSampleType::Pointer trainingLabeledListSample,
+                          std::string modelPath);
+  void TrainNormalBayes(typename ListSampleType::Pointer trainingListSample,
+                        typename TargetListSampleType::Pointer trainingLabeledListSample,
+                        std::string modelPath);
+  void TrainRandomForests(typename ListSampleType::Pointer trainingListSample,
+                          typename TargetListSampleType::Pointer trainingLabeledListSample,
+                          std::string modelPath);
+  void TrainKNN(typename ListSampleType::Pointer trainingListSample,
+                typename TargetListSampleType::Pointer trainingLabeledListSample,
+                std::string modelPath);
+#endif
+  //@}
+};
+
+}
+}
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbLearningApplicationBase.txx"
+#ifdef OTB_USE_OPENCV
+#include "otbTrainBoost.txx"
+#include "otbTrainDecisionTree.txx"
+#include "otbTrainGradientBoostedTree.txx"
+#include "otbTrainKNN.txx"
+#include "otbTrainNeuralNetwork.txx"
+#include "otbTrainNormalBayes.txx"
+#include "otbTrainRandomForests.txx"
+// OpenCV SVM implementation is buggy with linear kernel
+// Users should use the libSVM implementation instead.
+//#include "otbTrainSVM.txx"
+#endif
+#ifdef OTB_USE_LIBSVM
+#include "otbTrainLibSVM.txx"
+#endif
+#endif
+
+#endif
diff --git a/Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx
new file mode 100644
index 0000000..c9dec87
--- /dev/null
+++ b/Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx
@@ -0,0 +1,181 @@
+/*=========================================================================
+ 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 __otbLearningApplicationBase_txx
+#define __otbLearningApplicationBase_txx
+
+#include "otbLearningApplicationBase.h"
+
+namespace otb
+{
+namespace Wrapper
+{
+
+template <class TInputValue, class TOutputValue>
+LearningApplicationBase<TInputValue,TOutputValue>
+::LearningApplicationBase() : m_RegressionFlag(false)
+{
+} 
+
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::DoInit()
+{
+  AddDocTag(Tags::Learning);
+
+  // main choice parameter that will contain all machine learning options
+  AddParameter(ParameterType_Choice, "classifier", "Classifier to use for the training");
+  SetParameterDescription("classifier", "Choice of the classifier to use for the training.");
+
+  //Group LibSVM
+#ifdef OTB_USE_LIBSVM 
+  InitLibSVMParams();
+#endif
+
+#ifdef OTB_USE_OPENCV
+  // OpenCV SVM implementation is buggy with linear kernel
+  // Users should use the libSVM implementation instead.
+  // InitSVMParams();
+  if (!m_RegressionFlag)
+    {
+    InitBoostParams();  // Regression not supported
+    }
+  InitDecisionTreeParams();
+  InitGradientBoostedTreeParams();
+  InitNeuralNetworkParams();
+  if (!m_RegressionFlag)
+    {
+    InitNormalBayesParams(); // Regression not supported
+    }
+  InitRandomForestsParams();
+  InitKNNParams();
+#endif
+}
+
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::Classify(typename ListSampleType::Pointer validationListSample,
+           typename TargetListSampleType::Pointer predictedList,
+           std::string modelPath)
+{
+  // load a machine learning model from file and predict the input sample list
+  ModelPointerType model = ModelFactoryType::CreateMachineLearningModel(modelPath,
+                                                                        ModelFactoryType::ReadMode);
+
+  if (model.IsNull())
+    {
+    otbAppLogFATAL(<< "Error when loading model " << modelPath);
+    }
+
+  model->Load(modelPath);
+  model->SetRegressionMode(this->m_RegressionFlag);
+  model->SetInputListSample(validationListSample);
+  model->SetTargetListSample(predictedList);
+  model->PredictAll();
+}
+
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::Train(typename ListSampleType::Pointer trainingListSample,
+        typename TargetListSampleType::Pointer trainingLabeledListSample,
+        std::string modelPath)
+{
+  // get the name of the chosen machine learning model
+  const std::string modelName = GetParameterString("classifier");
+  // call specific train function
+  if (modelName == "libsvm")
+    {
+	#ifdef OTB_USE_LIBSVM
+    TrainLibSVM(trainingListSample, trainingLabeledListSample, modelPath);
+    #else
+    otbAppLogFATAL("Module LIBSVM is not installed. You should consider turning OTB_USE_LIBSVM on during cmake configuration.");
+    #endif
+    }
+  // OpenCV SVM implementation is buggy with linear kernel
+  // Users should use the libSVM implementation instead.
+  // else if (modelName == "svm")
+  //  {
+	//  #ifdef OTB_USE_OPENCV
+  //   TrainSVM(trainingListSample, trainingLabeledListSample, modelPath);
+  //  #else
+  //   otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
+  //  #endif
+  //  }
+  else if (modelName == "boost")
+    {
+	#ifdef OTB_USE_OPENCV
+    TrainBoost(trainingListSample, trainingLabeledListSample, modelPath);
+    #else
+    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
+    #endif
+    }
+  else if (modelName == "dt")
+    {
+	#ifdef OTB_USE_OPENCV
+    TrainDecisionTree(trainingListSample, trainingLabeledListSample, modelPath);
+    #else
+    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
+    #endif
+    }
+  else if (modelName == "gbt")
+    {
+	#ifdef OTB_USE_OPENCV
+    TrainGradientBoostedTree(trainingListSample, trainingLabeledListSample, modelPath);
+    #else
+    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
+    #endif
+    }
+  else if (modelName == "ann")
+    {
+	#ifdef OTB_USE_OPENCV
+    TrainNeuralNetwork(trainingListSample, trainingLabeledListSample, modelPath);
+    #else
+    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
+    #endif
+    }
+  else if (modelName == "bayes")
+    {
+	#ifdef OTB_USE_OPENCV
+    TrainNormalBayes(trainingListSample, trainingLabeledListSample, modelPath);
+    #else
+    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
+    #endif
+    }
+  else if (modelName == "rf")
+    {
+	#ifdef OTB_USE_OPENCV
+    TrainRandomForests(trainingListSample, trainingLabeledListSample, modelPath);
+    #else
+    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
+    #endif
+    }
+  else if (modelName == "knn")
+    {
+	#ifdef OTB_USE_OPENCV
+    TrainKNN(trainingListSample, trainingLabeledListSample, modelPath);
+    #else
+    otbAppLogFATAL("Module OPENCV is not installed. You should consider turning OTB_USE_OPENCV on during cmake configuration.");
+    #endif
+    }
+}
+
+}
+}
+
+#endif
diff --git a/Modules/Applications/AppClassification/app/otbTrainBoost.cxx b/Modules/Applications/AppClassification/include/otbTrainBoost.txx
similarity index 82%
rename from Modules/Applications/AppClassification/app/otbTrainBoost.cxx
rename to Modules/Applications/AppClassification/include/otbTrainBoost.txx
index c107f80..23e666b 100644
--- a/Modules/Applications/AppClassification/app/otbTrainBoost.cxx
+++ b/Modules/Applications/AppClassification/include/otbTrainBoost.txx
@@ -14,16 +14,19 @@
  PURPOSE.  See the above copyright notices for more information.
 
  =========================================================================*/
-
-#include "otbTrainImagesClassifier.h"
-
+#ifndef __otbTrainBoost_txx
+#define __otbTrainBoost_txx
+#include "otbLearningApplicationBase.h"
 
 namespace otb
 {
 namespace Wrapper
 {
-#ifdef OTB_USE_OPENCV
-  void TrainImagesClassifier::InitBoostParams()
+
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::InitBoostParams()
   {
     AddChoice("classifier.boost", "Boost classifier");
     SetParameterDescription("classifier.boost", "This group of parameters allows to set Boost classifier parameters. "
@@ -55,10 +58,15 @@ namespace Wrapper
     SetParameterDescription("classifier.boost.m","Maximum depth of the tree.");
   }
 
-
-  void TrainImagesClassifier::TrainBoost(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample)
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::TrainBoost(typename ListSampleType::Pointer trainingListSample,
+               typename TargetListSampleType::Pointer trainingLabeledListSample,
+               std::string modelPath)
   {
-    BoostType::Pointer boostClassifier = BoostType::New();
+    typename BoostType::Pointer boostClassifier = BoostType::New();
+    boostClassifier->SetRegressionMode(this->m_RegressionFlag);
     boostClassifier->SetInputListSample(trainingListSample);
     boostClassifier->SetTargetListSample(trainingLabeledListSample);
     boostClassifier->SetBoostType(GetParameterInt("classifier.boost.t"));
@@ -67,9 +75,10 @@ namespace Wrapper
     boostClassifier->SetMaxDepth(GetParameterInt("classifier.boost.m"));
 
     boostClassifier->Train();
-    boostClassifier->Save(GetParameterString("io.out"));
+    boostClassifier->Save(modelPath);
   }
-#endif
 
 } //end namespace wrapper
 } //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/app/otbTrainDecisionTree.cxx b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx
similarity index 86%
rename from Modules/Applications/AppClassification/app/otbTrainDecisionTree.cxx
rename to Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx
index 9f94a7f..04df938 100644
--- a/Modules/Applications/AppClassification/app/otbTrainDecisionTree.cxx
+++ b/Modules/Applications/AppClassification/include/otbTrainDecisionTree.txx
@@ -14,15 +14,19 @@
  PURPOSE.  See the above copyright notices for more information.
 
  =========================================================================*/
-
-#include "otbTrainImagesClassifier.h"
+#ifndef __otbTrainDecisionTree_txx
+#define __otbTrainDecisionTree_txx
+#include "otbLearningApplicationBase.h"
 
 namespace otb
 {
 namespace Wrapper
 {
-#ifdef OTB_USE_OPENCV
-void TrainImagesClassifier::InitDecisionTreeParams()
+
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::InitDecisionTreeParams()
 {
   AddChoice("classifier.dt", "Decision Tree classifier");
   SetParameterDescription("classifier.dt",
@@ -81,10 +85,15 @@ void TrainImagesClassifier::InitDecisionTreeParams()
 
 }
 
-void TrainImagesClassifier::TrainDecisionTree(ListSampleType::Pointer trainingListSample,
-                                                             LabelListSampleType::Pointer trainingLabeledListSample)
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::TrainDecisionTree(typename ListSampleType::Pointer trainingListSample,
+                    typename TargetListSampleType::Pointer trainingLabeledListSample,
+                    std::string modelPath)
 {
-  DecisionTreeType::Pointer classifier = DecisionTreeType::New();
+  typename DecisionTreeType::Pointer classifier = DecisionTreeType::New();
+  classifier->SetRegressionMode(this->m_RegressionFlag);
   classifier->SetInputListSample(trainingListSample);
   classifier->SetTargetListSample(trainingLabeledListSample);
   classifier->SetMaxDepth(GetParameterInt("classifier.dt.max"));
@@ -101,8 +110,10 @@ void TrainImagesClassifier::TrainDecisionTree(ListSampleType::Pointer trainingLi
     classifier->SetTruncatePrunedTree(false);
     }
   classifier->Train();
-  classifier->Save(GetParameterString("io.out"));
+  classifier->Save(modelPath);
 }
-#endif
+
 } //end namespace wrapper
 } //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/app/otbTrainGradientBoostedTree.cxx b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx
similarity index 63%
rename from Modules/Applications/AppClassification/app/otbTrainGradientBoostedTree.cxx
rename to Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx
index c703ad4..b556125 100644
--- a/Modules/Applications/AppClassification/app/otbTrainGradientBoostedTree.cxx
+++ b/Modules/Applications/AppClassification/include/otbTrainGradientBoostedTree.txx
@@ -14,23 +14,34 @@
  PURPOSE.  See the above copyright notices for more information.
 
  =========================================================================*/
-
-#include "otbTrainImagesClassifier.h"
+#ifndef __otbTrainGradientBoostedTree_txx
+#define __otbTrainGradientBoostedTree_txx
+#include "otbLearningApplicationBase.h"
 
 namespace otb
 {
 namespace Wrapper
 {
-#ifdef OTB_USE_OPENCV
-void TrainImagesClassifier::InitGradientBoostedTreeParams()
+
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::InitGradientBoostedTreeParams()
 {
   AddChoice("classifier.gbt", "Gradient Boosted Tree classifier");
   SetParameterDescription(
       "classifier.gbt",
       "This group of parameters allows to set Gradient Boosted Tree classifier parameters. "
       "See complete documentation here \\url{http://docs.opencv.org/modules/ml/doc/gradient_boosted_trees.html}.");
-  //LossFunctionType : not exposed, as only one type is used for Classification,
-  // the other three are used for regression.
+
+  if (m_RegressionFlag)
+    {
+    AddParameter(ParameterType_Choice, "classifier.gbt.t", "Loss Function Type");
+    SetParameterDescription("classifier.gbt.t","Type of loss functionused for training.");
+    AddChoice("classifier.gbt.t.sqr","Squared Loss");
+    AddChoice("classifier.gbt.t.abs","Absolute Loss");
+    AddChoice("classifier.gbt.t.hub","Huber Loss");
+    }
 
   //WeakCount
   AddParameter(ParameterType_Int, "classifier.gbt.w", "Number of boosting algorithm iterations");
@@ -67,10 +78,15 @@ void TrainImagesClassifier::InitGradientBoostedTreeParams()
 
 }
 
-void TrainImagesClassifier::TrainGradientBoostedTree(
-    ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample)
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::TrainGradientBoostedTree(typename ListSampleType::Pointer trainingListSample,
+                           typename TargetListSampleType::Pointer trainingLabeledListSample,
+                           std::string modelPath)
 {
-  GradientBoostedTreeType::Pointer classifier = GradientBoostedTreeType::New();
+  typename GradientBoostedTreeType::Pointer classifier = GradientBoostedTreeType::New();
+  classifier->SetRegressionMode(this->m_RegressionFlag);
   classifier->SetInputListSample(trainingListSample);
   classifier->SetTargetListSample(trainingLabeledListSample);
   classifier->SetWeakCount(GetParameterInt("classifier.gbt.w"));
@@ -78,9 +94,34 @@ void TrainImagesClassifier::TrainGradientBoostedTree(
   classifier->SetSubSamplePortion(GetParameterFloat("classifier.gbt.p"));
   classifier->SetMaxDepth(GetParameterInt("classifier.gbt.max"));
 
+  if (m_RegressionFlag)
+    {
+    switch (GetParameterInt("classifier.gbt.t"))
+      {
+      case 0: // SQUARED_LOSS
+        classifier->SetLossFunctionType(CvGBTrees::SQUARED_LOSS);
+        break;
+      case 1: // ABSOLUTE_LOSS
+        classifier->SetLossFunctionType(CvGBTrees::ABSOLUTE_LOSS);
+        break;
+      case 2: // HUBER_LOSS
+        classifier->SetLossFunctionType(CvGBTrees::HUBER_LOSS);
+        break;
+      default:
+        classifier->SetLossFunctionType(CvGBTrees::SQUARED_LOSS);
+        break;
+      }
+    }
+  else
+    {
+    classifier->SetLossFunctionType(CvGBTrees::DEVIANCE_LOSS);
+    }
+
   classifier->Train();
-  classifier->Save(GetParameterString("io.out"));
+  classifier->Save(modelPath);
 }
-#endif
+
 } //end namespace wrapper
 } //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/include/otbTrainKNN.txx b/Modules/Applications/AppClassification/include/otbTrainKNN.txx
new file mode 100644
index 0000000..9365600
--- /dev/null
+++ b/Modules/Applications/AppClassification/include/otbTrainKNN.txx
@@ -0,0 +1,86 @@
+/*=========================================================================
+ 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 __otbTrainKNN_txx
+#define __otbTrainKNN_txx
+#include "otbLearningApplicationBase.h"
+
+namespace otb
+{
+namespace Wrapper
+{
+
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::InitKNNParams()
+  {
+    AddChoice("classifier.knn", "KNN classifier");
+    SetParameterDescription("classifier.knn", "This group of parameters allows to set KNN classifier parameters. "
+        "See complete documentation here \\url{http://docs.opencv.org/modules/ml/doc/k_nearest_neighbors.html}.");
+
+    //K parameter
+    AddParameter(ParameterType_Int, "classifier.knn.k", "Number of Neighbors");
+    SetParameterInt("classifier.knn.k", 32);
+    SetParameterDescription("classifier.knn.k","The number of neighbors to use.");
+
+    if (this->m_RegressionFlag)
+      {
+      // Decision rule : mean / median
+      AddParameter(ParameterType_Choice, "classifier.knn.rule", "Decision rule");
+      SetParameterDescription("classifier.knn.rule", "Decision rule for regression output");
+
+      AddChoice("classifier.knn.rule.mean", "Mean of neighbors values");
+      SetParameterDescription("classifier.knn.rule.mean","Returns the mean of neighbors values");
+
+      AddChoice("classifier.knn.rule.median", "Median of neighbors values");
+      SetParameterDescription("classifier.knn.rule.median","Returns the median of neighbors values");
+      }
+  }
+
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::TrainKNN(typename ListSampleType::Pointer trainingListSample,
+             typename TargetListSampleType::Pointer trainingLabeledListSample,
+             std::string modelPath)
+  {
+    typename KNNType::Pointer knnClassifier = KNNType::New();
+    knnClassifier->SetRegressionMode(this->m_RegressionFlag);
+    knnClassifier->SetInputListSample(trainingListSample);
+    knnClassifier->SetTargetListSample(trainingLabeledListSample);
+    knnClassifier->SetK(GetParameterInt("classifier.knn.k"));
+    if (this->m_RegressionFlag)
+      {
+      std::string decision = this->GetParameterString("classifier.knn.rule");
+      if (decision == "mean")
+        {
+        knnClassifier->SetDecisionRule(KNNType::KNN_MEAN);
+        }
+      else if (decision == "median")
+        {
+        knnClassifier->SetDecisionRule(KNNType::KNN_MEDIAN);
+        }
+      }
+
+    knnClassifier->Train();
+    knnClassifier->Save(modelPath);
+  }
+
+} //end namespace wrapper
+} //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx b/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx
new file mode 100644
index 0000000..9282456
--- /dev/null
+++ b/Modules/Applications/AppClassification/include/otbTrainLibSVM.txx
@@ -0,0 +1,160 @@
+/*=========================================================================
+ 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 __otbTrainLibSVM_txx
+#define __otbTrainLibSVM_txx
+#include "otbLearningApplicationBase.h"
+
+namespace otb
+{
+namespace Wrapper
+{
+
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::InitLibSVMParams()
+  {
+    AddChoice("classifier.libsvm", "LibSVM classifier");
+    SetParameterDescription("classifier.libsvm", "This group of parameters allows to set SVM classifier parameters.");
+    AddParameter(ParameterType_Choice, "classifier.libsvm.k", "SVM Kernel Type");
+    AddChoice("classifier.libsvm.k.linear", "Linear");
+    AddChoice("classifier.libsvm.k.rbf", "Gaussian radial basis function");
+    AddChoice("classifier.libsvm.k.poly", "Polynomial");
+    AddChoice("classifier.libsvm.k.sigmoid", "Sigmoid");
+    SetParameterString("classifier.libsvm.k", "linear");
+    SetParameterDescription("classifier.libsvm.k", "SVM Kernel Type.");
+    AddParameter(ParameterType_Choice, "classifier.libsvm.m", "SVM Model Type");
+    SetParameterDescription("classifier.libsvm.m", "Type of SVM formulation.");
+    if (this->m_RegressionFlag)
+      {
+      AddChoice("classifier.libsvm.m.epssvr", "Epsilon Support Vector Regression");
+      AddChoice("classifier.libsvm.m.nusvr", "Nu Support Vector Regression");
+      SetParameterString("classifier.libsvm.m", "epssvr");
+      }
+    else
+      {
+      AddChoice("classifier.libsvm.m.csvc", "C support vector classification");
+      AddChoice("classifier.libsvm.m.nusvc", "Nu support vector classification");
+      AddChoice("classifier.libsvm.m.oneclass", "Distribution estimation (One Class SVM)");
+      SetParameterString("classifier.libsvm.m", "csvc");
+      }
+    AddParameter(ParameterType_Float, "classifier.libsvm.c", "Cost parameter C");
+    SetParameterFloat("classifier.libsvm.c", 1.0);
+    SetParameterDescription(
+        "classifier.libsvm.c",
+        "SVM models have a cost parameter C (1 by default) to control the trade-off between training errors and forcing rigid margins.");
+    AddParameter(ParameterType_Empty, "classifier.libsvm.opt", "Parameters optimization");
+    MandatoryOff("classifier.libsvm.opt");
+    SetParameterDescription("classifier.libsvm.opt", "SVM parameters optimization flag.");
+    AddParameter(ParameterType_Empty, "classifier.libsvm.prob", "Probability estimation");
+    MandatoryOff("classifier.libsvm.prob");
+    SetParameterDescription("classifier.libsvm.prob", "Probability estimation flag.");
+
+    if (this->m_RegressionFlag)
+      {
+      AddParameter(ParameterType_Float, "classifier.libsvm.eps", "Epsilon");
+      SetParameterFloat("classifier.libsvm.eps", 1e-3);
+      AddParameter(ParameterType_Float, "classifier.libsvm.nu", "Nu");
+      SetParameterFloat("classifier.libsvm.nu", 0.5);
+      }
+  }
+
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::TrainLibSVM(typename ListSampleType::Pointer trainingListSample,
+                typename TargetListSampleType::Pointer trainingLabeledListSample,
+                std::string modelPath)
+  {
+    typename LibSVMType::Pointer libSVMClassifier = LibSVMType::New();
+    libSVMClassifier->SetRegressionMode(this->m_RegressionFlag);
+    libSVMClassifier->SetInputListSample(trainingListSample);
+    libSVMClassifier->SetTargetListSample(trainingLabeledListSample);
+    //SVM Option
+    //TODO : Add other options ?
+    if (IsParameterEnabled("classifier.libsvm.opt"))
+      {
+      libSVMClassifier->SetParameterOptimization(true);
+      }
+    if (IsParameterEnabled("classifier.libsvm.prob"))
+      {
+      libSVMClassifier->SetDoProbabilityEstimates(true);
+      }
+    libSVMClassifier->SetC(GetParameterFloat("classifier.libsvm.c"));
+
+    switch (GetParameterInt("classifier.libsvm.k"))
+      {
+      case 0: // LINEAR
+        libSVMClassifier->SetKernelType(LINEAR);
+        break;
+      case 1: // RBF
+        libSVMClassifier->SetKernelType(RBF);
+        break;
+      case 2: // POLY
+        libSVMClassifier->SetKernelType(POLY);
+        break;
+      case 3: // SIGMOID
+        libSVMClassifier->SetKernelType(SIGMOID);
+        break;
+      default: // DEFAULT = LINEAR
+        libSVMClassifier->SetKernelType(LINEAR);
+        break;
+      }
+    if (this->m_RegressionFlag)
+      {
+      switch (GetParameterInt("classifier.libsvm.m"))
+        {
+        case 0: // EPSILON_SVR
+          libSVMClassifier->SetSVMType(EPSILON_SVR);
+          break;
+        case 1: // NU_SVR
+          libSVMClassifier->SetSVMType(NU_SVR);
+          break;
+        default:
+          libSVMClassifier->SetSVMType(EPSILON_SVR);
+          break;
+        }
+      libSVMClassifier->SetEpsilon(GetParameterFloat("classifier.libsvm.eps"));
+      libSVMClassifier->SetNu(GetParameterFloat("classifier.libsvm.nu"));
+      }
+    else
+      {
+      switch (GetParameterInt("classifier.libsvm.m"))
+        {
+        case 0: // C_SVC
+          libSVMClassifier->SetSVMType(C_SVC);
+          break;
+        case 1: // NU_SVC
+          libSVMClassifier->SetSVMType(NU_SVC);
+          break;
+        case 2: // ONE_CLASS
+          libSVMClassifier->SetSVMType(ONE_CLASS);
+          break;
+        default:
+          libSVMClassifier->SetSVMType(C_SVC);
+          break;
+        }
+      }
+
+    libSVMClassifier->Train();
+    libSVMClassifier->Save(modelPath);
+  }
+
+} //end namespace wrapper
+} //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/app/otbTrainNeuralNetwork.cxx b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx
similarity index 87%
rename from Modules/Applications/AppClassification/app/otbTrainNeuralNetwork.cxx
rename to Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx
index 29b3657..40f120f 100644
--- a/Modules/Applications/AppClassification/app/otbTrainNeuralNetwork.cxx
+++ b/Modules/Applications/AppClassification/include/otbTrainNeuralNetwork.txx
@@ -14,16 +14,20 @@
  PURPOSE.  See the above copyright notices for more information.
 
  =========================================================================*/
-
+#ifndef __otbTrainNeuralNetwork_txx
+#define __otbTrainNeuralNetwork_txx
 #include <boost/lexical_cast.hpp>
-#include "otbTrainImagesClassifier.h"
+#include "otbLearningApplicationBase.h"
 
 namespace otb
 {
 namespace Wrapper
 {
-#ifdef OTB_USE_OPENCV
-void TrainImagesClassifier::InitNeuralNetworkParams()
+
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::InitNeuralNetworkParams()
 {
   AddChoice("classifier.ann", "Artificial Neural Network classifier");
   SetParameterDescription("classifier.ann",
@@ -119,10 +123,15 @@ void TrainImagesClassifier::InitNeuralNetworkParams()
 
 }
 
-void TrainImagesClassifier::TrainNeuralNetwork(ListSampleType::Pointer trainingListSample,
-                                                              LabelListSampleType::Pointer trainingLabeledListSample)
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::TrainNeuralNetwork(typename ListSampleType::Pointer trainingListSample,
+                     typename TargetListSampleType::Pointer trainingLabeledListSample,
+                     std::string modelPath)
 {
-  NeuralNetworkType::Pointer classifier = NeuralNetworkType::New();
+  typename NeuralNetworkType::Pointer classifier = NeuralNetworkType::New();
+  classifier->SetRegressionMode(this->m_RegressionFlag);
   classifier->SetInputListSample(trainingListSample);
   classifier->SetTargetListSample(trainingLabeledListSample);
 
@@ -153,18 +162,23 @@ void TrainImagesClassifier::TrainNeuralNetwork(ListSampleType::Pointer trainingL
 
 
   unsigned int nbClasses = 0;
-  LabelType currentLabel = 0, prevLabel = 0;
-  for (unsigned int itLab = 0; itLab < trainingLabeledListSample->Size(); ++itLab)
+  if (this->m_RegressionFlag)
+    {
+    layerSizes.push_back(1);
+    }
+  else
     {
-    currentLabel = trainingLabeledListSample->GetMeasurementVector(itLab);
-    if ((currentLabel != prevLabel) || (itLab == 0))
+    std::set<TargetValueType> labelSet;
+    TargetSampleType currentLabel;
+    for (unsigned int itLab = 0; itLab < trainingLabeledListSample->Size(); ++itLab)
       {
-      ++nbClasses;
+      currentLabel = trainingLabeledListSample->GetMeasurementVector(itLab);
+      labelSet.insert(currentLabel[0]);
       }
-    prevLabel = currentLabel;
+    nbClasses = labelSet.size();
+    layerSizes.push_back(nbClasses);
     }
 
-  layerSizes.push_back(nbClasses);
   classifier->SetLayerSizes(layerSizes);
 
   switch (GetParameterInt("classifier.ann.f"))
@@ -208,8 +222,10 @@ void TrainImagesClassifier::TrainNeuralNetwork(ListSampleType::Pointer trainingL
   classifier->SetEpsilon(GetParameterFloat("classifier.ann.eps"));
   classifier->SetMaxIter(GetParameterInt("classifier.ann.iter"));
   classifier->Train();
-  classifier->Save(GetParameterString("io.out"));
+  classifier->Save(modelPath);
 }
-#endif
+
 } //end namespace wrapper
 } //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/app/otbTrainNormalBayes.cxx b/Modules/Applications/AppClassification/include/otbTrainNormalBayes.txx
similarity index 59%
rename from Modules/Applications/AppClassification/app/otbTrainNormalBayes.cxx
rename to Modules/Applications/AppClassification/include/otbTrainNormalBayes.txx
index d33e6ea..d5f3cce 100644
--- a/Modules/Applications/AppClassification/app/otbTrainNormalBayes.cxx
+++ b/Modules/Applications/AppClassification/include/otbTrainNormalBayes.txx
@@ -14,16 +14,19 @@
  PURPOSE.  See the above copyright notices for more information.
 
  =========================================================================*/
-
-#include "otbTrainImagesClassifier.h"
-
+#ifndef __otbTrainNormalBayes_txx
+#define __otbTrainNormalBayes_txx
+#include "otbLearningApplicationBase.h"
 
 namespace otb
 {
 namespace Wrapper
 {
-#ifdef OTB_USE_OPENCV
-  void TrainImagesClassifier::InitNormalBayesParams()
+
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::InitNormalBayesParams()
   {
     AddChoice("classifier.bayes", "Normal Bayes classifier");
     SetParameterDescription("classifier.bayes", "Use a Normal Bayes Classifier. "
@@ -31,15 +34,22 @@ namespace Wrapper
 
   }
 
-
-  void TrainImagesClassifier::TrainNormalBayes(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample)
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::TrainNormalBayes(typename ListSampleType::Pointer trainingListSample,
+                     typename TargetListSampleType::Pointer trainingLabeledListSample,
+                     std::string modelPath)
   {
-    NormalBayesType::Pointer classifier = NormalBayesType::New();
+    typename NormalBayesType::Pointer classifier = NormalBayesType::New();
+    classifier->SetRegressionMode(this->m_RegressionFlag);
     classifier->SetInputListSample(trainingListSample);
     classifier->SetTargetListSample(trainingLabeledListSample);
     classifier->Train();
-    classifier->Save(GetParameterString("io.out"));
+    classifier->Save(modelPath);
   }
-#endif
+
 } //end namespace wrapper
 } //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/app/otbTrainRandomForests.cxx b/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx
similarity index 87%
rename from Modules/Applications/AppClassification/app/otbTrainRandomForests.cxx
rename to Modules/Applications/AppClassification/include/otbTrainRandomForests.txx
index 1798b9d..a856243 100644
--- a/Modules/Applications/AppClassification/app/otbTrainRandomForests.cxx
+++ b/Modules/Applications/AppClassification/include/otbTrainRandomForests.txx
@@ -14,15 +14,19 @@
  PURPOSE.  See the above copyright notices for more information.
 
  =========================================================================*/
-
-#include "otbTrainImagesClassifier.h"
+#ifndef __otbTrainRandomForests_txx
+#define __otbTrainRandomForests_txx
+#include "otbLearningApplicationBase.h"
 
 namespace otb
 {
 namespace Wrapper
 {
-#ifdef OTB_USE_OPENCV
-void TrainImagesClassifier::InitRandomForestsParams()
+
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::InitRandomForestsParams()
 {
   AddChoice("classifier.rf", "Random forests classifier");
   SetParameterDescription("classifier.rf",
@@ -95,10 +99,15 @@ void TrainImagesClassifier::InitRandomForestsParams()
   //TerminationCriteria not exposed
 }
 
-void TrainImagesClassifier::TrainRandomForests(ListSampleType::Pointer trainingListSample,
-                                                              LabelListSampleType::Pointer trainingLabeledListSample)
+template <class TInputValue, class TOutputValue>
+void
+LearningApplicationBase<TInputValue,TOutputValue>
+::TrainRandomForests(typename ListSampleType::Pointer trainingListSample,
+                     typename TargetListSampleType::Pointer trainingLabeledListSample,
+                     std::string modelPath)
 {
-  RandomForestType::Pointer classifier = RandomForestType::New();
+  typename RandomForestType::Pointer classifier = RandomForestType::New();
+  classifier->SetRegressionMode(this->m_RegressionFlag);
   classifier->SetInputListSample(trainingListSample);
   classifier->SetTargetListSample(trainingLabeledListSample);
   classifier->SetMaxDepth(GetParameterInt("classifier.rf.max"));
@@ -110,8 +119,10 @@ void TrainImagesClassifier::TrainRandomForests(ListSampleType::Pointer trainingL
   classifier->SetForestAccuracy(GetParameterFloat("classifier.rf.acc"));
 
   classifier->Train();
-  classifier->Save(GetParameterString("io.out"));
+  classifier->Save(modelPath);
 }
-#endif
+
 } //end namespace wrapper
 } //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/app/otbTrainSVM.cxx b/Modules/Applications/AppClassification/include/otbTrainSVM.txx
similarity index 57%
rename from Modules/Applications/AppClassification/app/otbTrainSVM.cxx
rename to Modules/Applications/AppClassification/include/otbTrainSVM.txx
index a41e103..ac0f153 100644
--- a/Modules/Applications/AppClassification/app/otbTrainSVM.cxx
+++ b/Modules/Applications/AppClassification/include/otbTrainSVM.txx
@@ -14,28 +14,38 @@
  PURPOSE.  See the above copyright notices for more information.
 
  =========================================================================*/
-
-#include "otbTrainImagesClassifier.h"
-
+#ifndef __otbTrainSVM_txx
+#define __otbTrainSVM_txx
+#include "otbLearningApplicationBase.h"
 
 namespace otb
 {
 namespace Wrapper
 {
-#ifdef OTB_USE_OPENCV
-  void TrainImagesClassifier::InitSVMParams()
+
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::InitSVMParams()
   {
     AddChoice("classifier.svm", "SVM classifier (OpenCV)");
     SetParameterDescription("classifier.svm", "This group of parameters allows to set SVM classifier parameters. "
         "See complete documentation here \\url{http://docs.opencv.org/modules/ml/doc/support_vector_machines.html}.");
     AddParameter(ParameterType_Choice, "classifier.svm.m", "SVM Model Type");
-    AddChoice("classifier.svm.m.csvc", "C support vector classification");
-    AddChoice("classifier.svm.m.nusvc", "Nu support vector classification");
-    AddChoice("classifier.svm.m.oneclass", "Distribution estimation (One Class SVM)");
-    //AddChoice("classifier.svm.m.epssvr", "Epsilon Support Vector Regression");
-    //AddChoice("classifier.svm.m.nusvr", "Nu Support Vector Regression");
-    SetParameterString("classifier.svm.m", "csvc");
     SetParameterDescription("classifier.svm.m", "Type of SVM formulation.");
+    if (this->m_RegressionFlag)
+      {
+      AddChoice("classifier.svm.m.epssvr", "Epsilon Support Vector Regression");
+      AddChoice("classifier.svm.m.nusvr", "Nu Support Vector Regression");
+      SetParameterString("classifier.svm.m", "epssvr");
+      }
+    else
+      {
+      AddChoice("classifier.svm.m.csvc", "C support vector classification");
+      AddChoice("classifier.svm.m.nusvc", "Nu support vector classification");
+      AddChoice("classifier.svm.m.oneclass", "Distribution estimation (One Class SVM)");
+      SetParameterString("classifier.svm.m", "csvc");
+      }
     AddParameter(ParameterType_Choice, "classifier.svm.k", "SVM Kernel Type");
     AddChoice("classifier.svm.k.linear", "Linear");
     AddChoice("classifier.svm.k.rbf", "Gaussian radial basis function");
@@ -52,9 +62,26 @@ namespace Wrapper
                  "Parameter nu of a SVM optimization problem (NU_SVC / ONE_CLASS)");
     SetParameterFloat("classifier.svm.nu", 0.0);
     SetParameterDescription("classifier.svm.nu", "Parameter nu of a SVM optimization problem.");
-    //AddParameter(ParameterType_Float, "classifier.svm.p", "Parameter epsilon of a SVM optimization problem (EPS_SVR)");
-    //SetParameterFloat("classifier.svm.p", 0.0);
-    //SetParameterDescription("classifier.svm.p", "Parameter epsilon of a SVM optimization problem (EPS_SVR).");
+    if (this->m_RegressionFlag)
+      {
+      AddParameter(ParameterType_Float, "classifier.svm.p", "Parameter epsilon of a SVM optimization problem (EPS_SVR)");
+      SetParameterFloat("classifier.svm.p", 1.0);
+      SetParameterDescription("classifier.svm.p", "Parameter epsilon of a SVM optimization problem (EPS_SVR).");
+
+      AddParameter(ParameterType_Choice, "classifier.svm.term", "Termination criteria");
+      SetParameterDescription("classifier.svm.term","Termination criteria for iterative algorithm");
+      AddChoice("classifier.svm.term.iter", "Stops when maximum iteration is reached.");
+      AddChoice("classifier.svm.term.eps", "Stops when accuracy is lower than epsilon.");
+      AddChoice("classifier.svm.term.all", "Stops when either iteration or epsilon criteria is true");
+
+      AddParameter(ParameterType_Float, "classifier.svm.iter", "Maximum iteration");
+      SetParameterFloat("classifier.svm.iter", 1000);
+      SetParameterDescription("classifier.svm.iter", "Maximum number of iterations (corresponds to the termination criteria 'iter').");
+
+      AddParameter(ParameterType_Float, "classifier.svm.eps", "Epsilon accuracy threshold");
+      SetParameterFloat("classifier.svm.eps", FLT_EPSILON);
+      SetParameterDescription("classifier.svm.eps", "Epsilon accuracy (corresponds to the termination criteria 'eps').");
+      }
     AddParameter(ParameterType_Float, "classifier.svm.coef0", "Parameter coef0 of a kernel function (POLY / SIGMOID)");
     SetParameterFloat("classifier.svm.coef0", 0.0);
     SetParameterDescription("classifier.svm.coef0", "Parameter coef0 of a kernel function (POLY / SIGMOID).");
@@ -76,9 +103,15 @@ namespace Wrapper
                             "because the samples are not identically processed within OpenCV.");
   }
 
-  void TrainImagesClassifier::TrainSVM(ListSampleType::Pointer trainingListSample, LabelListSampleType::Pointer trainingLabeledListSample)
+  template <class TInputValue, class TOutputValue>
+  void
+  LearningApplicationBase<TInputValue,TOutputValue>
+  ::TrainSVM(typename ListSampleType::Pointer trainingListSample,
+             typename TargetListSampleType::Pointer trainingLabeledListSample,
+             std::string modelPath)
   {
-    SVMType::Pointer SVMClassifier = SVMType::New();
+    typename SVMType::Pointer SVMClassifier = SVMType::New();
+    SVMClassifier->SetRegressionMode(this->m_RegressionFlag);
     SVMClassifier->SetInputListSample(trainingListSample);
     SVMClassifier->SetTargetListSample(trainingLabeledListSample);
     switch (GetParameterInt("classifier.svm.k"))
@@ -104,36 +137,69 @@ namespace Wrapper
         std::cout << "CvSVM::LINEAR = " << CvSVM::LINEAR << std::endl;
         break;
       }
-    switch (GetParameterInt("classifier.svm.m"))
+    if (this->m_RegressionFlag)
       {
-      case 0: // C_SVC
-        SVMClassifier->SetSVMType(CvSVM::C_SVC);
-        std::cout << "CvSVM::C_SVC = " << CvSVM::C_SVC << std::endl;
-        break;
-      case 1: // NU_SVC
-        SVMClassifier->SetSVMType(CvSVM::NU_SVC);
-        std::cout << "CvSVM::NU_SVC = " << CvSVM::NU_SVC << std::endl;
-        break;
-      case 2: // ONE_CLASS
-        SVMClassifier->SetSVMType(CvSVM::ONE_CLASS);
-        std::cout << "CvSVM::ONE_CLASS = " << CvSVM::ONE_CLASS << std::endl;
-        break;
-        /*case 3: // EPS_SVR
-         SVMClassifier->SetSVMType(CvSVM::EPS_SVR);
-         std::cout<<"CvSVM::EPS_SVR = "<<CvSVM::EPS_SVR<<std::endl;
-         break;
-         case 4: // NU_SVR
-         SVMClassifier->SetSVMType(CvSVM::NU_SVR);
-         std::cout<<"CvSVM::NU_SVR = "<<CvSVM::NU_SVR<<std::endl;
-         break; */
-      default: // DEFAULT = C_SVC
-        SVMClassifier->SetSVMType(CvSVM::C_SVC);
-        std::cout << "CvSVM::C_SVC = " << CvSVM::C_SVC << std::endl;
-        break;
+      switch (GetParameterInt("classifier.svm.m"))
+        {
+        case 0: // EPS_SVR
+           SVMClassifier->SetSVMType(CvSVM::EPS_SVR);
+           std::cout<<"CvSVM::EPS_SVR = "<<CvSVM::EPS_SVR<<std::endl;
+           break;
+        case 1: // NU_SVR
+           SVMClassifier->SetSVMType(CvSVM::NU_SVR);
+           std::cout<<"CvSVM::NU_SVR = "<<CvSVM::NU_SVR<<std::endl;
+           break;
+        default: // DEFAULT = EPS_SVR
+          SVMClassifier->SetSVMType(CvSVM::EPS_SVR);
+          std::cout << "CvSVM::EPS_SVR = " << CvSVM::EPS_SVR << std::endl;
+          break;
+        }
+      }
+    else
+      {
+      switch (GetParameterInt("classifier.svm.m"))
+        {
+        case 0: // C_SVC
+          SVMClassifier->SetSVMType(CvSVM::C_SVC);
+          std::cout << "CvSVM::C_SVC = " << CvSVM::C_SVC << std::endl;
+          break;
+        case 1: // NU_SVC
+          SVMClassifier->SetSVMType(CvSVM::NU_SVC);
+          std::cout << "CvSVM::NU_SVC = " << CvSVM::NU_SVC << std::endl;
+          break;
+        case 2: // ONE_CLASS
+          SVMClassifier->SetSVMType(CvSVM::ONE_CLASS);
+          std::cout << "CvSVM::ONE_CLASS = " << CvSVM::ONE_CLASS << std::endl;
+          break;
+        default: // DEFAULT = C_SVC
+          SVMClassifier->SetSVMType(CvSVM::C_SVC);
+          std::cout << "CvSVM::C_SVC = " << CvSVM::C_SVC << std::endl;
+          break;
+        }
       }
     SVMClassifier->SetC(GetParameterFloat("classifier.svm.c"));
     SVMClassifier->SetNu(GetParameterFloat("classifier.svm.nu"));
-    //SVMClassifier->SetP(GetParameterFloat("classifier.svm.p"));
+    if (this->m_RegressionFlag)
+      {
+      SVMClassifier->SetP(GetParameterFloat("classifier.svm.p"));
+      switch (GetParameterInt("classifier.svm.term"))
+        {
+        case 0: // ITER
+          SVMClassifier->SetTermCriteriaType(CV_TERMCRIT_ITER);
+          break;
+        case 1: // EPS
+          SVMClassifier->SetTermCriteriaType(CV_TERMCRIT_EPS);
+          break;
+        case 2: // ITER+EPS
+          SVMClassifier->SetTermCriteriaType(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS);
+          break;
+        default:
+          SVMClassifier->SetTermCriteriaType(CV_TERMCRIT_ITER);
+          break;
+        }
+      SVMClassifier->SetMaxIter(GetParameterInt("classifier.svm.iter"));
+      SVMClassifier->SetEpsilon(GetParameterFloat("classifier.svm.eps"));
+      }
     SVMClassifier->SetCoef0(GetParameterFloat("classifier.svm.coef0"));
     SVMClassifier->SetGamma(GetParameterFloat("classifier.svm.gamma"));
     SVMClassifier->SetDegree(GetParameterFloat("classifier.svm.degree"));
@@ -142,17 +208,21 @@ namespace Wrapper
       SVMClassifier->SetParameterOptimization(true);
     }
     SVMClassifier->Train();
-    SVMClassifier->Save(GetParameterString("io.out"));
+    SVMClassifier->Save(modelPath);
 
     // Update the displayed parameters in the GUI after the training process, for further use of them
     SetParameterFloat("classifier.svm.c", static_cast<float> (SVMClassifier->GetOutputC()));
     SetParameterFloat("classifier.svm.nu", static_cast<float> (SVMClassifier->GetOutputNu()));
-    //SetParameterFloat("classifier.svm.p", static_cast<float> (SVMClassifier->GetOutputP()));
+    if (this->m_RegressionFlag)
+      {
+      SetParameterFloat("classifier.svm.p", static_cast<float> (SVMClassifier->GetOutputP()));
+      }
     SetParameterFloat("classifier.svm.coef0", static_cast<float> (SVMClassifier->GetOutputCoef0()));
     SetParameterFloat("classifier.svm.gamma", static_cast<float> (SVMClassifier->GetOutputGamma()));
     SetParameterFloat("classifier.svm.degree", static_cast<float> (SVMClassifier->GetOutputDegree()));
   }
-#endif
 
 } //end namespace wrapper
 } //end namespace otb
+
+#endif
diff --git a/Modules/Applications/AppClassification/test/CMakeLists.txt b/Modules/Applications/AppClassification/test/CMakeLists.txt
index e37126f..161714a 100644
--- a/Modules/Applications/AppClassification/test/CMakeLists.txt
+++ b/Modules/Applications/AppClassification/test/CMakeLists.txt
@@ -1,6 +1,14 @@
 otb_module_test()
 #----------- ComputeOGRLayersFeaturesStatistics TESTS ----------------
-
+otb_test_application(NAME apTvClComputeOGRLayersFeaturesStatistics
+                     APP  ComputeOGRLayersFeaturesStatistics
+                     OPTIONS -inshp ${INPUTDATA}/Classification/apTvClLabeledVector.shp
+                             -feat meanB0 meanB1 meanB2 meanB3 varB0 varB1 varB2 varB3
+                             -outstats ${TEMP}/apTvClComputeOGRLayersFeaturesStatistics.xml
+                     VALID   --compare-ascii ${NOTOL}
+                             ${OTBAPP_BASELINE_FILES}/apTvClComputeOGRLayersFeaturesStatistics.xml
+                             ${TEMP}/apTvClComputeOGRLayersFeaturesStatistics.xml)
+                             
 #----------- SOMClassification TESTS ----------------
 otb_test_application(NAME apTvClSOMClassificationSmall
                      APP  SOMClassification
@@ -69,8 +77,8 @@ set(rf_output_format ".rf")
 set(knn_output_format ".knn")
 
 # Training algorithms parameters
-set(libsvm_parameters "-classifier.libsvm.opt" "true")
-set(svm_parameters "-classifier.svm.opt" "true")
+set(libsvm_parameters "-classifier.libsvm.opt" "true" "-classifier.libsvm.prob" "true")
+#set(svm_parameters "-classifier.svm.opt" "true")
 set(boost_parameters "")
 set(dt_parameters "")
 set(gbt_parameters "")
@@ -82,6 +90,7 @@ set(knn_parameters "")
 # Validation depending on mode
 set(ascii_comparison --compare-ascii ${NOTOL})
 set(raster_comparison --compare-image ${NOTOL})
+set(raster_comparison_two --compare-n-images ${NOTOL} 2)
 
 # Reference ffiles depending on modes
 set(ascii_ref_path ${OTBAPP_BASELINE_FILES})
@@ -92,8 +101,10 @@ if(OTB_USE_LIBSVM)
   list(APPEND classifierList "LIBSVM")
 endif()
 if(OTB_USE_OPENCV)
-  list(APPEND classifierList "SVM" "BOOST" "DT" "GBT" "ANN" "BAYES" "RF" "KNN")
+  #list(APPEND classifierList "SVM" "BOOST" "DT" "GBT" "ANN" "BAYES" "RF" "KNN")
+  list(APPEND classifierList "BOOST" "DT" "GBT" "ANN" "BAYES" "RF" "KNN")
 endif()
+set(classifier_with_confmap "LIBSVM" "BOOST" "KNN" "ANN" "RF")
 
 # Loop on classifiers
 foreach(classifier ${classifierList})
@@ -102,13 +113,14 @@ foreach(classifier ${classifierList})
   # Derive output file name
   set(OUTMODELFILE cl${classifier}_ModelQB1${${lclassifier}_output_format})
   set(OUTRASTER cl${classifier}LabeledImageQB1${raster_output_format})
+  set(OUTCONFMAP cl${classifier}ConfidenceMapQB1${raster_output_format})
 
   otb_test_application(
                        NAME     apTvClTrainMethod${classifier}ImagesClassifierQB1
                        APP      TrainImagesClassifier
                        OPTIONS  -io.il ${INPUTDATA}/Classification/QB_1_ortho${raster_input_format}
                                 -io.vd ${INPUTDATA}/Classification/VectorData_${${lclassifier}_input}QB1${vector_input_format}
-                                -io.imstat ${ascii_ref_path}/clImageStatisticsQB1${stat_input_format}
+                                -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB1${stat_input_format}
                                 -classifier ${lclassifier}
                                 ${${lclassifier}_parameters}
                                 -io.out ${TEMP}/${OUTMODELFILE}
@@ -124,7 +136,7 @@ foreach(classifier ${classifierList})
                        APP      TrainImagesClassifier
                        OPTIONS  -io.il ${INPUTDATA}/Classification/QB_1_ortho${raster_input_format}
                                 -io.vd ${INPUTDATA}/Classification/VectorData_${${lclassifier}_input}QB1${vector_input_format}
-                                -io.imstat ${ascii_ref_path}/clImageStatisticsQB1${stat_input_format}
+                                -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB1${stat_input_format}
                                 -classifier ${lclassifier}
                                 ${${lclassifier}_parameters}
                                 -io.out ${TEMP}/OutXML1_${OUTMODELFILE}
@@ -142,7 +154,7 @@ foreach(classifier ${classifierList})
                        OPTIONS  -inxml ${INPUTDATA}/cl${classifier}_OutXML1.xml
                                 -io.il ${INPUTDATA}/Classification/QB_1_ortho${raster_input_format}
                                 -io.vd ${INPUTDATA}/Classification/VectorData_${${lclassifier}_input}QB1${vector_input_format}
-                                -io.imstat ${ascii_ref_path}/clImageStatisticsQB1${stat_input_format}
+                                -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB1${stat_input_format}
                                 -io.out ${TEMP}/OutXML2_${OUTMODELFILE}
 
                        VALID    ${ascii_comparison}
@@ -152,156 +164,166 @@ foreach(classifier ${classifierList})
 
                      #set_tests_properties(apTvClTrainMethod${classifier}ImagesClassifierQB1_InXML1 PROPERTIES DEPENDS apTvClTrainMethod${classifier}ImagesClassifierQB1_OutXML1)
 
-  otb_test_application(
+  list(FIND classifier_with_confmap ${classifier} _classifier_has_confmap)
+  if(${_classifier_has_confmap} EQUAL -1)
+    otb_test_application(
                        NAME     apTvClMethod${classifier}ImageClassifierQB1
                        APP      ImageClassifier
                        OPTIONS  -in ${INPUTDATA}/Classification/QB_1_ortho${raster_input_format}
-                                -model ${ascii_ref_path}/${OUTMODELFILE}
-                                -imstat ${ascii_ref_path}/clImageStatisticsQB1${stat_input_format}
+                                -model ${INPUTDATA}/Classification/${OUTMODELFILE}
+                                -imstat ${INPUTDATA}/Classification/clImageStatisticsQB1${stat_input_format}
                                 -out ${TEMP}/${OUTRASTER} ${raster_output_option}
 
                        VALID    ${raster_comparison}
                                 ${raster_ref_path}/${OUTRASTER}
                                 ${TEMP}/${OUTRASTER}
                        )
+  else()
+    otb_test_application(
+                       NAME     apTvClMethod${classifier}ImageClassifierQB1
+                       APP      ImageClassifier
+                       OPTIONS  -in ${INPUTDATA}/Classification/QB_1_ortho${raster_input_format}
+                                -model ${INPUTDATA}/Classification/${OUTMODELFILE}
+                                -imstat ${INPUTDATA}/Classification/clImageStatisticsQB1${stat_input_format}
+                                -out ${TEMP}/${OUTRASTER} ${raster_output_option}
+                                -confmap ${TEMP}/${OUTCONFMAP}
+
+                       VALID    ${raster_comparison_two}
+                                ${raster_ref_path}/${OUTRASTER}
+                                ${TEMP}/${OUTRASTER}
+                                ${raster_ref_path}/${OUTCONFMAP}
+                                ${TEMP}/${OUTCONFMAP}
+                       )
+  endif()
 
 endforeach()
 
 if(OTB_USE_LIBSVM)
-otb_test_application(NAME apTvClImageSVMClassifierQB2
+  otb_test_application(NAME apTvClImageSVMClassifierQB2
                       APP  ImageClassifier
                       OPTIONS -in      ${INPUTDATA}/Classification/QB_2_ortho.tif
-                              -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB1.xml
-                              -model   ${TEMP}/clsvmModelQB1.svm
+                              -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB1.xml
+                              -model   ${INPUTDATA}/Classification/clsvmModelQB1.svm
                               -out     ${TEMP}/clLabeledImageQB2.tif
                       VALID   --compare-image ${NOTOL}
                               ${OTBAPP_BASELINE}/clLabeledImageQB2.tif
                               ${TEMP}/clLabeledImageQB2.tif)
 
-set_tests_properties(apTvClImageSVMClassifierQB2 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB1)
-
-otb_test_application(NAME apTvClImageSVMClassifierQB3
+  otb_test_application(NAME apTvClImageSVMClassifierQB3
                       APP  ImageClassifier
                       OPTIONS -in      ${INPUTDATA}/Classification/QB_3_ortho.tif
-                              -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB1.xml
-                              -model   ${TEMP}/clsvmModelQB1.svm
+                              -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB1.xml
+                              -model   ${INPUTDATA}/Classification/clsvmModelQB1.svm
                               -out     ${TEMP}/clLabeledImageQB3.tif
                       VALID   --compare-image ${NOTOL}
                               ${OTBAPP_BASELINE}/clLabeledImageQB3.tif
                               ${TEMP}/clLabeledImageQB3.tif)
 
-set_tests_properties(apTvClImageSVMClassifierQB3 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB1)
-
-otb_test_application(NAME apTvClImageSVMClassifierQB1
+  otb_test_application(NAME apTvClImageSVMClassifierQB1
                       APP  ImageClassifier
                       OPTIONS -in      ${INPUTDATA}/Classification/QB_1_ortho.tif
-                              -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB1.xml
-                              -model   ${TEMP}/clsvmModelQB1.svm
+                              -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB1.xml
+                              -model   ${INPUTDATA}/Classification/clsvmModelQB1.svm
                               -out     ${TEMP}/clLabeledImageQB1.tif
                       VALID   --compare-image ${NOTOL}
                               ${OTBAPP_BASELINE}/clLabeledImageQB1.tif
                               ${TEMP}/clLabeledImageQB1.tif)
 
-set_tests_properties(apTvClImageSVMClassifierQB1 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB1)
-
   otb_test_application(NAME apTvClImageSVMClassifierQB456_6
                        APP  ImageClassifier
                        OPTIONS -in      ${INPUTDATA}/Classification/QB_6_extract.tif
                                -mask    ${INPUTDATA}/Classification/QB_6_mask.tif
-                               -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB456.xml
-                               -model   ${TEMP}/clsvmModelQB456.svm
+                               -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB456.xml
+                               -model   ${INPUTDATA}/Classification/clsvmModelQB456.svm
                                -out     ${TEMP}/clLabeledImageQB456_6.tif
                        VALID   --compare-image ${NOTOL}
                                ${OTBAPP_BASELINE}/clLabeledImageQB456_6.tif
                                ${TEMP}/clLabeledImageQB456_6.tif)
 
- set_tests_properties(apTvClImageSVMClassifierQB456_6 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB456)
-
   otb_test_application(NAME apTvClImageSVMClassifierQB456_4
                        APP  ImageClassifier
                        OPTIONS -in      ${INPUTDATA}/Classification/QB_4_extract.tif
-                               -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB456.xml
-                               -model   ${TEMP}/clsvmModelQB456.svm
+                               -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB456.xml
+                               -model   ${INPUTDATA}/Classification/clsvmModelQB456.svm
                                -out     ${TEMP}/clLabeledImageQB456_4.tif
                        VALID   --compare-image ${NOTOL}
                                ${OTBAPP_BASELINE}/clLabeledImageQB456_4.tif
                                ${TEMP}/clLabeledImageQB456_4.tif)
 
-set_tests_properties(apTvClImageSVMClassifierQB456_4 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB456)
-
   otb_test_application(NAME apTvClImageSVMClassifierQB456_5
                        APP  ImageClassifier
                        OPTIONS -in      ${INPUTDATA}/Classification/QB_5_extract.tif
-                               -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB456.xml
-                               -model   ${TEMP}/clsvmModelQB456.svm
+                               -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB456.xml
+                               -model   ${INPUTDATA}/Classification/clsvmModelQB456.svm
                                -out     ${TEMP}/clLabeledImageQB456_5.tif
                        VALID   --compare-image ${NOTOL}
                                ${OTBAPP_BASELINE}/clLabeledImageQB456_5.tif
                                ${TEMP}/clLabeledImageQB456_5.tif)
 
-set_tests_properties(apTvClImageSVMClassifierQB456_5 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB456)
-
   otb_test_application(NAME apTvClImageSVMClassifierQB123_6
                        APP  ImageClassifier
                        OPTIONS -in      ${INPUTDATA}/Classification/QB_6_extract.tif
-                               -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB123.xml
-                               -model   ${TEMP}/clsvmModelQB123.svm
+                               -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB123.xml
+                               -model   ${INPUTDATA}/Classification/clsvmModelQB123.svm
                                -out     ${TEMP}/clLabeledImageQB123_6.tif
                        VALID   --compare-image ${NOTOL}
                                ${OTBAPP_BASELINE}/clLabeledImageQB123_6.tif
                                ${TEMP}/clLabeledImageQB123_6.tif)
 
-  set_tests_properties(apTvClImageSVMClassifierQB123_6 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB123)
-
   otb_test_application(NAME apTvClImageSVMClassifierQB456_1
                        APP  ImageClassifier
                        OPTIONS -in      ${INPUTDATA}/Classification/QB_1_ortho.tif
-                               -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB456.xml
-                               -model   ${TEMP}/clsvmModelQB456.svm
+                               -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB456.xml
+                               -model   ${INPUTDATA}/Classification/clsvmModelQB456.svm
                                -out     ${TEMP}/clLabeledImageQB456_1.tif
                        VALID   --compare-image ${NOTOL}
                                ${OTBAPP_BASELINE}/clLabeledImageQB456_1.tif
                                ${TEMP}/clLabeledImageQB456_1.tif)
 
-set_tests_properties(apTvClImageSVMClassifierQB456_1 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB456)
-
   otb_test_application(NAME apTvClImageSVMClassifierQB123_3
                        APP  ImageClassifier
                        OPTIONS -in      ${INPUTDATA}/Classification/QB_3_ortho.tif
-                               -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB123.xml
-                               -model   ${TEMP}/clsvmModelQB123.svm
+                               -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB123.xml
+                               -model   ${INPUTDATA}/Classification/clsvmModelQB123.svm
                                -out     ${TEMP}/clLabeledImageQB123_3.tif
                        VALID   --compare-image ${NOTOL}
                                ${OTBAPP_BASELINE}/clLabeledImageQB123_3.tif
                                ${TEMP}/clLabeledImageQB123_3.tif)
 
-  set_tests_properties(apTvClImageSVMClassifierQB123_3 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB123)
-
   otb_test_application(NAME apTvClImageSVMClassifierQB123_2
                        APP  ImageClassifier
                        OPTIONS -in      ${INPUTDATA}/Classification/QB_2_ortho.tif
-                               -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB123.xml
-                               -model   ${TEMP}/clsvmModelQB123.svm
+                               -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB123.xml
+                               -model   ${INPUTDATA}/Classification/clsvmModelQB123.svm
                                -out     ${TEMP}/clLabeledImageQB123_2.tif
                        VALID   --compare-image ${NOTOL}
                                ${OTBAPP_BASELINE}/clLabeledImageQB123_2.tif
                                ${TEMP}/clLabeledImageQB123_2.tif)
 
-  set_tests_properties(apTvClImageSVMClassifierQB123_2 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB123)
   otb_test_application(NAME apTvClImageSVMClassifierQB123_1
                        APP  ImageClassifier
                        OPTIONS -in      ${INPUTDATA}/Classification/QB_1_ortho.tif
-                               -imstat  ${TEMP}/apTvClEstimateImageStatisticsQB123.xml
-                               -model   ${TEMP}/clsvmModelQB123.svm
+                               -imstat  ${INPUTDATA}/Classification/clImageStatisticsQB123.xml
+                               -model   ${INPUTDATA}/Classification/clsvmModelQB123.svm
                                -out     ${TEMP}/clLabeledImageQB123_1.tif
                        VALID   --compare-image ${NOTOL}
                                ${OTBAPP_BASELINE}/clLabeledImageQB123_1.tif
                                ${TEMP}/clLabeledImageQB123_1.tif)
 
-set_tests_properties(apTvClImageSVMClassifierQB123_1 PROPERTIES DEPENDS apTvClTrainSVMImagesClassifierQB123)
 endif()
 
 #----------- TrainOGRLayersClassifier TESTS ----------------
+otb_test_application(NAME apTvClTrainOGRLayersClassifier
+                     APP  TrainOGRLayersClassifier
+                     OPTIONS -inshp ${INPUTDATA}/Classification/apTvClLabeledVector.shp
+                             -feat meanB0 meanB1 meanB2 meanB3 varB0 varB1 varB2 varB3
+                             -instats ${TEMP}/apTvClComputeOGRLayersFeaturesStatistics.xml
+                             -outsvm ${TEMP}/apTvClModel.svm
+                     VALID   --compare-ascii ${NOTOL}
+                             ${OTBAPP_BASELINE_FILES}/apTvClModel.svm
+                             ${TEMP}/apTvClModel.svm)
+
+set_tests_properties(apTvClTrainOGRLayersClassifier PROPERTIES DEPENDS apTvClComputeOGRLayersFeaturesStatistics) 
 
 #----------- ComputeConfusionMatrix TESTS ----------------
 otb_test_application(NAME apTvComputeConfusionMatrixV
@@ -386,9 +408,9 @@ otb_test_application(NAME apTvFusionOfClassificationsDSPrecision6Inputs
 
 otb_test_application(NAME apTvFusionOfClassificationsMV3Inputs
                      APP  FusionOfClassifications
-                     OPTIONS -il ${OTBAPP_BASELINE}/clLabeledImageQB123_1.tif
-                                 ${OTBAPP_BASELINE}/clLabeledImageQB456_1.tif
-                                 ${OTBAPP_BASELINE}/clLabeledImageQB1.tif
+                     OPTIONS -il ${INPUTDATA}/Classification/clLabeledImageQB123_1.tif
+                                 ${INPUTDATA}/Classification/clLabeledImageQB456_1.tif
+                                 ${INPUTDATA}/Classification/clLabeledImageQB1.tif
                              -method majorityvoting
                              -undecidedlabel 100
                              -out ${TEMP}/apTvFusionOfClassificationsMV3InputsOutput.tif uint16
@@ -467,8 +489,8 @@ otb_test_application(NAME apTvFusionOfClassificationsDSAccuracy6Inputs
 
 otb_test_application(NAME apTvFusionOfClassificationsMV2Inputs
                      APP  FusionOfClassifications
-                     OPTIONS -il ${OTBAPP_BASELINE}/clLabeledImageQB123_1.tif
-                                 ${OTBAPP_BASELINE}/clLabeledImageQB456_1.tif
+                     OPTIONS -il ${INPUTDATA}/Classification/clLabeledImageQB123_1.tif
+                                 ${INPUTDATA}/Classification/clLabeledImageQB456_1.tif
                              -method majorityvoting
                              -undecidedlabel 100
                              -out ${TEMP}/apTvFusionOfClassificationsMV2InputsOutput.tif uint16
@@ -481,95 +503,95 @@ otb_test_application(NAME apTvFusionOfClassificationsMV2Inputs
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_wr
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/NDVI.TIF}
-                			 -vd LARGEINPUT{DEMPSTER-SHAFER/wrongroads.shp}
-                			 -expr  "(b1 > 0.4)"
-  						     -field "NONDVI"
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_wr.shp)
+                             -vd LARGEINPUT{DEMPSTER-SHAFER/wrongroads.shp}
+                             -expr  "(b1 > 0.4)"
+                             -field "NONDVI"
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_wr.shp)
 
 # FIXME cascade dependencies to largeinput repository
 if(OTB_DATA_USE_LARGEINPUT)
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/SpectralAngleRoad.TIF}
-                			 -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_RoadExtractionApplication.shp
-                			 -expr  "(b1 > 0.25)"
-  						     -field "ROADSA"
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication.shp)
+                             -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_RoadExtractionApplication.shp
+                             -expr  "(b1 > 0.25)"
+                             -field "ROADSA"
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication.shp)
 
 set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_RoadExtractionApplication)
 
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_wr
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/SpectralAngleRoad.TIF}
-                			 -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_wr.shp
-                			 -expr  "(b1 > 0.25)"
-  						     -field "ROADSA"
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_wr.shp)
+                             -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_wr.shp
+                             -expr  "(b1 > 0.25)"
+                             -field "ROADSA"
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_wr.shp)
 
 set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_wr PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_wr)
 
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_wr
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/BUILDINGS.TIF}
-                			 -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_wr.shp
-                			 -expr  "(b1 == 0)"
-  						     -field "NOBUIL"
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
-                     VALID	 --compare-ogr 0.0
-                     		 ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
-                   			 ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp)
+                             -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_wr.shp
+                             -expr  "(b1 == 0)"
+                             -field "NOBUIL"
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
+                     VALID   --compare-ogr 0.0
+                             ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
+                             ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp)
 
 set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_wr PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_wr)
 
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_RoadExtractionApplication
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/NDVI.TIF}
-                			 -vd LARGEINPUT{DEMPSTER-SHAFER/road_extraction.shp}
-                			 -expr  "(b1 > 0.4)"
-  						     -field "NONDVI"
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_RoadExtractionApplication.shp)
+                             -vd LARGEINPUT{DEMPSTER-SHAFER/road_extraction.shp}
+                             -expr  "(b1 > 0.4)"
+                             -field "NONDVI"
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_RoadExtractionApplication.shp)
 
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_gt
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/NDVI.TIF}
-                			 -vd LARGEINPUT{DEMPSTER-SHAFER/roads_ground_truth.shp}
-                			 -expr  "(b1 > 0.4)"
-  						     -field NONDVI
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage.shp)
+                             -vd LARGEINPUT{DEMPSTER-SHAFER/roads_ground_truth.shp}
+                             -expr  "(b1 > 0.4)"
+                             -field NONDVI
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage.shp)
 
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/SpectralAngleRoad.TIF}
-                			 -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage.shp
-                			 -expr  "(b1 > 0.25)"
-  						     -field "ROADSA"
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt.shp)
+                             -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage.shp
+                             -expr  "(b1 > 0.25)"
+                             -field "ROADSA"
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt.shp)
 
 set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_NONDVI_gt)
 
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/BUILDINGS.TIF}
-                			 -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt.shp
-                			 -expr  "(b1 == 0)"
-  						     -field "NOBUIL"
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp
-                     VALID	 --compare-ogr 0.0
-                     		 ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp
-                   			 ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp)
+                             -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt.shp
+                             -expr  "(b1 == 0)"
+                             -field "NOBUIL"
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp
+                     VALID   --compare-ogr 0.0
+                             ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp
+                             ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp)
 
 set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_gt PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_gt) 
 
 otb_test_application(NAME apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication
                      APP  ComputePolylineFeatureFromImage
                      OPTIONS -in LARGEINPUT{DEMPSTER-SHAFER/BUILDINGS.TIF}
-                			 -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication.shp
-                			 -expr  "(b1 == 0)"
-  						     -field "NOBUIL"
-                			 -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp
-                     VALID	 --compare-ogr 0.0
-                     		 ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp
-                   			 ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp)
+                             -vd ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication.shp
+                             -expr  "(b1 == 0)"
+                             -field "NOBUIL"
+                             -out ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp
+                     VALID   --compare-ogr 0.0
+                             ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp
+                             ${TEMP}/apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp)
 
 set_tests_properties(apTvCdbComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication PROPERTIES DEPENDS apTvCdbComputePolylineFeatureFromImage_LI_ROADSA_RoadExtractionApplication) 
 endif()
@@ -598,7 +620,7 @@ otb_test_application(NAME apTvClTrainSVMImagesClassifierQB1_allOpt_InXML
                               -inxml ${INPUTDATA}/clsvmModelQB1_OutXML.xml
                               -io.il ${INPUTDATA}/Classification/QB_1_ortho.tif
                               -io.vd ${INPUTDATA}/Classification/VectorData_QB1.shp
-                              -io.imstat ${OTBAPP_BASELINE_FILES}/clImageStatisticsQB1.xml
+                              -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB1.xml
                               -sample.mv 100
                               -sample.mt 100
                               -sample.vtr 0.5
@@ -609,13 +631,11 @@ otb_test_application(NAME apTvClTrainSVMImagesClassifierQB1_allOpt_InXML
                               ${OTBAPP_BASELINE_FILES}/clsvmModelQB1.svm
                               ${TEMP}/clsvmModelQB1_allOpt_InXML.svm)
 
-set_tests_properties(apTvClTrainSVMImagesClassifierQB1_allOpt_InXML PROPERTIES DEPENDS apTvClComputeImagesStatisticsQB1) 
-
 otb_test_application(NAME apTvClTrainSVMImagesClassifierQB1_OutXML
                       APP  TrainImagesClassifier
                       OPTIONS -io.il ${INPUTDATA}/Classification/QB_1_ortho.tif
                               -io.vd ${INPUTDATA}/Classification/VectorData_QB1.shp
-                              -io.imstat ${OTBAPP_BASELINE_FILES}/clImageStatisticsQB1.xml
+                              -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB1.xml
                               -classifier libsvm
                               -classifier.libsvm.opt true
                               -io.out ${TEMP}/clsvmModelQB1_OutXML.svm
@@ -625,8 +645,6 @@ otb_test_application(NAME apTvClTrainSVMImagesClassifierQB1_OutXML
                               ${OTBAPP_BASELINE_FILES}/clsvmModelQB1.svm
                               ${TEMP}/clsvmModelQB1_OutXML.svm)
 
-set_tests_properties(apTvClTrainSVMImagesClassifierQB1_OutXML PROPERTIES DEPENDS apTvClComputeImagesStatisticsQB1) 
-
   otb_test_application(NAME apTvClTrainSVMImagesClassifierQB123
                        APP  TrainImagesClassifier
                        OPTIONS -io.il ${INPUTDATA}/Classification/QB_1_ortho.tif
@@ -635,7 +653,7 @@ set_tests_properties(apTvClTrainSVMImagesClassifierQB1_OutXML PROPERTIES DEPENDS
                                -io.vd ${INPUTDATA}/Classification/VectorData_QB1.shp
                                       ${INPUTDATA}/Classification/VectorData_QB2.shp
                                       ${INPUTDATA}/Classification/VectorData_QB3.shp
-                               -io.imstat ${TEMP}/apTvClEstimateImageStatisticsQB123.xml
+                               -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB123.xml
                                -classifier libsvm
                                -classifier.libsvm.opt true
                                -io.out ${TEMP}/clsvmModelQB123.svm
@@ -644,13 +662,11 @@ set_tests_properties(apTvClTrainSVMImagesClassifierQB1_OutXML PROPERTIES DEPENDS
                                ${OTBAPP_BASELINE_FILES}/clsvmModelQB123.svm
                                ${TEMP}/clsvmModelQB123.svm)
 
-set_tests_properties(apTvClTrainSVMImagesClassifierQB123 PROPERTIES DEPENDS apTvClComputeImagesStatisticsQB123) 
-
 otb_test_application(NAME apTvClTrainSVMImagesClassifierQB1
                       APP  TrainImagesClassifier
                       OPTIONS -io.il ${INPUTDATA}/Classification/QB_1_ortho.tif
                               -io.vd ${INPUTDATA}/Classification/VectorData_QB1.shp
-                              -io.imstat ${TEMP}/apTvClEstimateImageStatisticsQB1.xml
+                              -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB1.xml
                               -classifier libsvm
                               -classifier.libsvm.opt true
                               -io.out ${TEMP}/clsvmModelQB1.svm
@@ -659,8 +675,6 @@ otb_test_application(NAME apTvClTrainSVMImagesClassifierQB1
                               ${OTBAPP_BASELINE_FILES}/clsvmModelQB1.svm
                               ${TEMP}/clsvmModelQB1.svm)
 
-set_tests_properties(apTvClTrainSVMImagesClassifierQB1 PROPERTIES DEPENDS apTvClComputeImagesStatisticsQB1) 
-
   otb_test_application(NAME apTvClTrainSVMImagesClassifierQB456
                        APP  TrainImagesClassifier
                        OPTIONS -io.il ${INPUTDATA}/Classification/QB_4_extract.tif
@@ -669,7 +683,7 @@ set_tests_properties(apTvClTrainSVMImagesClassifierQB1 PROPERTIES DEPENDS apTvCl
                                -io.vd ${INPUTDATA}/Classification/VectorData_QB4.shp
                                       ${INPUTDATA}/Classification/VectorData_QB5.shp
                                       ${INPUTDATA}/Classification/VectorData_QB6.shp
-                               -io.imstat ${TEMP}/apTvClEstimateImageStatisticsQB456.xml
+                               -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB456.xml
                                -classifier libsvm
                                -classifier.libsvm.opt true
                                -io.out ${TEMP}/clsvmModelQB456.svm
@@ -678,13 +692,11 @@ set_tests_properties(apTvClTrainSVMImagesClassifierQB1 PROPERTIES DEPENDS apTvCl
                                ${OTBAPP_BASELINE_FILES}/clsvmModelQB456.svm
                                ${TEMP}/clsvmModelQB456.svm)
 
-set_tests_properties(apTvClTrainSVMImagesClassifierQB456 PROPERTIES DEPENDS apTvClComputeImagesStatisticsQB456)
-
 otb_test_application(NAME apTvClTrainSVMImagesClassifierQB1_allOpt
                       APP  TrainImagesClassifier
                       OPTIONS -io.il ${INPUTDATA}/Classification/QB_1_ortho.tif
                               -io.vd ${INPUTDATA}/Classification/VectorData_QB1.shp
-                              -io.imstat ${OTBAPP_BASELINE_FILES}/clImageStatisticsQB1.xml
+                              -io.imstat ${INPUTDATA}/Classification/clImageStatisticsQB1.xml
                               -classifier libsvm
                               -sample.mv 100
                               -sample.mt 100
@@ -695,32 +707,30 @@ otb_test_application(NAME apTvClTrainSVMImagesClassifierQB1_allOpt
                       VALID   --compare-ascii ${NOTOL}
                               ${OTBAPP_BASELINE_FILES}/clsvmModelQB1.svm
                               ${TEMP}/clsvmModelQB1_allOpt.svm)
-
-set_tests_properties(apTvClTrainSVMImagesClassifierQB1_allOpt PROPERTIES DEPENDS apTvClComputeImagesStatisticsQB1)
 endif()
 
 #----------- DSFuzzyModelEstimation TESTS ----------------
 otb_test_application(NAME apTvCdbDSFuzzyModelEstimation_LI_autoInit
                      APP  DSFuzzyModelEstimation
                      OPTIONS -psin ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp
-                		     -nsin ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
-                		     -belsup "ROADSA"
-                		     -plasup "NONDVI" "ROADSA" "NOBUIL"
-                		     -desclist "NONDVI" "ROADSA" "NOBUIL"
-                		     -maxnbit 4
-                		     -optobs true
-                		     -out ${TEMP}/apTvCdbDSFuzzyModelEstimatorOutput_LI_autoInit.xml)
+                             -nsin ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
+                             -belsup "ROADSA"
+                             -plasup "NONDVI" "ROADSA" "NOBUIL"
+                             -desclist "NONDVI" "ROADSA" "NOBUIL"
+                             -maxnbit 4
+                             -optobs true
+                             -out ${TEMP}/apTvCdbDSFuzzyModelEstimatorOutput_LI_autoInit.xml)
 
 otb_test_application(NAME apTvCdbDSFuzzyModelEstimation_LI
                      APP  DSFuzzyModelEstimation
                      OPTIONS -psin ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp
-                		     -nsin ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
-                		     -belsup "ROADSA"
-                		     -plasup "NONDVI" "ROADSA" "NOBUIL"
-                		     -initmod ${OTB_DATA_ROOT}/Input/Dempster-Shafer/DSFuzzyModel_Init.xml
-                		     -maxnbit 4
-                		     -optobs true
-                		     -out ${TEMP}/apTvCdbDSFuzzyModelEstimatorOutput_LI.xml)
+                             -nsin ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
+                             -belsup "ROADSA"
+                             -plasup "NONDVI" "ROADSA" "NOBUIL"
+                             -initmod ${OTB_DATA_ROOT}/Input/Dempster-Shafer/DSFuzzyModel_Init.xml
+                             -maxnbit 4
+                             -optobs true
+                             -out ${TEMP}/apTvCdbDSFuzzyModelEstimatorOutput_LI.xml)
 
 
 #----------- ClassificationMapRegularization TESTS ----------------
@@ -773,30 +783,63 @@ otb_test_application(NAME apTvClComputeImagesStatisticsQB123
 otb_test_application(NAME cdbTvVectorDataDSValidationGroundTruth_LI
                      APP  VectorDataDSValidation
                      OPTIONS -in ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_gt.shp
-                		     -belsup "ROADSA"
-                		     -plasup "NONDVI" "ROADSA" "NOBUIL"
-                		     -descmod ${OTB_DATA_ROOT}/Input/Dempster-Shafer/DSFuzzyModel.xml
-                		     -out ${TEMP}/cdbTvVectorDataDSValidationOutpout_LI_gt.shp
-					VALID	 --compare-ogr 0.0
-							 ${OTBAPP_BASELINE_FILES}/cdbTvVectorDataDSValidationOutpout_LI_gt.shp
-							 ${TEMP}/cdbTvVectorDataDSValidationOutpout_LI_gt.shp)
+                             -belsup "ROADSA"
+                             -plasup "NONDVI" "ROADSA" "NOBUIL"
+                             -descmod ${OTB_DATA_ROOT}/Input/Dempster-Shafer/DSFuzzyModel.xml
+                             -out ${TEMP}/cdbTvVectorDataDSValidationOutpout_LI_gt.shp
+                    VALID    --compare-ogr 0.0
+                             ${OTBAPP_BASELINE_FILES}/cdbTvVectorDataDSValidationOutpout_LI_gt.shp
+                             ${TEMP}/cdbTvVectorDataDSValidationOutpout_LI_gt.shp)
 
 otb_test_application(NAME apTvCdbVectorDataDSValidationRoadExtractionApplication_LI
                      APP  VectorDataDSValidation
                      OPTIONS -in ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_RoadExtractionApplication.shp
-                		     -belsup "ROADSA"
-                		     -plasup "NONDVI" "ROADSA" "NOBUIL"
-                		     -descmod ${OTB_DATA_ROOT}/Input/Dempster-Shafer/DSFuzzyModel.xml
-                		     -out ${TEMP}/apTvCdbVectorDataDSValidationOutpout_LI_RoadExtractionApplication.shp)
+                             -belsup "ROADSA"
+                             -plasup "NONDVI" "ROADSA" "NOBUIL"
+                             -descmod ${OTB_DATA_ROOT}/Input/Dempster-Shafer/DSFuzzyModel.xml
+                             -out ${TEMP}/apTvCdbVectorDataDSValidationOutpout_LI_RoadExtractionApplication.shp)
 
 otb_test_application(NAME cdbTvVectorDataDSValidationWrongRoads_LI
                      APP  VectorDataDSValidation
                      OPTIONS -in ${OTBAPP_BASELINE_FILES}/cdbTvComputePolylineFeatureFromImage_LI_NOBUIL_wr.shp
-                		     -belsup "ROADSA"
-                		     -plasup "NONDVI" "ROADSA" "NOBUIL"
-                		     -descmod ${OTB_DATA_ROOT}/Input/Dempster-Shafer/DSFuzzyModel.xml
-                		     -out ${TEMP}/cdbTvVectorDataDSValidationOutpout_LI_wr.shp
-					VALID	 --compare-ogr 0.0
-							 ${OTBAPP_BASELINE_FILES}/cdbTvVectorDataDSValidationOutpout_LI_wr.shp
-							 ${TEMP}/cdbTvVectorDataDSValidationOutpout_LI_wr.shp)
+                             -belsup "ROADSA"
+                             -plasup "NONDVI" "ROADSA" "NOBUIL"
+                             -descmod ${OTB_DATA_ROOT}/Input/Dempster-Shafer/DSFuzzyModel.xml
+                             -out ${TEMP}/cdbTvVectorDataDSValidationOutpout_LI_wr.shp
+                    VALID    --compare-ogr 0.0
+                             ${OTBAPP_BASELINE_FILES}/cdbTvVectorDataDSValidationOutpout_LI_wr.shp
+                             ${TEMP}/cdbTvVectorDataDSValidationOutpout_LI_wr.shp)
+
+if(OTB_USE_OPENCV)
+#----------- TrainRegression TESTS ----------------
+# y = 0.01*x^2 + 1.5*x - 300
+otb_test_application(NAME apTvClTrainRegressionTest_monovar
+                     APP  TrainRegression
+                     OPTIONS -io.il ${INPUTDATA}/QB_Toulouse_Ortho_regression.tif
+                             -io.imstat ${INPUTDATA}/QB_Toulouse_Ortho_regression.xml
+                             -io.out ${TEMP}/apTvClTrainRegressionTest_monovar.rf
+                             -sample.mt 20000
+                             -sample.mv 20000
+                             -sample.vtr 0.5
+                             -rand 121212
+                             -classifier rf
+                             -classifier.rf.ra 0.0001
+                             -classifier.rf.max 6
+                             -classifier.rf.acc 0.0005
+                    VALID    --compare-ascii ${NOTOL}
+                             ${OTBAPP_BASELINE_FILES}/apTvClTrainRegressionTest_monovar.rf
+                             ${TEMP}/apTvClTrainRegressionTest_monovar.rf)
+
+#----------- PredictRegression TESTS ----------------
+otb_test_application(NAME apTvClPredictRegressionTest_monovar
+                     APP PredictRegression
+                     OPTIONS -in ${INPUTDATA}/QB_Toulouse_Ortho_PAN.tif
+                             -model ${OTBAPP_BASELINE_FILES}/apTvClTrainRegressionTest_monovar.rf
+                             -imstat ${INPUTDATA}/QB_Toulouse_Ortho_regression.xml
+                             -out ${TEMP}/apTvClPredictRegressionTest_monovar.tif
+                    VALID    --compare-image 1
+                             ${OTBAPP_BASELINE}/apTvClPredictRegressionTest_monovar.tif
+                             ${TEMP}/apTvClPredictRegressionTest_monovar.tif)
+
+endif()
 
diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx
index 5b5db74..396887d 100644
--- a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx
+++ b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx
@@ -104,6 +104,7 @@ private:
     SetParameterDescription("in", "The input image to apply dimensionality reduction.");
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription("out", "output image. Components are ordered by decreasing eigenvalues.");
+    MandatoryOff("out");
     AddParameter(ParameterType_Group, "rescale", "Rescale Output.");
 
     MandatoryOff("rescale");
@@ -236,6 +237,7 @@ private:
       // PCA Algorithm
       case 0:
         {
+
         otbAppLogDEBUG( << "PCA Algorithm ");
         PCAForwardFilterType::Pointer filter = PCAForwardFilterType::New();
         m_ForwardFilter = filter;
@@ -245,18 +247,20 @@ private:
 
         filter->SetInput(GetParameterFloatVectorImage("in"));
         filter->SetNumberOfPrincipalComponentsRequired(nbComp);
-        filter->SetUseNormalization(normalize);
-        m_ForwardFilter->Update();
-
+        filter->SetUseNormalization(normalize);        
+        m_ForwardFilter->GetOutput()->UpdateOutputInformation();
+        
         if (invTransform)
-          {
+          {  
           invFilter->SetInput(m_ForwardFilter->GetOutput());
           if (normalize)
             {
-            otbAppLogINFO( << "Normalization MeanValue :"<<filter->GetMeanValues()<<
-                "StdValue :" <<filter->GetStdDevValues() );
+            otbAppLogINFO( << "Normalization MeanValue:"<<filter->GetMeanValues() );
             invFilter->SetMeanValues(filter->GetMeanValues());
-            invFilter->SetStdDevValues(filter->GetStdDevValues());
+            // By default normalization by std dev is deactivated in
+            //forward filter, and GetStdDevValues() returns an empty
+            //vector, which confuses the invFilter.
+            //invFilter->SetStdDevValues(filter->GetStdDevValues());
             }
 
           invFilter->SetTransformationMatrix(filter->GetTransformationMatrix());
@@ -289,17 +293,22 @@ private:
         filter->SetNumberOfPrincipalComponentsRequired(nbComp);
         filter->SetUseNormalization(normalize);
         filter->GetNoiseImageFilter()->SetRadius(radius);
-        m_ForwardFilter->Update();
+
+        m_ForwardFilter->GetOutput()->UpdateOutputInformation();
+        
         if (invTransform)
           {
           otbAppLogDEBUG( << "Compute Inverse Transform");
           invFilter->SetInput(m_ForwardFilter->GetOutput());
+          otbAppLogINFO( << "Normalization MeanValue:"<<filter->GetMeanValues() );
           invFilter->SetMeanValues(filter->GetMeanValues());
           if (normalize)
             {
+            otbAppLogINFO( << "Normalization StdDevValue:"<<filter->GetStdDevValues() );
             invFilter->SetStdDevValues(filter->GetStdDevValues());
+            
             }
-
+          invFilter->SetUseNormalization(normalize);
           invFilter->SetTransformationMatrix(filter->GetTransformationMatrix());
           m_TransformationMatrix = invFilter->GetTransformationMatrix();
           }
@@ -314,8 +323,6 @@ private:
         MAFForwardFilterType::Pointer filter = MAFForwardFilterType::New();
         m_ForwardFilter = filter;
         filter->SetInput(GetParameterFloatVectorImage("in"));
-        m_ForwardFilter->Update();
-
         otbAppLogINFO( << "V :"<<std::endl<<filter->GetV()<<"Auto-Correlation :"<<std::endl <<filter->GetAutoCorrelation() );
 
         break;
@@ -336,18 +343,18 @@ private:
         filter->SetNumberOfPrincipalComponentsRequired(nbComp);
         filter->SetNumberOfIterations(nbIterations);
         filter->SetMu(mu);
-        m_ForwardFilter->Update();
 
+        m_ForwardFilter->GetOutput()->UpdateOutputInformation();
+        
         if (invTransform)
           {
           otbAppLogDEBUG( << "Compute Inverse Transform");
           invFilter->SetInput(m_ForwardFilter->GetOutput());
+          otbAppLogINFO( << "Normalization MeanValue:"<<filter->GetMeanValues() );
+          invFilter->SetMeanValues(filter->GetMeanValues());
+          otbAppLogINFO( << "Normalization StdDevValue:"<<filter->GetStdDevValues() );
+          invFilter->SetStdDevValues(filter->GetStdDevValues());
 
-          if (normalize)
-            {
-            invFilter->SetMeanValues(filter->GetMeanValues());
-            invFilter->SetStdDevValues(filter->GetStdDevValues());
-            }
           invFilter->SetPCATransformationMatrix(filter->GetPCATransformationMatrix());
           invFilter->SetTransformationMatrix(filter->GetTransformationMatrix());
           }
diff --git a/Modules/Applications/AppFiltering/app/otbDespeckle.cxx b/Modules/Applications/AppFiltering/app/otbDespeckle.cxx
index a580f12..bdd6b49 100644
--- a/Modules/Applications/AppFiltering/app/otbDespeckle.cxx
+++ b/Modules/Applications/AppFiltering/app/otbDespeckle.cxx
@@ -20,6 +20,8 @@
 
 #include "otbFrostImageFilter.h"
 #include "otbLeeImageFilter.h"
+#include "otbGammaMAPImageFilter.h"
+#include "otbKuanImageFilter.h"
 #include "otbMultiToMonoChannelExtractROI.h"
 
 namespace otb
@@ -38,8 +40,10 @@ public:
 
   typedef itk::ImageToImageFilter<FloatImageType, FloatImageType> SpeckleFilterType;
 
-  typedef LeeImageFilter<FloatImageType, FloatImageType>   LeeFilterType;
-  typedef FrostImageFilter<FloatImageType, FloatImageType> FrostFilterType;
+  typedef LeeImageFilter<FloatImageType, FloatImageType>        LeeFilterType;
+  typedef FrostImageFilter<FloatImageType, FloatImageType>      FrostFilterType;
+  typedef GammaMAPImageFilter<FloatImageType, FloatImageType>   GammaMAPFilterType;
+  typedef KuanImageFilter<FloatImageType, FloatImageType>       KuanFilterType;
 
   /** Standard macro */
   itkNewMacro(Self);
@@ -54,7 +58,7 @@ private:
 
     // Documentation
     SetDocName("Despeckle");
-    SetDocLongDescription("This application reduce speckle noise. Two methods are available: Lee and Frost.");
+    SetDocLongDescription("This application reduce speckle noise. Four methods are available: Lee, Frost, GammaMAP and Kuan.");
     SetDocLimitations("None");
     SetDocAuthors("OTB-Team");
     SetDocSeeAlso(" ");
@@ -74,6 +78,10 @@ private:
     SetParameterDescription("filter.lee","Lee filter");
     AddChoice("filter.frost","Frost");
     SetParameterDescription("filter.frost","Frost filter");
+    AddChoice("filter.gammamap","GammaMap");
+    SetParameterDescription("filter.gammamap","GammaMap filter");
+    AddChoice("filter.kuan","Kuan");
+    SetParameterDescription("filter.kuan","Kuan filter");
 
     AddParameter(ParameterType_Int,"filter.lee.rad","Radius");
     SetParameterDescription("filter.lee.rad","Radius for lee filter");
@@ -86,12 +94,26 @@ private:
 
     AddParameter(ParameterType_Float,"filter.frost.deramp","deramp");
     SetParameterDescription("filter.frost.deramp","Decrease factor declaration");
+    
+    AddParameter(ParameterType_Int,"filter.gammamap.rad","Radius");
+    SetParameterDescription("filter.gammamap.rad","Radius for GammaMAP filter");
+
+    AddParameter(ParameterType_Float,"filter.gammamap.nblooks","nb looks");
+    SetParameterDescription("filter.gammamap.nblooks","Nb looks for GammaMAP filter");
+    
+    AddParameter(ParameterType_Int,"filter.kuan.rad","Radius");
+    SetParameterDescription("filter.kuan.rad","Radius for Kuan filter");
+
+    AddParameter(ParameterType_Float,"filter.kuan.nblooks","nb looks");
+    SetParameterDescription("filter.kuan.nblooks","Nb looks for Kuan filter");
 
     // Default values
     SetDefaultParameterInt("filter.lee.rad", 1);
     SetDefaultParameterFloat("filter.lee.nblooks", 1.);
     SetDefaultParameterInt("filter.frost.rad",  1);
     SetDefaultParameterFloat("filter.frost.deramp",  0.1);
+    SetDefaultParameterInt("filter.gammamap.rad", 1);
+    SetDefaultParameterFloat("filter.gammamap.nblooks", 1.);
 
 
     // Doc example parameter settings
@@ -158,6 +180,40 @@ private:
       m_SpeckleFilter = filter;
       break;
       }
+      case 2:
+      {
+      GammaMAPFilterType::Pointer  filter = GammaMAPFilterType::New();
+      m_Ref.push_back(filter.GetPointer());
+
+      filter->SetInput(inImage);
+
+      GammaMAPFilterType::SizeType lradius;
+      lradius.Fill(GetParameterInt("filter.gammamap.rad"));
+
+      filter->SetRadius(lradius);
+      filter->SetNbLooks(GetParameterFloat("filter.gammamap.nblooks"));
+
+      otbAppLogINFO( << "GammaMAP filter" );
+      m_SpeckleFilter = filter;
+      break;
+      }
+      case 3:
+      {
+      KuanFilterType::Pointer  filter = KuanFilterType::New();
+      m_Ref.push_back(filter.GetPointer());
+
+      filter->SetInput(inImage);
+
+      KuanFilterType::SizeType lradius;
+      lradius.Fill(GetParameterInt("filter.kuan.rad"));
+
+      filter->SetRadius(lradius);
+      filter->SetNbLooks(GetParameterFloat("filter.kuan.nblooks"));
+
+      otbAppLogINFO( << "Kuan filter" );
+      m_SpeckleFilter = filter;
+      break;
+      }
       default:
       {
       otbAppLogFATAL(<<"non defined speckle reduction filter "<<GetParameterInt("filter")<<std::endl);
diff --git a/Modules/Applications/AppFiltering/test/CMakeLists.txt b/Modules/Applications/AppFiltering/test/CMakeLists.txt
index 46a40c4..984c183 100644
--- a/Modules/Applications/AppFiltering/test/CMakeLists.txt
+++ b/Modules/Applications/AppFiltering/test/CMakeLists.txt
@@ -30,4 +30,48 @@ otb_test_application(NAME  apTvUtSmoothingTest_OutXML
                      VALID   --compare-image ${NOTOL}
                              ${BASELINE}/apTvUtSmoothingTest.tif
                              ${TEMP}/apTvUtSmoothingTest_OutXML.tif)
+                             
+                             
+otb_test_application(NAME  apTvDespeckleLee
+                     APP  Despeckle
+                     OPTIONS -in ${INPUTDATA}/GomaAvant.tif
+               	             -out ${TEMP}/bfFiltreLee_05_05_12_app.tif
+                             -filter lee
+                             -filter.lee.rad 5
+                             -filter.lee.nblooks 12
+                     VALID   --compare-image ${EPSILON_7}
+                             ${BASELINE}/bfFiltreLee_05_05_12.tif
+                             ${TEMP}/bfFiltreLee_05_05_12_app.tif)
+                             
+otb_test_application(NAME  apTvDespeckleFrost
+                     APP  Despeckle
+                     OPTIONS -in ${INPUTDATA}/GomaAvant.tif
+               	             -out ${TEMP}/bfFiltreFrost_05_05_12_app.tif
+                             -filter frost
+                             -filter.frost.rad 5
+                             -filter.frost.deramp 0.1
+                     VALID   --compare-image ${EPSILON_7}
+                             ${BASELINE}/bfFiltreFrost_05_05_12_app.tif
+                             ${TEMP}/bfFiltreFrost_05_05_12_app.tif)
 
+otb_test_application(NAME  apTvDespeckleGammaMAP
+                     APP  Despeckle
+                     OPTIONS -in ${INPUTDATA}/GomaAvant.tif
+               	             -out ${TEMP}/bfFiltreGammaMAP_05_05_12_app.tif
+                             -filter gammamap
+                             -filter.gammamap.rad 5
+                             -filter.gammamap.nblooks 12
+                     VALID   --compare-image ${EPSILON_7}
+                             ${BASELINE}/bfFiltreGammaMAP_05_05_12.tif
+                             ${TEMP}/bfFiltreGammaMAP_05_05_12_app.tif)                      
+                             
+otb_test_application(NAME  apTvDespeckleKuan
+                     APP  Despeckle
+                     OPTIONS -in ${INPUTDATA}/GomaAvant.tif
+               	             -out ${TEMP}/bfFiltreKuan_05_05_12_app.tif
+                             -filter kuan
+                             -filter.kuan.rad 5
+                             -filter.kuan.nblooks 12
+                     VALID   --compare-image ${EPSILON_7}
+                             ${BASELINE}/bfFiltreKuan_05_05_12.tif
+                             ${TEMP}/bfFiltreKuan_05_05_12_app.tif)
diff --git a/Modules/Applications/AppImageUtils/app/CMakeLists.txt b/Modules/Applications/AppImageUtils/app/CMakeLists.txt
index 8fb5533..637eb92 100644
--- a/Modules/Applications/AppImageUtils/app/CMakeLists.txt
+++ b/Modules/Applications/AppImageUtils/app/CMakeLists.txt
@@ -87,3 +87,8 @@ otb_create_application(
   NAME           SplitImage
   SOURCES        otbSplitImage.cxx
   LINK_LIBRARIES ${${otb-module}_LIBRARIES})
+
+otb_create_application(
+  NAME           ManageNoData
+  SOURCES        otbManageNoData.cxx
+  LINK_LIBRARIES ${${otb-module}_LIBRARIES})
diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
index c20d69a..432ba75 100644
--- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
+++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx
@@ -291,6 +291,7 @@ private:
     SetParameterDescription("in", "Input image filename");
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription("out","Output image filename");
+    SetDefaultOutputPixelType("out",ImagePixelType_uint8);
 
     AddRAMParameter();
 
diff --git a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx
new file mode 100644
index 0000000..fa327c4
--- /dev/null
+++ b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx
@@ -0,0 +1,217 @@
+/*=========================================================================
+
+ 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 "otbWrapperApplication.h"
+#include "otbWrapperApplicationFactory.h"
+
+#include "otbImageToNoDataMaskFilter.h"
+#include "otbChangeNoDataValueFilter.h"
+#include "itkMaskImageFilter.h"
+#include "otbVectorImageToImageListFilter.h"
+#include "otbImageListToVectorImageFilter.h"
+#include "otbChangeInformationImageFilter.h"
+
+namespace otb
+{
+namespace Wrapper
+{
+
+class ManageNoData : public Application
+{
+public:
+  /** Standard class typedefs. */
+  typedef ManageNoData                       Self;
+  typedef Application                   Superclass;
+  typedef itk::SmartPointer<Self>       Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+
+  /** Standard macro */
+  itkNewMacro(Self);
+
+  itkTypeMacro(ManageNoData, otb::Application);
+
+  /** Filters typedef */
+  typedef otb::ImageToNoDataMaskFilter<FloatVectorImageType,UInt8ImageType> FilterType;
+  typedef otb::ChangeNoDataValueFilter<FloatVectorImageType,FloatVectorImageType> ChangeNoDataFilterType;
+  
+  typedef otb::ImageList<FloatImageType> ImageListType;
+  typedef otb::VectorImageToImageListFilter<FloatVectorImageType,ImageListType> VectorToListFilterType;
+  typedef otb::ImageListToVectorImageFilter<ImageListType,FloatVectorImageType> ListToVectorFilterType;
+  typedef itk::MaskImageFilter<FloatImageType,UInt8ImageType,FloatImageType> MaskFilterType;
+  typedef otb::ChangeInformationImageFilter<FloatVectorImageType> ChangeInfoFilterType;
+
+private:
+  void DoInit()
+  {
+    SetName("ManageNoData");
+    SetDescription("Manage No-Data");
+    // Documentation
+    SetDocName("No Data management");
+    SetDocLongDescription("This application has two modes. The first allows to build a mask of no-data pixels from the no-data flags read from the image file. The second allows to update the change the no-data value of an image (pixels value and metadata). This last mode also allows to replace NaN in images with a proper no-data value. To do so, one should activate the NaN is no-data option.");
+    SetDocLimitations("None");
+    SetDocAuthors("OTB-Team");
+    SetDocSeeAlso("BanMath");
+    AddDocTag("Conversion");
+    AddDocTag("Image Dynamic");
+    AddDocTag(Tags::Manip);
+
+    AddParameter(ParameterType_InputImage,  "in",   "Input image");
+    SetParameterDescription("in", "Input image");
+
+    AddParameter(ParameterType_OutputImage, "out",  "Output Image");
+    SetParameterDescription("out", "Output image");
+
+    AddParameter(ParameterType_Empty,"usenan", "Consider NaN as no-data");
+    SetParameterDescription("usenan","If active, the application will consider NaN as no-data values as well");
+    MandatoryOff("usenan");
+    DisableParameter("usenan");
+   
+    AddParameter(ParameterType_Choice,"mode","No-data handling mode");
+    SetParameterDescription("mode","Allows to choose between different no-data handling options");
+
+    AddChoice("mode.buildmask","Build a no-data Mask");
+    
+    AddParameter(ParameterType_Float,"mode.buildmask.inv","Inside Value");
+    SetParameterDescription("mode.buildmask.inv","Value given in the output mask to pixels that are not no data pixels");
+    SetDefaultParameterInt("mode.buildmask.inv",1);
+
+    AddParameter(ParameterType_Float,"mode.buildmask.outv","Outside Value");
+    SetParameterDescription("mode.buildmask.outv","Value given in the output mask to pixels that are no data pixels");
+    SetDefaultParameterInt("mode.buildmask.outv",0);
+
+    AddChoice("mode.changevalue","Change the no-data value");
+
+    AddParameter(ParameterType_Float,"mode.changevalue.newv","The new no-data value");
+    SetParameterDescription("mode.changevalue.newv","The new no-data value");
+    SetDefaultParameterInt("mode.changevalue.newv",0);
+
+    AddChoice("mode.apply","Apply a mask as no-data");
+
+    SetParameterDescription("mode.apply","Apply an external mask to an image using the no-data value of the input image");
+    AddParameter(ParameterType_InputImage, "mode.apply.mask", "Mask image");
+    SetParameterDescription("mode.apply.mask","Mask to be applied on input image (valid pixels have non null values)");
+
+    SetParameterString("mode","buildmask");
+
+    AddRAMParameter();
+
+    // Doc example parameter settings
+    SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_XS.tif");
+    SetDocExampleParameterValue("out", "QB_Toulouse_Ortho_XS_nodatamask.tif uint8");
+    SetDocExampleParameterValue("mode.buildmask.inv", "255");
+    SetDocExampleParameterValue("mode.buildmask.outv", "0");
+  }
+
+  void DoUpdateParameters()
+  {
+    // Nothing to do here for the parameters : all are independent
+  }
+
+
+ void DoExecute()
+  {
+    FloatVectorImageType::Pointer inputPtr = this->GetParameterImage("in");
+    
+    m_Filter = FilterType::New();
+    m_Filter->SetInsideValue(this->GetParameterFloat("mode.buildmask.inv"));
+    m_Filter->SetOutsideValue(this->GetParameterFloat("mode.buildmask.outv"));
+    m_Filter->SetNaNIsNoData(IsParameterEnabled("usenan"));
+    m_Filter->SetInput(inputPtr);
+
+    m_ChangeNoDataFilter = ChangeNoDataFilterType::New();
+    m_ChangeNoDataFilter->SetInput(inputPtr);
+    m_ChangeNoDataFilter->SetNaNIsNoData(IsParameterEnabled("usenan"));
+
+    std::vector<double> newNoData(inputPtr->GetNumberOfComponentsPerPixel(),GetParameterFloat("mode.changevalue.newv"));
+
+    m_ChangeNoDataFilter->SetNewNoDataValues(newNoData);
+    
+    if(GetParameterString("mode") == "buildmask")
+      {
+      SetParameterOutputImage("out",m_Filter->GetOutput());
+      }
+    else if(GetParameterString("mode") == "changevalue")
+      {
+      SetParameterOutputImage("out",m_ChangeNoDataFilter->GetOutput());
+      }
+    else if (GetParameterString("mode") == "apply")
+      {
+      m_MaskFilters.clear();
+      UInt8ImageType::Pointer maskPtr = this->GetParameterImage<UInt8ImageType>("mode.apply.mask");
+      unsigned int nbBands = inputPtr->GetNumberOfComponentsPerPixel();
+      itk::MetaDataDictionary &dict = inputPtr->GetMetaDataDictionary();
+      std::vector<bool> flags;
+      std::vector<double> values;
+      bool ret = otb::ReadNoDataFlags(dict,flags,values);
+      if (!ret)
+        {
+        flags.resize(nbBands,true);
+        values.resize(nbBands,0.0);
+        }
+
+      m_V2L = VectorToListFilterType::New();
+      m_V2L->SetInput(inputPtr);
+      ImageListType::Pointer inputList = m_V2L->GetOutput();
+      inputList->UpdateOutputInformation();
+      ImageListType::Pointer outputList = ImageListType::New();
+      for (unsigned int i=0 ; i<nbBands ; ++i)
+        {
+        if (flags[i])
+          {
+          MaskFilterType::Pointer masker = MaskFilterType::New();
+          masker->SetInput(inputList->GetNthElement(i));
+          masker->SetMaskImage(maskPtr);
+          masker->SetMaskingValue(0);
+          masker->SetOutsideValue(values[i]);
+          outputList->PushBack(masker->GetOutput());
+          m_MaskFilters.push_back(masker);
+          }
+        else
+          {
+          outputList->PushBack(inputList->GetNthElement(i));
+          }
+        }
+      m_L2V = ListToVectorFilterType::New();
+      m_L2V->SetInput(outputList);
+      if (!ret)
+        {
+        m_MetaDataChanger = ChangeInfoFilterType::New();
+        m_MetaDataChanger->SetInput(m_L2V->GetOutput());
+        m_MetaDataChanger->SetOutputMetaData<std::vector<bool> >(otb::MetaDataKey::NoDataValueAvailable,&flags);
+        m_MetaDataChanger->SetOutputMetaData<std::vector<double> >(otb::MetaDataKey::NoDataValue,&values);
+        SetParameterOutputImage("out",m_MetaDataChanger->GetOutput());
+        }
+      else
+        {
+        SetParameterOutputImage("out",m_L2V->GetOutput());
+        }
+      }
+  }
+
+  FilterType::Pointer m_Filter;
+  ChangeNoDataFilterType::Pointer m_ChangeNoDataFilter;
+  std::vector<MaskFilterType::Pointer> m_MaskFilters;
+  VectorToListFilterType::Pointer m_V2L;
+  ListToVectorFilterType::Pointer m_L2V;
+  ChangeInfoFilterType::Pointer m_MetaDataChanger;
+};
+
+}
+}
+
+OTB_APPLICATION_EXPORT(otb::Wrapper::ManageNoData)
+
diff --git a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx
index a1c1b49..973103c 100644
--- a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx
+++ b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx
@@ -65,7 +65,7 @@ private:
     SetParameterDescription("in", "Input image to analyse");
 
     AddParameter(ParameterType_Empty, "keywordlist", "Display the OSSIM keywordlist");
-    SetParameterDescription("keywordlist", "Output the OSSIM keyword list. It contains metadata information (sensor model, geometry ). Informations are stored in keyword list (pairs of key/value)");
+    SetParameterDescription("keywordlist", "Output the OSSIM keyword list. It contains metadata information (sensor model, geometry ). Information is stored in keyword list (pairs of key/value)");
     DisableParameter("keywordlist");
     MandatoryOff("keywordlist");
 
@@ -206,8 +206,8 @@ private:
     SetParameterRole("keyword", Role_Output);
     EnableParameter("keyword");
 
-    AddParameter(ParameterType_Group, "gcp", "Ground Control Points informations");
-    SetParameterDescription("gcp","This group of parameters allows to access to the GCPs informations.");
+    AddParameter(ParameterType_Group, "gcp", "Ground Control Points information");
+    SetParameterDescription("gcp","This group of parameters allows to access to the GCPs information.");
     SetParameterRole("gcp", Role_Output);
 
     AddParameter(ParameterType_Int, "gcp.count", "GCPs Number");
@@ -255,7 +255,7 @@ private:
     std::ostringstream ossOutput;
     FloatVectorImageType::Pointer inImage = GetParameterImage("in");
 
-    ossOutput << std::endl << "Image general informations:" << std::endl;
+    ossOutput << std::endl << "Image general information:" << std::endl;
 
     // Read informations
     typedef otb::ImageMetadataInterfaceBase ImageMetadataInterfaceType;
@@ -264,12 +264,39 @@ private:
     //Get number of bands
     SetParameterInt("numberbands", inImage->GetNumberOfComponentsPerPixel());
     ossOutput << "\tNumber of bands : " << GetParameterInt("numberbands") << std::endl;
+    std::vector<bool> noDataValueAvailable;
+    bool ret = itk::ExposeMetaData<std::vector<bool> >(inImage->GetMetaDataDictionary(),MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+
+    std::vector<double> noDataValues;
+    itk::ExposeMetaData<std::vector<double> >(inImage->GetMetaDataDictionary(),MetaDataKey::NoDataValue,noDataValues);
+
+
+      ossOutput<<"\tNo data flags :";
+
+      if(ret)
+        {
+    
+        for(unsigned int b = 0;b< inImage->GetNumberOfComponentsPerPixel();++b)
+          {
+          ossOutput<<"\n\t\tBand "<<b+1<<": ";
+
+          if(noDataValueAvailable[b])
+            ossOutput<<noDataValues[b];
+          else
+            ossOutput<<"No";  
+          }
+        }
+      else
+        {
+        ossOutput<<" Not found";
+        }
+      ossOutput<<std::endl;
 
     //Get image size
     SetParameterInt("indexx", inImage->GetLargestPossibleRegion().GetIndex()[0]);
     SetParameterInt("indexy", inImage->GetLargestPossibleRegion().GetIndex()[1]);
 
-    ossOutput << "\tStart index :  [" << GetParameterInt("indexx") << "," << GetParameterInt("indexy") << "]" << std::endl;
+        ossOutput << "\tStart index :  [" << GetParameterInt("indexx") << "," << GetParameterInt("indexy") << "]" << std::endl;
 
     //Get image size
     SetParameterInt("sizex", inImage->GetLargestPossibleRegion().GetSize()[0]);
@@ -309,7 +336,7 @@ private:
 
     ossOutput << "\tEstimated ground spacing (in meters): [" << GetParameterFloat("estimatedgroundspacingx") << "," << GetParameterFloat("estimatedgroundspacingy") << "]" << std::endl;
 
-    ossOutput << std::endl << "Image acquisition informations:" << std::endl;
+    ossOutput << std::endl << "Image acquisition information:" << std::endl;
 
     SetParameterString("sensor", metadataInterface->GetSensorID());
     ossOutput << "\tSensor : ";
@@ -433,7 +460,7 @@ private:
     for(int gcpIdx = 0; gcpIdx  < GetParameterInt("gcp.count"); ++ gcpIdx)
       {
       if (gcpIdx == 0)
-        ossOutput << "\tGCP individual informations:" << std::endl;
+        ossOutput << "\tGCP individual information:" << std::endl;
 
       gcp_ids.push_back(metadataInterface->GetGCPId(gcpIdx));
       gcp_infos.push_back(metadataInterface->GetGCPInfo(gcpIdx));
diff --git a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx
index f445b79..af2b478 100644
--- a/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx
+++ b/Modules/Applications/AppOpticalCalibration/app/otbOpticalCalibration.cxx
@@ -151,7 +151,7 @@ private:
 "- L(b) is the spectral radiance for band b \n"
 "- pi is the famous mathematical constant (3.14159...) \n"
 "- d is the earth-sun distance (in astronomical units) and depends on the acquisition's day and month \n"
-"- ESUN(b) is the mean TOA solar irradiance (or solar illumination) in W/m²/micrometers\n"
+"- ESUN(b) is the mean TOA solar irradiance (or solar illumination) in W/m2/micrometers\n"
 "- θ is the solar zenith angle in degrees. \n"
 "Note that the application asks for the solar elevation angle, and will perfom the conversion to the zenith angle itself (ze. angle = 90° - el. angle).\n"
 "Note also that ESUN(b) not only depends on the band b, but also on the spectral sensitivity of the sensor in this particular band. "
@@ -322,7 +322,7 @@ private:
     AddParameter(ParameterType_InputFilename, "atmo.rsr", "Relative Spectral Response File");
     std::ostringstream oss;
     oss << "Sensor relative spectral response file"<<std::endl;
-    oss << "By default the application gets these informations in the metadata";
+    oss << "By default the application gets this information in the metadata";
     SetParameterDescription("atmo.rsr", oss.str());
     MandatoryOff("atmo.rsr");
 
diff --git a/Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx b/Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx
index b3068c9..3aa03c2 100644
--- a/Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx
+++ b/Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx
@@ -24,7 +24,6 @@ namespace otb
 {
 namespace Wrapper
 {
-
 class SarRadiometricCalibration : public Application
 {
 public:
@@ -40,17 +39,17 @@ public:
   itkTypeMacro(SarRadiometricCalibration, otb::Application);
 
   typedef otb::SarRadiometricCalibrationToImageFilter<ComplexFloatImageType,
-                                                      ComplexFloatImageType>     CalibrationFilterType;
+                                                      FloatImageType>     CalibrationFilterType;
 
 private:
   void DoInit()
   {
     SetName("SarRadiometricCalibration");
-    SetDescription("Perform SAR calibration on input complex images");
+    SetDescription("Perform radiometric calibration of SAR images. Following sensors are supported: TerraSAR-X, Sentinel1 and Radarsat-2.Both Single Look Complex(SLC) and detected products are supported as input.\n");
 
     // Documentation
     SetDocName("SAR Radiometric calibration");
-    SetDocLongDescription("This application performs SAR calibration on input complex images.");
+    SetDocLongDescription("The objective of SAR calibration is to provide imagery in which the pixel values can be directly related to the radar backscatter of the scene. This application allows to compute Sigma Naught (Radiometric Calibration) for TerraSAR-X, Sentinel1 L1 and Radarsat-2 sensors. Metadata are automatically retrieved from image products.The application supports complex and non-complex images (SLC or detected products).\n");
     SetDocLimitations("None");
     SetDocAuthors("OTB-Team");
     SetDocSeeAlso(" ");
@@ -58,25 +57,39 @@ private:
     AddDocTag(Tags::Calibration);
     AddDocTag(Tags::SAR);
 
-    AddParameter(ParameterType_ComplexInputImage,  "in", "Input Complex Image");
+    AddParameter(ParameterType_ComplexInputImage,  "in", "Input Image");
     SetParameterDescription("in", "Input complex image");
 
-    AddParameter(ParameterType_ComplexOutputImage,  "out", "Output Image");
-    SetParameterDescription("out", "Output calibrated complex image");
+    AddParameter(ParameterType_OutputImage,  "out", "Output Image");
+    SetParameterDescription("out", "Output calibrated image. This image contains the backscatter (sigmaNought) of the input image.");
 
     AddRAMParameter();
 
     AddParameter(ParameterType_Empty, "noise", "Disable Noise");
-    SetParameterDescription("noise", "Flag to disable noise");
+    SetParameterDescription("noise", "Flag to disable noise. For 5.2.0 release, the noise values are only read by TerraSARX product.");
     MandatoryOff("noise");
 
+    AddParameter(ParameterType_Choice, "lut", "Lookup table sigma /gamma/ beta/ DN.");
+    SetParameterDescription("lut", "Lookup table values are not available with all SAR products. Products that provide lookup table with metadata are: Sentinel1, Radarsat2.");
+    AddChoice("lut.sigma", "Use sigma nought lookup");
+    SetParameterDescription("lut.sigma","Use Sigma nought lookup value from product metadata");
+    AddChoice("lut.gamma", "Use gamma nought lookup");
+    SetParameterDescription("lut.gamma","Use Gamma nought lookup value from product metadata");
+    AddChoice("lut.beta", "Use beta nought lookup");
+    SetParameterDescription("lut.beta","Use Beta nought lookup value from product metadata");
+    AddChoice("lut.dn", "Use DN value lookup");
+    SetParameterDescription("lut.dn","Use DN value lookup value from product metadata");
+    SetDefaultParameterInt("lut", 0);
+
     // Doc example parameter settings
     SetDocExampleParameterValue("in", "RSAT_imagery_HH.tif");
     SetDocExampleParameterValue("out", "SarRadiometricCalibration.tif" );
   }
 
   void DoUpdateParameters()
-  { }
+  {
+
+  }
 
   void DoExecute()
   {
@@ -92,11 +105,19 @@ private:
       m_CalibrationFilter->SetEnableNoise(false);
       }
 
+    short lut = 0;
+
+    lut = GetParameterInt("lut");
+
+    m_CalibrationFilter->SetLookupSelected(lut);
+
     // Set the output image
-    SetParameterComplexOutputImage("out", m_CalibrationFilter->GetOutput());
+    SetParameterOutputImage("out", m_CalibrationFilter->GetOutput());
+
   }
 
   CalibrationFilterType::Pointer   m_CalibrationFilter;
+
 };
 }
 }
diff --git a/Modules/Applications/AppSARCalibration/test/CMakeLists.txt b/Modules/Applications/AppSARCalibration/test/CMakeLists.txt
index 285dd10..02e9e48 100644
--- a/Modules/Applications/AppSARCalibration/test/CMakeLists.txt
+++ b/Modules/Applications/AppSARCalibration/test/CMakeLists.txt
@@ -1,2 +1,17 @@
 otb_module_test()
 #----------- SarRadiometricCalibration TESTS ----------------
+otb_test_application(NAME apTvRaSarRadiometricCalibration_SENTINEL1
+  APP  SarRadiometricCalibration
+  OPTIONS -in ${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_300_300.tif?&geom=${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_300_300.geom
+  -out ${TEMP}/apTvRaSarRadiometricCalibration_SENTINEL1.tif
+  VALID   --compare-image ${NOTOL}
+  ${BASELINE}/raTvSarRadiometricCalibration_SENTINEL1.tif
+  ${TEMP}/apTvRaSarRadiometricCalibration_SENTINEL1.tif )
+
+otb_test_application(NAME apTvRaSarRadiometricCalibration_RADARSAT2
+  APP  SarRadiometricCalibration
+  OPTIONS -in ${INPUTDATA}/RADARSAT2_ALTONA_300_300_VV.tif?&geom=${INPUTDATA}/RADARSAT2_ALTONA_300_300_VV.geom
+  -out ${TEMP}/apTvRaSarRadiometricCalibration_RADARSAT2.tif
+  VALID   --compare-image ${NOTOL}
+  ${BASELINE}/raTvSarRadiometricCalibration_RADARSAT2.tif
+  ${TEMP}/apTvRaSarRadiometricCalibration_RADARSAT2.tif )
diff --git a/Modules/Applications/AppSARDecompositions/CMakeLists.txt b/Modules/Applications/AppSARDecompositions/CMakeLists.txt
new file mode 100644
index 0000000..aa7832f
--- /dev/null
+++ b/Modules/Applications/AppSARDecompositions/CMakeLists.txt
@@ -0,0 +1,2 @@
+project(OTBAppSARDecompositions)
+otb_module_impl()
diff --git a/Modules/Applications/AppSARDecompositions/app/CMakeLists.txt b/Modules/Applications/AppSARDecompositions/app/CMakeLists.txt
new file mode 100644
index 0000000..d311a3c
--- /dev/null
+++ b/Modules/Applications/AppSARDecompositions/app/CMakeLists.txt
@@ -0,0 +1,12 @@
+set(OTBAppFiltering_LINK_LIBS
+  ${OTBPolarimetry_LIBRARIES}
+  ${OTBImageManipulation_LIBRARIES}
+  ${OTBApplicationEngine_LIBRARIES}
+  ${OTBImageBase_LIBRARIES}
+)
+
+otb_create_application(
+  NAME           SARDecompositions
+  SOURCES        otbSARDecompositions.cxx
+  LINK_LIBRARIES ${${otb-module}_LIBRARIES})
+
diff --git a/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx
new file mode 100644
index 0000000..a159356
--- /dev/null
+++ b/Modules/Applications/AppSARDecompositions/app/otbSARDecompositions.cxx
@@ -0,0 +1,189 @@
+/*=========================================================================
+
+ 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 "otbWrapperApplication.h"
+#include "otbWrapperApplicationFactory.h"
+
+
+#include "otbReciprocalHAlphaImageFilter.h"
+#include "otbSinclairReciprocalImageFilter.h"
+#include "otbSinclairToReciprocalCoherencyMatrixFunctor.h"
+#include "otbPerBandVectorImageFilter.h"
+#include "itkMeanImageFilter.h"
+
+
+namespace otb
+{
+namespace Wrapper
+{
+
+class SARDecompositions : public Application
+{
+public:
+  /** Standard class typedefs. */
+  typedef SARDecompositions                   Self;
+  typedef Application                         Superclass;
+  typedef itk::SmartPointer<Self>             Pointer;
+  typedef itk::SmartPointer<const Self>       ConstPointer;
+
+  
+  
+  typedef otb::Functor::SinclairToReciprocalCoherencyMatrixFunctor<ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleVectorImageType::PixelType>								FunctorType;
+                                    
+                                    								
+  typedef SinclairReciprocalImageFilter<ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleVectorImageType, 
+											 FunctorType > 												SRFilterType;
+  
+  
+  typedef otb::ReciprocalHAlphaImageFilter<ComplexDoubleVectorImageType, DoubleVectorImageType> 			HAFilterType;
+  
+  
+  typedef itk::MeanImageFilter<ComplexDoubleImageType, ComplexDoubleImageType>         MeanFilterType;
+  typedef otb::PerBandVectorImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType, MeanFilterType> PerBandMeanFilterType;
+  //FloatImageType
+
+  /** Standard macro */
+  itkNewMacro(Self);
+
+  itkTypeMacro(SARDecompositions, otb::Application);
+
+private:
+  void DoInit()
+  {
+    SetName("SARDecompositions");
+    SetDescription("From one-band complex images (each one related to an element of the Sinclair matrix), returns the selected decomposition.");
+
+    // Documentation
+    SetDocName("SARDecompositions");
+    SetDocLongDescription("From one-band complex images (HH, HV, VH, VV), returns the selected decomposition.\n \n"
+						  "The H-alpha-A decomposition is currently the only one available; it is implemented for the monostatic case (transmitter and receiver are co-located).\n"
+						  "User must provide three one-band complex images HH, HV or VH, and VV (monostatic case <=> HV = VH).\n"
+						  "The H-alpha-A decomposition consists in averaging 3x3 complex coherency matrices (incoherent analysis); the user must provide the size of the averaging window, thanks to the parameter inco.kernelsize.\n "
+						  "The applications returns a float vector image, made up of three channels : H (entropy), Alpha, A (Anisotropy)." );
+						  
+						  
+						  
+    SetDocLimitations("None");
+    SetDocAuthors("OTB-Team");
+    SetDocSeeAlso("SARPolarMatrixConvert, SARPolarSynth");
+
+    AddDocTag(Tags::SAR);
+
+    AddParameter(ParameterType_ComplexInputImage,  "inhh",   "Input Image");
+    SetParameterDescription("inhh", "Input image (HH)");
+    
+    AddParameter(ParameterType_ComplexInputImage,  "inhv",   "Input Image");
+    SetParameterDescription("inhv", "Input image (HV)");
+    MandatoryOff("inhv");
+    
+    AddParameter(ParameterType_ComplexInputImage,  "invh",   "Input Image");
+    SetParameterDescription("invh", "Input image (VH)");
+    MandatoryOff("invh");
+    
+    AddParameter(ParameterType_ComplexInputImage,  "invv",   "Input Image");
+    SetParameterDescription("invv", "Input image (VV)");
+    
+    AddParameter(ParameterType_OutputImage, "out",  "Output Image");
+    SetParameterDescription("out", "Output image");
+    
+    AddParameter(ParameterType_Choice, "decomp", "Decompositions");
+    AddChoice("decomp.haa","H-alpha-A decomposition");
+    SetParameterDescription("decomp.haa","H-alpha-A decomposition");
+    
+    AddParameter(ParameterType_Group,"inco","Incoherent decompositions");
+    SetParameterDescription("inco","This group allows to set parameters related to the incoherent decompositions.");
+    
+    AddParameter(ParameterType_Int, "inco.kernelsize",   "Kernel size for spatial incoherent averaging.");
+    SetParameterDescription("inco.kernelsize", "Minute (0-59)");
+    SetMinimumParameterIntValue("inco.kernelsize", 1);
+    SetDefaultParameterInt("inco.kernelsize", 3);
+    MandatoryOff("inco.kernelsize");
+
+    AddRAMParameter();
+
+    // Default values
+    SetDefaultParameterInt("decomp", 0); // H-alpha-A
+
+    // Doc example parameter settings
+    SetDocExampleParameterValue("inhh", "HH.tif");
+	SetDocExampleParameterValue("invh", "VH.tif");
+	SetDocExampleParameterValue("invv", "VV.tif");
+	SetDocExampleParameterValue("decomp", "haa");
+    SetDocExampleParameterValue("out", "HaA.tif");
+  }
+
+  void DoUpdateParameters()
+  {
+    // Nothing to do here : all parameters are independent
+  }
+
+  void DoExecute()
+  {
+	  
+	bool inhv = HasUserValue("inhv");
+	bool invh = HasUserValue("invh");
+		
+	if ( (!inhv) && (!invh) )
+	  otbAppLogFATAL( << "Parameter inhv or invh not set. Please provide a HV or a VH complex image.");
+    
+    switch (GetParameterInt("decomp"))
+      {
+		case 0: // H-alpha-A
+		
+		m_SRFilter = SRFilterType::New();
+		m_HAFilter = HAFilterType::New();
+		m_MeanFilter = PerBandMeanFilterType::New();
+		
+		if (inhv)
+		  m_SRFilter->SetInputHV_VH(GetParameterComplexDoubleImage("inhv"));
+	    else if (invh)
+		  m_SRFilter->SetInputHV_VH(GetParameterComplexDoubleImage("invh"));
+
+		m_SRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
+		m_SRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
+		
+		MeanFilterType::InputSizeType radius;
+        radius.Fill( GetParameterInt("inco.kernelsize") );
+        m_MeanFilter->GetFilter()->SetRadius(radius);
+		
+		
+		m_MeanFilter->SetInput(m_SRFilter->GetOutput());
+		m_HAFilter->SetInput(m_MeanFilter->GetOutput());
+		SetParameterOutputImage("out", m_HAFilter->GetOutput() );
+    
+		break;
+	  }
+   	 
+  }
+
+  //MCPSFilterType::Pointer m_MCPSFilter;
+  SRFilterType::Pointer m_SRFilter;
+  HAFilterType::Pointer m_HAFilter;
+  PerBandMeanFilterType::Pointer m_MeanFilter;
+  
+}; 
+
+} //end namespace Wrapper
+} //end namespace otb
+
+OTB_APPLICATION_EXPORT(otb::Wrapper::SARDecompositions)
diff --git a/Modules/Applications/AppSARDecompositions/otb-module.cmake b/Modules/Applications/AppSARDecompositions/otb-module.cmake
new file mode 100644
index 0000000..71303c8
--- /dev/null
+++ b/Modules/Applications/AppSARDecompositions/otb-module.cmake
@@ -0,0 +1,17 @@
+set(DOCUMENTATION "Basic filters application.")
+
+otb_module(OTBAppSARDecompositions
+  DEPENDS
+    OTBPolarimetry
+    OTBImageManipulation
+    OTBITK
+    OTBApplicationEngine
+    OTBImageBase
+
+  TEST_DEPENDS
+    OTBTestKernel
+    OTBCommandLine
+
+  DESCRIPTION
+    "${DOCUMENTATION}"
+)
diff --git a/Modules/Applications/AppSARDecompositions/test/CMakeLists.txt b/Modules/Applications/AppSARDecompositions/test/CMakeLists.txt
new file mode 100644
index 0000000..b99fa48
--- /dev/null
+++ b/Modules/Applications/AppSARDecompositions/test/CMakeLists.txt
@@ -0,0 +1,14 @@
+otb_module_test()
+#----------- SARDecompositions TESTS ----------------
+
+otb_test_application(NAME  apTvSARDecompositions
+                     APP  SARDecompositions
+                     OPTIONS 
+							 -inhh ${INPUTDATA}/RSAT_imageryC_HH.tif
+							 -inhv ${INPUTDATA}/RSAT_imageryC_HV.tif
+							 -invv ${INPUTDATA}/RSAT_imageryC_VV.tif
+							 -decomp haa
+							 -out ${TEMP}/apTvReciprocalHAlpha.tif
+							 
+                     )
+                             
diff --git a/Modules/Applications/AppSARPolarMatrixConvert/CMakeLists.txt b/Modules/Applications/AppSARPolarMatrixConvert/CMakeLists.txt
new file mode 100644
index 0000000..b20d3eb
--- /dev/null
+++ b/Modules/Applications/AppSARPolarMatrixConvert/CMakeLists.txt
@@ -0,0 +1,2 @@
+project(OTBAppSARPolarMatrixConvert)
+otb_module_impl()
diff --git a/Modules/Applications/AppSARPolarMatrixConvert/app/CMakeLists.txt b/Modules/Applications/AppSARPolarMatrixConvert/app/CMakeLists.txt
new file mode 100644
index 0000000..81426ca
--- /dev/null
+++ b/Modules/Applications/AppSARPolarMatrixConvert/app/CMakeLists.txt
@@ -0,0 +1,12 @@
+set(OTBAppFiltering_LINK_LIBS
+  ${OTBPolarimetry_LIBRARIES}
+  ${OTBImageManipulation_LIBRARIES}
+  ${OTBApplicationEngine_LIBRARIES}
+  ${OTBImageBase_LIBRARIES}
+)
+
+otb_create_application(
+  NAME           SARPolarMatrixConvert
+  SOURCES        otbSARPolarMatrixConvert.cxx
+  LINK_LIBRARIES ${${otb-module}_LIBRARIES})
+
diff --git a/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx
new file mode 100644
index 0000000..c670aab
--- /dev/null
+++ b/Modules/Applications/AppSARPolarMatrixConvert/app/otbSARPolarMatrixConvert.cxx
@@ -0,0 +1,709 @@
+/*=========================================================================
+
+ 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 "otbWrapperApplication.h"
+#include "otbWrapperApplicationFactory.h"
+
+
+
+
+
+//monostatic case
+#include "otbSinclairReciprocalImageFilter.h"
+#include "otbSinclairToReciprocalCoherencyMatrixFunctor.h"
+#include "otbSinclairToReciprocalCovarianceMatrixFunctor.h"
+#include "otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h"
+
+#include "otbReciprocalCoherencyToReciprocalMuellerImageFilter.h"
+#include "otbReciprocalCovarianceToCoherencyDegreeImageFilter.h"
+#include "otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h"
+#include "otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h"
+
+
+//bistatic case
+#include "otbSinclairImageFilter.h"
+#include "otbSinclairToCoherencyMatrixFunctor.h"
+#include "otbSinclairToCovarianceMatrixFunctor.h"
+#include "otbSinclairToCircularCovarianceMatrixFunctor.h"
+#include "otbSinclairToMuellerMatrixFunctor.h"
+
+#include "otbMuellerToReciprocalCovarianceImageFilter.h"
+#include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h"
+
+
+
+
+
+
+namespace otb
+{
+namespace Wrapper
+{
+
+class SARPolarMatrixConvert : public Application
+{
+public:
+  /** Standard class typedefs. */
+  typedef SARPolarMatrixConvert                   Self;
+  typedef Application                         Superclass;
+  typedef itk::SmartPointer<Self>             Pointer;
+  typedef itk::SmartPointer<const Self>       ConstPointer;
+
+  
+  //Monostatic case
+    typedef otb::Functor::SinclairToReciprocalCoherencyMatrixFunctor<ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleVectorImageType::PixelType>								RCoherencyFunctorType;
+                                    
+    typedef otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleVectorImageType::PixelType>								RCovarianceFunctorType;
+                                    
+    typedef otb::Functor::SinclairToReciprocalCircularCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleVectorImageType::PixelType>								RCircularCovarianceFunctorType;
+                                                                  
+                                    								
+    typedef SinclairReciprocalImageFilter<ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleVectorImageType, 
+											 RCoherencyFunctorType > 									RCohSRFilterType;
+											 
+											 
+    typedef SinclairReciprocalImageFilter<ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleVectorImageType, 
+											 RCovarianceFunctorType > 									RCovSRFilterType;
+											 
+	typedef SinclairReciprocalImageFilter<ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleVectorImageType, 
+											 RCircularCovarianceFunctorType > 							RCCSRFilterType;
+											 
+											 
+    typedef otb::ReciprocalCoherencyToReciprocalMuellerImageFilter<ComplexDoubleVectorImageType, DoubleVectorImageType> RCRMFilterType;
+	
+	typedef otb::ReciprocalCovarianceToCoherencyDegreeImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RCCDFilterType;
+	
+	typedef otb::ReciprocalCovarianceToReciprocalCoherencyImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RCRCFilterType;
+	
+	typedef otb::ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter<ComplexDoubleVectorImageType, ComplexDoubleVectorImageType> RLCRCCFilterType;
+											 
+  
+	//Bistatic case
+	typedef otb::Functor::SinclairToCoherencyMatrixFunctor<ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleVectorImageType::PixelType>								CoherencyFunctorType;
+                                    
+                                    
+	typedef otb::Functor::SinclairToCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleVectorImageType::PixelType>								CovarianceFunctorType;
+                                    
+                                   
+	typedef otb::Functor::SinclairToCircularCovarianceMatrixFunctor<ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleVectorImageType::PixelType>								CircularCovarianceFunctorType;
+                                    
+                                    	
+    typedef otb::Functor::SinclairToMuellerMatrixFunctor<ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    ComplexDoubleImageType::PixelType,
+                                    DoubleVectorImageType::PixelType>									MuellerFunctorType;
+                                    
+    
+    typedef SinclairImageFilter<ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleImageType,
+											 ComplexDoubleImageType, 
+											 ComplexDoubleVectorImageType, 
+											 CoherencyFunctorType > 									CohSRFilterType;
+											 
+											 
+    typedef SinclairImageFilter<ComplexDoubleImageType, 
+											 ComplexDoubleImageType,
+											 ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleVectorImageType, 
+											 CovarianceFunctorType > 									CovSRFilterType;
+											 
+	typedef SinclairImageFilter<ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleImageType,
+											 ComplexDoubleImageType, 
+											 ComplexDoubleVectorImageType, 
+											 CircularCovarianceFunctorType > 							CCSRFilterType;
+                                    
+	typedef SinclairImageFilter<ComplexDoubleImageType, 
+											 ComplexDoubleImageType, 
+											 ComplexDoubleImageType,
+											 ComplexDoubleImageType, 
+											 DoubleVectorImageType, 
+											 MuellerFunctorType > 										MSRFilterType;
+											 
+											 
+	typedef otb::MuellerToReciprocalCovarianceImageFilter<DoubleVectorImageType, ComplexDoubleVectorImageType>  MRCFilterType;									 
+	
+	typedef otb::MuellerToPolarisationDegreeAndPowerImageFilter<DoubleVectorImageType, DoubleVectorImageType>   MPDPFilterType;
+  
+  
+
+  /** Standard macro */
+  itkNewMacro(Self);
+
+  itkTypeMacro(SARPolarMatrixConvert, otb::Application);
+
+private:
+  void DoInit()
+  {
+    SetName("SARPolarMatrixConvert");
+    SetDescription("This applications allows converting classical polarimetric matrices to each other.");
+
+    // Documentation
+    SetDocName("SARPolarMatrixConvert");
+    SetDocLongDescription(
+    
+    "This application allows converting classical polarimetric matrices to each other.\n"
+    "For instance, it is possible to get the coherency matrix from the Sinclar one, or the Mueller matrix from the coherency one.\n"
+    "The filters used in this application never handle matrices, but images where each band is related to their elements.\n"
+    "As most of the time SAR polarimetry handles symetric/hermitian matrices, only the relevant elements are stored, so that the images representing them have a minimal number of bands.\n"
+    "For instance, the coherency matrix size is 3x3 in the monostatic case, and 4x4 in the bistatic case : it will thus be stored in a 6-band or a 10-band complex image (the diagonal and the upper elements of the matrix).\n"
+    "\n"
+    "The Sinclair matrix is a special case : it is always represented as 3 or 4 one-band complex images (for mono- or bistatic case).\n"
+    "The available conversions are listed below:\n"
+    
+	"\n--- Monostatic case ---\n" 
+    
+    "1 msinclairtocoherency --> Sinclair matrix to coherency matrix (input : 3 x 1 complex channel (HH, HV or VH, VV) | output :  6 complex channels)\n"
+    "2 msinclairtocovariance --> Sinclair matrix to covariance matrix (input : 3 x 1 complex channel (HH, HV or VH, VV) | output :  6 complex channels)\n"
+    "3 msinclairtocircovariance --> Sinclair matrix to circular covariance matrix (input : 3 x 1 complex channel (HH, HV or VH, VV) | output :  6 complex channels)\n"
+    "4 mcoherencytomueller --> Coherency matrix to Mueller matrix (input : 6 complex channels | 16 real channels)\n"
+    "5 mcovariancetocoherencydegree --> Covariance matrix to coherency degree (input : 6 complex channels | 3 complex channels)\n"
+    "6 mcovariancetocoherency --> Covariance matrix to coherency matrix (input : 6 complex channels | 6 complex channels)\n"
+    "7 mlinearcovariancetocircularcovariance --> Covariance matrix to circular covariance matrix (input : 6 complex channels | output : 6 complex channels)\n"
+    
+    "\n--- Bistatic case ---\n"
+    
+    "8 bsinclairtocoherency --> Sinclair matrix to coherency matrix (input : 4 x 1 complex channel (HH, HV, VH, VV) | 10 complex channels)\n"
+    "9 bsinclairtocovariance --> Sinclair matrix to covariance matrix (input : 4 x 1 complex channel (HH, HV, VH, VV) | output : 10 complex channels)\n"
+    "10 bsinclairtocircovariance --> Sinclair matrix to circular covariance matrix (input : 4 x 1 complex channel (HH, HV, VH, VV) | output : 10 complex channels)\n"
+    
+    "\n--- Both cases ---\n"
+    
+    "11 sinclairtomueller --> Sinclair matrix to Mueller matrix (input : 4 x 1 complex channel (HH, HV, VH, VV) | output : 16 real channels)\n"
+    "12 muellertomcovariance --> Mueller matrix to covariance matrix (input : 16 real channels | output : 6 complex channels)\n"
+    "13 muellertopoldegandpower --> Mueller matrix to polarization degree and power (input : 16 real channels | output : 4 real channels)\n"
+
+ );
+						  
+    SetDocLimitations("None");
+    SetDocAuthors("OTB-Team");
+    SetDocSeeAlso("SARPolarSynth, SARDecompositions");
+
+    AddDocTag(Tags::SAR);
+
+    AddParameter(ParameterType_ComplexInputImage,  "inc",   "Input : multi-band complex image");
+    SetParameterDescription("inc", "Input : multi-band complex image");
+    MandatoryOff("inc");
+    
+    AddParameter(ParameterType_InputImage,  "inf",   "Input : multi-band real image");
+    SetParameterDescription("inf", "Input : multi-band real image");
+    MandatoryOff("inf");
+
+
+    AddParameter(ParameterType_ComplexInputImage,  "inhh",   "Input : one-band complex image (HH)");
+    SetParameterDescription("inhh", "Input : one-band complex image (HH)");
+    MandatoryOff("inhh");
+    
+    AddParameter(ParameterType_ComplexInputImage,  "inhv",   "Input : one-band complex image (HV)");
+    SetParameterDescription("inhv", "Input : one-band complex image (HV)");
+    MandatoryOff("inhv");
+    
+    AddParameter(ParameterType_ComplexInputImage,  "invh",   "Input : one-band complex image (VH)");
+    SetParameterDescription("invh", "Input : one-band complex image (VH)");
+    MandatoryOff("invh");
+    
+    AddParameter(ParameterType_ComplexInputImage,  "invv",   "Input : one-band complex image (VV)");
+    SetParameterDescription("invv", "Input : one-band complex image (VV)");
+    MandatoryOff("invv");
+    
+    AddParameter(ParameterType_ComplexOutputImage, "outc",  "Output Complex Image");
+    SetParameterDescription("outc", "Output Complex image.");
+    MandatoryOff("outc");
+    
+    AddParameter(ParameterType_OutputImage, "outf",  "Output Real Image");
+    SetParameterDescription("outf", "Output Real image.");
+    MandatoryOff("outf");
+    
+    
+    
+    AddParameter(ParameterType_Choice, "conv", "Convertion");
+
+    //Monostatic case 
+    
+    // #1
+    // SinclairToReciprocalCoherency
+    AddChoice("conv.msinclairtocoherency","1 Monostatic : Sinclair matrix to coherency matrix (complex output)");
+    SetParameterDescription("conv.msinclairtocoherency","1 Monostatic :Sinclair matrix to coherency matrix (complex output)");
+    
+    // #2
+    // SinclairToReciprocalCovariance
+    AddChoice("conv.msinclairtocovariance","2 Monostatic : Sinclair matrix to covariance matrix (complex output)");
+    SetParameterDescription("conv.msinclairtocovariance","2 Monostatic : Sinclair matrix to covariance matrix (complex output)");
+    
+    // #3 
+    // SinclairToReciprocalCircularCovariance
+    AddChoice("conv.msinclairtocircovariance","3 Monostatic : Sinclair matrix to circular covariance matrix (complex output)");
+    SetParameterDescription("conv.msinclairtocircovariance","3 Monostatic : Sinclair matrix to circular covariance matrix (complex output)");
+    
+    // #4 
+    // ReciprocalCoherencyToReciprocalMuellerImageFilter
+    AddChoice("conv.mcoherencytomueller","4 Monostatic : Coherency matrix to Mueller matrix"); 
+    SetParameterDescription("conv.mcoherencytomueller","4 Monostatic : Coherency matrix to Mueller matrix"); 
+    
+    // #5
+    // ReciprocalCovarianceToCoherencyDegreeImageFilter 
+    AddChoice("conv.mcovariancetocoherencydegree","5 Monostatic : Covariance matrix to coherency degree "); 
+    SetParameterDescription("conv.mcovariancetocoherencydegree","5 Monostatic : Covariance matrix to coherency degree "); 
+    
+    // #6
+    // ReciprocalCovarianceToReciprocalCoherencyImageFilter
+    AddChoice("conv.mcovariancetocoherency","6 Monostatic : Covariance matrix to coherency matrix (complex output)"); 
+    SetParameterDescription("conv.mcovariancetocoherency","6 Monostatic : Covariance matrix to coherency matrix (complex output)");  
+    
+    // #7
+    // ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter
+    AddChoice("conv.mlinearcovariancetocircularcovariance","7 Monostatic : Covariance matrix to circular covariance matrix (complex output)"); 
+    SetParameterDescription("conv.mlinearcovariancetocircularcovariance","7 Monostatic : Covariance matrix to circular covariance matrix (complex output)");  
+    
+    // #8
+    // MuellerToReciprocalCovarianceImageFilter 
+    AddChoice("conv.muellertomcovariance","8 Bi/mono : Mueller matrix to monostatic covariance matrix");
+    SetParameterDescription("conv.muellertomcovariance","8 Bi/mono : Mueller matrix to monostatic covariance matrix");
+    
+    //Bistatic case
+    
+    // #9
+    // SinclairToCoherency
+    AddChoice("conv.bsinclairtocoherency","9 Bistatic : Sinclair matrix to coherency matrix (complex output)");
+    SetParameterDescription("conv.bsinclairtocoherency","9 Bistatic : Sinclair matrix to coherency matrix (complex output)");
+    
+    // #10
+    // SinclairToCovariance  
+    AddChoice("conv.bsinclairtocovariance","10 Bistatic : Sinclair matrix to covariance matrix (complex output)");
+    SetParameterDescription("conv.bsinclairtocovariance","10 Bistatic : Sinclair matrix to covariance matrix (complex output)");
+    
+    // #11
+    // SinclairToCircularCovariance 
+    AddChoice("conv.bsinclairtocircovariance","11 Bistatic : Sinclair matrix to circular covariance matrix (complex output)");
+    SetParameterDescription("conv.bsinclairtocircovariance","11 Bistatic : Sinclair matrix to circular covariance matrix (complex output)");
+    
+    //Both case
+    
+    // #12
+    // SinclairToMueller
+    AddChoice("conv.sinclairtomueller","12 Bi/mono : Sinclair matrix to Mueller matrix");
+    SetParameterDescription("conv.sinclairtomueller","12 Bi/mono : Sinclair matrix to Mueller matrix");
+    
+    
+    // #13
+    // MuellerToPolarisationDegreeAndPowerImageFilter
+    AddChoice("conv.muellertopoldegandpower","13 Bi/mono : Mueller matrix to polarisation degree and power");
+    SetParameterDescription("conv.muellertopoldegandpower","13 Bi/mono : Mueller matrix to polarisation degree and power");
+
+    AddRAMParameter();
+
+    // Default values
+    SetDefaultParameterInt("conv", 0); // SinclairToReciprocalCoherency
+
+    // Doc example parameter settings
+    SetDocExampleParameterValue("inhh", "HH.tif");
+	SetDocExampleParameterValue("invh", "VH.tif");
+	SetDocExampleParameterValue("invv", "VV.tif");
+	SetDocExampleParameterValue("conv", "msinclairtocoherency"); 
+    SetDocExampleParameterValue("outc", "mcoherency.tif");
+  }
+
+  void DoUpdateParameters()
+  {
+    
+    int convType = GetParameterInt("conv");
+    
+    if ( (convType>=0) && (convType<=2)) //msinclairtocoherency msinclairtocovariance msinclairtocircovariance
+	{
+	    GetParameterByKey("inc")->SetActive(false);
+	    GetParameterByKey("inf")->SetActive(false); 
+	    GetParameterByKey("inhh")->SetActive(true);
+	    GetParameterByKey("inhv")->SetActive(true); 
+	    GetParameterByKey("invh")->SetActive(true);
+	    GetParameterByKey("invv")->SetActive(true); 
+	    GetParameterByKey("outc")->SetActive(true);
+	    GetParameterByKey("outf")->SetActive(false);
+	}
+	else if ( (convType>=3) && (convType<=6)) // mcoherencytomueller mcovariancetocoherencydegree mcovariancetocoherency mlinearcovariancetocircularcovariance
+	{  
+	    GetParameterByKey("inc")->SetActive(true);
+	    GetParameterByKey("inf")->SetActive(false); 
+	    GetParameterByKey("inhh")->SetActive(false);
+	    GetParameterByKey("inhv")->SetActive(false); 
+	    GetParameterByKey("invh")->SetActive(false);
+	    GetParameterByKey("invv")->SetActive(false); 
+	    
+	    if (convType == 3)
+	    {
+			GetParameterByKey("outc")->SetActive(false);
+			GetParameterByKey("outf")->SetActive(true);
+		}
+		else
+		{
+			GetParameterByKey("outc")->SetActive(true);
+			GetParameterByKey("outf")->SetActive(false);
+		}
+	}
+	else if ( convType==7) // muellertomcovariance
+	{
+		GetParameterByKey("inc")->SetActive(false);
+	    GetParameterByKey("inf")->SetActive(true); 
+	    GetParameterByKey("inhh")->SetActive(false);
+	    GetParameterByKey("inhv")->SetActive(false); 
+	    GetParameterByKey("invh")->SetActive(false);
+	    GetParameterByKey("invv")->SetActive(false); 
+	    GetParameterByKey("outc")->SetActive(true);
+		GetParameterByKey("outf")->SetActive(false);	
+	}
+	else if ( (convType>=8) && (convType<=11)) // bsinclairtocoherency bsinclairtocovariance bsinclairtocircovariance sinclairtomueller
+	{
+	    GetParameterByKey("inc")->SetActive(false);
+	    GetParameterByKey("inf")->SetActive(false); 
+	    GetParameterByKey("inhh")->SetActive(true);
+	    GetParameterByKey("inhv")->SetActive(true); 
+	    GetParameterByKey("invh")->SetActive(true);
+	    GetParameterByKey("invv")->SetActive(true); 
+	    	    
+	    if (convType == 11)
+	    {
+			GetParameterByKey("outc")->SetActive(false);
+			GetParameterByKey("outf")->SetActive(true);
+		}
+		else
+		{
+			GetParameterByKey("outc")->SetActive(true);
+			GetParameterByKey("outf")->SetActive(false);
+		}
+	    
+	}
+	else if ( convType==12 )  // muellertopoldegandpower
+	{
+	    GetParameterByKey("inc")->SetActive(false);
+	    GetParameterByKey("inf")->SetActive(true); 
+	    GetParameterByKey("inhh")->SetActive(false);
+	    GetParameterByKey("inhv")->SetActive(false); 
+	    GetParameterByKey("invh")->SetActive(false);
+	    GetParameterByKey("invv")->SetActive(false); 
+	    GetParameterByKey("outc")->SetActive(false);
+		GetParameterByKey("outf")->SetActive(true);	    
+	}
+	
+    
+    
+  }
+
+  void DoExecute()
+  {
+
+    //****************************************
+	//* Check inputs and outputs consistency *
+	//****************************************
+	
+    bool inc = HasUserValue("inc");
+    bool inf = HasUserValue("inf");
+	bool inhh = HasUserValue("inhh");
+	bool inhv = HasUserValue("inhv");
+	bool invh = HasUserValue("invh");
+	bool invv = HasUserValue("invv");
+	bool outc = HasUserValue("outc"); 
+	bool outf = HasUserValue("outf"); 
+	
+	int convType = GetParameterInt("conv");
+	
+	
+	if ( (!outc) && (!outf) )
+	        otbAppLogFATAL( << "No output image provided; please, set the parameter 'outc' or 'outf'.");
+
+	
+	if ( (convType>=0) && (convType<=2)) //msinclairtocoherency msinclairtocovariance msinclairtocircovariance
+	{
+		if ( (!inhv) && (!invh) )
+	        otbAppLogFATAL( << "Parameter 'inhv' or 'invh' not set.");
+	    if ( !inhh )
+	        otbAppLogFATAL( << "Parameter 'inhh' not set.");
+	    if ( !invv )
+	        otbAppLogFATAL( << "Parameter 'invv' not set.");
+	        
+	}
+	
+	else if ( (convType>=3) && (convType<=6)) // mcoherencytomueller mcovariancetocoherencydegree mcovariancetocoherency mlinearcovariancetocircularcovariance
+	{
+		if ( !inc )
+	        otbAppLogFATAL( << "Parameter 'inc' not set.");
+	}
+	else if ( (convType>=8) && (convType<=11)) // bsinclairtocoherency bsinclairtocovariance bsinclairtocircovariance sinclairtomueller
+	{
+	    if ( (!inhh) || (!inhv) || (!invh) || (!invv) )
+	        otbAppLogFATAL( << "Please, ensure that HH, HV, VH and VV complex images have been provided (paramaters inhh, inhv, invh, invv).");
+	}
+	else if ( (convType==7) || (convType==12) ) // muellertomcovariance muellertopoldegandpower
+	{
+		if ( !inf )
+	        otbAppLogFATAL( << "Parameter 'inf' not set.");
+	}
+
+		
+	switch (GetParameterInt("conv"))
+      {
+		  
+		//***************************************
+		//*             MONOSTATIC              *
+		//***************************************
+		
+		case 0: // SinclairToReciprocalCoherency
+	  	m_RCohSRFilter = RCohSRFilterType::New();
+	  	
+	    if (inhv)
+		  m_RCohSRFilter->SetInputHV_VH(GetParameterComplexDoubleImage("inhv"));
+	    else if (invh)
+		  m_RCohSRFilter->SetInputHV_VH(GetParameterComplexDoubleImage("invh"));
+	  	
+		m_RCohSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
+		m_RCohSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
+		
+		SetParameterComplexOutputImage("outc", m_RCohSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output :  6 complex channels
+		
+		break;
+
+		
+		case 1: // SinclairToReciprocalCovariance	
+	
+		m_RCovSRFilter = RCovSRFilterType::New();
+		
+		if (inhv)
+		  m_RCovSRFilter->SetInputHV_VH(GetParameterComplexDoubleImage("inhv"));
+	    else if (invh)
+		  m_RCovSRFilter->SetInputHV_VH(GetParameterComplexDoubleImage("invh"));
+		
+		m_RCovSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
+		m_RCovSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
+		
+		SetParameterComplexOutputImage("outc", m_RCovSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output :  6 complex channels
+		
+		break;
+		
+		
+		
+		case 2: // SinclairToReciprocalCircularCovariance
+		
+		m_RCCSRFilter = RCCSRFilterType::New();
+		
+		if (inhv)
+		  m_RCCSRFilter->SetInputHV_VH(GetParameterComplexDoubleImage("inhv"));
+	    else if (invh)
+		  m_RCCSRFilter->SetInputHV_VH(GetParameterComplexDoubleImage("invh"));
+		
+		m_RCCSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
+		m_RCCSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
+		
+		SetParameterComplexOutputImage("outc", m_RCCSRFilter->GetOutput() ); // input : 3 x 1 complex channel | output :  6 complex channels
+		
+		break;
+		
+		
+	    case 3: // ReciprocalCoherencyToReciprocalMuellerImageFilter
+		
+		m_RCRMFilter = RCRMFilterType::New();
+		m_RCRMFilter->SetInput(GetParameterComplexDoubleVectorImage("inc"));
+		
+		SetParameterOutputImage("outf", m_RCRMFilter->GetOutput() ); // input : 6 complex channels | 16 real channels
+		
+		break;
+		
+	
+		
+		case 4: // ReciprocalCovarianceToCoherencyDegreeImageFilter
+		
+		m_RCCDFilter = RCCDFilterType::New();
+		m_RCCDFilter->SetInput(GetParameterComplexDoubleVectorImage("inc"));
+		
+		SetParameterComplexOutputImage("outc", m_RCCDFilter->GetOutput() ); // input : 6 complex channels | 3 complex channels
+		
+		break;
+
+
+	    case 5: // ReciprocalCovarianceToReciprocalCoherencyImageFilter
+		
+		m_RCRCFilter = RCRCFilterType::New();
+		m_RCRCFilter->SetInput(GetParameterComplexDoubleVectorImage("inc"));
+		
+		SetParameterComplexOutputImage("outc", m_RCRCFilter->GetOutput() ); // input : 6 complex channels | 6 complex channels
+		
+		break;
+		
+	    
+
+	    case 6: // ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter
+		
+		m_RLCRCCFilter = RLCRCCFilterType::New();
+		m_RLCRCCFilter->SetInput(GetParameterComplexDoubleVectorImage("inc"));
+		
+		SetParameterComplexOutputImage("outc", m_RLCRCCFilter->GetOutput() ); // input : 6 complex channels | output : 6 complex channels
+		
+		break;
+		
+		
+		case 7: // MuellerToReciprocalCovarianceImageFilter
+		
+		m_MRCFilter = MRCFilterType::New();
+		
+		m_MRCFilter->SetInput(GetParameterDoubleVectorImage("inf"));
+		
+		SetParameterComplexOutputImage("outc", m_MRCFilter->GetOutput() ); // input : 16 real channels | output : 6 complex channels
+		
+		break;
+		
+		
+	    //***************************************
+		//*               BISTATIC              * 
+		//***************************************
+		
+	    case 8: // SinclairToCoherency
+			
+	  	m_CohSRFilter = CohSRFilterType::New();
+	  	
+		m_CohSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
+		m_CohSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv"));
+		m_CohSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh"));
+		m_CohSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
+		
+		SetParameterComplexOutputImage("outc", m_CohSRFilter->GetOutput() ); // input : 4 x 1 complex channel | 10 complex channels
+		
+		break;
+		
+			
+    
+		case 9: // SinclairToCovariance	
+		
+		m_CovSRFilter = CovSRFilterType::New();
+		
+		m_CovSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
+		m_CovSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv"));
+		m_CovSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh"));
+		m_CovSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
+		
+		SetParameterComplexOutputImage("outc", m_CovSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels
+		
+		break;
+		
+		
+		case 10: // SinclairToCircularCovariance
+		
+		m_CCSRFilter = CCSRFilterType::New();
+		
+		m_CCSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
+		m_CCSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv"));
+		m_CCSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh"));
+		m_CCSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
+		
+		SetParameterComplexOutputImage("outc", m_CCSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 10 complex channels
+		
+		break;
+		
+		
+		//***************************************
+		//*             BOTH CASES              * 
+		//***************************************
+		
+				
+		case 11: // SinclairToMueller
+		std::cout << "taloula 1" << std::endl;
+		m_MSRFilter = MSRFilterType::New();
+		
+		m_MSRFilter->SetInputHH(GetParameterComplexDoubleImage("inhh"));
+		m_MSRFilter->SetInputHV(GetParameterComplexDoubleImage("inhv"));
+		m_MSRFilter->SetInputVH(GetParameterComplexDoubleImage("invh"));
+		m_MSRFilter->SetInputVV(GetParameterComplexDoubleImage("invv"));
+		
+		SetParameterOutputImage("outf", m_MSRFilter->GetOutput() ); // input : 4 x 1 complex channel | output : 16 real channels
+		
+		break;
+		
+		
+		case 12: // MuellerToPolarisationDegreeAndPowerImageFilter
+		m_MPDPFilter = MPDPFilterType::New();
+		
+		m_MPDPFilter->SetInput(GetParameterDoubleVectorImage("inf"));
+		
+		SetParameterOutputImage("outf", m_MPDPFilter->GetOutput() ); //  input : 16 real channels | output : 4 real channels
+		
+		break;
+		
+	  }
+	  
+
+    
+  }
+
+  //Monostatic
+  RCohSRFilterType::Pointer m_RCohSRFilter;
+  RCovSRFilterType::Pointer m_RCovSRFilter;
+  RCCSRFilterType::Pointer  m_RCCSRFilter;
+  RCRMFilterType::Pointer   m_RCRMFilter;
+  RCCDFilterType::Pointer   m_RCCDFilter;
+  RCRCFilterType::Pointer   m_RCRCFilter;
+  RLCRCCFilterType::Pointer m_RLCRCCFilter;
+  
+  //Bistatic
+  CohSRFilterType::Pointer m_CohSRFilter;
+  CovSRFilterType::Pointer m_CovSRFilter;
+  CCSRFilterType::Pointer  m_CCSRFilter;
+  MSRFilterType::Pointer   m_MSRFilter;
+  
+  //Both cases
+  MRCFilterType::Pointer   m_MRCFilter;
+  MPDPFilterType::Pointer  m_MPDPFilter;
+  
+
+
+
+  
+}; 
+
+} //end namespace Wrapper
+} //end namespace otb
+
+OTB_APPLICATION_EXPORT(otb::Wrapper::SARPolarMatrixConvert)
diff --git a/Modules/Applications/AppSARPolarMatrixConvert/otb-module.cmake b/Modules/Applications/AppSARPolarMatrixConvert/otb-module.cmake
new file mode 100644
index 0000000..759161f
--- /dev/null
+++ b/Modules/Applications/AppSARPolarMatrixConvert/otb-module.cmake
@@ -0,0 +1,17 @@
+set(DOCUMENTATION "Basic filters application.")
+
+otb_module(OTBAppSARPolarMatrixConvert
+  DEPENDS
+    OTBPolarimetry
+    OTBImageManipulation
+    OTBITK
+    OTBApplicationEngine
+    OTBImageBase
+
+  TEST_DEPENDS
+    OTBTestKernel
+    OTBCommandLine
+
+  DESCRIPTION
+    "${DOCUMENTATION}"
+)
diff --git a/Modules/Applications/AppSARPolarMatrixConvert/test/CMakeLists.txt b/Modules/Applications/AppSARPolarMatrixConvert/test/CMakeLists.txt
new file mode 100644
index 0000000..a7c518f
--- /dev/null
+++ b/Modules/Applications/AppSARPolarMatrixConvert/test/CMakeLists.txt
@@ -0,0 +1,157 @@
+otb_module_test()
+#----------- SARPolarMatrixConvert TESTS ----------------
+
+#1
+otb_test_application(NAME  apTvSARPolarMatrixConvertRecCoherency
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inhh ${INPUTDATA}/RSAT_imageryC_HH.tif
+							 -inhv ${INPUTDATA}/RSAT_imageryC_HV.tif
+							 -invv ${INPUTDATA}/RSAT_imageryC_VV.tif
+							 -conv msinclairtocoherency 
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertRecCoherency.tif
+							 
+                     )
+            
+#2                            
+otb_test_application(NAME  apTvSARPolarMatrixConvertRecCovariance
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inhh ${INPUTDATA}/RSAT_imageryC_HH.tif
+							 -inhv ${INPUTDATA}/RSAT_imageryC_HV.tif
+							 -invv ${INPUTDATA}/RSAT_imageryC_VV.tif
+							 -conv msinclairtocovariance 
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertRecCovariance.tif
+							 
+                     )
+
+#3
+otb_test_application(NAME  apTvSARPolarMatrixConvertRecCirCovariance
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inhh ${INPUTDATA}/RSAT_imageryC_HH.tif
+							 -inhv ${INPUTDATA}/RSAT_imageryC_HV.tif
+							 -invv ${INPUTDATA}/RSAT_imageryC_VV.tif
+							 -conv msinclairtocircovariance 
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertRecCirCovariance.tif
+							 
+                     )
+
+#4
+otb_test_application(NAME  apTvSARPolarMatrixConvertRecCohToMueller
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inc ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
+							 -conv mcoherencytomueller
+							 -outf ${TEMP}/apTvSARPolarMatrixConvertRecCohToMueller.tif
+							 
+                     )
+                             
+                             
+#5
+otb_test_application(NAME  apTvSARPolarMatrixConvertRecCovToCohDeg
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inc ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
+							 -conv mcovariancetocoherencydegree
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertRecCovToCohDeg.tif
+							 
+                     )
+                             
+
+#6 
+otb_test_application(NAME  apTvSARPolarMatrixConvertRecCovToRecCoh
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inc ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
+							 -conv mcovariancetocoherency
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertRecCovToRecCoh.tif
+							 
+                     )
+
+#7 
+otb_test_application(NAME  apTvSARPolarMatrixConvertRecLinCovToRecCirCov
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inc ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
+							 -conv mlinearcovariancetocircularcovariance
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertRecCovToRecCoh.tif
+							 
+                     )
+                             
+                             
+#8 
+otb_test_application(NAME  apTvSARPolarMatrixConvertMuellerToRecCov
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inf ${BASELINE}/saTvSinclairImageFilter_SinclairToMueller.tif
+							 -conv muellertomcovariance
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertMuellerToRecCov.tif
+							 
+                     )
+
+
+#9
+otb_test_application(NAME  apTvSARPolarMatrixConvertBiSincToCoherency
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inhh ${INPUTDATA}/RSAT_imageryC_HH.tif
+							 -inhv ${INPUTDATA}/RSAT_imageryC_HV.tif
+							 -invh ${INPUTDATA}/RSAT_imageryC_VH.tif
+							 -invv ${INPUTDATA}/RSAT_imageryC_VV.tif
+							 -conv bsinclairtocoherency
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertBiSincToCoherency.tif
+							 
+                     )
+                             
+                             
+#10
+otb_test_application(NAME  apTvSARPolarMatrixConvertBiSincToCovariance
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inhh ${INPUTDATA}/RSAT_imageryC_HH.tif
+							 -inhv ${INPUTDATA}/RSAT_imageryC_HV.tif
+							 -invh ${INPUTDATA}/RSAT_imageryC_VH.tif
+							 -invv ${INPUTDATA}/RSAT_imageryC_VV.tif
+							 -conv bsinclairtocovariance
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertBiSincToCovariance.tif
+							 
+                     )
+                             
+#11
+otb_test_application(NAME  apTvSARPolarMatrixConvertBiSincToCirCovariance
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inhh ${INPUTDATA}/RSAT_imageryC_HH.tif
+							 -inhv ${INPUTDATA}/RSAT_imageryC_HV.tif
+							 -invh ${INPUTDATA}/RSAT_imageryC_VH.tif
+							 -invv ${INPUTDATA}/RSAT_imageryC_VV.tif
+							 -conv bsinclairtocircovariance
+							 -outc ${TEMP}/apTvSARPolarMatrixConvertBiSincToCirCovariance.tif
+							 
+                     )
+   
+                             
+#12 
+otb_test_application(NAME  apTvSARPolarMatrixConvertSincToMueller
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inhh ${INPUTDATA}/RSAT_imageryC_HH.tif
+							 -inhv ${INPUTDATA}/RSAT_imageryC_HV.tif
+							 -invh ${INPUTDATA}/RSAT_imageryC_HV.tif #monostatic
+							 -invv ${INPUTDATA}/RSAT_imageryC_VV.tif
+							 -conv sinclairtomueller
+							 -outf ${TEMP}/apTvSARPolarMatrixConvertSincToMueller.tif
+							 
+                     )
+                             
+                             
+#13 
+otb_test_application(NAME  apTvSARPolarMatrixConvertMuellerToPolDeGPow
+                     APP  SARPolarMatrixConvert
+                     OPTIONS 
+							 -inf ${BASELINE}/saTvSinclairImageFilter_SinclairToMueller.tif
+							 -conv muellertopoldegandpower
+							 -outf ${TEMP}/apTvSARPolarMatrixConvertMuellerToPolDeGPow.tif
+							 
+                     )
diff --git a/Modules/Applications/AppSARPolarSynth/CMakeLists.txt b/Modules/Applications/AppSARPolarSynth/CMakeLists.txt
new file mode 100644
index 0000000..f6c2324
--- /dev/null
+++ b/Modules/Applications/AppSARPolarSynth/CMakeLists.txt
@@ -0,0 +1,2 @@
+project(OTBAppSARPolarSynth)
+otb_module_impl()
diff --git a/Modules/Applications/AppSARPolarSynth/app/CMakeLists.txt b/Modules/Applications/AppSARPolarSynth/app/CMakeLists.txt
new file mode 100644
index 0000000..ea87ee8
--- /dev/null
+++ b/Modules/Applications/AppSARPolarSynth/app/CMakeLists.txt
@@ -0,0 +1,12 @@
+set(OTBAppFiltering_LINK_LIBS
+  ${OTBPolarimetry_LIBRARIES}
+  ${OTBImageManipulation_LIBRARIES}
+  ${OTBApplicationEngine_LIBRARIES}
+  ${OTBImageBase_LIBRARIES}
+)
+
+otb_create_application(
+  NAME           SARPolarSynth
+  SOURCES        otbSARPolarSynth.cxx
+  LINK_LIBRARIES ${${otb-module}_LIBRARIES})
+
diff --git a/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx b/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx
new file mode 100644
index 0000000..b1017b3
--- /dev/null
+++ b/Modules/Applications/AppSARPolarSynth/app/otbSARPolarSynth.cxx
@@ -0,0 +1,185 @@
+/*=========================================================================
+
+ 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 "otbWrapperApplication.h"
+#include "otbWrapperApplicationFactory.h"
+
+#include "otbMultiChannelsPolarimetricSynthesisFilter.h"
+
+namespace otb
+{
+namespace Wrapper
+{
+
+class SARPolarSynth : public Application
+{
+public:
+  /** Standard class typedefs. */
+  typedef SARPolarSynth                       Self;
+  typedef Application                         Superclass;
+  typedef itk::SmartPointer<Self>             Pointer;
+  typedef itk::SmartPointer<const Self>       ConstPointer;
+
+  typedef MultiChannelsPolarimetricSynthesisFilter<ComplexDoubleVectorImageType, FloatImageType>        MCPSFilterType;
+  /** Standard macro */
+  itkNewMacro(Self);
+
+  itkTypeMacro(SARPolarSynth, otb::Application);
+
+private:
+  void DoInit()
+  {
+    SetName("SARPolarSynth");
+    SetDescription("Gives, for each pixel, the power that would have been received by a SAR system with a basis different from the classical (H,V) one (polarimetric synthetis).");
+
+    // Documentation
+    SetDocName("SARPolarSynth");
+    SetDocLongDescription("This application gives, for each pixel, the power that would have been received by a SAR system with a basis different from the classical (H,V) one (polarimetric synthetis).\n" 
+						  "The new basis A and B are indicated through two Jones vectors, defined by the user thanks to orientation (psi) and ellipticity (khi) parameters.\n"
+						  "These parameters are namely psii, khii, psir and khir. The suffixes (i) and (r) refer to the transmiting antenna and the receiving antenna respectively.\n"
+						  "Orientations and ellipticities are given in degrees, and are between -90°/90° and -45°/45° respectively.\n " 
+						  "\n"
+						  "Four polarization architectures can be processed : \n"
+						  "1) HH_HV_VH_VV : full polarization, general bistatic case.\n"
+						  "2) HH_HV_VV or HH_VH_VV : full polarization, monostatic case (transmitter and receiver are co-located).\n"
+						  "3) HH_HV : dual polarization.\n"
+						  "4) VH_VV : dual polarization.\n"
+						  "The application takes a complex vector image as input, where each band correspond to a particular emission/reception polarization scheme.\n"
+						  "User must comply with the band order given above, since the bands are used to build the Sinclair matrix.\n"
+						  "\n"
+						  "In order to determine the architecture, the application first relies on the number of bands of the input image.\n" 
+						  "1) Architecture HH_HV_VH_VV is the only one with four bands, there is no possible confusion.\n"
+						  "2) Concerning HH_HV_VV and HH_VH_VV architectures, both correspond to a three channels image. But they are processed in the same way, as the Sinclair matrix is symetric in the monostatic case.\n"
+						  "3) Finally, the two last architectures (dual polarizations), can't be distinguished only by the number of bands of the input image.\n"
+						  "   User must then use the parameters emissionh and emissionv to indicate the architecture of the system : emissionh=1 and emissionv=0 --> HH_HV,  emissionh=0 and emissionv=1 --> VH_VV.\n"
+						  "Note : if the architecture is HH_HV, khii and psii are automatically set to 0°/0°; if the architecture is VH_VV, khii and psii are automatically set to 0°/90°.\n"
+						  "\n"
+						  "It is also possible to force the calculation to co-polar or cross-polar modes.\n"
+						  "In the co-polar case, values for psir and khir will be ignored and forced to psii and khii; same as the cross-polar mode, where khir and psir will be forced to psii+90° and -khii.\n"
+						  "\n"
+						  "Finally, the result of the polarimetric synthetis is expressed in the power domain, through a one-band scalar image.\n"
+						  "Note: this application doesn't take into account the terms which do not depend on the polarization of the antennas. \n"
+						  "The parameter gain can be used for this purpose.\n"
+						  "\n"
+						  "More details can be found in the OTB CookBook (SAR processing chapter).");
+						  
+    SetDocLimitations("None");
+    SetDocAuthors("OTB-Team");
+    SetDocSeeAlso("SARDecompositions, SARPolarMatrixConvert");
+
+    AddDocTag(Tags::SAR);
+
+    AddParameter(ParameterType_ComplexInputImage,  "in",   "Input Image");
+    SetParameterDescription("in", "Input image.");
+    AddParameter(ParameterType_OutputImage, "out",  "Output Image");
+    SetParameterDescription("out", "Output image.");
+    
+    AddParameter(ParameterType_Float,"psii","psii");
+    SetParameterDescription("psii","Orientation (transmitting antenna)");
+    SetMinimumParameterFloatValue("psii",-90.0);
+    SetMaximumParameterFloatValue("psii",90.0);
+    
+    AddParameter(ParameterType_Float,"khii","khii");
+    SetParameterDescription("khii","Ellipticity (transmitting antenna)");
+    SetMinimumParameterFloatValue("khii",-45.0);
+    SetMaximumParameterFloatValue("khii",45.0);
+    
+    AddParameter(ParameterType_Float,"psir","psir");
+    SetParameterDescription("psir","Orientation (receiving antenna)");
+    SetMinimumParameterFloatValue("psir",-90.0);
+    SetMaximumParameterFloatValue("psir",90.0);
+    
+    AddParameter(ParameterType_Float,"khir","khir");
+    SetParameterDescription("khir","Ellipticity (receiving antenna)");
+    SetMinimumParameterFloatValue("khir",-45.0);
+    SetMaximumParameterFloatValue("khir",45.0);
+    
+    AddParameter(ParameterType_Int,"emissionh","Emission H");
+    SetParameterDescription("emissionh","This parameter is useful in determining the polarization architecture (dual polarization case).");
+    SetMinimumParameterIntValue("emissionh",0);
+    SetMaximumParameterIntValue("emissionh",1);
+    MandatoryOff("emissionh");
+    
+    AddParameter(ParameterType_Int,"emissionv","Emission V");
+    SetParameterDescription("emissionv","This parameter is useful in determining the polarization architecture (dual polarization case).");
+    SetMinimumParameterIntValue("emissionv",0);
+    SetMaximumParameterIntValue("emissionv",1);
+    MandatoryOff("emissionv");
+    
+    AddParameter(ParameterType_Choice, "mode", "Forced mode");
+    AddChoice("mode.none","None");
+    SetParameterDescription("mode.none","None");
+    AddChoice("mode.co","Copolarization");
+    SetParameterDescription("mode.none","Copolarization");
+    AddChoice("mode.cross","Crosspolarization");
+    SetParameterDescription("mode.cross","Crosspolarization");
+    
+
+    AddRAMParameter();
+
+    // Default values
+    SetDefaultParameterFloat("psii", 0.);
+    SetDefaultParameterFloat("khii", 0.);
+    SetDefaultParameterFloat("psir",  0.);
+    SetDefaultParameterFloat("khir",  0.);
+    SetDefaultParameterInt("emissionh", 0);
+    SetDefaultParameterInt("emissionv", 0);
+	SetDefaultParameterFloat("mode",  0);
+
+    // Doc example parameter settings
+    SetDocExampleParameterValue("in", "sar.tif");
+    SetDocExampleParameterValue("psii","15.");
+    SetDocExampleParameterValue("khii", "5.");
+    SetDocExampleParameterValue("psir","-25.");
+    SetDocExampleParameterValue("khir", "10.");
+    SetDocExampleParameterValue("out", "newbasis.tif");
+  }
+
+  void DoUpdateParameters()
+  {
+    // Nothing to do here : all parameters are independent
+  }
+
+  void DoExecute()
+  {
+	
+	m_MCPSFilter = MCPSFilterType::New();
+	m_MCPSFilter->SetPsiI(GetParameterFloat("psii"));
+    m_MCPSFilter->SetKhiI(GetParameterFloat("khii"));
+    m_MCPSFilter->SetPsiR(GetParameterFloat("psir"));
+    m_MCPSFilter->SetKhiR(GetParameterFloat("khir"));
+    m_MCPSFilter->SetEmissionH(GetParameterInt("emissionh"));
+    m_MCPSFilter->SetEmissionV(GetParameterInt("emissionv"));
+	m_MCPSFilter->SetMode(GetParameterInt("mode"));  
+	  
+    ComplexDoubleVectorImageType* inVImage = GetParameterComplexDoubleVectorImage("in");
+    inVImage->UpdateOutputInformation();
+    int nbBands = inVImage->GetNumberOfComponentsPerPixel();
+    otbAppLogINFO( << "nbBands = " << nbBands);
+
+	m_MCPSFilter->SetInput(inVImage);
+   
+    SetParameterOutputImage("out", m_MCPSFilter->GetOutput());
+  }
+  //std::vector<itk::ProcessObject::Pointer> m_Ref;
+  MCPSFilterType::Pointer m_MCPSFilter;
+}; 
+
+} //end namespace Wrapper
+} //end namespace otb
+
+OTB_APPLICATION_EXPORT(otb::Wrapper::SARPolarSynth)
diff --git a/Modules/Applications/AppSARPolarSynth/otb-module.cmake b/Modules/Applications/AppSARPolarSynth/otb-module.cmake
new file mode 100644
index 0000000..16d19e0
--- /dev/null
+++ b/Modules/Applications/AppSARPolarSynth/otb-module.cmake
@@ -0,0 +1,17 @@
+set(DOCUMENTATION "Basic filters application.")
+
+otb_module(OTBAppSARPolarSynth
+  DEPENDS
+    OTBPolarimetry
+    OTBImageManipulation
+    OTBITK
+    OTBApplicationEngine
+    OTBImageBase
+
+  TEST_DEPENDS
+    OTBTestKernel
+    OTBCommandLine
+
+  DESCRIPTION
+    "${DOCUMENTATION}"
+)
diff --git a/Modules/Applications/AppSARPolarSynth/test/CMakeLists.txt b/Modules/Applications/AppSARPolarSynth/test/CMakeLists.txt
new file mode 100644
index 0000000..1adeb20
--- /dev/null
+++ b/Modules/Applications/AppSARPolarSynth/test/CMakeLists.txt
@@ -0,0 +1,13 @@
+otb_module_test()
+#----------- PolarSynth TESTS ----------------
+
+otb_test_application(NAME  apTvSARPolarSynth
+                     APP  SARPolarSynth
+                     OPTIONS -in ${INPUTDATA}/RSAT2_AltonaExtract_1000_1000_100_100.hdr
+               	             -out ${TEMP}/resApMultiPolarimetricSynthesis1.tif
+                             -psii 10.0 
+                             -khii 0.0
+                             -psir 0.0
+                             -khir 0.0
+                     )
+                             
diff --git a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
index 9b52f3b..74423df 100644
--- a/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbHooverCompareSegmentation.cxx
@@ -165,10 +165,12 @@ private:
 
     AddParameter(ParameterType_OutputImage,  "outgt",    "Colored ground truth output");
     SetParameterDescription( "outgt", "The colored ground truth output image." );
+    SetDefaultOutputPixelType("outgt",ImagePixelType_uint8);
     MandatoryOff("outgt");
 
     AddParameter(ParameterType_OutputImage,  "outms",    "Colored machine segmentation output");
     SetParameterDescription( "outms", "The colored machine segmentation output image." );
+    SetDefaultOutputPixelType("outms",ImagePixelType_uint8);
     MandatoryOff("outms");
 
     // TODO : add color settings ?
diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx
index 1af6e23..0f50064 100644
--- a/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbLSMSSegmentation.cxx
@@ -20,13 +20,13 @@
 #include "otbMultiChannelExtractROI.h"
 #include "otbExtractROI.h"
 #include "otbConnectedComponentMuParserFunctor.h"
-#include "otbBandMathImageFilter.h"
 #include "itkUnaryFunctorImageFilter.h"
 #include "itkStatisticsImageFilter.h"
 #include "itkChangeLabelImageFilter.h"
 #include "itkImageRegionConstIterator.h"
 #include "itkScalarConnectedComponentImageFilter.h"
 #include "otbConcatenateVectorImageFilter.h"
+#include "otbAffineFunctor.h"
 
 #include "otbMultiToMonoChannelExtractROI.h"
 #include "otbImportGeoInformationImageFilter.h"
@@ -70,13 +70,20 @@ public:
   typedef otb::Functor::ConnectedComponentMuParserFunctor<ImageType::PixelType>  CCFunctorType;
   typedef itk::ConnectedComponentFunctorImageFilter<ImageType, LabelImageType, CCFunctorType, otb::Image<unsigned int> > CCFilterType;
   typedef itk::ScalarConnectedComponentImageFilter<LabelImageType, LabelImageType> ScalarCCFilterType;
-  typedef otb::BandMathImageFilter<LabelImageType> BandMathImageFilterType;
   typedef itk::StatisticsImageFilter<LabelImageType> StatisticsImageFilterType;
   typedef itk::ChangeLabelImageFilter<LabelImageType,LabelImageType> ChangeLabelImageFilterType;
   typedef otb::ImportGeoInformationImageFilter<LabelImageType,ImageType> ImportGeoInformationImageFilterType;
   typedef itk::ImageRegionConstIterator<LabelImageType> LabelImageIterator;
 
   typedef otb::ConcatenateVectorImageFilter <ImageType,ImageType,ImageType> ConcatenateType;
+  typedef otb::Functor::AffineFunctor<
+    LabelImagePixelType,
+    LabelImagePixelType,
+    LabelImagePixelType>                      AffineFunctorType;
+  typedef itk::UnaryFunctorImageFilter<
+    LabelImageType,
+    LabelImageType,
+    AffineFunctorType>                        LabelShiftFilterType;
 
   LSMSSegmentation(): m_FinalReader(),m_ImportGeoInformationFilter(),m_FilesToRemoveAfterExecute(),m_TmpDirCleanup(false){}
 
@@ -225,6 +232,7 @@ private:
 
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription( "out", "The output image. The output image is the segmentation of the filtered image. It is recommended to set the pixel type to uint32." );
+    SetDefaultOutputPixelType("out",ImagePixelType_uint32);
 
     AddParameter(ParameterType_Float, "ranger", "Range radius");
     SetParameterDescription("ranger", "Range radius defining the radius (expressed in radiometry unit) in the multi-spectral space.");
@@ -400,14 +408,12 @@ private:
         ccFilter->GetFunctor().SetExpression(expr.str());
         ccFilter->Update();
 
-        std::stringstream ssexpr;
-        ssexpr<<"label+"<<regionCount;
-
         //Shifting
-        BandMathImageFilterType::Pointer labelBandMath = BandMathImageFilterType::New();
-        labelBandMath->SetNthInput(0,ccFilter->GetOutput(),"label");
-        labelBandMath->SetExpression(ssexpr.str());
-        labelBandMath->Update();
+        LabelShiftFilterType::Pointer labelShiftFilter = LabelShiftFilterType::New();
+        labelShiftFilter->SetInput(ccFilter->GetOutput());
+        labelShiftFilter->GetFunctor().SetA(1);
+        labelShiftFilter->GetFunctor().SetB(regionCount);
+        labelShiftFilter->Update();
 
         //Maximum label calculation for the shifting
         StatisticsImageFilterType::Pointer stats = StatisticsImageFilterType::New();
@@ -415,7 +421,7 @@ private:
         stats->Update();
         regionCount+=stats->GetMaximum();
 
-        std::string filename = WriteTile(labelBandMath->GetOutput(),row,column,"SEG");
+        std::string filename = WriteTile(labelShiftFilter->GetOutput(),row,column,"SEG");
         }
 
 
diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx
index 9ea8f90..c2122b5 100644
--- a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx
@@ -90,6 +90,7 @@ private:
 
     AddParameter(ParameterType_OutputImage, "out", "Output Image");
     SetParameterDescription( "out", "The output image. The output image is the input image where the minimal regions have been merged." );
+    SetDefaultOutputPixelType("out",ImagePixelType_uint32);
 
     AddParameter(ParameterType_Int, "minsize", "Minimum Region Size");
     SetParameterDescription("minsize", "Minimum Region Size. If, after the segmentation, a region is of size lower than this criterion, the region is merged with the \"nearest\" region (radiometrically).");
diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
index dfd43a4..00515af 100644
--- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
+++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx
@@ -251,6 +251,7 @@ private:
     //Raster mode parameters
     AddParameter(ParameterType_OutputImage,  "mode.raster.out",    "Output labeled image");
     SetParameterDescription( "mode.raster.out", "The output labeled image.");
+    SetDefaultOutputPixelType("mode.raster.out",ImagePixelType_uint32);
 
     //Streaming vectorization parameters
     AddParameter(ParameterType_OutputFilename, "mode.vector.out", "Output vector file");
@@ -675,7 +676,8 @@ private:
        //and recomputed FID for each features (without holes).
         //Note : the GetDriver() Method has not been encapsulated in otb::ogr::DataSource,
         //so we must access the OGR pointer by using .ogr()
-       std::string driverName(ogrDS->ogr().GetDriver()->GetName());
+
+        std::string driverName(otb::ogr::version_proxy::GetDriverNameFromDataSource(&ogrDS->ogr()));
        if ( driverName.find("ESRI Shapefile") != std::string::npos)
          {
            otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl);
diff --git a/Modules/Applications/AppSegmentation/otb-module.cmake b/Modules/Applications/AppSegmentation/otb-module.cmake
index bb33287..1ae1f0a 100644
--- a/Modules/Applications/AppSegmentation/otb-module.cmake
+++ b/Modules/Applications/AppSegmentation/otb-module.cmake
@@ -17,7 +17,6 @@ otb_module(OTBAppSegmentation
     OTBGdalAdapters
     OTBApplicationEngine
     OTBImageBase
-    OTBMathParser
     OTBCommon
     OTBImageManipulation
     OTBMorphologicalProfiles
diff --git a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx
index 51fcada..246fef0 100644
--- a/Modules/Applications/AppStereo/app/otbBlockMatching.cxx
+++ b/Modules/Applications/AppStereo/app/otbBlockMatching.cxx
@@ -155,6 +155,7 @@ private:
 
     AddParameter(ParameterType_OutputImage, "io.outmask", "The output mask corresponding to all criterions");
     SetParameterDescription("io.outmask","A mask image corresponding to all citerions (see masking parameters). Only required if variance threshold or nodata criterions are set.");
+    SetDefaultOutputPixelType("io.outmask",ImagePixelType_uint8);
     DisableParameter("io.outmask");
     MandatoryOff("io.outmask");
 
diff --git a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx
index 16f86b1..bd9677a 100644
--- a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx
+++ b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx
@@ -27,11 +27,11 @@
 #include "otbDEMToImageGenerator.h"
 
 #include "otbVarianceImageFilter.h"
-#include "otbBandMathImageFilter.h"
 #include "otbImageList.h"
 #include "otbImageListToVectorImageFilter.h"
 #include "otbVectorImageToImageListFilter.h"
 #include "otbBCOInterpolateImageFunction.h"
+#include "otbImageToNoDataMaskFilter.h"
 
 #include "itkUnaryFunctorImageFilter.h"
 #include "itkVectorCastImageFilter.h"
@@ -239,6 +239,8 @@ public:
         FloatImageType>                             BijectionFilterType;
 
     typedef itk::ImageToImageFilter<FloatImageType,FloatImageType>  FilterType;
+
+    typedef otb::ImageToNoDataMaskFilter<FloatImageType,FloatImageType> NoDataMaskFilterType;
 private:
 
   StereoFramework()
@@ -1113,9 +1115,10 @@ private:
 
       m_Filters.push_back(disparityTranslateFilter.GetPointer());
 
-      BandMathFilterType::Pointer dispTranslateMaskFilter = BandMathFilterType::New();
-      dispTranslateMaskFilter->SetNthInput(0, disparityTranslateFilter->GetHorizontalDisparityMapOutput(), "hdisp");
-      dispTranslateMaskFilter->SetExpression("hdisp!=-32768");
+      NoDataMaskFilterType::Pointer dispTranslateMaskFilter = NoDataMaskFilterType::New();
+      dispTranslateMaskFilter->SetInput(disparityTranslateFilter->GetHorizontalDisparityMapOutput());
+      dispTranslateMaskFilter->SetInsideValue(1);
+      dispTranslateMaskFilter->SetOutsideValue(0);
       m_Filters.push_back(dispTranslateMaskFilter.GetPointer());
 
       FloatImageType::Pointer hDispOutput2 = disparityTranslateFilter->GetHorizontalDisparityMapOutput();
diff --git a/Modules/Applications/AppStereo/otb-module.cmake b/Modules/Applications/AppStereo/otb-module.cmake
index 9490e1c..c79c316 100644
--- a/Modules/Applications/AppStereo/otb-module.cmake
+++ b/Modules/Applications/AppStereo/otb-module.cmake
@@ -8,6 +8,7 @@ otb_module(OTBAppStereo
     OTBITK
     OTBImageBase
     OTBImageIO
+    OTBImageManipulation
     OTBInterpolation
     OTBMathParser
     OTBObjectList
diff --git a/Modules/Applications/AppTest/test/otbWrapperApplicationDocTests.cxx b/Modules/Applications/AppTest/test/otbWrapperApplicationDocTests.cxx
index 01dc19c..1fbaf04 100644
--- a/Modules/Applications/AppTest/test/otbWrapperApplicationDocTests.cxx
+++ b/Modules/Applications/AppTest/test/otbWrapperApplicationDocTests.cxx
@@ -39,7 +39,6 @@ int otbWrapperApplicationDocTest(int argc, char* argv[])
     std::copy(argv + 1, argv + argc, std::back_inserter(modulePathList));
 
     // Load the path in the environment
-    std::string specificEnv("ITK_AUTOLOAD_PATH=");
     std::list<std::string>::const_iterator it = modulePathList.begin();
     while( it != modulePathList.end() )
       {
diff --git a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx
index 8b66ad3..588940d 100644
--- a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx
+++ b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx
@@ -70,7 +70,7 @@ private:
 
     AddDocTag(Tags::Vector);
 
-    AddParameter(ParameterType_InputFilename,  "in",   "Input vector dataset");
+    AddParameter(ParameterType_InputVectorData,  "in",   "Input vector dataset");
     SetParameterDescription( "in", "The input vector dataset to be rasterized" );
 
     AddParameter(ParameterType_OutputImage,  "out",   "Ouptut image");
diff --git a/Modules/Core/Common/include/otbDecimateImageFilter.h b/Modules/Core/Common/include/otbDecimateImageFilter.h
index d0edccc..a171a76 100644
--- a/Modules/Core/Common/include/otbDecimateImageFilter.h
+++ b/Modules/Core/Common/include/otbDecimateImageFilter.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Core/Common/include/otbDecimateImageFilter.txx b/Modules/Core/Common/include/otbDecimateImageFilter.txx
index b6eeede..cfe08ab 100644
--- a/Modules/Core/Common/include/otbDecimateImageFilter.txx
+++ b/Modules/Core/Common/include/otbDecimateImageFilter.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
@@ -113,7 +113,7 @@ template <class TInputImage, class TOutputImage>
 void
 DecimateImageFilter<TInputImage, TOutputImage>
 ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
-                       itk::ThreadIdType threadId)
+                       itk::ThreadIdType itkNotUsed(threadId))
 {
   InputImageRegionType inputRegionForThread;
   this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
diff --git a/Modules/Core/Common/include/otbDotProductImageFilter.h b/Modules/Core/Common/include/otbDotProductImageFilter.h
index ac78b38..34effe4 100644
--- a/Modules/Core/Common/include/otbDotProductImageFilter.h
+++ b/Modules/Core/Common/include/otbDotProductImageFilter.h
@@ -43,7 +43,7 @@ public:
   DotProductFunctor() {}
   virtual ~DotProductFunctor() {}
 
-  bool operator !=(const DotProductFunctor& other) const
+  bool operator !=(const DotProductFunctor& itkNotUsed(other)) const
   {
     return false;
   }
diff --git a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx
index 154c73b..ef5b281 100644
--- a/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx
+++ b/Modules/Core/Common/include/otbImageRegionAdaptativeSplitter.txx
@@ -107,10 +107,14 @@ ImageRegionAdaptativeSplitter<VImageDimension>
   // Now we can handle the case where we have a tile hint and a
   // non-trivial requested number of splits
   SizeType tilesPerDim, splitsPerDim;
-
-  tilesPerDim[0] = (m_ImageRegion.GetSize()[0] + m_TileHint[0] -1) / m_TileHint[0];
-  tilesPerDim[1] = (m_ImageRegion.GetSize()[1] + m_TileHint[1] -1) / m_TileHint[1];
-
+  IndexType firstTileCovered;
+
+  // First, we need to get which tiles are covered by ROI
+  firstTileCovered[0] = m_ImageRegion.GetIndex()[0] / m_TileHint[0];
+  firstTileCovered[1] = m_ImageRegion.GetIndex()[1] / m_TileHint[1];
+  tilesPerDim[0] = (m_ImageRegion.GetIndex()[0] + m_ImageRegion.GetSize()[0] + m_TileHint[0] -1) / m_TileHint[0] - firstTileCovered[0];
+  tilesPerDim[1] = (m_ImageRegion.GetIndex()[1] + m_ImageRegion.GetSize()[1] + m_TileHint[1] -1) / m_TileHint[1] - firstTileCovered[1];
+  
   unsigned int totalTiles = tilesPerDim[0] * tilesPerDim[1];
 
   // In this case, we have to group input tiles
@@ -134,13 +138,14 @@ ImageRegionAdaptativeSplitter<VImageDimension>
       i = (i+1)%2;
       }
 
+   
     splitsPerDim[0] = tilesPerDim[0] / groupTiles[0];
+    splitsPerDim[1] = tilesPerDim[1] / groupTiles[1];
 
     // Handle the last small tile if any
     if(tilesPerDim[0] % groupTiles[0] > 0)
       splitsPerDim[0]++;
 
-    splitsPerDim[1] = tilesPerDim[1] / groupTiles[1];
     if(tilesPerDim[1] % groupTiles[1] > 0)
       splitsPerDim[1]++;
 
@@ -157,8 +162,8 @@ ImageRegionAdaptativeSplitter<VImageDimension>
         newSplitSize[0] = groupTiles[0] * m_TileHint[0];
         newSplitSize[1] = groupTiles[1] * m_TileHint[1];
 
-        newSplitIndex[0] = splitx * newSplitSize[0];
-        newSplitIndex[1] = splity * newSplitSize[1];
+        newSplitIndex[0] = firstTileCovered[0] * m_TileHint[0] + splitx * newSplitSize[0];
+        newSplitIndex[1] = firstTileCovered[1] * m_TileHint[1] + splity * newSplitSize[1];
 
         newSplit.SetIndex(newSplitIndex);
         newSplit.SetSize(newSplitSize);
@@ -181,7 +186,9 @@ ImageRegionAdaptativeSplitter<VImageDimension>
 
     unsigned int i = 1;
 
-    while(totalTiles * (divideTiles[0] * divideTiles[1]) < m_RequestedNumberOfSplits)
+    // Exit condition if divideTiles=m_TileHint (i.e. no more subdivision available)
+    while(totalTiles * (divideTiles[0] * divideTiles[1]) < m_RequestedNumberOfSplits
+      && (divideTiles[0] < m_TileHint[0] || divideTiles[1] < m_TileHint[1]))
       {
       if(divideTiles[i] < m_TileHint[i])
         {
@@ -195,6 +202,8 @@ ImageRegionAdaptativeSplitter<VImageDimension>
     splitSize[0] = (m_TileHint[0] + divideTiles[0] - 1)/ divideTiles[0];
     splitSize[1] = (m_TileHint[1] + divideTiles[1] - 1)/ divideTiles[1];
 
+    RegionType tileHintRegion;
+    tileHintRegion.SetSize(m_TileHint);
     // Fill the tiling scheme
     for(unsigned int tiley = 0; tiley < tilesPerDim[1]; ++tiley)
       {
@@ -208,19 +217,27 @@ ImageRegionAdaptativeSplitter<VImageDimension>
             RegionType newSplit;
             IndexType newSplitIndex;
 
-            newSplitIndex[0] = tilex * m_TileHint[0] + divx * splitSize[0];
-            newSplitIndex[1] = tiley * m_TileHint[1] + divy * splitSize[1];
+            newSplitIndex[0] = (tilex + firstTileCovered[0]) * m_TileHint[0] + divx * splitSize[0];
+            newSplitIndex[1] = (tiley + firstTileCovered[1]) * m_TileHint[1] + divy * splitSize[1];
 
             newSplit.SetIndex(newSplitIndex);
             newSplit.SetSize(splitSize);
 
+            tileHintRegion.SetIndex(0, tilex * m_TileHint[0]);
+            tileHintRegion.SetIndex(1, tiley * m_TileHint[1]);
+
             bool cropped = newSplit.Crop(m_ImageRegion);
 
             // If newSplit could not be cropped, it means that it is
             // outside m_ImageRegion. In this case we ignore it.
             if(cropped)
               {
-              m_StreamVector.push_back(newSplit);
+              // check that the split stays inside its tile
+              cropped = newSplit.Crop(tileHintRegion);
+              if (cropped)
+                {
+                m_StreamVector.push_back(newSplit);
+                }
               }
             }
           }
diff --git a/Modules/Core/Common/include/otbMachineLearningUtils.h b/Modules/Core/Common/include/otbMachineLearningUtils.h
deleted file mode 100644
index f5532b6..0000000
--- a/Modules/Core/Common/include/otbMachineLearningUtils.h
+++ /dev/null
@@ -1,34 +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.
-
-  =========================================================================*/
-#ifndef __otbMachineLearningUtils_h
-#define __otbMachineLearningUtils_h
-
-#include "otbMachineLearningModel.h"
-
-typedef otb::MachineLearningModel<float,short>         MachineLearningModelType;
-typedef MachineLearningModelType::InputValueType       InputValueType;
-typedef MachineLearningModelType::InputSampleType      InputSampleType;
-typedef MachineLearningModelType::InputListSampleType  InputListSampleType;
-typedef MachineLearningModelType::TargetValueType      TargetValueType;
-typedef MachineLearningModelType::TargetSampleType     TargetSampleType;
-typedef MachineLearningModelType::TargetListSampleType TargetListSampleType;
-
-
-bool ReadDataFile(const char * infname, InputListSampleType * samples, TargetListSampleType * labels);
-
-#endif
diff --git a/Modules/Core/Common/include/otbModelComponentBase.h b/Modules/Core/Common/include/otbModelComponentBase.h
index cdf80a0..f8956cd 100644
--- a/Modules/Core/Common/include/otbModelComponentBase.h
+++ b/Modules/Core/Common/include/otbModelComponentBase.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Some parts of this code are covered by the GET copyright.
-  See GETCopyright.txt for details.
+  Some parts of this code are covered by the IMT copyright.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Core/Common/include/otbModelComponentBase.txx b/Modules/Core/Common/include/otbModelComponentBase.txx
index c3a130c..bfdb3c7 100644
--- a/Modules/Core/Common/include/otbModelComponentBase.txx
+++ b/Modules/Core/Common/include/otbModelComponentBase.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Some parts of this code are covered by the GET copyright.
-  See GETCopyright.txt for details.
+  Some parts of this code are covered by the IMT copyright.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h
index ea8276f..ef49212 100644
--- a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h
+++ b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.txx b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.txx
index 58f1035..1a9552d 100644
--- a/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.txx
+++ b/Modules/Core/Common/include/otbSubsampledImageRegionConstIterator.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Core/Common/include/otbSubsampledImageRegionIterator.h b/Modules/Core/Common/include/otbSubsampledImageRegionIterator.h
index eb0e45d..0fa6f96 100644
--- a/Modules/Core/Common/include/otbSubsampledImageRegionIterator.h
+++ b/Modules/Core/Common/include/otbSubsampledImageRegionIterator.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Core/Common/otb-module.cmake b/Modules/Core/Common/otb-module.cmake
index cefb91f..7501fbd 100644
--- a/Modules/Core/Common/otb-module.cmake
+++ b/Modules/Core/Common/otb-module.cmake
@@ -4,6 +4,8 @@ otb_module(OTBCommon
   DEPENDS
     OTBBoost
     OTBITK
+    #Add dependency to OTBGDAL as GDAL module need to set OTB_USE_GDAL_20 before configuring otbConfigure.h
+    OTBGDAL
 
   TEST_DEPENDS
     OTBImageBase
diff --git a/Modules/Core/Common/src/CMakeLists.txt b/Modules/Core/Common/src/CMakeLists.txt
index b82e7a3..a01c54d 100644
--- a/Modules/Core/Common/src/CMakeLists.txt
+++ b/Modules/Core/Common/src/CMakeLists.txt
@@ -1,7 +1,6 @@
 set(OTBCommon_SRC
   otbStandardFilterWatcher.cxx
   otbFilterWatcherBase.cxx
-  otbMachineLearningUtils.cxx
   otbSystem.cxx
   otbStandardWriterWatcher.cxx
   otbUtils.cxx
diff --git a/Modules/Core/Common/src/otbConfigure.h.in b/Modules/Core/Common/src/otbConfigure.h.in
index 29555ad..38ac5b8 100644
--- a/Modules/Core/Common/src/otbConfigure.h.in
+++ b/Modules/Core/Common/src/otbConfigure.h.in
@@ -17,3 +17,4 @@
 /* Show developper debug messages */
 #cmakedefine OTB_SHOW_ALL_MSG_DEBUG
 
+#cmakedefine OTB_USE_GDAL_20
diff --git a/Modules/Core/Common/src/otbMachineLearningUtils.cxx b/Modules/Core/Common/src/otbMachineLearningUtils.cxx
deleted file mode 100644
index 8fb9fa1..0000000
--- a/Modules/Core/Common/src/otbMachineLearningUtils.cxx
+++ /dev/null
@@ -1,94 +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 "otbMachineLearningUtils.h"
-
-#include <fstream>
-#include <string>
-#include <algorithm>
-
-bool ReadDataFile(const char * infname, InputListSampleType * samples, TargetListSampleType * labels)
-{
-  std::ifstream ifs;
-  ifs.open(infname);
-
-  if(!ifs)
-    {
-    std::cerr<<"Could not read file "<<infname<<std::endl;
-    return false;
-    }
-
-  unsigned int nbfeatures = 0;
-
-    while (!ifs.eof())
-      {
-      std::string line;
-      std::getline(ifs, line);
-
-      if(nbfeatures == 0)
-        {
-        nbfeatures = std::count(line.begin(),line.end(),' ')-1;
-        std::cout<<"Found "<<nbfeatures<<" features per samples"<<std::endl;
-        }
-
-      if(line.size()>1)
-        {
-
-        InputSampleType sample(nbfeatures);
-        sample.Fill(0);
-
-        std::string::size_type pos = line.find_first_of(" ", 0);
-
-        // Parse label
-        TargetSampleType label;
-        label[0] = atoi(line.substr(0, pos).c_str());
-
-        bool endOfLine = false;
-
-        unsigned int id = 0;
-
-        while(!endOfLine)
-          {
-          std::string::size_type nextpos = line.find_first_of(" ", pos+1);
-
-          if(nextpos == std::string::npos)
-            {
-            endOfLine = true;
-            nextpos = line.size()-1;
-            }
-          else
-            {
-            std::string feature = line.substr(pos,nextpos-pos);
-            std::string::size_type semicolonpos = feature.find_first_of(":");
-            id = atoi(feature.substr(0,semicolonpos).c_str());
-            sample[id] = atof(feature.substr(semicolonpos+1,feature.size()-semicolonpos).c_str());
-            pos = nextpos;
-            }
-          }
-        samples->SetMeasurementVectorSize(itk::NumericTraits<InputSampleType>::GetLength(sample));
-        samples->PushBack(sample);
-        labels->PushBack(label);
-        }
-      }
-
-    std::cout<<"Retrieved "<<samples->Size()<<" samples"<<std::endl;
-
-  ifs.close();
-
-  return true;
-}
diff --git a/Modules/Core/Common/test/CMakeLists.txt b/Modules/Core/Common/test/CMakeLists.txt
index e321182..c40b6a2 100644
--- a/Modules/Core/Common/test/CMakeLists.txt
+++ b/Modules/Core/Common/test/CMakeLists.txt
@@ -78,6 +78,36 @@ otb_add_test(NAME coTvImageRegionAdaptativeSplitterStripLargeStream COMMAND otbC
   ${TEMP}/coTvImageRegionAdaptativeSplitterStripLargeStreamOutput.txt
   )
 
+otb_add_test(NAME coTvImageRegionAdaptativeSplitterShiftedROILargeStream COMMAND otbCommonTestDriver
+  --compare-ascii ${NOTOL}
+  ${BASELINE_FILES}/coTvImageRegionAdaptativeSplitterShiftedROILargeStreamOutput.txt
+  ${TEMP}/coTvImageRegionAdaptativeSplitterShiftedROILargeStreamOutput.txt
+  otbImageRegionAdaptativeSplitter
+  1000 1000 4000 4000 2000 2000 5
+  ${TEMP}/coTvImageRegionAdaptativeSplitterShiftedROILargeStreamOutput.txt
+  )
+
+otb_add_test(NAME coTvImageRegionAdaptativeSplitterShiftedROISmallStream COMMAND otbCommonTestDriver
+  --compare-ascii ${NOTOL}
+  ${BASELINE_FILES}/coTvImageRegionAdaptativeSplitterShiftedROISmallStreamOutput.txt
+  ${TEMP}/coTvImageRegionAdaptativeSplitterShiftedROISmallStreamOutput.txt
+  otbImageRegionAdaptativeSplitter
+  1000 1000 4000 4000 2000 2000 10
+  ${TEMP}/coTvImageRegionAdaptativeSplitterShiftedROISmallStreamOutput.txt
+  )
+
+otb_add_test(NAME coTvImageRegionAdaptativeSplitterMissingLine COMMAND otbCommonTestDriver
+  otbImageRegionAdaptativeSplitter
+  0 0 1000 1000 1000 1 37
+  ${TEMP}/coTvImageRegionAdaptativeSplitterMissingLine.txt
+  )
+
+otb_add_test(NAME coTvImageRegionAdaptativeSplitterDivideBlock COMMAND otbCommonTestDriver
+  otbImageRegionAdaptativeSplitter
+  0 0 10 10 5 5 36
+  ${TEMP}/coTvImageRegionAdaptativeSplitterDivideBlock.txt
+  )
+
 otb_add_test(NAME coTuRGBAPixelConverter COMMAND otbCommonTestDriver
   otbRGBAPixelConverterNew
   )
diff --git a/Modules/Core/Common/test/otbImageRegionAdaptativeSplitter.cxx b/Modules/Core/Common/test/otbImageRegionAdaptativeSplitter.cxx
index 6389935..66cc0ae 100644
--- a/Modules/Core/Common/test/otbImageRegionAdaptativeSplitter.cxx
+++ b/Modules/Core/Common/test/otbImageRegionAdaptativeSplitter.cxx
@@ -59,16 +59,63 @@ int otbImageRegionAdaptativeSplitter(int itkNotUsed(argc), char * argv[])
 
 
   unsigned int nbSplits = splitter->GetNumberOfSplits(region, requestedNbSplits);
+  std::vector<RegionType> splits;
 
   outfile<<splitter<<std::endl;
   outfile<<"Split map: "<<std::endl;
 
   for(unsigned int i = 0; i < nbSplits; ++i)
     {
-    outfile<<"Split "<<i<<": "<<splitter->GetSplit(i, requestedNbSplits, region);
+    RegionType tmpRegion = splitter->GetSplit(i, requestedNbSplits, region);
+    splits.push_back(tmpRegion);
+    outfile<<"Split "<<i<<": "<<tmpRegion;
     }
 
   outfile.close();
 
+  // Basic consistency check on split map
+  if (requestedNbSplits != nbSplits)
+    {
+    std::cout << "Wrong number of splits : got "<<nbSplits<<" , expected "<<requestedNbSplits<< std::endl;
+    }
+  IndexType tmpIndex;
+  for (unsigned int i=regionIndex[0] ; i<(regionIndex[0]+regionSize[0]) ; ++i)
+    {
+    for (unsigned int j=regionIndex[1] ; j<(regionIndex[1]+regionSize[1]) ; ++j)
+      {
+      tmpIndex[0] = i;
+      tmpIndex[1] = j;
+      unsigned int count = 0;
+      for (unsigned int k=0 ; k<nbSplits ; ++k )
+        {
+        if (splits[k].IsInside(tmpIndex))
+          {
+          count++;
+          }
+        }
+      if (count == 0)
+        {
+        std::cout << "Index ["<<i<<","<<j<<"] is missing in split map" << std::endl;
+        return EXIT_FAILURE;
+        }
+      if (count > 1)
+        {
+        std::cout << "Index ["<<i<<","<<j<<"] occurs more than once in the split map" << std::endl;
+        return EXIT_FAILURE;
+        }
+      }
+    }
+
+  unsigned int pixelInSplit = 0;
+  for (unsigned int k=0 ; k<nbSplits ; ++k )
+    {
+    pixelInSplit += splits[k].GetSize(0) * splits[k].GetSize(1);
+    }
+  if (pixelInSplit != regionSize[0]*regionSize[1])
+    {
+    std::cout << "Wrong number of pixels in split : got "<<pixelInSplit << " , expected "<< regionSize[0]*regionSize[1] << std::endl;
+    return EXIT_FAILURE;
+    }
+
   return EXIT_SUCCESS;
 }
diff --git a/Modules/Core/Common/test/otbRGBAPixelConverter.cxx b/Modules/Core/Common/test/otbRGBAPixelConverter.cxx
index 78d04fe..8ed1984 100644
--- a/Modules/Core/Common/test/otbRGBAPixelConverter.cxx
+++ b/Modules/Core/Common/test/otbRGBAPixelConverter.cxx
@@ -52,12 +52,13 @@ int otbRGBAPixelConverter(int itkNotUsed(argc), char * itkNotUsed(argv) [])
   typedef unsigned int                                           PixelType0;
   typedef double                                                 PixelType1;
   typedef itk::RGBAPixel<unsigned int>                           PixelType2;
-  typedef itk::RGBPixel<double>                                  PixelType3;
+  typedef itk::RGBAPixel<double>                                 PixelType3;
+  typedef itk::RGBPixel<double>                                  PixelType4;
 
   typedef otb::RGBAPixelConverter<PixelType0, PixelType0>        ConverterType0;
   typedef otb::RGBAPixelConverter<PixelType1, PixelType0>        ConverterType1;
-  typedef otb::RGBAPixelConverter<PixelType0, PixelType2>        ConverterType2;
-  typedef otb::RGBAPixelConverter<PixelType0, PixelType3>        ConverterType3;
+  typedef otb::RGBAPixelConverter<PixelType0, PixelType3>        ConverterType2;
+  typedef otb::RGBAPixelConverter<PixelType0, PixelType4>        ConverterType3;
 
   // Instantiating object
   ConverterType0::Pointer converter0 = ConverterType0::New();
@@ -74,19 +75,19 @@ int otbRGBAPixelConverter(int itkNotUsed(argc), char * itkNotUsed(argv) [])
   std::cout << "outputPixel0: " << outputPixel0 << std::endl;
   if(outputPixel0 != 112)
     {
-    itkGenericExceptionMacro(<< "RGBA<unsigned int> 2 unsigned int Failled");
+    itkGenericExceptionMacro(<< "RGBA<unsigned int> 2 unsigned int Failed");
     }
 
-  PixelType2 pixel1;
-  pixel1[0] = 125;
-  pixel1[1] = 105;
-  pixel1[2] = 145;
-  pixel1[3] = 0.75;
+  PixelType3 pixel1;
+  pixel1[0] = 125.0;
+  pixel1[1] = 105.0;
+  pixel1[2] = 145.0;
+  pixel1[3] = 191.0;
   ConverterType1::OutputPixelType outputPixel1 = converter1->Convert(pixel1);
   std::cout << "outputPixel1: " << outputPixel1 << std::endl;
   if(outputPixel1 != 112)
     {
-    itkGenericExceptionMacro(<< "RGBA<double> 2 unsigned int  Failled");
+    itkGenericExceptionMacro(<< "RGBA<double> 2 unsigned int  Failed");
     }
 
   PixelType2 pixel2;
@@ -98,7 +99,7 @@ int otbRGBAPixelConverter(int itkNotUsed(argc), char * itkNotUsed(argv) [])
   std::cout << "outputPixel2: " << outputPixel2 << std::endl;
   if(outputPixel2[0] != 125 || outputPixel2[1] != 105 || outputPixel2[2] != 145 || outputPixel2[3] != 0 )
     {
-    itkGenericExceptionMacro(<< "RGBA<unsigned int> 2 RGBA<double>  Failled");
+    itkGenericExceptionMacro(<< "RGBA<unsigned int> 2 RGBA<double>  Failed");
     }
 
   PixelType2 pixel3;
@@ -110,7 +111,7 @@ int otbRGBAPixelConverter(int itkNotUsed(argc), char * itkNotUsed(argv) [])
   std::cout << "outputPixel3: " << outputPixel3 << std::endl;
   if(outputPixel3[0] != 125 || outputPixel3[1] != 105 || outputPixel3[2] != 145)
     {
-    itkGenericExceptionMacro(<< "RGBA<unsigned int> 2 RGB<double>  Failled");
+    itkGenericExceptionMacro(<< "RGBA<unsigned int> 2 RGB<double>  Failed");
     }
 
 
diff --git a/Modules/Core/ImageBase/include/otbImage.h b/Modules/Core/ImageBase/include/otbImage.h
index 5a2e4b8..12081b0 100644
--- a/Modules/Core/ImageBase/include/otbImage.h
+++ b/Modules/Core/ImageBase/include/otbImage.h
@@ -18,7 +18,15 @@
 #ifndef __otbImage_h
 #define __otbImage_h
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include "itkImage.h"
+#pragma GCC diagnostic pop
+#else
+#include "itkImage.h"
+#endif
+
 #include "otbImageMetadataInterfaceBase.h"
 
 namespace otb
diff --git a/Modules/Core/ImageBase/include/otbVectorImage.h b/Modules/Core/ImageBase/include/otbVectorImage.h
index d8e2b41..88efd5e 100644
--- a/Modules/Core/ImageBase/include/otbVectorImage.h
+++ b/Modules/Core/ImageBase/include/otbVectorImage.h
@@ -18,7 +18,14 @@
 #ifndef __otbVectorImage_h
 #define __otbVectorImage_h
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include "itkVectorImage.h"
+#pragma GCC diagnostic pop
+#else
+#include "itkVectorImage.h"
+#endif
 #include "otbImageMetadataInterfaceBase.h"
 
 namespace otb
diff --git a/Modules/Core/ImageBase/test/CMakeLists.txt b/Modules/Core/ImageBase/test/CMakeLists.txt
index 52ecd42..8acdf67 100644
--- a/Modules/Core/ImageBase/test/CMakeLists.txt
+++ b/Modules/Core/ImageBase/test/CMakeLists.txt
@@ -28,6 +28,7 @@ set(OTBImageBaseTests
   otbImageFunctionAdaptor.cxx
   otbMultiChannelExtractROINew.cxx
   otbMetaImageFunction.cxx
+
   )
 
 add_executable(otbImageBaseTestDriver ${OTBImageBaseTests})
@@ -164,6 +165,7 @@ otb_add_test(NAME coTvMultiChannelROI_RGB2NG_PNG3 COMMAND otbImageBaseTestDriver
 otb_add_test(NAME ioTvMultiDatasetReading2 COMMAND otbImageBaseTestDriver
   --compare-ascii ${NOTOL}  ${BASELINE_FILES}/ioTvMultiDatasetReading2.txt
   ${TEMP}/ioTvMultiDatasetReading2.txt
+  --ignore-lines-with 1 Pointer:
   otbVectorImageTest
   ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf?&sdataidx=5
   ${TEMP}/ioTvMultiDatasetReading2.txt
@@ -172,6 +174,7 @@ otb_add_test(NAME ioTvMultiDatasetReading2 COMMAND otbImageBaseTestDriver
 otb_add_test(NAME ioTvMultiDatasetReading1 COMMAND otbImageBaseTestDriver
   --compare-ascii ${NOTOL}  ${BASELINE_FILES}/ioTvMultiDatasetReading1.txt
   ${TEMP}/ioTvMultiDatasetReading1.txt
+  --ignore-lines-with 1 Pointer:
   otbVectorImageTest
   ${INPUTDATA}/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf?&sdataidx=0
   ${TEMP}/ioTvMultiDatasetReading1.txt
diff --git a/Modules/Core/ImageBase/test/otbExtractROITestMetaData.cxx b/Modules/Core/ImageBase/test/otbExtractROITestMetaData.cxx
index 0969d34..173972f 100644
--- a/Modules/Core/ImageBase/test/otbExtractROITestMetaData.cxx
+++ b/Modules/Core/ImageBase/test/otbExtractROITestMetaData.cxx
@@ -28,7 +28,7 @@
 #include "otbImageFileReader.h"
 #include "otbImageFileWriter.h"
 
-#include "boost/algorithm/string.hpp"
+#include "otb_boost_string_header.h"
 
 int otbExtractROITestMetaData(int itkNotUsed(argc), char * argv[])
 {
diff --git a/Modules/Core/ImageBase/test/otbFlexibleDistanceWithMissingValue.cxx b/Modules/Core/ImageBase/test/otbFlexibleDistanceWithMissingValue.cxx
index ed2a12c..8d468f3 100644
--- a/Modules/Core/ImageBase/test/otbFlexibleDistanceWithMissingValue.cxx
+++ b/Modules/Core/ImageBase/test/otbFlexibleDistanceWithMissingValue.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Core/ImageBase/test/otbFlexibleDistanceWithMissingValueNew.cxx b/Modules/Core/ImageBase/test/otbFlexibleDistanceWithMissingValueNew.cxx
index d4a76c8..d698343 100644
--- a/Modules/Core/ImageBase/test/otbFlexibleDistanceWithMissingValueNew.cxx
+++ b/Modules/Core/ImageBase/test/otbFlexibleDistanceWithMissingValueNew.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h b/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h
index 2564bc2..966a7ad 100644
--- a/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h
+++ b/Modules/Core/LabelMap/include/otbAttributesMapLabelObject.h
@@ -18,7 +18,15 @@
 #ifndef __otbAttributesMapLabelObject_h
 #define __otbAttributesMapLabelObject_h
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include "itkShapeLabelObject.h"
+#pragma GCC diagnostic pop
+#else
+#include "itkShapeLabelObject.h"
+#endif
+
 #include "otbPolygon.h"
 #include <map>
 
diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h
index 07ce777..100eb6f 100644
--- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h
+++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.h
@@ -64,6 +64,8 @@ public:
   typedef SimplifyPathFunctor<PolygonType,
                               PolygonType> SimplifyPolygonFunctorType;
 
+  typedef unsigned int DimensionType;
+
   /** ImageDimension constants */
   itkStaticConstMacro(ImageDimension, unsigned int, TLabelObject::ImageDimension);
   typedef itk::ImageRegion< TLabelObject::ImageDimension > RegionType;
diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx
index 5e92a95..ea28e70 100644
--- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx
+++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx
@@ -202,13 +202,13 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
 
   // compute the size per pixel, to be used later
   double sizePerPixel = 1;
-  for (int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
     sizePerPixel *= vcl_abs(m_LabelImage->GetSpacing()[i]);
     }
 
   typename std::vector<double> sizePerPixelPerDimension;
-  for (int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
     sizePerPixelPerDimension.push_back(sizePerPixel / vcl_abs(m_LabelImage->GetSpacing()[i]));
     }
@@ -216,7 +216,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
   // compute the max the index on the border of the image
   typename LabelObjectType::IndexType borderMin = m_LabelImage->GetLargestPossibleRegion().GetIndex();
   typename LabelObjectType::IndexType borderMax = borderMin;
-  for (int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
     borderMax[i] += borderMin[i] + m_LabelImage->GetLargestPossibleRegion().GetSize()[i] - 1;
     }
@@ -251,7 +251,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
 
     // update the centroid - and report the progress
     // first, update the axes which are not 0
-    for (int i = 1; i < LabelObjectType::ImageDimension; ++i)
+    for (DimensionType i = 1; i < LabelObjectType::ImageDimension; ++i)
       {
       centroid[i] += length * idx[i];
       }
@@ -259,7 +259,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
     centroid[0] += idx[0] * length + (length * (length - 1)) / 2.0;
 
     // update the mins and maxs
-    for (int i = 0; i < LabelObjectType::ImageDimension; ++i)
+    for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
       {
       if (idx[i] < mins[i])
         {
@@ -278,7 +278,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
 
     // object is on a border ?
     bool isOnBorder = false;
-    for (int i = 1; i < LabelObjectType::ImageDimension; ++i)
+    for (DimensionType i = 1; i < LabelObjectType::ImageDimension; ++i)
       {
       if (idx[i] == borderMin[i] || idx[i] == borderMax[i])
         {
@@ -326,7 +326,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
       physicalSizeOnBorder += sizePerPixelPerDimension[0];
       }
     // then the other dimensions
-    for (int i = 1; i < LabelObjectType::ImageDimension; ++i)
+    for (DimensionType i = 1; i < LabelObjectType::ImageDimension; ++i)
       {
       if (idx[i] == borderMin[i])
         {
@@ -375,13 +375,13 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
                                       + spacing[0] *
                                       (length - 1) * ((spacing[0] * (2 * length - 1)) / 6.0 + physicalPosition[0]));
     // the other ones
-    for (int i = 1; i < LabelObjectType::ImageDimension; ++i)
+    for (DimensionType i = 1; i < LabelObjectType::ImageDimension; ++i)
       {
       // do this one here to avoid the double assigment in the following loop
       // when i == j
       centralMoments[i][i] += length * physicalPosition[i] * physicalPosition[i];
       // central moments are symetrics, so avoid to compute them 2 times
-      for (int j = i + 1; j < LabelObjectType::ImageDimension; ++j)
+      for (DimensionType j = i + 1; j < LabelObjectType::ImageDimension; ++j)
         {
         // note that we won't use that code if the image dimension is less than 3
         // --> the tests should be in 3D at least
@@ -401,14 +401,14 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
   typename TLabelImage::SizeType regionSize;
   double                         minSize = itk::NumericTraits<double>::max();
   double                         maxSize = itk::NumericTraits<double>::NonpositiveMin();
-  for (int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
     centroid[i] /= size;
     regionSize[i] = maxs[i] - mins[i] + 1;
     double s = regionSize[i] * vcl_abs(m_LabelImage->GetSpacing()[i]);
     minSize = std::min(s, minSize);
     maxSize = std::max(s, maxSize);
-    for (unsigned int j = 0; j < LabelObjectType::ImageDimension; ++j)
+    for (DimensionType j = 0; j < LabelObjectType::ImageDimension; ++j)
       {
       centralMoments[i][j] /= size;
       }
@@ -418,9 +418,9 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
   m_LabelImage->TransformContinuousIndexToPhysicalPoint(centroid, physicalCentroid);
 
   // Center the second order moments
-  for (unsigned int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
-    for (unsigned int j = 0; j < LabelObjectType::ImageDimension; ++j)
+    for (DimensionType j = 0; j < LabelObjectType::ImageDimension; ++j)
       {
       centralMoments[i][j] -= physicalCentroid[i] * physicalCentroid[j];
       }
@@ -444,12 +444,12 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
   vnl_diag_matrix<vcl_complex<double> > eigenval = eigenrot.D;
   vcl_complex<double> det(1.0, 0.0);
 
-  for (unsigned int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
     det *= eigenval(i, i);
     }
 
-  for (unsigned int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
     principalAxes[LabelObjectType::ImageDimension - 1][i] *= std::real(det);
     }
@@ -469,12 +469,12 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
   // compute equilalent ellipsoid radius
   itk::Vector<double, LabelObjectType::ImageDimension> ellipsoidSize;
   double                                               edet = 1.0;
-  for (unsigned int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
     edet *= principalMoments[i];
     }
   edet = vcl_pow(edet, 1.0 / LabelObjectType::ImageDimension);
-  for (unsigned int i = 0; i < LabelObjectType::ImageDimension; ++i)
+  for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
     {
     ellipsoidSize[i] = 2.0 * equivalentRadius * vcl_sqrt(principalMoments[i] / edet);
     }
@@ -619,7 +619,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
         {
         // Compute the length between the 2 indexes
         double length = 0;
-        for (int i = 0; i < LabelObjectType::ImageDimension; ++i)
+        for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i)
           {
           length += vcl_pow((iIt1->operator[] (i) - iIt2->operator[] (i)) * m_LabelImage->GetSpacing()[i], 2);
           }
@@ -700,7 +700,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
   typename LineImageType::IndexType lIdx;
   typename LineImageType::SizeType lSize;
   RegionType boundingBox = region;
-  for( int i=0; i<ImageDimension-1; i++ )
+  for( DimensionType i=0; i<ImageDimension-1; i++ )
     {
     lIdx[i] = boundingBox.GetIndex()[i+1];
     lSize[i] = boundingBox.GetSize()[i+1];
@@ -725,7 +725,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
   while( ! lit.IsAtEnd() )
     {
     const typename TLabelObject::IndexType & idx = lit.GetLine().GetIndex();
-    for( int i=0; i<ImageDimension-1; i++ )
+    for( DimensionType i=0; i<ImageDimension-1; i++ )
       {
       lIdx[i] = idx[i+1];
       }
@@ -764,7 +764,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage>
       // prepare the offset to be stored in the intercepts map
       typename LineImageType::OffsetType lno = ci.GetNeighborhoodOffset();
       no[0] = 0;
-      for( int i=0; i<ImageDimension-1; i++ )
+      for( DimensionType i=0; i<ImageDimension-1; i++ )
         {
         no[i+1] = vnl_math_abs(lno[i]);
         }
diff --git a/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h b/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h
index d920957..2a68579 100644
--- a/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h
+++ b/Modules/Core/Metadata/include/otbImageMetadataInterfaceBase.h
@@ -53,6 +53,8 @@ public:
   typedef MetaDataKey::VariableLengthVectorType VariableLengthVectorType;
   typedef ImageKeywordlist                      ImageKeywordlistType;
   typedef unsigned int                          UnsignedIntType;
+  typedef std::vector<std::string>              StringVectorType;
+  typedef std::vector<unsigned int>             UIntVectorType;
 
 
   /** Set the image used to get the metadata */
@@ -80,7 +82,7 @@ public:
   std::string GetGCPProjection() const;
 //  otbMetadataGetMacro(GCPProjection, std::string);
 
-  unsigned int GetGCPCount() const;
+  UnsignedIntType GetGCPCount() const;
 //  otbMetadataGetMacro(GCPCount, unsigned int);
 
   OTB_GCP& GetGCPs(unsigned int GCPnum);
@@ -107,6 +109,12 @@ public:
   double GetGCPZ(unsigned int GCPnum) const;
 //  otbMetadataGetGCPnumMacro(GCPZ, double, GCPnum, unsigned int);
 
+  /**
+   * Get The no data flags if existing
+   * return False otherwise
+   */
+  bool GetNoDataFlags(std::vector<bool> & flags, std::vector<double> & values) const;
+
   /** Get the six coefficients of affine geoTtransform. */
 
   VectorType GetGeoTransform() const;
@@ -135,11 +143,11 @@ public:
   //otbMetadataGetMacro(SensorID, std::string);
 
   /** Get the number of bands from the ossim metadata */
-  unsigned int GetNumberOfBands() const;
+  UnsignedIntType GetNumberOfBands() const;
   //otbMetadataGetMacro(NumberOfBands, unsigned int);
 
   /** Get the band name from the ossim metadata */
-  std::vector<std::string> GetBandName() const;
+  StringVectorType GetBandName() const;
   //otbMetadataGetMacro(BandName, std::vector<std::string>);
 
   /** Get the x pixel spacing*/
@@ -150,7 +158,6 @@ public:
   double GetYPixelSpacing() const;
   //otbMetadataGetMacro(YPixelSpacing, double);
 
-
   /** Get the imaging acquisition day from the ossim metadata */
   virtual int GetDay() const = 0;
 //  otbMetadataGetMacro(Day, int);
@@ -184,11 +191,11 @@ public:
   //otbMetadataGetMacro(ProductionYear, int);
 
   /** Convert the band names provided by ossim to the official band names  */
-  virtual std::vector<std::string> GetEnhancedBandNames () const = 0;
+  virtual StringVectorType GetEnhancedBandNames () const = 0;
 
   /** Get the 3 spectral band numbers corresponding to the default display for visualization,
    *  in the order R, G, B */
-  virtual std::vector<unsigned int> GetDefaultDisplay() const = 0;
+  virtual UIntVectorType GetDefaultDisplay() const = 0;
 
   virtual bool CanRead() const = 0;
 
diff --git a/Modules/Core/Metadata/include/otbNoDataHelper.h b/Modules/Core/Metadata/include/otbNoDataHelper.h
new file mode 100644
index 0000000..57d927c
--- /dev/null
+++ b/Modules/Core/Metadata/include/otbNoDataHelper.h
@@ -0,0 +1,165 @@
+/*=========================================================================
+
+  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 __otbNoDataHelper_h
+#define __otbNoDataHelper_h
+#include <vector>
+#include <cassert>
+#include "vnl/vnl_math.h"
+#include <itkVariableLengthVector.h>
+
+namespace itk
+{
+class MetaDataDictionary;
+}
+
+namespace otb
+{
+
+/** 
+ * Reads no data flag from the MetaDataDictionnary dict to flags and values
+ * vectors. Returns true upon success. 
+ */
+bool ReadNoDataFlags(const itk::MetaDataDictionary& dict, std::vector<bool> & flags, std::vector<double> & values);
+
+/** 
+ * Write no data flags to the MetaDataDictionnary dict from flags and values
+ * vectors. Returns true upon success. 
+ */
+void WriteNoDataFlags(const std::vector<bool> & flags, const std::vector<double> & values, itk::MetaDataDictionary& dict);
+
+/**
+* Test if the pixel corresponds to a no data pixel according to a
+* vector of no data flags, and a vector of no data values.
+* \param pixel The pixel to test
+* \param flags A vector of size > 1 containing a flag per band to
+* indicate if a no data value is available for this band
+* \param values A vector of size > 1 corresponding to the no data
+* value for each band. If flag is 0, the value will be ignored.
+* \param nanIsNoData If true, NaN values will be reported as no-data.
+*/
+template<typename T> bool IsNoData(const T & pixel, const
+                                   std::vector<bool> & flags, const std::vector<double> & values, bool nanIsNoData = false) {
+  assert(flags.size()>0);
+  assert(values.size()>0);
+
+  if(nanIsNoData && vnl_math_isnan(values[0]))
+    return true;
+
+
+  if(flags[0])
+    {
+    return (pixel == values[0]);
+    }
+  else
+    {
+    return false;
+    }
+}
+
+/**
+* Reads a pixel and change the no data value if it is found. No data
+* value is changed either if the pixel value is NaN or if the pixel
+* value equals the no data value and flag is true.
+* 
+* \param pixel The pixel to process \param flags A vector of size > 1
+* containing a flag per band to indicate if a no data value is
+* available for this band
+* \param values A vector of size > 1 corresponding to the current no data
+* value for each band. If flag is 0, the value will be ignored.
+* \param newValues A vector of size > 1 corresponding to the new no data
+* value for each band. If flag is 0, the value will be ignored 
+* \param nanIsNoData If true, NaN values will be considered as no-data
+* and changed as well.
+*
+*/
+template<typename T> T ChangeNoData(const T & pixel, const
+                                    std::vector<bool> & flags,
+                                    const std::vector<double> & values,
+                                    const std::vector<double> & newValues,
+                                    bool nanIsNoData = false) {
+  assert(flags.size()>0);
+  assert(values.size()>0);
+  assert(newValues.size()>0);
+  
+  if(nanIsNoData && vnl_math_isnan(pixel))
+    {
+    return static_cast<T>(newValues[0]);
+    }
+
+  if(flags[0] && pixel == values[0])
+    {
+    return static_cast<T>(newValues[0]);
+    }
+  return pixel;
+}
+
+
+/**
+ * Specialization of IsNoData function to handle itk::VariableLengthVector
+ */
+template <typename T> bool IsNoData(const itk::VariableLengthVector<T> & pixel, const std::vector<bool> & flags, const std::vector<double> & values, bool nanIsNoData = false)
+{
+  assert(flags.size()>=pixel.Size());
+  assert(values.size()>=pixel.Size());
+
+  for(unsigned int i = 0; i < pixel.Size();++i)
+    {
+    if((nanIsNoData && vnl_math_isnan(pixel[i])) || (flags[i] && (pixel[i] == values[i])))
+      {
+      return true;
+      }
+    }
+  return false;
+}
+
+
+/**
+ * Specialization of ChangeNoData function to handle itk::VariableLengthVector
+ */
+template <typename T> itk::VariableLengthVector<T> ChangeNoData(const itk::VariableLengthVector<T> & pixel,
+                                                                const std::vector<bool> & flags,
+                                                                const std::vector<double> & values,
+                                                                const std::vector<double> & newValues,
+                                                                bool nanIsNoData = false)
+{
+  assert(flags.size()>=pixel.Size());
+  assert(values.size()>=pixel.Size());
+  assert(newValues.size()>=pixel.Size());
+
+  itk::VariableLengthVector<T> outPixel(pixel.Size());
+  
+  for(unsigned int i = 0; i < pixel.Size();++i)
+    {
+    if((nanIsNoData && vnl_math_isnan(pixel[i])) || (flags[i] && (pixel[i] == values[i])))
+      {
+      outPixel[i] = newValues[i];
+      }
+    else
+      {
+      outPixel[i] = pixel[i];
+      }
+    }
+
+  return outPixel;
+}
+
+
+
+} // End namespace otb
+
+#endif
diff --git a/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h
new file mode 100644
index 0000000..46439ca
--- /dev/null
+++ b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterface.h
@@ -0,0 +1,203 @@
+/*=========================================================================
+
+  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 __otbRadarsat2ImageMetadataInterface_h
+#define __otbRadarsat2ImageMetadataInterface_h
+
+#include "otbSarImageMetadataInterface.h"
+
+namespace otb
+{
+/** \class Radarsat2ImageMetadataInterface
+ *
+ * \brief Creation of an "otb" Radarsat2ImageMetadataInterface that gets metadata.
+ *
+ *
+ * \ingroup OTBMetadata
+ */
+
+class ITK_ABI_EXPORT Radarsat2ImageMetadataInterface : public SarImageMetadataInterface
+{
+public:
+
+  typedef Radarsat2ImageMetadataInterface    Self;
+  typedef SarImageMetadataInterface         Superclass;
+  typedef itk::SmartPointer<Self>         Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(Radarsat2ImageMetadataInterface, SarImageMetadataInterface);
+
+  typedef Superclass::ImageType                ImageType;
+  typedef Superclass::MetaDataDictionaryType   MetaDataDictionaryType;
+  typedef Superclass::VectorType               VectorType;
+  typedef Superclass::VariableLengthVectorType VariableLengthVectorType;
+  typedef Superclass::ImageKeywordlistType     ImageKeywordlistType;
+  typedef Superclass::LookupDataPointerType LookupDataPointerType;
+//  typedef Radarsat2CalibrationLookupData::Pointer          LookupDataPointerType;
+
+  /*ImageMetadataInterfaceBase pure virtuals */
+  /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */
+  int GetProductionDay() const;
+
+  /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */
+  int GetProductionMonth() const;
+
+  /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */
+  int GetProductionYear() const;
+
+  /** check sensor ID */
+  bool CanRead() const;
+
+  int GetDay() const;
+
+  int GetMonth() const;
+
+  int GetYear() const;
+
+  int GetHour() const;
+
+  int GetMinute() const;
+
+  UIntVectorType GetDefaultDisplay() const;
+
+  /*SarImageMetadataInterface pure virutals rituals */
+  double GetPRF() const;
+
+  double GetRSF() const;
+
+  double GetRadarFrequency() const;
+
+  double GetCenterIncidenceAngle() const;
+
+  /*get lookup data for calulating backscatter */
+  void CreateCalibrationLookupData(const short type);
+
+
+protected:
+  /* class constructor */
+  Radarsat2ImageMetadataInterface();
+
+  /* class desctructor */
+  virtual ~Radarsat2ImageMetadataInterface() {}
+
+private:
+  Radarsat2ImageMetadataInterface(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+/* Helper function to parse date and time into a std::vector<std::string>
+ * using boost::split() expect date time in yyyy-mm-ddThh:mm:ss.ms
+ * the date-time string is to be found in keywordlist with key 'key'
+ * fills argument dateFields of type std::vector<std::string> which is mutable!
+ * TODO: move this method into base class
+ */
+  void ParseDateTime(const char* key, std::vector<int>& dateFields) const;
+
+  mutable std::vector<int> m_ProductionDateFields;
+  mutable std::vector<int> m_AcquisitionDateFields;
+
+};
+
+
+class Radarsat2CalibrationLookupData : public SarCalibrationLookupData
+{
+
+public:
+
+  /** Standard typedefs */
+  typedef Radarsat2CalibrationLookupData   Self;
+  typedef SarCalibrationLookupData         Superclass;
+  typedef itk::SmartPointer<Self>          Pointer;
+  typedef itk::SmartPointer<const Self>    ConstPointer;
+
+  /** Creation through the object factory */
+  itkNewMacro(Self);
+
+  /** RTTI */
+  itkTypeMacro(Radarsat2CalibrationLookupData, SarCalibrationLookupData);
+
+  typedef itk::IndexValueType IndexValueType;
+
+  typedef std::vector<float> GainListType;
+
+
+  Radarsat2CalibrationLookupData()
+    : m_Offset(0)
+  {
+
+  }
+
+  virtual ~Radarsat2CalibrationLookupData()
+  {
+
+  }
+
+  void InitParameters(short type, int offset,  GainListType gains)
+  {
+    this->SetType(type);
+    m_Offset = offset;
+    m_Gains = gains;
+  }
+
+  double GetValue(const IndexValueType x, const IndexValueType itkNotUsed(y))
+  {
+    double lutVal = 1.0;
+
+    const size_t pos =  x + m_Offset;
+    if(pos  < m_Gains.size())
+      {
+      lutVal = m_Gains[pos];
+      }
+    else
+      {
+      //itkExceptionMacro( << "error: (pos < list.size() )" << pos << " < " << list.size())
+      }
+    return lutVal;
+  }
+
+  void PrintSelf(std::ostream & os, itk::Indent indent) const
+  {
+    os << indent << " offset:'" << m_Offset << "'" << std::endl;
+    os <<  " referenceNoiseLevel.gain: " << std::endl;
+    std::vector<float>::const_iterator it = m_Gains.begin();
+    while (it != m_Gains.end())
+      {
+      os << (*it) << " ";
+      ++it;
+      }
+    os << std::endl;
+
+    Superclass::PrintSelf(os, indent);
+  }
+
+private:
+
+  Radarsat2CalibrationLookupData(const Self&); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+  GainListType m_Gains;
+  int m_Offset;
+
+
+};
+
+} // end namespace otb
+
+#endif
diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h
similarity index 51%
copy from Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h
copy to Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h
index 395d9af..2aeb8a8 100644
--- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h
+++ b/Modules/Core/Metadata/include/otbRadarsat2ImageMetadataInterfaceFactory.h
@@ -15,30 +15,26 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-#ifndef __otbSVMMachineLearningModelFactory_h
-#define __otbSVMMachineLearningModelFactory_h
-
-#include "otbRequiresOpenCVCheck.h"
+#ifndef __otbRadarsat2ImageMetadataInterfaceFactory_h
+#define __otbRadarsat2ImageMetadataInterfaceFactory_h
 
 #include "itkObjectFactoryBase.h"
-#include "itkImageIOBase.h"
 
 namespace otb
 {
-/** \class SVMMachineLearningModelFactory
- * \brief Creation d'un instance d'un objet SVMMachineLearningModel utilisant les object factory.
+/** \class Radarsat2ImageMetadataInterfaceFactory
+ * \brief Creating an instance of a ImageMetadataInterface object using object factory.
  *
- * \ingroup OTBSupervised
+ * \ingroup OTBMetadata
  */
-template <class TInputValue, class TTargetValue>
-class ITK_EXPORT SVMMachineLearningModelFactory : public itk::ObjectFactoryBase
+class ITK_EXPORT Radarsat2ImageMetadataInterfaceFactory : public itk::ObjectFactoryBase
 {
 public:
   /** Standard class typedefs. */
-  typedef SVMMachineLearningModelFactory             Self;
-  typedef itk::ObjectFactoryBase        Superclass;
-  typedef itk::SmartPointer<Self>       Pointer;
-  typedef itk::SmartPointer<const Self> ConstPointer;
+  typedef Radarsat2ImageMetadataInterfaceFactory Self;
+  typedef itk::ObjectFactoryBase            Superclass;
+  typedef itk::SmartPointer<Self>           Pointer;
+  typedef itk::SmartPointer<const Self>     ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
   virtual const char* GetITKSourceVersion(void) const;
@@ -48,29 +44,25 @@ public:
   itkFactorylessNewMacro(Self);
 
   /** Run-time type information (and related methods). */
-  itkTypeMacro(SVMMachineLearningModelFactory, itk::ObjectFactoryBase);
+  itkTypeMacro(Radarsat2ImageMetadataInterfaceFactory, itk::ObjectFactoryBase);
 
   /** Register one factory of this type  */
   static void RegisterOneFactory(void)
   {
-    SVMMachineLearningModelFactory::Pointer SVMFactory = SVMMachineLearningModelFactory::New();
-    itk::ObjectFactoryBase::RegisterFactory(SVMFactory);
+    Pointer factory = Radarsat2ImageMetadataInterfaceFactory::New();
+    itk::ObjectFactoryBase::RegisterFactory(factory);
   }
 
 protected:
-  SVMMachineLearningModelFactory();
-  virtual ~SVMMachineLearningModelFactory();
+  Radarsat2ImageMetadataInterfaceFactory();
+  virtual ~Radarsat2ImageMetadataInterfaceFactory();
 
 private:
-  SVMMachineLearningModelFactory(const Self &); //purposely not implemented
+  Radarsat2ImageMetadataInterfaceFactory(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
 
 };
 
 } // end namespace otb
 
-#ifndef OTB_MANUAL_INSTANTIATION
-#include "otbSVMMachineLearningModelFactory.txx"
-#endif
-
 #endif
diff --git a/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h b/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h
new file mode 100644
index 0000000..ef95f2b
--- /dev/null
+++ b/Modules/Core/Metadata/include/otbSarCalibrationLookupData.h
@@ -0,0 +1,72 @@
+#ifndef SarCalibrationLookupData_H
+#define SarCalibrationLookupData_H 1
+#include <string>
+#include <itkLightObject.h>
+#include <itkNumericTraits.h>
+#include <itkObjectFactory.h>
+
+namespace otb {
+
+class ITK_EXPORT SarCalibrationLookupData : public itk::LightObject {
+
+  public:
+
+    /** Standard typedefs */
+  typedef SarCalibrationLookupData          Self;
+  typedef itk::LightObject                 Superclass;
+  typedef itk::SmartPointer<Self>          Pointer;
+  typedef itk::SmartPointer<const Self>    ConstPointer;
+
+  /** Creation through the object factory */
+  itkNewMacro(Self);
+
+  /** RTTI */
+  itkTypeMacro(SarCalibrationLookupData, itk::LightObject);
+
+  typedef itk::IndexValueType IndexValueType;
+
+  enum {
+    SIGMA = 0,
+    BETA,
+    GAMMA,
+    DN
+  };
+
+  SarCalibrationLookupData()
+    :m_Type(0)
+  {
+
+  }
+
+  virtual ~SarCalibrationLookupData()
+  {
+  }
+
+  virtual double GetValue(const IndexValueType itkNotUsed(x), const IndexValueType itkNotUsed(y))
+  {
+    return 1.0;
+  }
+
+  void SetType(short t)
+  {
+    m_Type = t;
+  }
+
+  itkGetMacro(Type, short);
+
+  void PrintSelf(std::ostream & os, itk::Indent indent) const
+  {
+    os << indent << " lookup table type:'" << m_Type << "'" << std::endl;
+    Superclass::PrintSelf(os, indent);
+  }
+
+private:
+
+  SarCalibrationLookupData(const Self&); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+  short m_Type;
+
+};
+
+}
+#endif
diff --git a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h
index f78fa3e..dd6529a 100644
--- a/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h
+++ b/Modules/Core/Metadata/include/otbSarDefaultImageMetadataInterface.h
@@ -58,8 +58,7 @@ public:
   typedef double                                     RealType;
   typedef PointSetType::PointType                    PointType;
 
-
-  RealType   GetRadiometricCalibrationScale() const
+  RealType GetRadiometricCalibrationScale() const
   {
     itkExceptionMacro("GetRadiometricCalibrationScale() not implemented in SarDefaultImageMetadataInterface, no captor type found");
   }
@@ -194,9 +193,9 @@ public:
 
   /** Get the 3 spectral band numbers corresponding to the default display for visualization,
    *  in the order R, G, B */
-    std::vector<unsigned int> GetDefaultDisplay() const
+    UIntVectorType GetDefaultDisplay() const
   {
-    std::vector<unsigned int> rgb(3);
+    UIntVectorType rgb(3);
     rgb[0] = 0;
     rgb[1] = 0;
     rgb[2] = 0;
diff --git a/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h
index 73f055c..7ce844f 100644
--- a/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h
+++ b/Modules/Core/Metadata/include/otbSarImageMetadataInterface.h
@@ -19,9 +19,11 @@
 #define __otbSarImageMetadataInterface_h
 
 #include <string>
-
+#include <vector>
 #include "otbImageMetadataInterfaceBase.h"
 #include "itkPointSet.h"
+#include "otbSarCalibrationLookupData.h"
+#include "otbStringUtils.h"
 
 namespace otb
 {
@@ -50,11 +52,25 @@ public:
   typedef Superclass::VectorType                     VectorType;
   typedef Superclass::VariableLengthVectorType       VariableLengthVectorType;
   typedef Superclass::ImageKeywordlistType           ImageKeywordlistType;
+  typedef Superclass::UIntVectorType                 UIntVectorType;
+  typedef Superclass::StringVectorType               StringVectorType;
   typedef itk::PointSet<double, 2>                   PointSetType;
   typedef PointSetType::Pointer                      PointSetPointer;
   typedef double                                     RealType;
   typedef PointSetType::PointType                    PointType;
+  typedef SarCalibrationLookupData                   LookupDataType;
+  typedef LookupDataType::Pointer                    LookupDataPointerType;
+
+  virtual void CreateCalibrationLookupData(const short t);
 
+  const LookupDataPointerType GetCalibrationLookupData(const short type);
+
+  bool HasCalibrationLookupDataFlag() const;
+
+  void SetCalibrationLookupData(LookupDataType* lut)
+  {
+    m_SarLut = lut;
+  }
 
   virtual RealType   GetRadiometricCalibrationScale() const;
 
@@ -75,10 +91,18 @@ public:
   virtual double GetRadarFrequency () const = 0;
   virtual double GetCenterIncidenceAngle() const = 0;
 
+
+
+  virtual double GetRescalingFactor() const;
+
+  virtual const std::string GetProductType() const;
+
+  virtual const std::string GetAcquisitionMode() const;
+
   /** Get the enhanced band names (No enhanced band name support for SAR) */
-  std::vector<std::string> GetEnhancedBandNames() const
+  StringVectorType GetEnhancedBandNames() const
   {
-    std::vector<std::string> nothing;
+    StringVectorType nothing;
     return nothing;
   }
 
@@ -91,9 +115,13 @@ protected:
 
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
+  LookupDataPointerType m_SarLut;
+
+
 private:
   SarImageMetadataInterface(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
+
 };
 
 } // end namespace otb
diff --git a/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h
new file mode 100644
index 0000000..c67ead3
--- /dev/null
+++ b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterface.h
@@ -0,0 +1,236 @@
+/*=========================================================================
+
+  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 __otbSentinel1ImageMetadataInterface_h
+#define __otbSentinel1ImageMetadataInterface_h
+
+#include "otbSarImageMetadataInterface.h"
+
+
+namespace otb
+{
+/** \class Sentinel1ImageMetadataInterface
+ *
+ * \brief Creation of an "otb" Sentinel1ImageMetadataInterface that gets metadata.
+ *
+ *
+ * \ingroup OTBMetadata
+ */
+
+class ITK_ABI_EXPORT Sentinel1ImageMetadataInterface : public SarImageMetadataInterface
+{
+public:
+
+  typedef Sentinel1ImageMetadataInterface    Self;
+  typedef SarImageMetadataInterface         Superclass;
+  typedef itk::SmartPointer<Self>         Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(Sentinel1ImageMetadataInterface, SarImageMetadataInterface);
+
+  typedef Superclass::ImageType                ImageType;
+  typedef Superclass::MetaDataDictionaryType   MetaDataDictionaryType;
+  typedef Superclass::VectorType               VectorType;
+  typedef Superclass::VariableLengthVectorType VariableLengthVectorType;
+  typedef Superclass::ImageKeywordlistType     ImageKeywordlistType;
+  typedef Superclass::RealType                  RealType;
+  typedef Superclass::LookupDataPointerType LookupDataPointerType;
+
+  /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */
+  int GetProductionDay() const;
+
+  /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */
+  int GetProductionMonth() const;
+
+  /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */
+  int GetProductionYear() const;
+
+  /** check sensor ID */
+  bool CanRead() const;
+
+  int GetDay() const;
+
+  int GetMonth() const;
+
+  int GetYear() const;
+
+  int GetHour() const;
+
+  int GetMinute() const;
+
+  UIntVectorType GetDefaultDisplay() const;
+
+  /*SarImageMetadataInterface pure virutals rituals */
+  double GetPRF() const;
+
+  double GetRSF() const;
+
+  double GetRadarFrequency() const;
+
+  double GetCenterIncidenceAngle() const;
+
+  /*get lookup data for calulating backscatter */
+  void CreateCalibrationLookupData(const short type);
+
+protected:
+
+  /* class ctor */
+  Sentinel1ImageMetadataInterface();
+
+  /* class dtor */
+  virtual ~Sentinel1ImageMetadataInterface() {}
+
+private:
+
+  Sentinel1ImageMetadataInterface(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+/* Helper function to parse date and time into a std::vector<std::string>
+ * using boost::split() expect date time in yyyy-mm-ddThh:mm:ss.ms
+ * the date-time string is to be found in keywordlist with key 'key'
+ * fills argument dateFields of type std::vector<std::string> which is mutable!
+ * TODO: move this method into base class
+ */
+  void ParseDateTime(const char* key, std::vector<int>& dateFields) const;
+
+  mutable std::vector<int> m_ProductionDateFields;
+  mutable std::vector<int> m_AcquisitionDateFields;
+};
+
+
+
+struct Sentinel1CalibrationStruct {
+
+public:
+  double timeMJD;
+  int line;
+  std::vector<int> pixels;
+  std::vector<float> vect;
+};
+
+class Sentinel1CalibrationLookupData : public SarCalibrationLookupData
+{
+
+public:
+
+
+  /** Standard typedefs */
+  typedef Sentinel1CalibrationLookupData   Self;
+  typedef SarCalibrationLookupData         Superclass;
+  typedef itk::SmartPointer<Self>          Pointer;
+  typedef itk::SmartPointer<const Self>    ConstPointer;
+
+  /** Creation through the object factory */
+  itkNewMacro(Self);
+
+  /** RTTI */
+  itkTypeMacro(Sentinel1CalibrationLookupData, SarCalibrationLookupData);
+
+  typedef itk::IndexValueType IndexValueType;
+
+  Sentinel1CalibrationLookupData()
+    : firstLineTime(0.)
+    , lastLineTime(0.)
+    , numOfLines(0)
+    , count(0)
+    , lineTimeInterval(0.)
+  {
+
+  }
+
+  virtual ~Sentinel1CalibrationLookupData()
+  {
+
+  }
+
+  void InitParameters(short type, double ft, double lt,
+                      int lines, int c,
+                      std::vector<Sentinel1CalibrationStruct> vlist)
+  {
+    firstLineTime = ft;
+    lastLineTime = lt;
+    numOfLines = lines;
+    count = c;
+    calibrationVectorList = vlist;
+    this->SetType(type);
+    lineTimeInterval = (lt - ft) / ((lines - 1) * 1.0);
+  }
+
+  virtual double GetValue(const IndexValueType x, const IndexValueType y)
+  {
+    const int calVecIdx = GetVectorIndex(y);
+    const Sentinel1CalibrationStruct vec0 = calibrationVectorList[calVecIdx];
+    const Sentinel1CalibrationStruct vec1 = calibrationVectorList[calVecIdx + 1];
+    const double azTime = firstLineTime + y * lineTimeInterval;
+    const double muY = (azTime - vec0.timeMJD) /(vec1.timeMJD - vec0.timeMJD);
+    const int pixelIdx = GetPixelIndex(x, calibrationVectorList[calVecIdx]);
+    const double muX = (static_cast<float>(x) - static_cast<float>(vec0.pixels[pixelIdx])) / (static_cast<float>(vec0.pixels[pixelIdx + 1] - vec0.pixels[pixelIdx]));
+    const double lutVal = (1 - muY) * ((1 - muX) * vec0.vect[pixelIdx] + muX * vec0.vect[pixelIdx + 1]) +
+      muY * ((1 - muX) * vec1.vect[pixelIdx] + muX *   vec1.vect[pixelIdx + 1]);
+    return lutVal;
+  }
+
+  int GetVectorIndex(int y)
+  {
+    for (int i = 1; i < count; i++)
+      {
+      if (y < calibrationVectorList[i].line)
+        {
+        return i - 1;
+        }
+      }
+    return -1;
+
+  }
+
+  int GetPixelIndex(int x, const Sentinel1CalibrationStruct& calVec)
+  {
+    const int size = calVec.pixels.size();
+    for (int i = 0; i < size; i++)
+      {
+      if (x < calVec.pixels[i])
+        {
+        return i - 1;
+        }
+      }
+    return size - 2;
+  }
+
+private:
+
+  Sentinel1CalibrationLookupData(const Self&); //purposely not implemented
+
+  void operator =(const Self&); //purposely not implemented
+
+  double firstLineTime;
+  double lastLineTime;
+  int numOfLines;
+  int count;
+  std::vector<Sentinel1CalibrationStruct> calibrationVectorList;
+  double lineTimeInterval;
+
+};
+
+
+} // end namespace otb
+
+#endif
diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h
similarity index 51%
copy from Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h
copy to Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h
index 395d9af..76964bb 100644
--- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h
+++ b/Modules/Core/Metadata/include/otbSentinel1ImageMetadataInterfaceFactory.h
@@ -15,30 +15,27 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-#ifndef __otbSVMMachineLearningModelFactory_h
-#define __otbSVMMachineLearningModelFactory_h
+#ifndef __otbSentinel1ImageMetadataInterfaceFactory_h
+#define __otbSentinel1ImageMetadataInterfaceFactory_h
 
-#include "otbRequiresOpenCVCheck.h"
 
 #include "itkObjectFactoryBase.h"
-#include "itkImageIOBase.h"
 
 namespace otb
 {
-/** \class SVMMachineLearningModelFactory
- * \brief Creation d'un instance d'un objet SVMMachineLearningModel utilisant les object factory.
+/** \class Sentinel1ImageMetadataInterfaceFactory
+ * \brief Creating an instance of a ImageMetadataInterface object using object factory.
  *
- * \ingroup OTBSupervised
+ * \ingroup OTBMetadata
  */
-template <class TInputValue, class TTargetValue>
-class ITK_EXPORT SVMMachineLearningModelFactory : public itk::ObjectFactoryBase
+class ITK_EXPORT Sentinel1ImageMetadataInterfaceFactory : public itk::ObjectFactoryBase
 {
 public:
   /** Standard class typedefs. */
-  typedef SVMMachineLearningModelFactory             Self;
-  typedef itk::ObjectFactoryBase        Superclass;
-  typedef itk::SmartPointer<Self>       Pointer;
-  typedef itk::SmartPointer<const Self> ConstPointer;
+  typedef Sentinel1ImageMetadataInterfaceFactory Self;
+  typedef itk::ObjectFactoryBase            Superclass;
+  typedef itk::SmartPointer<Self>           Pointer;
+  typedef itk::SmartPointer<const Self>     ConstPointer;
 
   /** Class methods used to interface with the registered factories. */
   virtual const char* GetITKSourceVersion(void) const;
@@ -48,29 +45,25 @@ public:
   itkFactorylessNewMacro(Self);
 
   /** Run-time type information (and related methods). */
-  itkTypeMacro(SVMMachineLearningModelFactory, itk::ObjectFactoryBase);
+  itkTypeMacro(Sentinel1ImageMetadataInterfaceFactory, itk::ObjectFactoryBase);
 
   /** Register one factory of this type  */
   static void RegisterOneFactory(void)
   {
-    SVMMachineLearningModelFactory::Pointer SVMFactory = SVMMachineLearningModelFactory::New();
-    itk::ObjectFactoryBase::RegisterFactory(SVMFactory);
+    Pointer factory = Sentinel1ImageMetadataInterfaceFactory::New();
+    itk::ObjectFactoryBase::RegisterFactory(factory);
   }
 
 protected:
-  SVMMachineLearningModelFactory();
-  virtual ~SVMMachineLearningModelFactory();
+  Sentinel1ImageMetadataInterfaceFactory();
+  virtual ~Sentinel1ImageMetadataInterfaceFactory();
 
 private:
-  SVMMachineLearningModelFactory(const Self &); //purposely not implemented
+  Sentinel1ImageMetadataInterfaceFactory(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
 
 };
 
 } // end namespace otb
 
-#ifndef OTB_MANUAL_INSTANTIATION
-#include "otbSVMMachineLearningModelFactory.txx"
-#endif
-
 #endif
diff --git a/Modules/Core/Metadata/otb-module.cmake b/Modules/Core/Metadata/otb-module.cmake
index afaff0b..6e0e51f 100644
--- a/Modules/Core/Metadata/otb-module.cmake
+++ b/Modules/Core/Metadata/otb-module.cmake
@@ -5,16 +5,16 @@ are supported. for instance: Pleiades, SPOT6, TerraSar, and so on).")
 otb_module(OTBMetadata
   DEPENDS
     OTBObjectList
-    OTBBoost
+    OTBBoostAdapters
     OTBITK
     OTBOSSIMAdapters
     OTBCommon
-
+    
   TEST_DEPENDS
     OTBTestKernel
     OTBImageIO
     OTBImageBase
-
+    
   DESCRIPTION
     "${DOCUMENTATION}"
 )
diff --git a/Modules/Core/Metadata/src/CMakeLists.txt b/Modules/Core/Metadata/src/CMakeLists.txt
index bc3c990..a81509e 100644
--- a/Modules/Core/Metadata/src/CMakeLists.txt
+++ b/Modules/Core/Metadata/src/CMakeLists.txt
@@ -1,33 +1,52 @@
 set(OTBMetadata_SRC
+  otbWorldView2ImageMetadataInterfaceFactory.cxx
   otbWorldView2ImageMetadataInterface.cxx
+
+  otbQuickBirdImageMetadataInterfaceFactory.cxx
   otbQuickBirdImageMetadataInterface.cxx
-  otbWorldView2ImageMetadataInterfaceFactory.cxx
-  otbTerraSarImageMetadataInterface.cxx
-  otbImageMetadataInterfaceBase.cxx
+
   otbImageMetadataInterfaceFactory.cxx
-  otbFormosatImageMetadataInterface.cxx
+  otbImageMetadataInterfaceBase.cxx
+
   otbSpotImageMetadataInterfaceFactory.cxx
+  otbSpotImageMetadataInterface.cxx
+
   otbDefaultImageMetadataInterfaceFactory.cxx
   otbSarDefaultImageMetadataInterfaceFactory.cxx
   otbOpticalDefaultImageMetadataInterfaceFactory.cxx
-  otbSpotImageMetadataInterface.cxx
+
   otbFormosatImageMetadataInterfaceFactory.cxx
+  otbFormosatImageMetadataInterface.cxx
+
   otbOpticalImageMetadataInterfaceFactory.cxx
+  otbOpticalImageMetadataInterface.cxx
+
   otbSpot6ImageMetadataInterfaceFactory.cxx
-  otbSarImageMetadataInterfaceFactory.cxx
   otbSpot6ImageMetadataInterface.cxx
+
+  otbIkonosImageMetadataInterfaceFactory.cxx
   otbIkonosImageMetadataInterface.cxx
+
+  otbPleiadesImageMetadataInterfaceFactory.cxx
   otbPleiadesImageMetadataInterface.cxx
-  otbQuickBirdImageMetadataInterfaceFactory.cxx
-  otbOpticalImageMetadataInterface.cxx
-  otbIkonosImageMetadataInterfaceFactory.cxx
+
+  otbSarImageMetadataInterfaceFactory.cxx
   otbSarImageMetadataInterface.cxx
-  otbPleiadesImageMetadataInterfaceFactory.cxx
+
   otbTerraSarImageMetadataInterfaceFactory.cxx
+  otbTerraSarImageMetadataInterface.cxx
+
+  otbSentinel1ImageMetadataInterfaceFactory.cxx
+  otbSentinel1ImageMetadataInterface.cxx
+
+  otbRadarsat2ImageMetadataInterfaceFactory.cxx
+  otbRadarsat2ImageMetadataInterface.cxx
+
+  otbNoDataHelper.cxx
   )
 
 add_library(OTBMetadata ${OTBMetadata_SRC})
-target_link_libraries(OTBMetadata 
+target_link_libraries(OTBMetadata
   ${OTBBoost_LIBRARIES}
   ${OTBCommon_LIBRARIES}
   ${OTBOSSIMAdapters_LIBRARIES}
diff --git a/Modules/Core/Metadata/src/otbFormosatImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbFormosatImageMetadataInterface.cxx
index aeb636f..59be97f 100644
--- a/Modules/Core/Metadata/src/otbFormosatImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbFormosatImageMetadataInterface.cxx
@@ -18,11 +18,11 @@
 
 #include "otbFormosatImageMetadataInterface.h"
 
-#include <boost/algorithm/string.hpp>
 #include "otbMacro.h"
 #include "otbMath.h"
 #include "itkMetaDataObject.h"
 #include "otbImageKeywordlist.h"
+#include "otbStringUtils.h"
 
 namespace otb
 {
diff --git a/Modules/Core/Metadata/src/otbIkonosImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbIkonosImageMetadataInterface.cxx
index 1751f14..7cf2314 100644
--- a/Modules/Core/Metadata/src/otbIkonosImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbIkonosImageMetadataInterface.cxx
@@ -18,7 +18,7 @@
 
 #include "otbIkonosImageMetadataInterface.h"
 
-#include <boost/algorithm/string.hpp>
+#include "otbStringUtils.h"
 #include "itkMetaDataObject.h"
 #include "otbImageKeywordlist.h"
 
diff --git a/Modules/Core/Metadata/src/otbImageMetadataInterfaceBase.cxx b/Modules/Core/Metadata/src/otbImageMetadataInterfaceBase.cxx
index 784f584..013e4f9 100644
--- a/Modules/Core/Metadata/src/otbImageMetadataInterfaceBase.cxx
+++ b/Modules/Core/Metadata/src/otbImageMetadataInterfaceBase.cxx
@@ -18,9 +18,11 @@
 
 #include "otbImageMetadataInterfaceBase.h"
 
+#include "otbNoDataHelper.h"
 #include "itkMetaDataObject.h"
 #include "itksys/SystemTools.hxx"
 
+
 namespace otb
 {
 
@@ -222,6 +224,12 @@ ImageMetadataInterfaceBase::GetGCPZ(unsigned int GCPnum) const
   else return (0);
 }
 
+bool
+ImageMetadataInterfaceBase::GetNoDataFlags(std::vector<bool> & flags, std::vector<double> & values) const
+{
+  return ReadNoDataFlags(this->GetMetaDataDictionary(),flags,values);
+}
+
 ImageMetadataInterfaceBase::VectorType
 ImageMetadataInterfaceBase::GetGeoTransform() const
 {
diff --git a/Modules/Core/Metadata/src/otbImageMetadataInterfaceFactory.cxx b/Modules/Core/Metadata/src/otbImageMetadataInterfaceFactory.cxx
index 248a69f..31ff54a 100644
--- a/Modules/Core/Metadata/src/otbImageMetadataInterfaceFactory.cxx
+++ b/Modules/Core/Metadata/src/otbImageMetadataInterfaceFactory.cxx
@@ -32,6 +32,8 @@
 
 // SAR Sensors
 #include "otbTerraSarImageMetadataInterfaceFactory.h"
+#include "otbSentinel1ImageMetadataInterfaceFactory.h"
+#include "otbRadarsat2ImageMetadataInterfaceFactory.h"
 
 #include "itkMutexLock.h"
 #include "itkMutexLockHolder.h"
@@ -109,7 +111,9 @@ ImageMetadataInterfaceFactory
       itk::ObjectFactoryBase::RegisterFactory(FormosatImageMetadataInterfaceFactory::New());
       itk::ObjectFactoryBase::RegisterFactory(QuickBirdImageMetadataInterfaceFactory::New());
       itk::ObjectFactoryBase::RegisterFactory(WorldView2ImageMetadataInterfaceFactory::New());
-      itk::ObjectFactoryBase::RegisterFactory( TerraSarImageMetadataInterfaceFactory::New() );
+      itk::ObjectFactoryBase::RegisterFactory(TerraSarImageMetadataInterfaceFactory::New());
+      itk::ObjectFactoryBase::RegisterFactory(Sentinel1ImageMetadataInterfaceFactory::New());
+      itk::ObjectFactoryBase::RegisterFactory(Radarsat2ImageMetadataInterfaceFactory::New());
       firstTime = false;
       }
     }
diff --git a/Modules/Core/Metadata/src/otbNoDataHelper.cxx b/Modules/Core/Metadata/src/otbNoDataHelper.cxx
new file mode 100644
index 0000000..b5edf9d
--- /dev/null
+++ b/Modules/Core/Metadata/src/otbNoDataHelper.cxx
@@ -0,0 +1,43 @@
+/*=========================================================================
+
+  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 "otbNoDataHelper.h"
+
+#include "itkMetaDataDictionary.h"
+#include "itkMetaDataObject.h"
+#include "otbMetaDataKey.h"
+
+namespace otb
+{
+
+bool ReadNoDataFlags(const itk::MetaDataDictionary& dict, std::vector<bool> & flags, std::vector<double> & values)
+{
+  bool ret = itk::ExposeMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,flags);
+
+  if (ret)
+    ret = itk::ExposeMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,values);
+  
+  return ret;
+}
+
+void WriteNoDataFlags(const std::vector<bool> & flags, const std::vector<double> & values, itk::MetaDataDictionary& dict)
+{
+ itk::EncapsulateMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,flags);
+ itk::EncapsulateMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,values);
+}
+
+} // End namespace otb
diff --git a/Modules/Core/Metadata/src/otbPleiadesImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbPleiadesImageMetadataInterface.cxx
index 309d803..d1693a8 100644
--- a/Modules/Core/Metadata/src/otbPleiadesImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbPleiadesImageMetadataInterface.cxx
@@ -18,13 +18,12 @@
 
 #include "otbPleiadesImageMetadataInterface.h"
 
-#include <boost/algorithm/string.hpp>
 #include "otbMacro.h"
 #include "itkMetaDataObject.h"
 #include "otbImageKeywordlist.h"
-#include <boost/lexical_cast.hpp>
+#include "otbStringUtils.h"
 
-//uyseful constants
+//useful constants
 #include <otbMath.h>
 
 namespace otb
diff --git a/Modules/Core/Metadata/src/otbQuickBirdImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbQuickBirdImageMetadataInterface.cxx
index 3f17d32..b4337e5 100644
--- a/Modules/Core/Metadata/src/otbQuickBirdImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbQuickBirdImageMetadataInterface.cxx
@@ -18,7 +18,7 @@
 
 #include "otbQuickBirdImageMetadataInterface.h"
 
-#include <boost/algorithm/string.hpp>
+#include "otbStringUtils.h"
 #include "itkMetaDataObject.h"
 #include "otbImageKeywordlist.h"
 
diff --git a/Modules/Core/Metadata/src/otbRadarsat2ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbRadarsat2ImageMetadataInterface.cxx
new file mode 100644
index 0000000..748c45d
--- /dev/null
+++ b/Modules/Core/Metadata/src/otbRadarsat2ImageMetadataInterface.cxx
@@ -0,0 +1,260 @@
+/*=========================================================================
+
+  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 "otbSarImageMetadataInterface.h"
+#include "otbRadarsat2ImageMetadataInterface.h"
+
+#include "otbMacro.h"
+#include "itkMetaDataObject.h"
+#include "otbImageKeywordlist.h"
+
+//useful constants
+#include <otbMath.h>
+
+namespace otb
+{
+
+Radarsat2ImageMetadataInterface
+::Radarsat2ImageMetadataInterface()
+{
+
+}
+
+bool
+Radarsat2ImageMetadataInterface::CanRead() const
+{
+  std::string sensorID = GetSensorID();
+
+  if (sensorID.find("RADARSAT-2") != std::string::npos)
+    {
+    return true;
+    }
+  else
+    return false;
+}
+
+
+void
+Radarsat2ImageMetadataInterface::
+CreateCalibrationLookupData(const short type)
+  {
+   std::string lut = "SigmaNought";
+
+   switch (type)
+     {
+     case SarCalibrationLookupData::BETA:
+     {
+     lut = "BetaNought";
+     }
+     break;
+
+     case SarCalibrationLookupData::GAMMA:
+     {
+     lut = "GammaNought";
+     }
+     break;
+
+     case SarCalibrationLookupData::DN:
+     {
+     lut = "DN";
+     }
+     break;
+
+     case SarCalibrationLookupData::SIGMA:
+     default:
+     {
+     lut = "SigmaNought";
+     }
+     break;
+     }
+
+  const ImageKeywordlistType imageKeywordlist =  this->GetImageKeywordlist();
+  const std::string key = "referenceNoiseLevel[" + lut + "].gain";
+
+  Radarsat2CalibrationLookupData::GainListType glist;
+  int offset = 0;
+
+  Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey("referenceNoiseLevel[" + lut + "].gain"), glist, "referenceNoiseLevel[" + lut + "].gain");
+
+  Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey("referenceNoiseLevel[" + lut + "].offset"), "referenceNoiseLevel[" + lut + "].offset");
+
+  Radarsat2CalibrationLookupData::Pointer sarLut;
+  sarLut = Radarsat2CalibrationLookupData::New();
+  sarLut->InitParameters(type, offset, glist);
+  this->SetCalibrationLookupData(sarLut);
+
+}
+
+void
+Radarsat2ImageMetadataInterface
+::ParseDateTime(const char* key, std::vector<int>& dateFields) const
+{
+  if(dateFields.size() < 1 )
+    {
+    //parse from keyword list
+    if (!this->CanRead())
+      {
+      itkExceptionMacro(<< "Invalid Metadata, not a valid product");
+      }
+
+    const ImageKeywordlistType imageKeywordlist  = this->GetImageKeywordlist();
+    if (!imageKeywordlist.HasKey(key))
+      {
+      itkExceptionMacro( << "no key named '" << key << "'");
+      }
+
+    std::string date_time_str = imageKeywordlist.GetMetadataByKey(key);
+    date_time_str.resize(date_time_str.size() - 1);
+    Utils::ConvertStringToVector(date_time_str, dateFields, key, "-T:.");
+    }
+}
+
+int
+Radarsat2ImageMetadataInterface::GetYear() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 0 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[0], "support_data.image_date(year)" );
+    }
+  return value;
+}
+
+int
+Radarsat2ImageMetadataInterface::GetMonth() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 1 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[1], "support_data.image_date(month)" );
+    }
+  return value;
+}
+
+int
+Radarsat2ImageMetadataInterface::GetDay() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 2 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[2], "support_data.image_date(day)" );
+    }
+  return value;
+}
+
+int
+Radarsat2ImageMetadataInterface::GetHour() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 3 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[3], "support_data.image_date(hour)" );
+    }
+  return value;
+}
+
+int
+Radarsat2ImageMetadataInterface::GetMinute() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 4 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[4], "support_data.image_date(minute)" );
+    }
+  return value;
+}
+
+int
+Radarsat2ImageMetadataInterface::GetProductionYear() const
+{
+  int value = 0;
+  ParseDateTime("support_data.date", m_ProductionDateFields);
+  if(m_ProductionDateFields.size() > 0 )
+    {
+    value = Utils::LexicalCast<int>( m_ProductionDateFields[0], "support_data.image_date(year)" );
+    }
+  return value;
+
+}
+
+int
+Radarsat2ImageMetadataInterface::GetProductionMonth() const
+{
+  int value = 0;
+  ParseDateTime("support_data.date", m_ProductionDateFields);
+  if(m_ProductionDateFields.size() > 1 )
+    {
+    value = Utils::LexicalCast<int>( m_ProductionDateFields[1], "support_data.image_date(production month)" );
+    }
+  return value;
+}
+
+int
+Radarsat2ImageMetadataInterface::GetProductionDay() const
+{
+  int value = 0;
+  ParseDateTime("support_data.date", m_ProductionDateFields);
+  if(m_ProductionDateFields.size() > 2 )
+    {
+    value = Utils::LexicalCast<int>( m_ProductionDateFields[2], "support_data.image_date(production day)" );
+    }
+  return value;
+}
+
+
+double
+Radarsat2ImageMetadataInterface::GetPRF() const
+{
+  return 0;
+}
+
+double
+Radarsat2ImageMetadataInterface::GetRSF() const
+{
+  return 0;
+}
+
+double
+Radarsat2ImageMetadataInterface::GetRadarFrequency() const
+{
+  return 0;
+}
+
+double
+Radarsat2ImageMetadataInterface::GetCenterIncidenceAngle() const
+{
+  return 0;
+}
+
+Radarsat2ImageMetadataInterface::UIntVectorType
+Radarsat2ImageMetadataInterface::
+GetDefaultDisplay() const
+{
+  UIntVectorType rgb(3);
+  rgb[0] = 0;
+  rgb[1] = 0;
+  rgb[2] = 0;
+  return rgb;
+}
+
+} // end namespace otb
diff --git a/Modules/Core/Metadata/src/otbRadarsat2ImageMetadataInterfaceFactory.cxx b/Modules/Core/Metadata/src/otbRadarsat2ImageMetadataInterfaceFactory.cxx
new file mode 100644
index 0000000..e9f656c
--- /dev/null
+++ b/Modules/Core/Metadata/src/otbRadarsat2ImageMetadataInterfaceFactory.cxx
@@ -0,0 +1,58 @@
+/*=========================================================================
+
+  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 <typeinfo>
+#include <cassert>
+
+#include "otbRadarsat2ImageMetadataInterfaceFactory.h"
+#include "otbRadarsat2ImageMetadataInterface.h"
+
+#include "itkCreateObjectFunction.h"
+#include "itkVersion.h"
+
+namespace otb
+{
+Radarsat2ImageMetadataInterfaceFactory
+::Radarsat2ImageMetadataInterfaceFactory()
+{
+  this->RegisterOverride("SarImageMetadataInterface",
+                         "otbRadarsat2ImageMetadataInterface",
+                         "Radarsat2 Metadata Interface",
+                         1,
+                         itk::CreateObjectFunction<Radarsat2ImageMetadataInterface>::New());
+}
+
+Radarsat2ImageMetadataInterfaceFactory
+::~Radarsat2ImageMetadataInterfaceFactory()
+{
+}
+
+const char*
+Radarsat2ImageMetadataInterfaceFactory::GetITKSourceVersion(void) const
+{
+  return ITK_SOURCE_VERSION;
+}
+
+const char*
+Radarsat2ImageMetadataInterfaceFactory::GetDescription() const
+{
+  return "Radarsat2 Metadata Interface Factory, handle Radarsat2 metadata in OTB";
+}
+
+} // end namespace otb
diff --git a/Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx
index d1a46a9..4dc4568 100644
--- a/Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbSarImageMetadataInterface.cxx
@@ -28,8 +28,90 @@ namespace otb
 SarImageMetadataInterface
 ::SarImageMetadataInterface()
 {
+
 }
 
+const std::string
+SarImageMetadataInterface
+::GetProductType() const
+{
+  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
+  if (!this->CanRead())
+    {
+    itkExceptionMacro(<< "Invalid Metadata");
+    }
+
+    ImageKeywordlistType imageKeywordlist;
+
+    if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
+      {
+      itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
+      }
+
+    if (imageKeywordlist.HasKey("support_data.product_type"))
+      {
+      const std::string product_type = imageKeywordlist.GetMetadataByKey("support_data.product_type");
+      return product_type;
+      }
+    return "";
+}
+
+const std::string
+SarImageMetadataInterface
+::GetAcquisitionMode() const
+{
+  const MetaDataDictionaryType& dict = this->GetMetaDataDictionary();
+  if (!this->CanRead())
+    {
+    itkExceptionMacro(<< "Invalid Metadata");
+    }
+
+    ImageKeywordlistType imageKeywordlist;
+
+    if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
+      {
+      itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
+      }
+
+    if (imageKeywordlist.HasKey("support_data.acquisition_mode"))
+      {
+      const std::string acquisition_mode = imageKeywordlist.GetMetadataByKey("support_data.acquisition_mode");
+      return acquisition_mode;
+      }
+    return "";
+}
+
+void
+SarImageMetadataInterface
+::CreateCalibrationLookupData(const short itkNotUsed(t))
+{
+
+}
+
+const SarImageMetadataInterface::LookupDataPointerType
+SarImageMetadataInterface
+::GetCalibrationLookupData(const short type)
+{
+  if (HasCalibrationLookupDataFlag())
+    {
+    CreateCalibrationLookupData(type);
+    }
+
+  return m_SarLut;
+}
+
+bool
+SarImageMetadataInterface
+::HasCalibrationLookupDataFlag() const
+{
+  const ImageKeywordlist imageKeywordlist = this->GetImageKeywordlist();
+  /* checking if the key exist is more than enough */
+  if (imageKeywordlist.HasKey("support_data.calibration_lookup_flag"))
+    {
+    return true;
+    }
+  return false;
+}
 
 SarImageMetadataInterface::RealType
 SarImageMetadataInterface
@@ -63,7 +145,6 @@ SarImageMetadataInterface
   return SarImageMetadataInterface::GetConstantValuePointSet(0.0);
 }
 
-
 SarImageMetadataInterface::PointSetPointer
 SarImageMetadataInterface
 ::GetRadiometricCalibrationAntennaPatternNewGain() const
@@ -106,6 +187,12 @@ SarImageMetadataInterface
   return polynomialDegree;
 }
 
+double
+SarImageMetadataInterface
+::GetRescalingFactor() const
+{
+  return 1.0;
+}
 SarImageMetadataInterface::IndexType
 SarImageMetadataInterface
 ::GetRadiometricCalibrationNoisePolynomialDegree() const
diff --git a/Modules/Core/Metadata/src/otbSarImageMetadataInterfaceFactory.cxx b/Modules/Core/Metadata/src/otbSarImageMetadataInterfaceFactory.cxx
index 8075a23..f0c7bcf 100644
--- a/Modules/Core/Metadata/src/otbSarImageMetadataInterfaceFactory.cxx
+++ b/Modules/Core/Metadata/src/otbSarImageMetadataInterfaceFactory.cxx
@@ -22,6 +22,8 @@
 
 // SAR Sensors
 #include "otbTerraSarImageMetadataInterfaceFactory.h"
+#include "otbSentinel1ImageMetadataInterfaceFactory.h"
+#include "otbRadarsat2ImageMetadataInterfaceFactory.h"
 
 #include "itkMutexLock.h"
 #include "itkMutexLockHolder.h"
@@ -78,7 +80,9 @@ SarImageMetadataInterfaceFactory
     itk::MutexLockHolder<itk::SimpleMutexLock> mutexHolder(mutex);
     if (firstTime)
       {
-      itk::ObjectFactoryBase::RegisterFactory( TerraSarImageMetadataInterfaceFactory::New() );
+      itk::ObjectFactoryBase::RegisterFactory(TerraSarImageMetadataInterfaceFactory::New());
+      itk::ObjectFactoryBase::RegisterFactory(Sentinel1ImageMetadataInterfaceFactory::New());
+      itk::ObjectFactoryBase::RegisterFactory(Radarsat2ImageMetadataInterfaceFactory::New());
       firstTime = false;
       }
     }
diff --git a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx
new file mode 100644
index 0000000..daac6d7
--- /dev/null
+++ b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx
@@ -0,0 +1,339 @@
+/*=========================================================================
+
+  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 "otbSarImageMetadataInterface.h"
+#include "otbSentinel1ImageMetadataInterface.h"
+
+#include "otbMacro.h"
+#include "itkMetaDataObject.h"
+#include "otbImageKeywordlist.h"
+
+//useful constants
+#include <otbMath.h>
+
+namespace otb
+{
+
+Sentinel1ImageMetadataInterface
+::Sentinel1ImageMetadataInterface()
+{
+
+}
+
+bool
+Sentinel1ImageMetadataInterface::CanRead() const
+{
+  std::string sensorID = GetSensorID();
+
+  if (sensorID.find("SENTINEL-1") != std::string::npos)
+    {
+    return true;
+    }
+  else
+    return false;
+}
+
+void
+Sentinel1ImageMetadataInterface
+::CreateCalibrationLookupData(const short type)
+  {
+    bool sigmaLut = false;
+    bool betaLut = false;
+    bool gammaLut = false;
+    bool dnLut = false;
+
+    switch (type)
+      {
+      case SarCalibrationLookupData::BETA:
+      {
+      betaLut = true;
+      }
+      break;
+
+      case SarCalibrationLookupData::GAMMA:
+      {
+      gammaLut = true;
+      }
+      break;
+
+      case SarCalibrationLookupData::DN:
+      {
+      dnLut = true;
+      }
+      break;
+
+      case SarCalibrationLookupData::SIGMA:
+      default:
+        sigmaLut = true;
+        break;
+      }
+
+  const ImageKeywordlistType imageKeywordlist =  this->GetImageKeywordlist();
+
+  const double firstLineTime = Utils::LexicalCast<double>(imageKeywordlist.GetMetadataByKey("calibration.startTime"), "calibration.startTime(double)");
+
+  const double lastLineTime = Utils::LexicalCast<double>(imageKeywordlist.GetMetadataByKey("calibration.stopTime"), "calibration.stopTime(double)");
+
+  const std::string bandPrefix = "Band[0]."; //make && use GetBandPrefix(subSwath, polarisation)
+
+  const int numOfLines = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey(bandPrefix + "number_lines"), bandPrefix + "number_lines(int)");
+
+  const int count = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey("calibration.count"), "calibration.count");
+
+  std::vector<Sentinel1CalibrationStruct> calibrationVectorList(count);
+
+  for(int i = 0; i < count; i++)
+    {
+    Sentinel1CalibrationStruct calibrationVector;
+
+    std::stringstream prefix;
+    prefix << "calibration.calibrationVector[" << i << "].";
+
+    calibrationVector.line = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey(prefix.str() + "line"), prefix.str() + "line");
+
+    calibrationVector.timeMJD =  Utils::LexicalCast<double>(imageKeywordlist.GetMetadataByKey(prefix.str() + "azimuthTime"), prefix.str() + "azimuthTime");
+
+    Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "pixel"), calibrationVector.pixels, prefix.str() + "pixel");
+
+    if (sigmaLut) {
+    Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "sigmaNought"), calibrationVector.vect, prefix.str() + "sigmaNought");
+      }
+
+    if (betaLut) {
+    Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "betaNought"), calibrationVector.vect, prefix.str() + "betaNought");
+    }
+
+    if (gammaLut) {
+    Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "gamma"), calibrationVector.vect, prefix.str() + "gamma");
+    }
+
+    if (dnLut) {
+    Utils::ConvertStringToVector(imageKeywordlist.GetMetadataByKey(prefix.str() + "dn"), calibrationVector.vect, prefix.str() + "dn");
+    }
+
+    calibrationVectorList[i] = calibrationVector;
+
+    }
+
+  Sentinel1CalibrationLookupData::Pointer sarLut;
+  sarLut = Sentinel1CalibrationLookupData::New();
+  sarLut->InitParameters(type, firstLineTime, lastLineTime, numOfLines, count, calibrationVectorList);
+  this->SetCalibrationLookupData(sarLut);
+
+
+  }
+
+void
+Sentinel1ImageMetadataInterface
+::ParseDateTime(const char* key, std::vector<int>& dateFields) const
+{
+  if(dateFields.size() < 1 )
+    {
+    //parse from keyword list
+    if (!this->CanRead())
+      {
+      itkExceptionMacro(<< "Invalid Metadata, not a valid product");
+      }
+
+    const ImageKeywordlistType imageKeywordlist  = this->GetImageKeywordlist();
+    if (!imageKeywordlist.HasKey(key))
+      {
+      itkExceptionMacro( << "no key named " << key );
+      }
+
+    const std::string date_time_str = imageKeywordlist.GetMetadataByKey(key);
+    Utils::ConvertStringToVector(date_time_str, dateFields, key, "T:-.");
+    }
+
+}
+
+int
+Sentinel1ImageMetadataInterface::GetYear() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 0 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[0], "support_data.image_date:year(int)" );
+    }
+  else
+    {
+    itkExceptionMacro( << "Invalid year" );
+    }
+  return value;
+}
+
+int
+Sentinel1ImageMetadataInterface::GetMonth() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 1 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[1], "support_data.image_date:month(int)" );
+    }
+  else
+    {
+    itkExceptionMacro( << "Invalid month" );
+    }
+  return value;
+}
+
+int
+Sentinel1ImageMetadataInterface::GetDay() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 2 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[2], "support_data.image_date:day(int)");
+    }
+  else
+    {
+    itkExceptionMacro( << "Invalid day" );
+    }
+  return value;
+}
+
+int
+Sentinel1ImageMetadataInterface::GetHour() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 3 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[3], "support_data.image_date:hour(int)");
+    }
+  else
+    {
+    itkExceptionMacro( << "Invalid hour" );
+    }
+  return value;
+}
+
+int
+Sentinel1ImageMetadataInterface::GetMinute() const
+{
+  int value = 0;
+  ParseDateTime("support_data.image_date", m_AcquisitionDateFields);
+  if(m_AcquisitionDateFields.size() > 4 )
+    {
+    value = Utils::LexicalCast<int>( m_AcquisitionDateFields[4], "support_data.image_date:minute(int)");
+    }
+  else
+    {
+    itkExceptionMacro( << "Invalid minute" );
+    }
+  return value;
+}
+
+int
+Sentinel1ImageMetadataInterface::GetProductionYear() const
+{
+  int value = 0;
+  ParseDateTime("support_data.date", m_ProductionDateFields);
+  if(m_ProductionDateFields.size() > 0 )
+    {
+    value = Utils::LexicalCast<int>( m_ProductionDateFields[0], "support_data.date:year(int)" );
+    }
+  else
+    {
+    itkExceptionMacro( << "Invalid production year" );
+    }
+  return value;
+
+}
+
+int
+Sentinel1ImageMetadataInterface::GetProductionMonth() const
+{
+  int value = 0;
+  ParseDateTime("support_data.date", m_ProductionDateFields);
+  if(m_ProductionDateFields.size() > 1 )
+    {
+    value = Utils::LexicalCast<int>( m_ProductionDateFields[1], "support_data.date:month(int)" );
+    }
+  else
+    {
+    itkExceptionMacro( << "Invalid production month" );
+    }
+  return value;
+}
+
+int
+Sentinel1ImageMetadataInterface::GetProductionDay() const
+{
+  int value = 0;
+  ParseDateTime("support_data.date", m_ProductionDateFields);
+  if(m_ProductionDateFields.size() > 2 )
+    {
+    value = Utils::LexicalCast<int>( m_ProductionDateFields[2], "support_data.date:day(int)" );
+    }
+  else
+    {
+    itkExceptionMacro( << "Invalid production day" );
+    }
+  return value;
+}
+
+double
+Sentinel1ImageMetadataInterface::GetPRF() const
+{
+  double value = 0;
+  const ImageKeywordlistType imageKeywordlist  = this->GetImageKeywordlist();
+  if (!imageKeywordlist.HasKey("support_data.pulse_repetition_frequency"))
+    {
+    return value;
+    }
+
+  value = Utils::LexicalCast<double>( imageKeywordlist.GetMetadataByKey("support_data.pulse_repetition_frequency"),
+                                      "support_data.pulse_repetition_frequency(double)" );
+
+  return value;
+}
+
+
+Sentinel1ImageMetadataInterface::UIntVectorType
+Sentinel1ImageMetadataInterface::GetDefaultDisplay() const
+{
+  UIntVectorType rgb(3);
+  rgb[0] = 0;
+  rgb[1] = 0;
+  rgb[2] = 0;
+  return rgb;
+}
+
+double
+Sentinel1ImageMetadataInterface::GetRSF() const
+{
+  return 0;
+}
+
+double
+Sentinel1ImageMetadataInterface::GetRadarFrequency() const
+{
+  return 0;
+}
+
+double
+Sentinel1ImageMetadataInterface::GetCenterIncidenceAngle() const
+{
+  return 0;
+}
+
+} // end namespace otb
diff --git a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterfaceFactory.cxx b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterfaceFactory.cxx
new file mode 100644
index 0000000..424f825
--- /dev/null
+++ b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterfaceFactory.cxx
@@ -0,0 +1,58 @@
+/*=========================================================================
+
+  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 <typeinfo>
+#include <cassert>
+
+#include "otbSentinel1ImageMetadataInterfaceFactory.h"
+#include "otbSentinel1ImageMetadataInterface.h"
+
+#include "itkCreateObjectFunction.h"
+#include "itkVersion.h"
+
+namespace otb
+{
+Sentinel1ImageMetadataInterfaceFactory
+::Sentinel1ImageMetadataInterfaceFactory()
+{
+  this->RegisterOverride("SarImageMetadataInterface",
+                         "otbSentinel1ImageMetadataInterface",
+                         "Sentinel1 Metadata Interface",
+                         1,
+                         itk::CreateObjectFunction<Sentinel1ImageMetadataInterface>::New());
+}
+
+Sentinel1ImageMetadataInterfaceFactory
+::~Sentinel1ImageMetadataInterfaceFactory()
+{
+}
+
+const char*
+Sentinel1ImageMetadataInterfaceFactory::GetITKSourceVersion(void) const
+{
+  return ITK_SOURCE_VERSION;
+}
+
+const char*
+Sentinel1ImageMetadataInterfaceFactory::GetDescription() const
+{
+  return "Sentinel1 Metadata Interface Factory, handle Sentinel1 metadata in OTB";
+}
+
+} // end namespace otb
diff --git a/Modules/Core/Metadata/src/otbSpot6ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSpot6ImageMetadataInterface.cxx
index aafa1f5..b862f62 100644
--- a/Modules/Core/Metadata/src/otbSpot6ImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbSpot6ImageMetadataInterface.cxx
@@ -18,12 +18,10 @@
 
 #include "otbSpot6ImageMetadataInterface.h"
 
-#include <boost/algorithm/string.hpp>
 #include "otbMacro.h"
 #include "itkMetaDataObject.h"
 #include "otbImageKeywordlist.h"
-#include <boost/lexical_cast.hpp>
-
+#include "otbStringUtils.h"
 
 namespace otb
 {
diff --git a/Modules/Core/Metadata/src/otbSpotImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSpotImageMetadataInterface.cxx
index 4518bb9..7c4b751 100644
--- a/Modules/Core/Metadata/src/otbSpotImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbSpotImageMetadataInterface.cxx
@@ -18,7 +18,7 @@
 
 #include "otbSpotImageMetadataInterface.h"
 
-#include <boost/algorithm/string.hpp>
+#include "otbStringUtils.h"
 #include "otbMacro.h"
 #include "itkMetaDataObject.h"
 #include "otbImageKeywordlist.h"
diff --git a/Modules/Core/Metadata/src/otbTerraSarImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbTerraSarImageMetadataInterface.cxx
index 05ce273..968b8f8 100644
--- a/Modules/Core/Metadata/src/otbTerraSarImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbTerraSarImageMetadataInterface.cxx
@@ -18,7 +18,7 @@
 
 #include "otbTerraSarImageMetadataInterface.h"
 
-#include <boost/algorithm/string.hpp>
+#include "otbStringUtils.h"
 #include "otbMath.h"
 #include "itkIndex.h"
 #include "itkMetaDataObject.h"
diff --git a/Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx
index 7f78cf6..5a13011 100644
--- a/Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx
+++ b/Modules/Core/Metadata/src/otbWorldView2ImageMetadataInterface.cxx
@@ -18,7 +18,7 @@
 
 #include "otbWorldView2ImageMetadataInterface.h"
 
-#include <boost/algorithm/string.hpp>
+#include "otbStringUtils.h"
 #include "itkMetaDataObject.h"
 #include "otbImageKeywordlist.h"
 
diff --git a/Modules/Core/Metadata/test/CMakeLists.txt b/Modules/Core/Metadata/test/CMakeLists.txt
index 3403244..23e6ef4 100644
--- a/Modules/Core/Metadata/test/CMakeLists.txt
+++ b/Modules/Core/Metadata/test/CMakeLists.txt
@@ -19,9 +19,13 @@ otbSpotImageMetadataInterfaceNew.cxx
 otbQuickBirdImageMetadataInterfaceNew.cxx
 otbIkonosImageMetadataInterfaceNew.cxx
 otbTerraSarImageMetadataInterfaceNew.cxx
+otbSentinel1ImageMetadataInterfaceNew.cxx
 otbWorldView2ImageMetadataInterfaceNew.cxx
 otbDefaultImageMetadataInterface.cxx
 otbImageMetadataInterfaceTest2.cxx
+otbNoDataHelperTest.cxx
+otbSarCalibrationLookupDataTest.cxx
+otbRadarsat2ImageMetadataInterfaceNew.cxx
 )
 
 add_executable(otbMetadataTestDriver ${OTBMetadataTests})
@@ -73,6 +77,28 @@ otb_add_test(NAME ioTvSarImageMetadataInterfaceTest_TSX1PANGKALANBUUNUsingHHCosF
   ${TEMP}/ioTvSarImageMetadataInterface_TSX1PANGKALANBUUNUsingHHCosFile.txt
   )
 
+otb_add_test(NAME ioTvImageMetadataInterfaceBaseTest_SENTINEL1 COMMAND otbMetadataTestDriver
+  --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvImageMetadataInterfaceBase_SENTINEL1.txt
+  ${TEMP}/ioTvImageMetadataInterfaceBase_SENTINEL1.txt
+  otbImageMetadataInterfaceBaseTest
+  LARGEINPUT{SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff}
+  ${TEMP}/ioTvImageMetadataInterfaceBase_SENTINEL1.txt
+  )
+
+otb_add_test(NAME ioTvImageMetadataInterfaceBaseTest_RADARSAT2 COMMAND otbMetadataTestDriver
+  --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvImageMetadataInterfaceBase_RADARSAT2.txt
+  ${TEMP}/ioTvImageMetadataInterfaceBase_RADARSAT2.txt
+  otbImageMetadataInterfaceBaseTest
+  LARGEINPUT{RADARSAT2/ALTONA/Fine_Quad-Pol_Dataset/PK6621_DK406_FQ9_20080405_124900_HH_VV_HV_VH_SLC_Altona/imagery_HV.tif}
+  ${TEMP}/ioTvImageMetadataInterfaceBase_RADARSAT2.txt
+  )
+
+otb_add_test(NAME ioTuSentinel1ImageMetadataInterfaceNew COMMAND otbMetadataTestDriver
+  otbSentinel1ImageMetadataInterfaceNew )
+
+otb_add_test(NAME ioTuRadarsat2ImageMetadataInterfaceNew COMMAND otbMetadataTestDriver
+  otbRadarsat2ImageMetadataInterfaceNew )
+
 otb_add_test(NAME ioTuDefaultImageMetadataInterfaceFactoryNew COMMAND otbMetadataTestDriver
   otbDefaultImageMetadataInterfaceFactoryNew )
 
@@ -351,3 +377,22 @@ foreach( current_file ${GenericTestSPOT6_DATA_INPUTS} )
       ${TEMP}/ioTvOpticalImageMetadataInterface_${current_type}_OUT.txt
     )
 endforeach()
+
+otb_add_test(NAME coreMetaDataNoDataHelperTest COMMAND otbMetadataTestDriver
+  otbNoDataHelperTest)
+
+otb_add_test(NAME ioTvSarCalibrationLookupDataTest_SENTINEL1 COMMAND otbMetadataTestDriver
+  --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvSarCalibrationLookupDataTest_SENTINEL1.txt
+  ${TEMP}/ioTvSarCalibrationLookupDataTest_SENTINEL1.txt
+  otbSarCalibrationLookupDataTest
+  ${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_300_300.tif?&geom=${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_300_300.geom
+  ${TEMP}/ioTvSarCalibrationLookupDataTest_SENTINEL1.txt
+  )
+
+otb_add_test(NAME ioTvSarCalibrationLookupDataTest_RADARSAT2 COMMAND otbMetadataTestDriver
+  --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvSarCalibrationLookupDataTest_RADARSAT2.txt
+  ${TEMP}/ioTvSarCalibrationLookupDataTest_RADARSAT2.txt
+  otbSarCalibrationLookupDataTest
+  ${INPUTDATA}/RADARSAT2_ALTONA_300_300_VV.tif?&geom=${INPUTDATA}/RADARSAT2_ALTONA_300_300_VV.geom
+  ${TEMP}/ioTvSarCalibrationLookupDataTest_RADARSAT2.txt
+  )
\ No newline at end of file
diff --git a/Modules/Core/Metadata/test/otbMetadataTestDriver.cxx b/Modules/Core/Metadata/test/otbMetadataTestDriver.cxx
index d2dfb19..ea205e1 100644
--- a/Modules/Core/Metadata/test/otbMetadataTestDriver.cxx
+++ b/Modules/Core/Metadata/test/otbMetadataTestDriver.cxx
@@ -18,7 +18,11 @@ void RegisterTests()
   REGISTER_TEST(otbQuickBirdImageMetadataInterfaceNew);
   REGISTER_TEST(otbIkonosImageMetadataInterfaceNew);
   REGISTER_TEST(otbTerraSarImageMetadataInterfaceNew);
+  REGISTER_TEST(otbSentinel1ImageMetadataInterfaceNew);
   REGISTER_TEST(otbWorldView2ImageMetadataInterfaceNew);
   REGISTER_TEST(otbDefaultImageMetadataInterface);
   REGISTER_TEST(otbImageMetadataInterfaceTest2);
+  REGISTER_TEST(otbNoDataHelperTest);
+  REGISTER_TEST(otbSarCalibrationLookupDataTest);
+  REGISTER_TEST(otbRadarsat2ImageMetadataInterfaceNew);
 }
diff --git a/Modules/Core/Metadata/test/otbNoDataHelperTest.cxx b/Modules/Core/Metadata/test/otbNoDataHelperTest.cxx
new file mode 100644
index 0000000..4db9ba0
--- /dev/null
+++ b/Modules/Core/Metadata/test/otbNoDataHelperTest.cxx
@@ -0,0 +1,53 @@
+/*=========================================================================
+
+  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 "otbNoDataHelper.h"
+#include "itkMetaDataDictionary.h"
+#include "otbMacro.h"
+
+int otbNoDataHelperTest(int itkNotUsed(argc),char * itkNotUsed(argv) [])
+{
+  std::vector<bool> b1(1,true);
+  std::vector<double> v1(1,0);
+
+  itk::MetaDataDictionary dict;
+
+  otb::WriteNoDataFlags(b1,v1,dict);
+  otb::ReadNoDataFlags(dict,b1,v1);
+  
+  otbControlConditionTestMacro(otb::IsNoData(10,b1,v1)," wrong output of IsNoData function");
+  otbControlConditionTestMacro(!otb::IsNoData(0,b1,v1)," wrong output of IsNoData function");
+  b1[0]=false;
+  otbControlConditionTestMacro(otb::IsNoData(10,b1,v1)," wrong output of IsNoData function");
+  otbControlConditionTestMacro(otb::IsNoData(0,b1,v1)," wrong output of IsNoData function");
+
+
+  std::vector<bool> b2(4,true);
+  std::vector<double> v2(4,1);
+
+  itk::VariableLengthVector<unsigned short int> v(4);
+  v.Fill(10);
+
+  otbControlConditionTestMacro(otb::IsNoData(v,b2,v2)," wrong output of IsNoData function");
+  v[1]=1;
+  otbControlConditionTestMacro(!otb::IsNoData(v,b2,v2)," wrong output of IsNoData function");
+  b2[1]=false;
+  otbControlConditionTestMacro(otb::IsNoData(v,b2,v2)," wrong output of IsNoData function");
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx b/Modules/Core/Metadata/test/otbRadarsat2ImageMetadataInterfaceNew.cxx
similarity index 57%
copy from Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
copy to Modules/Core/Metadata/test/otbRadarsat2ImageMetadataInterfaceNew.cxx
index 45620f8..191ac66 100644
--- a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
+++ b/Modules/Core/Metadata/test/otbRadarsat2ImageMetadataInterfaceNew.cxx
@@ -16,20 +16,17 @@
 
 =========================================================================*/
 
-#include "otbStreamingHistogramVectorImageFilter.h"
-#include "otbVectorImage.h"
 
-typedef otb::VectorImage<unsigned char>               VectorImageType;
-typedef otb::StreamingHistogramVectorImageFilter<VectorImageType>                SHVIFType;
 
+#include "itkMacro.h"
+#include <iostream>
+#include "otbRadarsat2ImageMetadataInterface.h"
 
-
-int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
+int otbRadarsat2ImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
 {
+  otb::Radarsat2ImageMetadataInterface::Pointer object = otb::Radarsat2ImageMetadataInterface::New();
 
-  SHVIFType::Pointer SHVIFFilter = SHVIFType::New();
-
-  std::cout << SHVIFFilter << std::endl;
+  std::cout << object << std::endl;
 
   return EXIT_SUCCESS;
 }
diff --git a/Modules/Core/Metadata/test/otbSarCalibrationLookupDataTest.cxx b/Modules/Core/Metadata/test/otbSarCalibrationLookupDataTest.cxx
new file mode 100644
index 0000000..5d323c9
--- /dev/null
+++ b/Modules/Core/Metadata/test/otbSarCalibrationLookupDataTest.cxx
@@ -0,0 +1,75 @@
+/*=========================================================================
+
+  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 <iostream>
+#include "itkMacro.h"
+#include "otbImage.h"
+#include "otbImageFileReader.h"
+#include "otbSarImageMetadataInterfaceFactory.h"
+
+int otbSarCalibrationLookupDataTest(int argc, char* argv[])
+{
+  typedef double                                  RealType;
+  typedef otb::SarImageMetadataInterface             ImageMetadataInterfaceType;
+  typedef otb::SarCalibrationLookupData              LookupDataType;
+  typedef otb::Image<double,  2>                     InputImageType;
+  typedef otb::ImageFileReader<InputImageType>       ImageReaderType;
+
+  if (argc < 3 )
+    {
+    std::cerr << "Usage: otbSarCalibationLookupDataTest /path/to/input/file /path/to/output/file  !"<< std::endl;
+    return EXIT_FAILURE;
+    }
+  ImageReaderType::Pointer reader = ImageReaderType::New();
+  reader->SetFileName(argv[1]);
+  reader->UpdateOutputInformation();
+
+  const char *  outFileName = argv[2];
+  std::ofstream outfile;
+  outfile.open(outFileName);
+
+  ImageMetadataInterfaceType::Pointer imageMetadataInterface =
+    otb::SarImageMetadataInterfaceFactory::CreateIMI( reader->GetOutput()->GetMetaDataDictionary() );
+
+  if (!imageMetadataInterface.IsNotNull())
+    {
+    std::cerr << "cannot create a otb::SarImageMetadataInterface for input image." << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  const std::string sensorId = imageMetadataInterface->GetSensorID();
+
+  outfile << sensorId << std::endl;
+
+  LookupDataType::Pointer lookupDataObj = imageMetadataInterface->GetCalibrationLookupData(0);
+
+  if (!lookupDataObj.IsNotNull())
+    {
+    std::cerr << "lookupDataObj is Null"<< std::endl;
+    return EXIT_FAILURE;
+    }
+
+  RealType lutVal = static_cast<RealType>(lookupDataObj->GetValue(10,19));
+
+  outfile << imageMetadataInterface->HasCalibrationLookupDataFlag() << std::endl;
+  outfile << lutVal << std::endl;
+
+  return EXIT_SUCCESS;
+
+}
diff --git a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx b/Modules/Core/Metadata/test/otbSentinel1ImageMetadataInterfaceNew.cxx
similarity index 57%
copy from Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
copy to Modules/Core/Metadata/test/otbSentinel1ImageMetadataInterfaceNew.cxx
index 45620f8..c0a805a 100644
--- a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
+++ b/Modules/Core/Metadata/test/otbSentinel1ImageMetadataInterfaceNew.cxx
@@ -16,20 +16,17 @@
 
 =========================================================================*/
 
-#include "otbStreamingHistogramVectorImageFilter.h"
-#include "otbVectorImage.h"
 
-typedef otb::VectorImage<unsigned char>               VectorImageType;
-typedef otb::StreamingHistogramVectorImageFilter<VectorImageType>                SHVIFType;
 
+#include "itkMacro.h"
+#include <iostream>
+#include "otbSentinel1ImageMetadataInterface.h"
 
-
-int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
+int otbSentinel1ImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
 {
+  otb::Sentinel1ImageMetadataInterface::Pointer object = otb::Sentinel1ImageMetadataInterface::New();
 
-  SHVIFType::Pointer SHVIFFilter = SHVIFType::New();
-
-  std::cout << SHVIFFilter << std::endl;
+  std::cout << object << std::endl;
 
   return EXIT_SUCCESS;
 }
diff --git a/Modules/Core/ObjectList/include/otbObjectList.h b/Modules/Core/ObjectList/include/otbObjectList.h
index 9e66210..eb7781e 100644
--- a/Modules/Core/ObjectList/include/otbObjectList.h
+++ b/Modules/Core/ObjectList/include/otbObjectList.h
@@ -52,27 +52,28 @@ public:
   typedef TObject                        ObjectType;
   typedef itk::SmartPointer<ObjectType>  ObjectPointerType;
   typedef std::vector<ObjectPointerType> InternalContainerType;
+  typedef typename InternalContainerType::size_type InternalContainerSizeType;
 
   /**
    * Set the minimum capacity of the vector.
    * \param size Size of the vector to reserve.
    */
-  void Reserve(unsigned int size);
+  void Reserve(InternalContainerSizeType size);
   /**
    * Get the capacity of the vector.
    * \return The capacity of the vector.
    */
-  unsigned int Capacity(void) const;
+  InternalContainerSizeType Capacity(void) const;
   /**
    * Get the number of elements in the vector.
    * \return The number of elements in the vector.
    */
-  unsigned int Size(void) const;
+  InternalContainerSizeType Size(void) const;
   /**
    * Resize the maximal list capacity.
    * \param size The new maximal size of the list.
    */
-  void Resize(unsigned int size);
+  void Resize(InternalContainerSizeType size);
   /**
    * Append an element to the list.
    * \param element Pointer to the element to append.
diff --git a/Modules/Core/ObjectList/include/otbObjectList.txx b/Modules/Core/ObjectList/include/otbObjectList.txx
index 34f99b6..e48d0f0 100644
--- a/Modules/Core/ObjectList/include/otbObjectList.txx
+++ b/Modules/Core/ObjectList/include/otbObjectList.txx
@@ -37,7 +37,7 @@ ObjectList<TObject>
 template <class TObject>
 void
 ObjectList<TObject>
-::Reserve(unsigned int size)
+::Reserve(InternalContainerSizeType size)
 {
   m_InternalContainer.reserve(size);
 }
@@ -46,7 +46,7 @@ ObjectList<TObject>
  * \return The capacity of the vector.
  */
 template <class TObject>
-unsigned int
+typename ObjectList<TObject>::InternalContainerSizeType
 ObjectList<TObject>
 ::Capacity(void) const
 {
@@ -57,7 +57,7 @@ ObjectList<TObject>
  * \return The number of elements in the vector.
  */
 template <class TObject>
-unsigned int
+typename ObjectList<TObject>::InternalContainerSizeType
 ObjectList<TObject>
 ::Size(void) const
 {
@@ -70,7 +70,7 @@ ObjectList<TObject>
 template <class TObject>
 void
 ObjectList<TObject>
-::Resize(unsigned int size)
+::Resize(InternalContainerSizeType size)
 {
   m_InternalContainer.resize(size);
 }
diff --git a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h
index 4ebdfce..3b44ec0 100644
--- a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h
+++ b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.h
@@ -93,6 +93,8 @@ protected:
    */
   virtual void GenerateInputRequestedRegion();
 
+  virtual void GenerateOutputInformation();
+
   /**
    * Re-implement the method ThreadedGenerateData to mask area outside the deformation grid
    */
diff --git a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx
index a3e9972..19ba9ff 100644
--- a/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx
+++ b/Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx
@@ -23,6 +23,9 @@
 
 #include "otbStreamingWarpImageFilter.h"
 #include "itkImageRegionIteratorWithIndex.h"
+#include "itkDefaultConvertPixelTraits.h"
+#include "itkMetaDataObject.h"
+#include "otbMetaDataKey.h"
 
 namespace otb
 {
@@ -205,6 +208,40 @@ StreamingWarpImageFilter<TInputImage, TOutputImage, TDisplacementField>
 template<class TInputImage, class TOutputImage, class TDisplacementField>
 void
 StreamingWarpImageFilter<TInputImage, TOutputImage, TDisplacementField>
+::GenerateOutputInformation()
+{
+  Superclass::GenerateOutputInformation();
+
+  // Set the NoData flag to the edge padding value
+  itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
+  std::vector<bool> noDataValueAvailable;
+  bool ret = itk::ExposeMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+  if (!ret)
+    {
+    noDataValueAvailable.resize(this->GetOutput()->GetNumberOfComponentsPerPixel(),false);
+    }
+  std::vector<double> noDataValue;
+  ret = itk::ExposeMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValue);
+  if (!ret)
+    {
+    noDataValue.resize(this->GetOutput()->GetNumberOfComponentsPerPixel(),0.0);
+    }
+  PixelType edgePadding = this->GetEdgePaddingValue();
+  for (unsigned int i=0; i<noDataValueAvailable.size() ; ++i)
+    {
+    if (!noDataValueAvailable[i])
+      {
+      noDataValueAvailable[i] = true;
+      noDataValue[i] = itk::DefaultConvertPixelTraits<PixelType>::GetNthComponent(i,edgePadding);
+      }
+    }
+  itk::EncapsulateMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+  itk::EncapsulateMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValue);
+}
+
+template<class TInputImage, class TOutputImage, class TDisplacementField>
+void
+StreamingWarpImageFilter<TInputImage, TOutputImage, TDisplacementField>
 ::ThreadedGenerateData(
   const OutputImageRegionType& outputRegionForThread,
   itk::ThreadIdType threadId )
diff --git a/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx b/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx
index 0e69743..4fad71c 100644
--- a/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx
+++ b/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx
@@ -44,10 +44,22 @@
 
 #include "otbInverseSensorModel.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/imaging/ossimImageHandler.h"
 #include "ossim/base/ossimKeywordlist.h"
 #include "ossim/imaging/ossimImageHandlerRegistry.h"
 #include "ossim/projection/ossimProjectionFactoryRegistry.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/imaging/ossimImageHandler.h"
+#include "ossim/base/ossimKeywordlist.h"
+#include "ossim/imaging/ossimImageHandlerRegistry.h"
+#include "ossim/projection/ossimProjectionFactoryRegistry.h"
+#endif
 
 int otbCreateProjectionWithOSSIM(int argc, char* argv[])
 {
diff --git a/Modules/Core/Transform/test/otbCreateProjectionWithOTB.cxx b/Modules/Core/Transform/test/otbCreateProjectionWithOTB.cxx
index a02b23b..ef4ab4c 100644
--- a/Modules/Core/Transform/test/otbCreateProjectionWithOTB.cxx
+++ b/Modules/Core/Transform/test/otbCreateProjectionWithOTB.cxx
@@ -44,10 +44,22 @@
 
 #include "otbInverseSensorModel.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include "ossim/base/ossimKeywordlist.h"
 #include "ossim/base/ossimGpt.h"
 #include "ossim/projection/ossimProjectionFactoryRegistry.h"
 #include "ossim/imaging/ossimImageHandlerRegistry.h"
+#pragma GCC diagnostic pop
+#else
+#include "ossim/base/ossimKeywordlist.h"
+#include "ossim/base/ossimGpt.h"
+#include "ossim/projection/ossimProjectionFactoryRegistry.h"
+#include "ossim/imaging/ossimImageHandlerRegistry.h"
+#endif
 
 int otbCreateProjectionWithOTB(int argc, char* argv[])
 {
diff --git a/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h b/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h
index e4145be..33c81ef 100644
--- a/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h
+++ b/Modules/Core/VectorDataBase/include/otbGISConnectionImplementation.h
@@ -69,7 +69,7 @@ public:
 
   virtual void ConnectToDB(){}
 
-  virtual void PerformTransaction(const TransactorType& theTransaction) const {}
+  virtual void PerformTransaction(const TransactorType& itkNotUsed(theTransaction)) const {}
 
 protected:
   /** Constructor */
diff --git a/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h b/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h
index 0816817..0c0da9e 100644
--- a/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h
+++ b/Modules/Core/VectorDataBase/include/otbPolyLineParametricPathWithValue.h
@@ -18,7 +18,15 @@
 #ifndef __otbPolyLineParametricPathWithValue_h
 #define __otbPolyLineParametricPathWithValue_h
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include "itkPolyLineParametricPath.h"
+#pragma GCC diagnostic pop
+#else
+#include "itkPolyLineParametricPath.h"
+#endif
+
 #include "itkMetaDataObject.h"
 #include "otbRemoteSensingRegion.h"
 #include "otbMacro.h"
diff --git a/Modules/Core/VectorDataBase/include/otbVectorDataKeywordlist.h b/Modules/Core/VectorDataBase/include/otbVectorDataKeywordlist.h
index 8b16fb5..10fd9a7 100644
--- a/Modules/Core/VectorDataBase/include/otbVectorDataKeywordlist.h
+++ b/Modules/Core/VectorDataBase/include/otbVectorDataKeywordlist.h
@@ -21,7 +21,7 @@
 #include "itkLightObject.h"
 #include "itkObjectFactory.h"
 #include <vector>
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wshadow"
 #include "ogr_feature.h"
@@ -141,8 +141,9 @@ public:
 
   /** Constructor */
   VectorDataKeywordlist();
+
   /** Destructor */
-  virtual ~VectorDataKeywordlist();
+  ~VectorDataKeywordlist();
 
   /** Constructor by copy (deep copy)*/
   VectorDataKeywordlist(const Self& other);
diff --git a/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx b/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx
index 4404db5..90737a9 100644
--- a/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx
+++ b/Modules/Core/VectorDataBase/src/otbVectorDataKeywordlist.cxx
@@ -20,6 +20,9 @@
 
 #include "otbVectorDataKeywordlist.h"
 
+#include "otbConfigure.h"
+#include "itkNumericTraits.h"
+
 namespace otb
 {
 
@@ -88,25 +91,39 @@ VectorDataKeywordlist
     {
     if (key.compare(m_FieldList[i].first->GetNameRef()) == 0)
       {
-      if (m_FieldList[i].first->GetType() == OFTString)
+      switch(m_FieldList[i].first->GetType())
+        {
+        case OFTString:
         {
         return m_FieldList[i].second.String;
         }
-      if (m_FieldList[i].first->GetType() == OFTInteger)
+        case OFTInteger:
         {
         std::ostringstream ss;
         ss << std::setprecision(15) << m_FieldList[i].second.Integer;
         return ss.str();
         }
-      if (m_FieldList[i].first->GetType() == OFTReal)
+#ifdef OTB_USE_GDAL_20
+        case OFTInteger64:
+        {
+        std::ostringstream ss;
+        ss << std::setprecision(15) << m_FieldList[i].second.Integer64;
+        return ss.str();
+        }
+#endif     
+        case OFTReal:
         {
         std::ostringstream ss;
         ss << std::setprecision(15) << m_FieldList[i].second.Real;
         return ss.str();
         }
-      itkExceptionMacro(
-        << "This type (" << m_FieldList[i].first->GetType() <<
-        ") is not handled (yet) by GetFieldAsString(), please request for it");
+        default:
+        {
+        itkExceptionMacro(
+          << "Type of field " << m_FieldList[i].first->GetNameRef() << " (" << m_FieldList[i].first->GetType() <<
+          ") is not handled (yet) by GetFieldAsString(), please request for it");
+        }
+        }
       }
     }
   return "";
@@ -120,24 +137,30 @@ VectorDataKeywordlist
       {
       if (key.compare(m_FieldList[i].first->GetNameRef()) == 0)
         {
-        if (m_FieldList[i].first->GetType() == OFTInteger)
+        switch (m_FieldList[i].first->GetType())
+          {
+          case OFTInteger:
           {
           return (double)(m_FieldList[i].second.Integer);
           }
-        if (m_FieldList[i].first->GetType() == OFTReal)
+          case OFTReal:
           {
           return (double)(m_FieldList[i].second.Real);
           }
-        if (m_FieldList[i].first->GetType() == OFTString)
+          case OFTString:
           {
           std::istringstream is(m_FieldList[i].second.String);
           double value;
           is >> value;
           return value;
           }
-        itkExceptionMacro(
-          << "This type (" << m_FieldList[i].first->GetType() <<
-          ") is not handled (yet) by GetFieldAsDouble(), please request for it");
+          default:
+          {
+           itkExceptionMacro(
+             << "Type of field " << m_FieldList[i].first->GetNameRef() << " (" << m_FieldList[i].first->GetType() <<
+             ") is not handled (yet) by GetFieldAsDouble(), please request for it");
+          }
+          }
         }
       }
     return 0.;
@@ -151,26 +174,47 @@ VectorDataKeywordlist
       {
       if (key.compare(m_FieldList[i].first->GetNameRef()) == 0)
         {
-        if (m_FieldList[i].first->GetType() == OFTInteger)
+        switch(m_FieldList[i].first->GetType())
+          {
+          case OFTInteger:
           {
-          return (int)(m_FieldList[i].second.Integer);
+        return (int)(m_FieldList[i].second.Integer);
+        }
+#ifdef OTB_USE_GDAL_20
+        // Some fields that were OFTInteger with gdal 1.x are now
+        // exposed as OFTInteger64. So as to make the old code still
+        // work with the same data, here we downcast to Integer (if
+        // and only if no overflow occur).
+        case OFTInteger64:
+          {
+          if(m_FieldList[i].second.Integer64 > itk::NumericTraits<int>::max())
+            {
+            itkExceptionMacro(<<"value "<<m_FieldList[i].second.Integer64<<" of field "<<m_FieldList[i].first->GetNameRef()<<" can not be safely casted to 32 bits integer");
+            }
+          
+          return static_cast<int>(m_FieldList[i].second.Integer64);
           }
-        if (m_FieldList[i].first->GetType() == OFTReal)
+#endif    
+        case OFTReal:
           {
           return (int)(m_FieldList[i].second.Real);
           }
-        if (m_FieldList[i].first->GetType() == OFTString)
+        case OFTString:
           {
           std::istringstream is(m_FieldList[i].second.String);
           int value;
           is >> value;
           return value;
           }
+        default:
+        {
         itkExceptionMacro(
-          << "This type (" << m_FieldList[i].first->GetType() <<
+          << "Type of field " << m_FieldList[i].first->GetNameRef() << " (" << m_FieldList[i].first->GetType() <<
           ") is not handled (yet) by GetFieldAsInt(), please request for it");
         }
-      }
+        }
+        }
+        }
     return 0.;
 }
 
@@ -383,51 +427,11 @@ VectorDataKeywordlist::CopyFieldList(const Self& kwl)
                              kwl.GetNthField(idx).second.Real);
       break;
       }
-      case OFTIntegerList:
-      {
-      std::cerr << "Type not handled for Integer conversion" <<std::endl;
-      break;
-      }
-      case OFTRealList:
-      {
-      std::cerr << "Type not handled for Integer conversion"<<std::endl;
-      break;
-      }
-      case OFTStringList:
-      {
-      std::cerr << "Type not handled for Integer conversion"<<std::endl;
-      break;
-      }
-      case OFTWideString:
-      {
-      std::cerr << "Type not handled for Integer conversion"<<std::endl;
-      break;
-      }
-      case OFTWideStringList:
-      {
-      std::cerr << "Type not handled for Integer conversion"<<std::endl;
-      break;
-      }
-      case OFTBinary:
-      {
-      std::cerr << "Type not handled for Integer conversion"<<std::endl;
-      break;
-      }
-      case OFTDate:
-      {
-      std::cerr << "Type not handled for Integer conversion"<<std::endl;
-      break;
-      }
-      case OFTTime:
-      {
-      std::cerr << "Type not handled for Integer conversion"<<std::endl;
-      break;
-      }
-      case OFTDateTime:
+      default:
       {
       std::cerr << "Type not handled for Integer conversion"<<std::endl;
       break;
-      }
+      }      
       }
     }
 }
@@ -447,21 +451,11 @@ VectorDataKeywordlist
       output << field.second.Integer;
       break;
       }
-    case OFTIntegerList:
-      {
-      output << "Type not handled for printing";
-      break;
-      }
     case OFTReal:
       {
       output << field.second.Real;
       break;
       }
-    case OFTRealList:
-      {
-      std::cerr << "Type not handled for printing" << std::endl;
-      break;
-      }
     case OFTString:
       {
       if (field.second.String != NULL)
@@ -470,26 +464,6 @@ VectorDataKeywordlist
         }
       break;
       }
-    case OFTStringList:
-      {
-      output << "Type not handled for printing";
-      break;
-      }
-    case OFTWideString:
-      {
-      output << "Type not handled for printing";
-      break;
-      }
-    case OFTWideStringList:
-      {
-      output << "Type not handled for printing";
-      break;
-      }
-    case OFTBinary:
-      {
-      output << "Type not handled for printing";
-      break;
-      }
     case OFTDate:
       {
       output << field.second.Date.Year << field.second.Date.Month << field.second.Date.Day;
@@ -506,6 +480,16 @@ VectorDataKeywordlist
              << field.second.Date.Hour << field.second.Date.Minute << field.second.Date.Second;
       break;
       }
+#ifdef OTB_USE_GDAL_20
+    case OFTInteger64:
+    {
+    output << std::setprecision(15)<<field.second.Integer64;
+    break;
+    }
+#endif     
+    default:
+      output << "Type not handled for printing";
+      break;
     }
   output << std::endl;
   return output.str();
@@ -524,21 +508,18 @@ VectorDataKeywordlist
       outField.second.Integer = field.second.Integer;
       break;
       }
-    case OFTIntegerList:
-      {
-      std::cerr << "OGR type not handled" << std::endl;
-      break;
-      }
+#ifdef OTB_USE_GDAL_20
+    case OFTInteger64:
+    {
+    outField.second.Integer64 = field.second.Integer64;
+    break;
+    }
+#endif     
     case OFTReal:
       {
       outField.second.Real = field.second.Real;
       break;
       }
-    case OFTRealList:
-      {
-      std::cerr << "OGR type not handled" << std::endl;
-      break;
-      }
     case OFTString:
       {
       if (field.second.String != NULL)
@@ -548,26 +529,6 @@ VectorDataKeywordlist
         }
       break;
       }
-    case OFTStringList:
-      {
-      std::cerr << "OGR type not handled" << std::endl;
-      break;
-      }
-    case OFTWideString:
-      {
-      std::cerr << "OGR type not handled" << std::endl;
-      break;
-      }
-    case OFTWideStringList:
-      {
-      std::cerr << "OGR type not handled" << std::endl;
-      break;
-      }
-    case OFTBinary:
-      {
-      std::cerr << "OGR type not handled" << std::endl;
-      break;
-      }
     case OFTDate:
       {
       outField.second.Date.Year = field.second.Date.Year;
@@ -592,6 +553,11 @@ VectorDataKeywordlist
       outField.second.Date.Second = field.second.Date.Second;
       break;
       }
+    default:
+      {
+      std::cerr << "OGR type not handled" << std::endl;
+      break;
+      }
     }
   return outField;
 }
diff --git a/Modules/Feature/Edge/test/otbHorizontalSobelVectorImageFilter.cxx b/Modules/Feature/Edge/test/otbHorizontalSobelVectorImageFilter.cxx
index 8f77718..a1464eb 100644
--- a/Modules/Feature/Edge/test/otbHorizontalSobelVectorImageFilter.cxx
+++ b/Modules/Feature/Edge/test/otbHorizontalSobelVectorImageFilter.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Feature/Edge/test/otbSobelVectorImageFilter.cxx b/Modules/Feature/Edge/test/otbSobelVectorImageFilter.cxx
index e7f0ff4..23cad00 100644
--- a/Modules/Feature/Edge/test/otbSobelVectorImageFilter.cxx
+++ b/Modules/Feature/Edge/test/otbSobelVectorImageFilter.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Feature/Edge/test/otbVerticalSobelVectorImageFilter.cxx b/Modules/Feature/Edge/test/otbVerticalSobelVectorImageFilter.cxx
index 5a8fffa..a8439b1 100644
--- a/Modules/Feature/Edge/test/otbVerticalSobelVectorImageFilter.cxx
+++ b/Modules/Feature/Edge/test/otbVerticalSobelVectorImageFilter.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h
deleted file mode 100644
index aeafe07..0000000
--- a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h
+++ /dev/null
@@ -1,164 +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.
-
-=========================================================================*/
-#ifndef __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_h
-#define __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_h
-
-#include "vcl_deprecated_header.h"
-
-#include "itkHistogram.h"
-#include "itkMacro.h"
-
-namespace otb {
-
-/** \class GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator
- *  \brief This class computes texture feature coefficients from a grey level
- * co-occurrence matrix.
- *
- * This class computes features that summarize image texture, given a grey level
- * co-occurrence matrix (generated by a ScalarImageToGreyLevelCooccurrenceMatrixGenerator
- * or related class).
- *
- * The features calculated are as follows (where \f$ g(i, j) \f$ is the element in
- * cell i, j of a a normalized GLCM):
- *
- * "Mean" \f$ = \sum_{i, j}i g(i, j) \f$
- *
- * "Sum of squares: Variance" \f$ = f_4 = \sum_{i, j}(i - \mu)^2 g(i, j) \f$
- *
- * "Sum average" \f$ = f_6 = -\sum_{i}i g_{x+y}(i)
- *
- * "Sum Variance" \f$ = f_7 = \sum_{i}(i - f_8)^2 g_{x+y}(i) \f$
- *
- * "Sum Entropy" \f$= f_8 = -\sum_{i}g_{x+y}(i) log (g_{x+y}(i)) \f$
- *
- * "Difference variance" \f$ = f_10 = variance of g_{x-y}(i)
- *
- * "Difference entropy" \f$ = f_11 = -\sum_{i}g_{x-y}(i) log (g_{x-y}(i)) \f$
- *
- * "Information Measures of Correlation IC1" \f$ = f_12 = \frac{f_9 - HXY1}{H} \f$
- *
- * "Information Measures of Correlation IC2" \f$ = f_13 = \sqrt{1 - \exp{-2}|HXY2 - f_9|} \f$
- *
- * Above, \f$ \mu =  \f$ (weighted pixel average) \f$ = \sum_{i, j}i \cdot g(i, j) =
- * \sum_{i, j}j \cdot g(i, j) \f$ (due to matrix summetry), and
- *
- * \f$ \g_{x+y}(k) =  \sum_{i}\sum_{j}g(i)\f$ where \f$ i+j=k \f$ and \f$ k = 2, 3, .., 2N_[g}  \f$ and
- *
- * \f$ \g_{x-y}(k) =  \sum_{i}\sum_{j}g(i)\f$ where \f$ i-j=k \f$ and \f$ k = 0, 1, .., N_[g}-1  \f$
- *
- * NOTA BENE: The input histogram will be forcably normalized!
- * This algorithm takes three passes through the input
- * histogram if the histogram was already normalized, and four if not.
- *
- * Web references:
- *
- * http://www.cssip.uq.edu.au/meastex/www/algs/algs/algs.html
- * http://www.ucalgary.ca/~mhallbey/texture/texture_tutorial.html
- *
- * Print references:
- *
- * Haralick, R.M., K. Shanmugam and I. Dinstein. 1973.  Textural Features for
- * Image Classification. IEEE Transactions on Systems, Man and Cybernetics.
- * SMC-3(6):610-620.
- *
- * Haralick, R.M. 1979. Statistical and Structural Approaches to Texture.
- * Proceedings of the IEEE, 67:786-804.
- *
- * R.W. Conners and C.A. Harlow. A Theoretical Comaprison of Texture Algorithms.
- * IEEE Transactions on Pattern Analysis and Machine Intelligence,  2:204-222, 1980.
- *
- * R.W. Conners, M.M. Trivedi, and C.A. Harlow. Segmentation of a High-Resolution
- * Urban Scene using Texture  Operators. Computer Vision, Graphics and Image
- * Processing, 25:273-310,  1984.
- *
- * \sa ScalarImageToGreyLevelCooccurrenceMatrixGenerator
- * \sa GreyLevelCooccurrenceMatrixTextureCoefficientsCalculator
- * \sa ScalarImageTextureCalculator
- *
- *
- * \ingroup OTBTextures
- */
-
-template <typename THistogram>
-class ITK_EXPORT GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator :
-  public itk::Object
-{
-public:
-  /** Standard typedefs */
-  typedef GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator Self;
-  typedef itk::Object                                                      Superclass;
-  typedef itk::SmartPointer<Self>                                          Pointer;
-  typedef itk::SmartPointer<const Self>                                    ConstPointer;
-
-  /** Run-time type information (and related methods). */
-  itkTypeMacro(GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator, itk::Object);
-
-  /** standard New() method support */
-  itkNewMacro(Self);
-
-  typedef THistogram                                    HistogramType;
-  typedef typename HistogramType::Pointer               HistogramPointer;
-  typedef typename HistogramType::ConstPointer          HistogramConstPointer;
-  typedef typename HistogramType::MeasurementType       MeasurementType;
-  typedef typename HistogramType::RelativeFrequencyType RelativeFrequencyType;
-  typedef typename HistogramType::MeasurementVectorType MeasurementVectorType;
-  typedef typename HistogramType::IndexType             IndexType;
-  typedef typename HistogramType::AbsoluteFrequencyType         FrequencyType; //FIXME several type in the new stat framework
-
-  /** Connects the GLCM histogram over which the features are going to be computed */
-  itkSetObjectMacro(Histogram, HistogramType);
-  itkGetObjectMacro(Histogram, HistogramType);
-
-  itkGetMacro(Mean, double);
-  itkGetMacro(Variance, double);
-  itkGetMacro(SumAverage, double);
-  itkGetMacro(SumVariance, double);
-  itkGetMacro(SumEntropy, double);
-  itkGetMacro(DifferenceEntropy, double);
-  itkGetMacro(DifferenceVariance, double);
-  itkGetMacro(IC1, double);
-  itkGetMacro(IC2, double);
-
-  /** Triggers the Computation of the histogram */
-  void Compute(void);
-
-protected:
-  GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator() {};
-  virtual ~GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator() {}
-  void PrintSelf(std::ostream& os, itk::Indent indent) const;
-
-private:
-  GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator(const Self &); //purposely not implemented
-  void operator =(const Self&); //purposely not implemented
-
-  HistogramPointer m_Histogram;
-
-  void ComputeMean();
-  double m_Mean, m_Variance, m_SumAverage, m_SumVariance, m_SumEntropy, m_DifferenceEntropy,
-         m_DifferenceVariance, m_IC1, m_IC2;
-
-  double ComputePS(long unsigned int k);
-  double ComputePD(long unsigned int k);
-};
-} // end of namespace otb
-
-#ifndef OTB_MANUAL_INSTANTIATION
-#include "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx"
-#endif
-
-#endif
diff --git a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx b/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx
deleted file mode 100644
index 823d848..0000000
--- a/Modules/Feature/Textures/include/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx
+++ /dev/null
@@ -1,196 +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.
-
-=========================================================================*/
-#ifndef __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_txx
-#define __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_txx
-
-#include "itkNumericTraits.h"
-#include "vnl/vnl_math.h"
-#include <algorithm>
-
-namespace otb {
-
-template<class THistogram>
-void
-GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>::
-ComputeMean()
-{
-  // Initialize everything
-  m_Mean = 0.;
-
-  // Ok, now do the first pass through the histogram to get the marginal sums
-  // and compute the pixel mean
-  typename HistogramType::Iterator itr = m_Histogram->Begin();
-  typename HistogramType::Iterator end = m_Histogram->End();
-  while( itr != end )
-    {
-    RelativeFrequencyType frequency = static_cast<RelativeFrequencyType>(itr.GetFrequency()) /
-      static_cast<RelativeFrequencyType>(m_Histogram->GetTotalFrequency());
-
-    IndexType       index = m_Histogram->GetIndex(itr.GetInstanceIdentifier());
-    m_Mean += static_cast<double>(index[0]) * static_cast<double>(frequency);
-    ++itr;
-    }
-}
-
-template<class THistogram>
-void
-GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>::
-Compute()
-{
-  typedef typename HistogramType::Iterator HistogramIterator;
-
-  // Now get the pixel mean.
-  this->ComputeMean();
-
-  m_SumAverage = 0;
-  m_SumEntropy = 0;
-  m_SumVariance = 0;
-  double PSSquareCumul = 0;
-  double log2 = vcl_log(2.);
-
-  // First pass to compute SumAverage, SumVariance
-  for (long unsigned int i = 0; i < m_Histogram->GetSize()[0] + m_Histogram->GetSize()[1]; ++i)
-    {
-    double psTmp = ComputePS (i);
-
-    m_SumAverage += i * psTmp;
-    m_SumEntropy -= (psTmp > 0.0001) ? psTmp * vcl_log(psTmp) / log2 : 0;
-    PSSquareCumul += i * i * psTmp;
-    }
-  m_SumVariance = PSSquareCumul - m_SumAverage * m_SumAverage;
-
-  double minSizeHist = std::min (m_Histogram->GetSize()[0], m_Histogram->GetSize()[1]);
-
-  m_DifferenceEntropy = 0;
-  m_DifferenceVariance = 0;
-
-  double PDSquareCumul = 0;
-  double PDCumul = 0;
-
-  // Second pass to compute DifferenceVariance and DifferenceEntropy
-  for (long unsigned int i = 0; i < minSizeHist; ++i)
-    {
-    double pdTmp = ComputePD (i);
-
-    PDCumul += i * pdTmp;
-    m_DifferenceEntropy -= (pdTmp > 0.0001) ? pdTmp * vcl_log(pdTmp) / log2 : 0;
-    PDSquareCumul += i * i * pdTmp;
-    }
-  m_DifferenceVariance = PDSquareCumul - PDCumul * PDCumul;
-
-  typedef typename HistogramType::Iterator HistogramIterator;
-
-  double hx = 0;
-  double hy = 0;
-
-  // Compute hx and hy need to compute f12 and f13 texture coefficients
-  for (long unsigned int i = 0; i < m_Histogram->GetSize()[0]; ++i)
-    {
-    double marginalfreq = static_cast<double>(m_Histogram->GetFrequency (i, 0))/static_cast<double>(m_Histogram->GetTotalFrequency());
-    hx += (marginalfreq > 0.0001) ? vcl_log (marginalfreq) * marginalfreq : 0;
-    }
-
-  for (long unsigned int j = 0; j < m_Histogram->GetSize()[1]; ++j)
-    {
-    double marginalfreq = static_cast<double>(m_Histogram->GetFrequency (j, 1))/static_cast<double>(m_Histogram->GetTotalFrequency());
-    hy += (marginalfreq > 0.0001) ? vcl_log (marginalfreq) * marginalfreq : 0;
-    }
-
-  double hxy1 = 0;
-  double hxy2 = 0;
-
-  m_Variance = 0;
-  double Entropy = 0;
-
-  // Third pass over the histogram to compute Sum of squares (variance), entropy (needed for f12)
-  for (HistogramIterator hit = m_Histogram->Begin();
-       hit != m_Histogram->End(); ++hit)
-    {
-    double frequency = static_cast<double>(hit.GetFrequency())
-      / static_cast<double>(m_Histogram->GetTotalFrequency());
-
-    IndexType index = m_Histogram->GetIndex(hit.GetInstanceIdentifier());
-
-    m_Variance += ((static_cast<double>(index[0]) - m_Mean) * (static_cast<double>(index[0]) - m_Mean)) * frequency;
-    Entropy -= (frequency > 0.0001) ? frequency * vcl_log(frequency) / log2 : 0.;
-
-    double pipj =
-      static_cast<double>(m_Histogram->GetFrequency (index[0], 0))/ static_cast<double>(m_Histogram->GetTotalFrequency())
-      * static_cast<double>(m_Histogram->GetFrequency (index[1], 1))/  static_cast<double>(m_Histogram->GetTotalFrequency());
-
-    hxy1 -= (pipj > 0.0001) ? frequency * vcl_log(pipj) : 0.;
-    hxy2 -= (pipj > 0.0001) ? pipj * vcl_log(pipj) : 0.;
-    }
-
-  //Finally get f12 and f13
-  m_IC1 = (vcl_abs(std::max (hx, hy)) > 0.0001) ? (Entropy - hxy1) / (std::max (hx, hy)) : 0;
-
-  m_IC2 = 1 - vcl_exp (-2. * vcl_abs (hxy2 - Entropy));
-  m_IC2 = (m_IC2 >= 0) ? vcl_sqrt (m_IC2) : 0;
-}
-
-//TODO check this!!
-template<class THistogram>
-double
-GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>::
-ComputePS(long unsigned int k)
-{
-  double            result = 0;
-  IndexType         index(m_Histogram->GetMeasurementVectorSize());
-  long unsigned int start = std::max (static_cast <long unsigned int> (0),  k - m_Histogram->GetSize()[1]);
-  long unsigned int end = std::min (k,  m_Histogram->GetSize()[0]);
-  for (long unsigned int i = start; i < end; ++i)
-    {
-    index[0] = i;
-    index[1] = k - i;
-    result += static_cast<double>(m_Histogram->GetFrequency (index))
-      /static_cast<double>(m_Histogram->GetTotalFrequency());
-    }
-  return result;
-}
-
-//TODO check this!!
-template<class THistogram>
-double
-GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>::
-ComputePD(long unsigned int k)
-{
-  double            result = 0;
-  IndexType         index(m_Histogram->GetMeasurementVectorSize());
-  long unsigned int end = std::min (m_Histogram->GetSize()[0] - k, m_Histogram->GetSize()[1]);
-  for (long unsigned int j = 0; j < end; ++j)
-    {
-    index[0] = j + k;
-    index[1] = j;
-    result += static_cast<double>(m_Histogram->GetFrequency (index))
-      /static_cast<double>(m_Histogram->GetTotalFrequency());
-    }
-  return result;
-}
-
-template<class THistogram>
-void
-GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<THistogram>::
-PrintSelf(std::ostream& os, itk::Indent indent) const
-{
-  Superclass::PrintSelf(os, indent);
-}
-
-} // end of namespace otb
-
-#endif
diff --git a/Modules/Feature/Textures/test/CMakeLists.txt b/Modules/Feature/Textures/test/CMakeLists.txt
index 256bf04..547be6e 100644
--- a/Modules/Feature/Textures/test/CMakeLists.txt
+++ b/Modules/Feature/Textures/test/CMakeLists.txt
@@ -2,7 +2,6 @@ otb_module_test()
 
 set(OTBTexturesTests
 otbTexturesTestDriver.cxx
-otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx
 otbScalarImageToHigherOrderTexturesFilter.cxx
 otbHaralickTexturesImageFunction.cxx
 otbGreyLevelCooccurrenceIndexedList.cxx
@@ -15,19 +14,12 @@ otbScalarImageToAdvancedTexturesFilterNew.cxx
 otbGreyLevelCooccurrenceIndexedListNew.cxx
 otbScalarImageToAdvancedTexturesFilter.cxx
 otbScalarImageToPanTexTextureFilter.cxx
-otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx
 )
 
 add_executable(otbTexturesTestDriver ${OTBTexturesTests})
 target_link_libraries(otbTexturesTestDriver ${OTBTextures-Test_LIBRARIES})
 otb_module_target_label(otbTexturesTestDriver)
 
-# Tests Declaration
-
-otb_add_test(NAME feTuotbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator COMMAND otbTexturesTestDriver
-  otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator
-  )
-
 otb_add_test(NAME feTuScalarImageToHigherOrderTexturesFilterNew COMMAND otbTexturesTestDriver
   otbScalarImageToHigherOrderTexturesFilterNew
   )
@@ -158,8 +150,3 @@ otb_add_test(NAME feTvScalarImageToPanTexTextureFilter COMMAND otbTexturesTestDr
   ${INPUTDATA}/Mire_Cosinus.png
   ${TEMP}/feTvScalarImageToPanTexTextureFilterOutput
   8 5)
-
-otb_add_test(NAME feTuotbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew COMMAND otbTexturesTestDriver
-  otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew
-  )
-
diff --git a/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx b/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx
deleted file mode 100644
index 1a41476..0000000
--- a/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx
+++ /dev/null
@@ -1,196 +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 "vnl/vnl_math.h"
-
-#include "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h"
-
-int otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator(int itkNotUsed(argc), char * itkNotUsed(argv) [])
-{
-
-  try   // the rest of the function is in the try block...
-
-    { //Data definitions
-    const unsigned int HISTOGRAM_AXIS_LEN =  25;
-
-    //------------------------------------------------------
-    // Create a simple test histogram. The histogram must be
-    // symmetric and normalized.
-    //------------------------------------------------------
-    const unsigned int Dimension = 2;
-    typedef float                                                  MeasurementType;
-    typedef itk::Statistics::Histogram<MeasurementType> HistogramType;
-    HistogramType::Pointer  histogram = HistogramType::New();
-    HistogramType::SizeType size(Dimension);
-    size.Fill(HISTOGRAM_AXIS_LEN);
-    HistogramType::MeasurementVectorType lowerBound(Dimension);
-    HistogramType::MeasurementVectorType upperBound(Dimension);
-    lowerBound[0] = 0;
-    lowerBound[1] = 0;
-    upperBound[0] = HISTOGRAM_AXIS_LEN + 1;
-    upperBound[1] = HISTOGRAM_AXIS_LEN + 1;
-    histogram->SetMeasurementVectorSize(Dimension);
-    histogram->Initialize(size, lowerBound, upperBound);
-    histogram->SetToZero();
-
-    HistogramType::IndexType index(Dimension);
-    index[0] = 0;
-    index[1] = 0;
-    histogram->SetFrequencyOfIndex(index, 10);
-    index[0] = 3;
-    index[1] = 3;
-    histogram->SetFrequencyOfIndex(index, 50);
-    index[0] = 2;
-    index[1] = 1;
-    histogram->SetFrequencyOfIndex(index, 5);
-    index[0] = 1;
-    index[1] = 2;
-    histogram->SetFrequencyOfIndex(index, 5);
-    index[0] = 7;
-    index[1] = 6;
-    histogram->SetFrequencyOfIndex(index, 10);
-    index[0] = 6;
-    index[1] = 7;
-    histogram->SetFrequencyOfIndex(index, 10);
-    index[0] = 10;
-    index[1] = 10;
-    histogram->SetFrequencyOfIndex(index, 10);
-
-    typedef otb::GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<
-        HistogramType>  GLCMCalcType;
-    GLCMCalcType::Pointer glcmCalc = GLCMCalcType::New();
-
-    glcmCalc->SetHistogram(histogram);
-    glcmCalc->Compute();
-
-    double trueVariance = 7.6475;
-    double trueMean = 3.95;
-    double trueSumAverage = 0;
-    double trueSumVariance = 0;
-    double trueSumEntropy = 0;
-    double trueDifferenceEntropy = 0.770746;
-    double trueDifferenceVariance = 0.1275;
-    double trueIC1 = 0.557305;
-    double trueIC2 = 0.908663;
-
-    double variance = glcmCalc->GetVariance();
-    double mean = glcmCalc->GetMean();
-    double sumAverage = glcmCalc->GetSumAverage();
-    double sumVariance = glcmCalc->GetSumVariance();
-    double sumEntropy = glcmCalc->GetSumEntropy();
-    double differenceEntropy = glcmCalc->GetDifferenceEntropy();
-    double differenceVariance = glcmCalc->GetDifferenceVariance();
-    double ic1 = glcmCalc->GetIC1();
-    double ic2 = glcmCalc->GetIC2();
-
-    bool passed = true;
-
-    if (vnl_math_abs(variance - trueVariance) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "Variance calculated wrong. Expected: " << trueVariance << ", got: "
-                << variance << std::endl;
-      passed = false;
-      }
-
-    if (vnl_math_abs(mean - trueMean) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "Mean calculated wrong. Expected: " << trueMean << ", got: "
-                << mean << std::endl;
-      passed = false;
-      }
-
-    if (vnl_math_abs(sumAverage - trueSumAverage) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "Sum average calculated wrong. Expected: " << trueSumAverage << ", got: "
-                << sumAverage << std::endl;
-      passed = false;
-      }
-
-    if (vnl_math_abs(sumVariance - trueSumVariance) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "Sum variance calculated wrong. Expected: " << trueSumVariance <<
-      ", got: "  << sumVariance << std::endl;
-      passed = false;
-      }
-
-    if (vnl_math_abs(sumEntropy - trueSumEntropy) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "Sum entropy calculated wrong. Expected: " <<
-      trueSumEntropy <<  ", got: "  << sumEntropy << std::endl;
-      passed = false;
-      }
-
-    if (vnl_math_abs(differenceEntropy - trueDifferenceEntropy) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "Difference entropy calculated wrong. Expected: " << trueDifferenceEntropy << ", got: "
-                << differenceEntropy << std::endl;
-      passed = false;
-      }
-
-    if (vnl_math_abs(differenceVariance - trueDifferenceVariance) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "Difference variance calculated wrong. Expected: " << trueDifferenceVariance <<
-      ", got: "  << differenceVariance << std::endl;
-      passed = false;
-      }
-
-    if (vnl_math_abs(ic1 - trueIC1) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "IC1 calculated wrong. Expected: "
-                << trueIC1 << ", got: "  << ic1 << std::endl;
-      passed = false;
-      }
-
-    if (vnl_math_abs(ic2 - trueIC2) > 0.001)
-      {
-      std::cerr << "Error:" << std::endl;
-      std::cerr << "IC2 calculated wrong. Expected: "
-                << trueIC2 << ", got: "  << ic2 << std::endl;
-      passed = false;
-      }
-
-    if (!passed)
-      {
-      std::cerr << "Test failed" << std::endl;
-      return EXIT_FAILURE;
-      }
-    else
-      {
-      std::cerr << "Test succeeded" << std::endl;
-      return EXIT_SUCCESS;
-      }
-
-    }
-  catch (itk::ExceptionObject& err)
-    {
-    std::cerr << "ExceptionObject caught !" << std::endl;
-    std::cerr << err << std::endl;
-    std::cerr << "Test failed" << std::endl;
-    return EXIT_FAILURE;
-    }
-
-  return EXIT_SUCCESS;
-}
diff --git a/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx b/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx
deleted file mode 100644
index 6ce2347..0000000
--- a/Modules/Feature/Textures/test/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx
+++ /dev/null
@@ -1,33 +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 "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h"
-
-int otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
-{
-  typedef float                                                  MeasurementType;
-  typedef itk::Statistics::Histogram<MeasurementType> HistogramType;
-  typedef otb::GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator<
-      HistogramType> FilterType;
-
-  FilterType::Pointer filter = FilterType::New();
-
-  std::cout << filter << std::endl;
-
-  return EXIT_SUCCESS;
-}
diff --git a/Modules/Feature/Textures/test/otbTexturesTestDriver.cxx b/Modules/Feature/Textures/test/otbTexturesTestDriver.cxx
index c55742f..a6d7163 100644
--- a/Modules/Feature/Textures/test/otbTexturesTestDriver.cxx
+++ b/Modules/Feature/Textures/test/otbTexturesTestDriver.cxx
@@ -1,7 +1,6 @@
 #include "otbTestMain.h"
 void RegisterTests()
 {
-  REGISTER_TEST(otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator);
   REGISTER_TEST(otbScalarImageToHigherOrderTexturesFilterNew);
   REGISTER_TEST(otbScalarImageToHigherOrderTexturesFilter);
   REGISTER_TEST(otbHaralickTexturesImageFunctionNew);
@@ -16,5 +15,4 @@ void RegisterTests()
   REGISTER_TEST(otbGreyLevelCooccurrenceIndexedListNew);
   REGISTER_TEST(otbScalarImageToAdvancedTexturesFilter);
   REGISTER_TEST(otbScalarImageToPanTexTextureFilter);
-  REGISTER_TEST(otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew);
 }
diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h
index 84ea1ce..cba75ee 100644
--- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h
+++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.txx b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.txx
index 809e374..b309f58 100644
--- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.txx
+++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerDistanceImageFilter.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h
index 370a038..d4a5e93 100644
--- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h
+++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Some parts of this code are covered by the GET copyright.
-  See GETCopyright.txt for details.
+  Some parts of this code are covered by the IMT copyright.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.txx b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.txx
index d49f78a..1620df7 100644
--- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.txx
+++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerProfileImageFilter.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Some parts of this code are covered by the GET copyright.
-  See GETCopyright.txt for details.
+  Some parts of this code are covered by the IMT copyright.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h
index 511f219..5498cc9 100644
--- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h
+++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.txx b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.txx
index f0454a6..ab78083 100644
--- a/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.txx
+++ b/Modules/Filtering/ChangeDetection/include/otbKullbackLeiblerSupervizedDistanceImageFilter.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h
index 65b44b1..c7c02ac 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h
+++ b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.h
@@ -164,6 +164,8 @@ protected:
   virtual void GenerateData ();
 
   /** Internal methods */
+  void ForwardGenerateOutputInformation();
+  void ReverseGenerateOutputInformation();
   virtual void ForwardGenerateData();
   virtual void ReverseGenerateData();
 
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.txx
index 2a42c3c..6aab3f1 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.txx
+++ b/Modules/Filtering/DimensionalityReduction/include/otbFastICAImageFilter.txx
@@ -103,24 +103,19 @@ FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
           "Class should be templeted with FORWARD or INVERSE only...",
           ITK_LOCATION );
   }
-}
 
-template < class TInputImage, class TOutputImage,
-            Transform::TransformDirection TDirectionOfTransformation >
-void
-FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
-::GenerateData ()
-{
   switch ( static_cast<int>(DirectionOfTransformation) )
     {
     case static_cast<int>(Transform::FORWARD):
-      return ForwardGenerateData();
+    {
+    ForwardGenerateOutputInformation();
+    break;
+    }
     case static_cast<int>(Transform::INVERSE):
-      return ReverseGenerateData();
-    default:
-      throw itk::ExceptionObject(__FILE__, __LINE__,
-                                 "Class should be templated with FORWARD or INVERSE only...",
-                                 ITK_LOCATION );
+    {
+    ReverseGenerateOutputInformation();
+    break;
+    }
     }
 }
 
@@ -128,13 +123,13 @@ template < class TInputImage, class TOutputImage,
             Transform::TransformDirection TDirectionOfTransformation >
 void
 FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
-::ForwardGenerateData ()
+::ForwardGenerateOutputInformation()
 {
   typename InputImageType::Pointer inputImgPtr
     = const_cast<InputImageType*>( this->GetInput() );
 
   m_PCAFilter->SetInput( inputImgPtr );
-  m_PCAFilter->Update();
+  m_PCAFilter->GetOutput()->UpdateOutputInformation();
 
   if ( !m_GivenTransformationMatrix )
   {
@@ -157,19 +152,15 @@ FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
 
   m_TransformFilter->SetInput( m_PCAFilter->GetOutput() );
   m_TransformFilter->SetMatrix( m_TransformationMatrix.GetVnlMatrix() );
-  m_TransformFilter->GraftOutput( this->GetOutput() );
-  m_TransformFilter->Update();
-
-  this->GraftOutput( m_TransformFilter->GetOutput() );
 }
 
 template < class TInputImage, class TOutputImage,
             Transform::TransformDirection TDirectionOfTransformation >
 void
 FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
-::ReverseGenerateData ()
+::ReverseGenerateOutputInformation()
 {
-  if ( !m_GivenTransformationMatrix )
+ if ( !m_GivenTransformationMatrix )
   {
     throw itk::ExceptionObject( __FILE__, __LINE__,
                                 "No Transformation matrix given",
@@ -200,9 +191,48 @@ FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
    * have not been given at this point
    */
   m_PCAFilter->SetInput( m_TransformFilter->GetOutput() );
+}
+
+
+template < class TInputImage, class TOutputImage,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
+::GenerateData ()
+{
+  switch ( static_cast<int>(DirectionOfTransformation) )
+    {
+    case static_cast<int>(Transform::FORWARD):
+      return ForwardGenerateData();
+    case static_cast<int>(Transform::INVERSE):
+      return ReverseGenerateData();
+    default:
+      throw itk::ExceptionObject(__FILE__, __LINE__,
+                                 "Class should be templated with FORWARD or INVERSE only...",
+                                 ITK_LOCATION );
+    }
+}
+
+template < class TInputImage, class TOutputImage,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
+::ForwardGenerateData ()
+{
+  m_TransformFilter->GraftOutput( this->GetOutput() );
+  m_TransformFilter->Update();
+
+  this->GraftOutput( m_TransformFilter->GetOutput() );
+}
+
+template < class TInputImage, class TOutputImage,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
+::ReverseGenerateData ()
+{
   m_PCAFilter->GraftOutput( this->GetOutput() );
   m_PCAFilter->Update();
-
   this->GraftOutput( m_PCAFilter->GetOutput() );
 }
 
@@ -285,7 +315,7 @@ FastICAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
 
   if ( size != this->GetNumberOfPrincipalComponentsRequired() )
     {
-    this->m_TransformationMatrix = W.get_n_rows( 0, this->GetNumberOfPrincipalComponentsRequired() );
+    this->m_TransformationMatrix = W.get_n_columns( 0, this->GetNumberOfPrincipalComponentsRequired() );
     }
   else
     {
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h
index 9ae62f8..27c2f2f 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h
+++ b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.h
@@ -166,6 +166,8 @@ protected:
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
   /** Internal methods */
+  void ForwardGenerateOutputInformation();
+  void ReverseGenerateOutputInformation();
   virtual void ForwardGenerateData();
   virtual void ReverseGenerateData();
 
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.txx
index 20e1f43..3308074 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.txx
+++ b/Modules/Filtering/DimensionalityReduction/include/otbMNFImageFilter.txx
@@ -104,7 +104,6 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf
 
       m_NumberOfPrincipalComponentsRequired = 0;
       this->GetOutput()->SetNumberOfComponentsPerPixel( theOutputDimension );
-
       break;
     }
     default: // should not go so far...
@@ -112,26 +111,21 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf
           "Class should be templeted with FORWARD or INVERSE only...",
           ITK_LOCATION );
   }
-}
 
-template <class TInputImage, class TOutputImage,
-            class TNoiseImageFilter,
-            Transform::TransformDirection TDirectionOfTransformation >
-void
-MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransformation >
-::GenerateData ()
-{
+
   switch ( static_cast<int>(DirectionOfTransformation) )
-  {
-  case static_cast<int>(Transform::FORWARD):
-    return ForwardGenerateData();
-  case static_cast<int>(Transform::INVERSE):
-    return ReverseGenerateData();
-  default: // should not go so far
-    throw itk::ExceptionObject(__FILE__, __LINE__,
-                               "Class should be templated with FORWARD or INVERSE only...",
-                               ITK_LOCATION );
-  }
+    {
+    case static_cast<int>(Transform::FORWARD):
+    {
+    ForwardGenerateOutputInformation();
+    break;
+    }
+    case static_cast<int>(Transform::INVERSE):
+    {
+    ReverseGenerateOutputInformation();
+    break;
+    }
+    }
 }
 
 template <class TInputImage, class TOutputImage,
@@ -139,7 +133,7 @@ template <class TInputImage, class TOutputImage,
             Transform::TransformDirection TDirectionOfTransformation >
 void
 MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransformation >
-::ForwardGenerateData ()
+::ForwardGenerateOutputInformation()
 {
   typename InputImageType::Pointer inputImgPtr
     = const_cast<InputImageType*>( this->GetInput() );
@@ -157,10 +151,10 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf
     m_Normalizer->SetUseStdDev( false );
 
   m_Normalizer->SetInput( inputImgPtr );
-  m_Normalizer->Update();
+  m_Normalizer->GetOutput()->UpdateOutputInformation();
 
   if ( !m_GivenMeanValues )
-    m_MeanValues = m_Normalizer->GetFunctor().GetMean();
+    m_MeanValues = m_Normalizer->GetCovarianceEstimator()->GetMean();
 
   if ( m_UseNormalization )
   {
@@ -213,11 +207,6 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf
 
   m_Transformer->SetInput( m_Normalizer->GetOutput() );
   m_Transformer->SetMatrix( m_TransformationMatrix.GetVnlMatrix() );
-  m_Transformer->GraftOutput( this->GetOutput() );
-  m_Transformer->Update();
-
-  this->GraftOutput( m_Transformer->GetOutput() );
-
 }
 
 template <class TInputImage, class TOutputImage,
@@ -225,9 +214,9 @@ template <class TInputImage, class TOutputImage,
             Transform::TransformDirection TDirectionOfTransformation >
 void
 MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransformation >
-::ReverseGenerateData ()
+::ReverseGenerateOutputInformation()
 {
-  if ( !m_GivenTransformationMatrix )
+ if ( !m_GivenTransformationMatrix )
   {
     if ( !m_GivenCovarianceMatrix )
     {
@@ -313,12 +302,55 @@ MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransf
       revMean[i] = - m_MeanValues[i];
     m_Normalizer->SetMean( revMean );
     m_Normalizer->SetUseStdDev( false );
-  }
+  }  
 
   m_Normalizer->SetInput( m_Transformer->GetOutput() );
+ 
+
+}
+
+
+template <class TInputImage, class TOutputImage,
+            class TNoiseImageFilter,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransformation >
+::GenerateData ()
+{
+  switch ( static_cast<int>(DirectionOfTransformation) )
+  {
+  case static_cast<int>(Transform::FORWARD):
+    return ForwardGenerateData();
+  case static_cast<int>(Transform::INVERSE):
+    return ReverseGenerateData();
+  default: // should not go so far
+    throw itk::ExceptionObject(__FILE__, __LINE__,
+                               "Class should be templated with FORWARD or INVERSE only...",
+                               ITK_LOCATION );
+  }
+}
+
+template <class TInputImage, class TOutputImage,
+            class TNoiseImageFilter,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransformation >
+::ForwardGenerateData ()
+{
+  m_Transformer->GraftOutput( this->GetOutput() );
+  m_Transformer->Update();
+  this->GraftOutput( m_Transformer->GetOutput() );
+}
+
+template <class TInputImage, class TOutputImage,
+            class TNoiseImageFilter,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+MNFImageFilter< TInputImage, TOutputImage, TNoiseImageFilter, TDirectionOfTransformation >
+::ReverseGenerateData ()
+{
   m_Normalizer->GraftOutput( this->GetOutput() );
   m_Normalizer->Update();
-
   this->GraftOutput( m_Normalizer->GetOutput() );
 }
 
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h
index 859c124..5ef212d 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h
+++ b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.h
@@ -178,9 +178,11 @@ protected:
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
   /** Internal methods */
+  virtual void ForwardGenerateOutputInformation();
+  virtual void ReverseGenerateOutputInformation();
   virtual void ForwardGenerateData();
   virtual void ReverseGenerateData();
-
+  
   void GenerateTransformationMatrix();
 
   /** Internal attributes */
diff --git a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.txx b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.txx
index cd13f5c..69d298c 100644
--- a/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.txx
+++ b/Modules/Filtering/DimensionalityReduction/include/otbPCAImageFilter.txx
@@ -105,32 +105,28 @@ PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
                                  "Class should be templeted with FORWARD or INVERSE only...",
                                  ITK_LOCATION );
     }
-}
 
-template < class TInputImage, class TOutputImage,
-            Transform::TransformDirection TDirectionOfTransformation >
-void
-PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
-::GenerateData ()
-{
+  
   switch ( static_cast<int>(DirectionOfTransformation) )
-  {
-  case static_cast<int>(Transform::FORWARD):
-      return ForwardGenerateData();
+    {
+    case static_cast<int>(Transform::FORWARD):
+    {
+    ForwardGenerateOutputInformation();
+    break;
+    }
     case static_cast<int>(Transform::INVERSE):
-      return ReverseGenerateData();
-    default:
-      throw itk::ExceptionObject(__FILE__, __LINE__,
-          "Class should be templated with FORWARD or INVERSE only...",
-          ITK_LOCATION );
-  }
+    {
+    ReverseGenerateOutputInformation();
+    break;
+    }
+    }
 }
 
 template < class TInputImage, class TOutputImage,
             Transform::TransformDirection TDirectionOfTransformation >
 void
 PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
-::ForwardGenerateData ()
+::ForwardGenerateOutputInformation()
 {
   typename InputImageType::Pointer inputImgPtr
     = const_cast<InputImageType*>( this->GetInput() );
@@ -150,7 +146,7 @@ PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
         if ( m_GivenStdDevValues )
           m_Normalizer->SetStdDev( m_StdDevValues );
 
-        m_Normalizer->Update();
+        m_Normalizer->GetOutput()->UpdateOutputInformation();
 
         if ( !m_GivenMeanValues )
         {
@@ -167,8 +163,7 @@ PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
         else
         {
           m_CovarianceEstimator->SetInput( m_Normalizer->GetOutput() );
-          m_CovarianceEstimator->Update();
-
+          m_CovarianceEstimator->UpdateOutputInformation();
           m_CovarianceMatrix = m_CovarianceEstimator->GetCovariance();
         }
 
@@ -200,23 +195,18 @@ PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
   }
 
   if ( m_TransformationMatrix.GetVnlMatrix().empty() )
-  {
+    {
     throw itk::ExceptionObject( __FILE__, __LINE__,
-          "Empty transformation matrix",
-          ITK_LOCATION);
-  }
-
-  m_Transformer->SetMatrix( m_TransformationMatrix.GetVnlMatrix() );
-  m_Transformer->GraftOutput( this->GetOutput() );
-  m_Transformer->Update();
-  this->GraftOutput( m_Transformer->GetOutput() );
+                                "Empty transformation matrix",
+                                ITK_LOCATION);
+    }
 }
 
 template < class TInputImage, class TOutputImage,
             Transform::TransformDirection TDirectionOfTransformation >
 void
 PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
-::ReverseGenerateData ()
+::ReverseGenerateOutputInformation()
 {
   if ( !m_GivenTransformationMatrix )
   {
@@ -248,11 +238,10 @@ PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
 
   m_Transformer->SetInput( this->GetInput() );
   m_Transformer->SetMatrix( m_TransformationMatrix.GetVnlMatrix() );
+  m_Normalizer->SetInput( m_Transformer->GetOutput() );
 
-  if ( m_GivenMeanValues || m_GivenStdDevValues )
+  if ( m_GivenStdDevValues || m_GivenMeanValues )
   {
-    m_Normalizer->SetInput( m_Transformer->GetOutput() );
-
     if ( m_GivenStdDevValues )
     {
       VectorType revStdDev ( m_StdDevValues.Size() );
@@ -278,17 +267,65 @@ PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
       }
       m_Normalizer->SetMean( revMean );
     }
-
-    m_Normalizer->GraftOutput( this->GetOutput() );
-    m_Normalizer->Update();
-    this->GraftOutput( m_Normalizer->GetOutput() );
   }
   else
+    {
+    m_Normalizer->SetUseMean(false);
+    m_Normalizer->SetUseStdDev(false);
+    }
+}
+
+
+template < class TInputImage, class TOutputImage,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
+::GenerateData ()
+{
+  switch ( static_cast<int>(DirectionOfTransformation) )
   {
+  case static_cast<int>(Transform::FORWARD):
+      return ForwardGenerateData();
+    case static_cast<int>(Transform::INVERSE):
+      return ReverseGenerateData();
+    default:
+      throw itk::ExceptionObject(__FILE__, __LINE__,
+          "Class should be templated with FORWARD or INVERSE only...",
+          ITK_LOCATION );
+  }
+}
+
+template < class TInputImage, class TOutputImage,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
+::ForwardGenerateData ()
+{
+  m_Transformer->SetMatrix( m_TransformationMatrix.GetVnlMatrix() );
+  m_Transformer->GraftOutput( this->GetOutput() );
+  m_Transformer->Update();
+  this->GraftOutput( m_Transformer->GetOutput() );
+}
+
+template < class TInputImage, class TOutputImage,
+            Transform::TransformDirection TDirectionOfTransformation >
+void
+PCAImageFilter< TInputImage, TOutputImage, TDirectionOfTransformation >
+::ReverseGenerateData ()
+{
+
+  if ( m_GivenStdDevValues || m_GivenMeanValues )
+    {
+    m_Normalizer->GraftOutput(this->GetOutput());
+    m_Normalizer->Update();
+    this->GraftOutput(m_Normalizer->GetOutput());
+    }
+  else
+    {
     m_Transformer->GraftOutput( this->GetOutput() );
     m_Transformer->Update();
     this->GraftOutput( m_Transformer->GetOutput() );
-  }
+    }
 }
 
 template < class TInputImage, class TOutputImage,
diff --git a/Modules/Filtering/DimensionalityReduction/test/otbAngularProjectionBinaryImageFilter.cxx b/Modules/Filtering/DimensionalityReduction/test/otbAngularProjectionBinaryImageFilter.cxx
index 8a4e469..3fa0231 100644
--- a/Modules/Filtering/DimensionalityReduction/test/otbAngularProjectionBinaryImageFilter.cxx
+++ b/Modules/Filtering/DimensionalityReduction/test/otbAngularProjectionBinaryImageFilter.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/DimensionalityReduction/test/otbLocalActivityVectorImageFilter.cxx b/Modules/Filtering/DimensionalityReduction/test/otbLocalActivityVectorImageFilter.cxx
index 52c3005..c5ff2f8 100644
--- a/Modules/Filtering/DimensionalityReduction/test/otbLocalActivityVectorImageFilter.cxx
+++ b/Modules/Filtering/DimensionalityReduction/test/otbLocalActivityVectorImageFilter.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/include/otbAffineFunctor.h b/Modules/Filtering/ImageManipulation/include/otbAffineFunctor.h
new file mode 100644
index 0000000..2b7594f
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbAffineFunctor.h
@@ -0,0 +1,90 @@
+/*=========================================================================
+
+  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 __otbAffineFunctor_h
+#define __otbAffineFunctor_h
+
+namespace otb
+{
+namespace Functor
+{
+/** \class AffineFunctor
+ *  \brief This functor performs a linear transform of its input.
+ *
+ *  \f[ output = a*input + b \f]
+ *
+ * Coefficient a is a scalar, its type is templated (default is double).
+ * Coefficient b has the same type as output type. Standard casting is applied
+ * between input and output type.
+ *
+ * TInput and TOutput type are supposed to be scalar types.
+ *
+ * \ingroup OTBImageManipulation
+ */
+template<class TInput, class TOutput, class TScale=double>
+class AffineFunctor
+{
+public:
+  /// Constructor
+  AffineFunctor() {}
+
+  /// Constructor
+  virtual ~AffineFunctor() {}
+
+  /// Accessors
+  void SetA(TScale value)
+  {
+    m_A = value;
+  }
+  TScale GetA()
+  {
+    return m_A;
+  }
+  void SetB(TOutput value)
+  {
+    m_B = value;
+  }
+  TOutput GetB()
+  {
+    return m_B;
+  }
+
+  bool operator !=(const AffineFunctor& other) const
+  {
+    return ((m_A != other.GetA()) || (m_B != other.GetB()));
+  }
+
+  bool operator==(const AffineFunctor& other) const
+  {
+    return ((m_A == other.GetA()) && (m_B == other.GetB()));
+  }
+
+  // main computation method
+  inline TOutput operator()(const TInput & x) const
+  {
+    return (m_B + static_cast<TOutput>(m_A*x));
+  }
+
+private:
+  TScale  m_A;
+  TOutput m_B;
+};
+} // End namespace Functor
+} // End namespace otb
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.txx b/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.txx
index 8cca671..c97db40 100644
--- a/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.txx
+++ b/Modules/Filtering/ImageManipulation/include/otbBinaryImageMinimalBoundingRegionCalculator.txx
@@ -124,7 +124,7 @@ BinaryImageMinimalBoundingRegionCalculator<TInputImage>
   typename InputImageType::SizeType  size;
   typename InputImageType::IndexType index;
 
-  for (int i = 0; i < InputImageType::ImageDimension; ++i)
+  for (unsigned int i = 0; i < InputImageType::ImageDimension; ++i)
     {
     size[i] = max[i] - min[i] + 1;
     index[i] = min[i];
diff --git a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h
index 8197ec2..7836509 100644
--- a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h
+++ b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.txx
index 9863ae1..f15af8a 100644
--- a/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.txx
+++ b/Modules/Filtering/ImageManipulation/include/otbBoxAndWhiskerImageFilter.txx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h
new file mode 100644
index 0000000..f92b2c2
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h
@@ -0,0 +1,94 @@
+/*=========================================================================
+
+  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 __otbChangeInformationImageFilter_h
+#define __otbChangeInformationImageFilter_h
+
+#include "itkChangeInformationImageFilter.h"
+#include "otbMetaDataKey.h"
+
+namespace otb
+{
+
+/**
+ * \class ChangeInformationImageFilter
+ * \brief Filter to modify image metadata
+ *
+ * The base class is itk::ChangeInformationImageFilter that allows to
+ * modifiy origin, spacing, direction and buffered region. This deriving
+ * filter adds the support of MetaDataDictionary.
+ *
+ * \ingroup OTBImageManipulation
+ */
+template< typename TInputImage >
+class ChangeInformationImageFilter:
+  public itk::ChangeInformationImageFilter< TInputImage >
+{
+public:
+  /** Standard class typedefs. */
+  typedef ChangeInformationImageFilter                   Self;
+  typedef itk::ChangeInformationImageFilter<TInputImage> Superclass;
+  typedef itk::SmartPointer<Self>                        Pointer;
+  typedef itk::SmartPointer<const Self>                  ConstPointer;
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+  /** Creation through object factory macro */
+  itkTypeMacro(ChangeInformationImageFilter, itk::ChangeInformationImageFilter);
+
+  /** Set key names to change */
+  void SetChangeMetaData(const char *keyname, bool flag);
+
+  /** Ask if a metadata will be changed */
+  bool GetChangeMetaData(const char *keyname);
+
+  /** Set output values for metadata, passing a NULL value will remove the
+   *  metadata from output. If not set for a key name in the change list,
+   *  the metadata will also be set.
+   */
+  template<typename T>
+  void SetOutputMetaData(const char *keyname, const T * value);
+
+protected:
+  ChangeInformationImageFilter() {}
+  virtual ~ChangeInformationImageFilter() {}
+
+  /** Apply changes to the output image metadata. */
+  virtual void GenerateOutputInformation();
+
+private:
+  ChangeInformationImageFilter(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+  /** Removes a field from a metadata dictionary
+   *  After ITK 4.6, an Erase() method has been added to
+   *  itk::MetaDataDictionary, so this function could be tagged as deprecated */
+  bool RemoveKeyFromDictionary(itk::MetaDataDictionary & dict, const std::string & key);
+
+  /** List of metadata keys to change */
+  std::set<std::string> m_ChangedKeys;
+
+};
+
+} // End of namespace OTB
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbChangeInformationImageFilter.txx"
+#endif
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.txx
new file mode 100644
index 0000000..3196840
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.txx
@@ -0,0 +1,150 @@
+/*=========================================================================
+
+  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 __otbChangeInformationImageFilter_txx
+#define __otbChangeInformationImageFilter_txx
+
+#include "otbChangeInformationImageFilter.h"
+#include "itkMetaDataObject.h"
+
+namespace otb
+{
+
+template< typename TInputImage >
+void
+ChangeInformationImageFilter<TInputImage>
+::SetChangeMetaData(const char *keyname, bool flag)
+{
+  std::string key(keyname);
+  if (! key.empty())
+    {
+    if (flag)
+      {
+      m_ChangedKeys.insert(key);
+      }
+    else
+      {
+      std::set<std::string>::iterator pos = m_ChangedKeys.find(key);
+      if (pos != m_ChangedKeys.end())
+        {
+        m_ChangedKeys.erase(pos);
+        }
+      }
+    }
+}
+
+template< typename TInputImage >
+bool
+ChangeInformationImageFilter<TInputImage>
+::GetChangeMetaData(const char *keyname)
+{
+  std::string key(keyname);
+  if (! key.empty())
+    {
+    if (m_ChangedKeys.find(key) != m_ChangedKeys.end())
+      {
+      return true;
+      }
+    }
+  return false;
+}
+
+template< typename TInputImage >
+template<typename T>
+void
+ChangeInformationImageFilter<TInputImage>
+::SetOutputMetaData(const char *keyname, const T * value)
+{
+  std::string key(keyname);
+  if (! key.empty())
+    {
+    // enable this key for metadata change
+    m_ChangedKeys.insert(key);
+    itk::MetaDataDictionary &dict = this->GetMetaDataDictionary();
+    if (value == NULL)
+      {
+      // Remove meta-data from dictionary
+      this->RemoveKeyFromDictionary(dict,key);
+      }
+    else
+      {
+      // Set metadata in dictionary
+      const T &valueRef = (*value);
+      itk::EncapsulateMetaData<T>(dict,key,valueRef);
+      }
+    }
+}
+
+template< typename TInputImage >
+void
+ChangeInformationImageFilter<TInputImage>
+::GenerateOutputInformation()
+{
+  Superclass::GenerateOutputInformation();
+
+  // Process the metadatas to be changed
+  itk::MetaDataDictionary &dict = this->GetMetaDataDictionary();
+  itk::MetaDataDictionary &outputDict = this->GetOutput()->GetMetaDataDictionary();
+  std::set<std::string>::iterator it = m_ChangedKeys.begin();
+  for ( ; it != m_ChangedKeys.end() ; ++it)
+    {
+    if (dict.HasKey(*it))
+      {
+      // Replace metadata in output dictionary
+      outputDict[*it] = dict[*it];
+      }
+    else
+      {
+      // Remove metadata from output dictionary
+      this->RemoveKeyFromDictionary(outputDict,*it);
+      }
+    }
+}
+
+template< typename TInputImage >
+bool
+ChangeInformationImageFilter<TInputImage>
+::RemoveKeyFromDictionary(itk::MetaDataDictionary & dict, const std::string & key)
+{
+  std::vector<std::string> keyList = dict.GetKeys();
+  std::vector<std::string>::iterator pos = keyList.begin();
+  while (pos != keyList.end())
+    {
+    if (key.compare(*pos) == 0)
+      {
+      break;
+      }
+    ++pos;
+    }
+  if (pos != keyList.end())
+    {
+    itk::MetaDataDictionary copyDict;
+    keyList.erase(pos);
+    pos = keyList.begin();
+    for ( ; pos != keyList.end();++pos)
+      {
+      copyDict.Set(*pos, const_cast<itk::MetaDataObjectBase*>(dict.Get(*pos)));
+      }
+    dict = copyDict;
+    return true;
+    }
+  return false;
+}
+
+} // End of namespace OTB
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h b/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h
new file mode 100644
index 0000000..59d4fca
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbChangeNoDataValueFilter.h
@@ -0,0 +1,178 @@
+/*=========================================================================
+
+  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 __otbChangeNoDataValueFilter_h
+#define __otbChangeNoDataValueFilter_h
+
+#include "itkUnaryFunctorImageFilter.h"
+#include "itkMetaDataObject.h"
+#include "otbMetaDataKey.h"
+#include "otbNoDataHelper.h"
+
+namespace otb
+{
+namespace Functor
+{
+/** \class ChangeNoDataFunctor
+ *  \brief Functor used by ChangeNoDataValueFilter
+ *
+ *  See ChangeNoDataValueFilter for complete documentation. 
+ *  \ingroup OTBImageManipulation
+ */
+template <typename TInputPixel, typename TOutputPixel> 
+class ChangeNoDataFunctor
+{
+public:
+  ChangeNoDataFunctor():
+    m_Flags(),
+    m_Values(),
+    m_NewValues(),
+    m_NaNIsNoData(false)
+  {}
+  virtual ~ChangeNoDataFunctor(){}
+
+  inline TOutputPixel operator()(const TInputPixel& in) const
+  {
+    return otb::ChangeNoData(in,m_Flags,m_Values,m_NewValues,m_NaNIsNoData);
+  }
+
+  std::vector<bool>   m_Flags;
+  std::vector<double> m_Values;
+  std::vector<double> m_NewValues;
+  bool                m_NaNIsNoData;
+};
+
+} // End namespace Functor
+
+/** \class ChangeNoDataValueFilter
+ *  \brief Change no-data flags and values and replace them in image
+ *  
+ *  This filter reads the no-data flags (a boolean vector indicating
+ *  for each band if a no-data value exists) and values (the actual
+ *  value to be used as no-data for each band) from
+ *  MetaDataDictionary, and allows to change this value.
+ * 
+ *  The algorithm is the following: for each pixel, for each channel
+ *  in the pixel, if there is a no-data value for this channel
+ *  (according to no-data flags) and the current channel value equals
+ *  to the no-data value set for this channel, then the value is
+ *  changed for the new no-data value specified by the
+ *  users. Otherwise, value remains untouched.
+ * 
+ *  If NaNIsNoData is true:
+ *  - NaN values will be considered as no data and replaced as well
+ *  - Output image will have no-data flags and values for all bands
+ *
+ *  If NaNIsNoData is false:
+ *  - Band for which input no-data flags is false will remain
+ *    untouched
+ *  - Output image will have no-data flags and values only for bands
+ *    for which input no-data flag is true.
+ * 
+ * \ingroup Streamed
+ * \ingroup MultiThreaded
+ * \ingroup OTBImageManipulation
+ */
+template <typename TInputImage, typename TOutputImage>
+class ChangeNoDataValueFilter
+  : public itk::UnaryFunctorImageFilter<TInputImage,
+                                        TOutputImage,
+                                        Functor::ChangeNoDataFunctor<typename TInputImage::PixelType,
+                                                                     typename TOutputImage::PixelType> >
+{
+public:
+  typedef Functor::ChangeNoDataFunctor<typename TInputImage::PixelType,typename TOutputImage::PixelType> FunctorType;
+
+  typedef ChangeNoDataValueFilter                           Self;
+  typedef itk::UnaryFunctorImageFilter<TInputImage,
+                                        TOutputImage,
+                                       FunctorType>         Superclass;
+  typedef itk::SmartPointer<Self>                           Pointer;
+  typedef itk::SmartPointer<const Self>                     ConstPointer;
+
+  /** Type macro */
+  itkNewMacro(Self);
+
+  /** Creation through object factory macro */
+  itkTypeMacro(ChangeNoDataValueFilter, itk::ImageToImageFilter);
+
+  /**
+   * Set the new no-data values
+   * \param newValues The vector of new no-data values (size should be
+   * >= to number of bands)
+   */
+  void SetNewNoDataValues(std::vector<double> & newValues)
+  {
+    this->GetFunctor().m_NewValues = newValues;
+  }
+
+   /**
+   * Set the NaN is no data flags
+   * \param nanIsNoData If true, NaN values will be considered as
+   * no-data as well (default is false)
+   */
+  void SetNaNIsNoData(bool nanIsNoData)
+  {
+    this->GetFunctor().m_NaNIsNoData = nanIsNoData;
+  }
+
+protected:
+  ChangeNoDataValueFilter()
+  {}
+
+  virtual ~ChangeNoDataValueFilter()
+  {}
+
+  virtual void GenerateOutputInformation()
+  {
+    Superclass::GenerateOutputInformation();
+
+    std::vector<bool> noDataValueAvailable;
+    std::vector<double> noDataValues;
+
+    bool ret = ReadNoDataFlags(this->GetInput()->GetMetaDataDictionary(),noDataValueAvailable,noDataValues);
+
+    if(!ret)
+      {
+      noDataValueAvailable.resize(this->GetInput()->GetNumberOfComponentsPerPixel(),false);
+      noDataValues.resize(this->GetInput()->GetNumberOfComponentsPerPixel(),0);
+      }
+
+    this->GetFunctor().m_Flags = noDataValueAvailable;
+    this->GetFunctor().m_Values = noDataValues;
+    
+    std::vector<bool> flags = noDataValueAvailable;
+    
+    if(this->GetFunctor().m_NaNIsNoData)
+      {
+      flags = std::vector<bool>(flags.size(),true);
+      }
+    
+    WriteNoDataFlags(flags,this->GetFunctor().m_NewValues,this->GetOutput()->GetMetaDataDictionary());
+  }
+
+private:
+  ChangeNoDataValueFilter(const Self&); // purposely not implemented
+  void operator =(const Self&); // purposely not implemented
+
+}; 
+
+} // End namespace otb
+
+
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h
index 1c20500..a4866f2 100644
--- a/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h
+++ b/Modules/Filtering/ImageManipulation/include/otbConcatenateScalarValueImageFilter.h
@@ -55,7 +55,7 @@ public:
     m_ScalarValue = p;
   }
 
-  bool operator !=(const ConcatenateScalarValueFunctor& other) const
+  bool operator !=(const ConcatenateScalarValueFunctor& itkNotUsed(other)) const
   {
     return false;
   }
diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h
index e92979c..62bbeff 100644
--- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h
+++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValue.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h
index 6b0d7f4..6aa3b2e 100644
--- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h
+++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.txx b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.txx
index f83dcc3..37c2115 100644
--- a/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.txx
+++ b/Modules/Filtering/ImageManipulation/include/otbEuclideanDistanceMetricWithMissingValuePow2.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h
index 0df9e91..2c94887 100644
--- a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h
+++ b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.txx b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.txx
index c8b77af..9bdb744 100644
--- a/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.txx
+++ b/Modules/Filtering/ImageManipulation/include/otbFlexibleDistanceWithMissingValue.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h b/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h
new file mode 100644
index 0000000..a790b37
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbImageToNoDataMaskFilter.h
@@ -0,0 +1,156 @@
+/*=========================================================================
+
+  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 __otbImageToNoDataMaskFilter_h
+#define __otbImageToNoDataMaskFilter_h
+
+#include "itkUnaryFunctorImageFilter.h"
+#include "itkMetaDataObject.h"
+#include "otbMetaDataKey.h"
+#include "otbNoDataHelper.h"
+
+namespace otb
+{
+namespace Functor
+{
+/** \class NoDataFunctor
+ *  \brief Functor used by ImageToNoDataMaskFilter
+ *
+ *  See ImageToNoDataMaskFilter for complete documentation. 
+ *  \ingroup OTBImageManipulation
+ */
+template <typename TInputPixel, typename TOutputPixel> 
+class NoDataFunctor
+{
+public:
+  NoDataFunctor():
+    m_Flags(),
+    m_Values(),
+    m_OutsideValue(0),
+    m_InsideValue(1),
+    m_NaNIsNoData(false)
+  {}
+  virtual ~NoDataFunctor(){}
+
+  inline TOutputPixel operator()(const TInputPixel& in) const
+  {
+    return otb::IsNoData(in,m_Flags,m_Values,m_NaNIsNoData)?m_OutsideValue:m_InsideValue;
+  }
+
+  std::vector<bool>   m_Flags;
+  std::vector<double> m_Values;
+  TOutputPixel        m_OutsideValue;
+  TOutputPixel        m_InsideValue;
+  bool                m_NaNIsNoData;
+};
+
+} // End namespace Functor
+
+
+/** \class ImageToNoDataMaskFilter 
+ *  \brief Builds a no-data mask image from no-data flags and values
+ *  
+ *  This filter reads the no-data flags (a boolean vector indicating
+ *  for each band if a no-data value exists) and values (the actual
+ *  value to be used as no-data for each band) from
+ *  MetaDataDictionary, and builds a binary mask indicating presence
+ *  or absence of no-data for each pixel.
+ * 
+ *  If NaNIsNoData is true, NaN pixels will also be considered as
+ *  no-data pixels.
+ * 
+ * \ingroup Streamed
+ * \ingroup MultiThreaded
+ * \ingroup OTBImageManipulation
+ */
+template <typename TInputImage, typename TOutputImage>
+class ImageToNoDataMaskFilter
+  : public itk::UnaryFunctorImageFilter<TInputImage,
+                                        TOutputImage,
+                                        Functor::NoDataFunctor<typename TInputImage::PixelType,
+                                                               typename TOutputImage::PixelType> >
+{
+public:
+  typedef Functor::NoDataFunctor<typename TInputImage::PixelType,typename TOutputImage::PixelType> FunctorType;
+
+  typedef ImageToNoDataMaskFilter                           Self;
+  typedef itk::UnaryFunctorImageFilter<TInputImage,
+                                        TOutputImage,
+                                       FunctorType>         Superclass;
+  typedef itk::SmartPointer<Self>                           Pointer;
+  typedef itk::SmartPointer<const Self>                     ConstPointer;
+
+  /** Type macro */
+  itkNewMacro(Self);
+
+  /** Creation through object factory macro */
+  itkTypeMacro(SpectralAngleDistanceImageFilter, itk::ImageToImageFilter);
+
+  /**
+   * Set inside value of output mask. This value will be used to
+   * indicate absence of no-data for the pixel in the output mask
+   */ 
+  void SetInsideValue(const typename TOutputImage::PixelType & value)
+  {
+    this->GetFunctor().m_InsideValue = value;
+  }
+  /**
+   * Set outside value of output mask. This value will be used to
+   * indicate presence of no-data for the pixel in the output mask
+   */ 
+  void SetOutsideValue(const typename TOutputImage::PixelType & value)
+  {
+    this->GetFunctor().m_OutsideValue = value;
+  }
+  /**
+   * Set the NaN is no data flags
+   * \param nanIsNoData If true, NaN values will be considered as
+   * no-data as well (default is false)
+   */
+  void SetNaNIsNoData(bool nanIsNoData)
+  {
+    this->GetFunctor().m_NaNIsNoData=nanIsNoData;
+  }
+
+protected:
+  ImageToNoDataMaskFilter()
+  {}
+
+  virtual ~ImageToNoDataMaskFilter()
+  {}
+
+  virtual void BeforeThreadedGenerateData()
+  {
+    std::vector<bool> noDataValueAvailable;
+    std::vector<double> noDataValues;
+
+    ReadNoDataFlags(this->GetInput()->GetMetaDataDictionary(),noDataValueAvailable,noDataValues);
+    
+    this->GetFunctor().m_Flags = noDataValueAvailable;
+    this->GetFunctor().m_Values = noDataValues;
+  }
+
+private:
+  ImageToNoDataMaskFilter(const Self&); // purposely not implemented
+  void operator =(const Self&); // purposely not implemented
+}; 
+
+} // End namespace otb
+
+
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h
new file mode 100644
index 0000000..18f1465
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.h
@@ -0,0 +1,92 @@
+/*=========================================================================
+
+  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 __otbNRIBandImagesToOneNComplexBandsImage_h
+#define __otbNRIBandImagesToOneNComplexBandsImage_h
+
+#include "itkImageToImageFilter.h"
+#include "itkImage.h"
+#include "itkNumericTraits.h"
+
+/*
+ * Inputs : N images made of two real bands 
+ * Output : one single image made of N complex bands
+ * 
+ * */
+
+
+namespace otb
+{
+
+
+template <class TInputImage, class TOutputImage>
+class ITK_EXPORT NRIBandImagesToOneNComplexBandsImage :  public itk::ImageToImageFilter<TInputImage, TOutputImage>
+{
+public:
+  /**   Extract input and output image dimension */
+  itkStaticConstMacro(InputImageDimension,
+                      unsigned int,
+                      TInputImage::ImageDimension);
+  itkStaticConstMacro(OutputImageDimension,
+                      unsigned int,
+                      TOutputImage::ImageDimension);
+
+  typedef TInputImage  InputImageType;
+  typedef TOutputImage OutputImageType;
+
+  /** standard class typedefs */
+  typedef NRIBandImagesToOneNComplexBandsImage                                           Self;
+  typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
+  typedef itk::SmartPointer<Self>                                  Pointer;
+  typedef itk::SmartPointer<const Self>                            ConstPointer;
+
+  /** Object factory management */
+  itkNewMacro(Self);
+
+  /** typemacro */
+  itkTypeMacro(NRIBandImagesToOneNComplexBandsImage, ImageToImageFilter);
+
+  typedef typename InputImageType::PixelType                    InputPixelType;
+  typedef typename OutputImageType::PixelType                   OutputPixelType;
+  typedef typename itk::NumericTraits<InputPixelType>::RealType InputRealType;
+  typedef typename InputImageType::RegionType                   InputImageRegionType;
+  typedef typename OutputImageType::RegionType                  OutputImageRegionType;
+
+
+protected:
+  NRIBandImagesToOneNComplexBandsImage();
+  virtual ~NRIBandImagesToOneNComplexBandsImage() {}
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+  void GenerateOutputInformation(void);
+  void BeforeThreadedGenerateData(void);
+  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
+                            itk::ThreadIdType threadId);
+
+private:
+  NRIBandImagesToOneNComplexBandsImage(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+
+};
+} // end namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbNRIBandImagesToOneNComplexBandsImage.txx"
+#endif
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.txx b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.txx
new file mode 100644
index 0000000..46abbf7
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbNRIBandImagesToOneNComplexBandsImage.txx
@@ -0,0 +1,139 @@
+/*=========================================================================
+
+  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 __otbNRIBandImagesToOneNComplexBandsImage_txx
+#define __otbNRIBandImagesToOneNComplexBandsImage_txx
+
+#include "otbNRIBandImagesToOneNComplexBandsImage.h"
+
+#include "itkImageRegionIterator.h"
+#include "itkImageRegionConstIterator.h"
+#include "itkProgressReporter.h"
+#include "itkVariableLengthVector.h"
+
+
+
+
+namespace otb
+{
+
+/**
+ *
+ */
+template <class TInputImage, class TOutputImage>
+NRIBandImagesToOneNComplexBandsImage<TInputImage, TOutputImage>::NRIBandImagesToOneNComplexBandsImage()
+{
+	//this->SetNumberOfThreads(1);
+}
+
+/**
+ * GenerateOutputInformation
+ */
+template<class TInputImage, class TOutputImage>
+void
+NRIBandImagesToOneNComplexBandsImage<TInputImage, TOutputImage>
+::GenerateOutputInformation(void)
+{
+  Superclass::GenerateOutputInformation();
+  
+  unsigned int nbInputs = this->GetNumberOfInputs();
+  this->GetOutput()->SetNumberOfComponentsPerPixel(nbInputs);
+  
+}
+
+/**
+ * BeforeThreadedGenerateData
+ */
+template <class TInputImage, class TOutputImage>
+void
+NRIBandImagesToOneNComplexBandsImage<TInputImage, TOutputImage>
+::BeforeThreadedGenerateData(void)
+{
+	unsigned int nbInputs = this->GetNumberOfInputs();
+	
+	for (unsigned int i=0; i<nbInputs; i++)
+		if (this->GetInput(i)->GetNumberOfComponentsPerPixel() != 2 )
+			itkExceptionMacro("Input images must be made of two bands and only two (see input #" << i << ").");
+		
+}
+
+/**
+ * ThreadedGenerateData
+ */
+template<class TInputImage, class TOutputImage>
+void NRIBandImagesToOneNComplexBandsImage<TInputImage, TOutputImage>::ThreadedGenerateData(
+  const OutputImageRegionType&     outputRegionForThread,
+  itk::ThreadIdType threadId
+  )
+{
+ 
+  // support progress methods/callbacks
+  itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());	
+	
+  unsigned int nbInputs = this->GetNumberOfInputs();	  
+  
+  itk::VariableLengthVector< std::complex< typename InputPixelType::ValueType > > vlv(nbInputs);
+
+  std::vector< typename itk::ImageRegionConstIterator<TInputImage> > vInIt;
+  for (unsigned int i=0; i<nbInputs; i++)
+	vInIt.push_back( itk::ImageRegionConstIterator<TInputImage>(this->GetInput(i), outputRegionForThread) );
+
+	
+  itk::ImageRegionIterator<OutputImageType>      outIt;
+  outIt = itk::ImageRegionIterator<OutputImageType>(this->GetOutput(), outputRegionForThread);
+  
+  for (unsigned int i=0; i<nbInputs; i++)
+	vInIt[i].GoToBegin();
+  outIt.GoToBegin();
+
+  while (!outIt.IsAtEnd())
+  {
+	  
+	  
+	  for (unsigned int i=0; i<nbInputs; i++)
+	  {
+		  vlv[i] = std::complex< typename InputPixelType::ValueType >(vInIt[i].Get()[0],vInIt[i].Get()[1]);
+		//std::cout << "i = " << i << " " << vInIt[i].Get()[0] << " " << vInIt[i].Get()[1] << std::endl;
+	  }
+
+	  
+	  outIt.Set(vlv);
+	  
+	  //std::cout << "outIt.Get() = " << outIt.Get() << std::endl;
+	  
+	  for (unsigned int i=0; i<nbInputs; i++)
+		++vInIt[i];
+	  ++outIt;
+	  
+	  progress.CompletedPixel();
+  }
+  
+}
+
+/**
+ * Standard "PrintSelf" method
+ */
+template <class TInputImage, class TOutput>
+void
+NRIBandImagesToOneNComplexBandsImage<TInputImage, TOutput>::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  Superclass::PrintSelf(os, indent);
+}
+
+} // end namespace otb
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h
new file mode 100644
index 0000000..7451997
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.h
@@ -0,0 +1,91 @@
+/*=========================================================================
+
+  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 __otbOneRIBandImageToOneComplexBandImage_h
+#define __otbOneRIBandImageToOneComplexBandImage_h
+
+#include "itkImageToImageFilter.h"
+#include "itkImage.h"
+#include "itkNumericTraits.h"
+
+
+/*
+ * Inputs : one image made of two real bands 
+ * Output : one image made of one complex band
+ * 
+ * */
+
+namespace otb
+{
+
+
+template <class TInputImage, class TOutputImage>
+class ITK_EXPORT OneRIBandImageToOneComplexBandImage :  public itk::ImageToImageFilter<TInputImage, TOutputImage>
+{
+public:
+  /**   Extract input and output image dimension */
+  itkStaticConstMacro(InputImageDimension,
+                      unsigned int,
+                      TInputImage::ImageDimension);
+  itkStaticConstMacro(OutputImageDimension,
+                      unsigned int,
+                      TOutputImage::ImageDimension);
+
+  typedef TInputImage  InputImageType;
+  typedef TOutputImage OutputImageType;
+
+  /** standard class typedefs */
+  typedef OneRIBandImageToOneComplexBandImage                                           Self;
+  typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
+  typedef itk::SmartPointer<Self>                                  Pointer;
+  typedef itk::SmartPointer<const Self>                            ConstPointer;
+
+  /** Object factory management */
+  itkNewMacro(Self);
+
+  /** typemacro */
+  itkTypeMacro(OneRIBandImageToOneComplexBandImage, ImageToImageFilter);
+
+  typedef typename InputImageType::PixelType                    InputPixelType;
+  typedef typename OutputImageType::PixelType                   OutputPixelType;
+  typedef typename itk::NumericTraits<InputPixelType>::RealType InputRealType;
+  typedef typename InputImageType::RegionType                   InputImageRegionType;
+  typedef typename OutputImageType::RegionType                  OutputImageRegionType;
+
+
+protected:
+  OneRIBandImageToOneComplexBandImage();
+  virtual ~OneRIBandImageToOneComplexBandImage() {}
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+  void BeforeThreadedGenerateData(void);
+  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
+                            itk::ThreadIdType threadId);
+
+private:
+  OneRIBandImageToOneComplexBandImage(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+
+};
+} // end namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbOneRIBandImageToOneComplexBandImage.txx"
+#endif
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.txx b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.txx
new file mode 100644
index 0000000..8a7003a
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbOneRIBandImageToOneComplexBandImage.txx
@@ -0,0 +1,100 @@
+/*=========================================================================
+
+  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 __otbOneRIBandImageToOneComplexBandImage_txx
+#define __otbOneRIBandImageToOneComplexBandImage_txx
+
+#include "otbOneRIBandImageToOneComplexBandImage.h"
+
+#include "itkImageRegionIterator.h"
+#include "itkImageRegionConstIterator.h"
+#include "itkProgressReporter.h"
+
+namespace otb
+{
+
+/**
+ *
+ */
+template <class TInputImage, class TOutputImage>
+OneRIBandImageToOneComplexBandImage<TInputImage, TOutputImage>::OneRIBandImageToOneComplexBandImage()
+{
+  //this->SetNumberOfThreads(1);
+}
+
+/**
+ * BeforeThreadedGenerateData
+ */
+template <class TInputImage, class TOutputImage>
+void
+OneRIBandImageToOneComplexBandImage<TInputImage, TOutputImage>
+::BeforeThreadedGenerateData(void)
+{
+	if (this->GetInput()->GetNumberOfComponentsPerPixel() != 2 )
+			itkExceptionMacro("Input image must be made of two bands and only two.");
+		
+}
+
+/**
+ * ThreadedGenerateData
+ */
+template<class TInputImage, class TOutputImage>
+void OneRIBandImageToOneComplexBandImage<TInputImage, TOutputImage>::ThreadedGenerateData(
+  const OutputImageRegionType&     outputRegionForThread,
+  itk::ThreadIdType threadId
+  )
+{
+	
+  // support progress methods/callbacks
+  itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());	
+	
+  typename OutputImageType::Pointer     output = this->GetOutput();
+  typename InputImageType::ConstPointer input  = this->GetInput();
+  
+  itk::ImageRegionIterator<OutputImageType>      it;
+   itk::ImageRegionConstIterator<TInputImage>      itIn;
+  
+  itIn = itk::ImageRegionConstIterator<TInputImage>(input, outputRegionForThread);
+  it = itk::ImageRegionIterator<OutputImageType>(output, outputRegionForThread);
+  
+  it.GoToBegin();
+  itIn.GoToBegin();
+  while (!it.IsAtEnd())
+  {
+	  
+	  it.Set(static_cast<OutputPixelType>(   std::complex< typename InputPixelType::ValueType >(itIn.Get()[0],itIn.Get()[1])   ));
+	  
+	  ++it;
+	  ++itIn;
+	  progress.CompletedPixel();
+  }
+  
+}
+
+/**
+ * Standard "PrintSelf" method
+ */
+template <class TInputImage, class TOutput>
+void
+OneRIBandImageToOneComplexBandImage<TInputImage, TOutput>::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  Superclass::PrintSelf(os, indent);
+}
+
+} // end namespace otb
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h
index 26422e3..431bd73 100644
--- a/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h
+++ b/Modules/Filtering/ImageManipulation/include/otbShiftScaleVectorImageFilter.h
@@ -142,6 +142,14 @@ private:
 /** \class ShiftScaleVectorImageFilter
  *  \brief This filter performs a shift and scaling of a vector image on a per band basis.
  *
+ *  For each band, the following formula is applied :
+ *
+ *  \f[ output = \frac{input - shift}{scale} \f]
+ *
+ *  Beware that the behaviour differs from itk::ShiftScaleImageFilter
+ *  (which add shift instead of subtracting it).
+ *
+ *  \sa VectorShiftScale
  *  \ingroup IntensityImageFilters
  *  \ingroup MultiThreaded
  *
diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h
index 8411174..71230c9 100644
--- a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h
+++ b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h
@@ -171,6 +171,9 @@ public:
     m_DisplacementFilter->SetNumberOfThreads(nbThread);
   }
 
+  /** Override itk::ProcessObject method to let the internal filter do the propagation */
+  virtual void PropagateRequestedRegion(itk::DataObject *output);
+
 protected:
   StreamingResampleImageFilter();
 
@@ -181,8 +184,6 @@ protected:
 
   virtual void GenerateOutputInformation();
 
-  virtual void GenerateInputRequestedRegion();
-
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
 private:
diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx
index 03ad438..8543b9e 100644
--- a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx
+++ b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx
@@ -50,7 +50,7 @@ StreamingResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionTy
   progress->RegisterInternalFilter(m_WarpFilter, 1.f);
 
   m_WarpFilter->GraftOutput(this->GetOutput());
-  m_WarpFilter->Update();
+  m_WarpFilter->UpdateOutputData(m_WarpFilter->GetOutput());
   this->GraftOutput(m_WarpFilter->GetOutput());
 }
 
@@ -62,41 +62,14 @@ void
 StreamingResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionType>
 ::GenerateOutputInformation()
 {
-  // call the superclass's implementation of this method
-  Superclass::GenerateOutputInformation();
-
-  typename OutputImageType::Pointer outputPtr = this->GetOutput();
-
-  outputPtr->SetSpacing( this->GetOutputSpacing() );
-  outputPtr->SetOrigin(  this->GetOutputOrigin() );
-
-  typename OutputImageType::RegionType region;
-  region.SetSize( this->GetOutputSize() );
-  region.SetIndex(this->GetOutputStartIndex() );
-
-  outputPtr->SetLargestPossibleRegion(region);
-
   // check the output spacing of the displacement field
   if(this->GetDisplacementFieldSpacing()== itk::NumericTraits<SpacingType>::ZeroValue())
     {
     this->SetDisplacementFieldSpacing(2.*this->GetOutputSpacing());
     }
-}
-
-template <class TInputImage, class TOutputImage, class TInterpolatorPrecisionType>
-void
-StreamingResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionType>
-::GenerateInputRequestedRegion()
-{
-  // Retrieve output pointer
-  OutputImageType * outputPtr = this->GetOutput();
 
-  // Retrieve input pointer
-  const InputImageType * inputPtr = this->GetInput();
-
-  // Retrieve output requested region
-  RegionType requestedRegion = outputPtr->GetRequestedRegion();
-  SizeType largestSize       = outputPtr->GetLargestPossibleRegion().GetSize();
+  // Retrieve output largest region
+  SizeType largestSize       = this->GetOutputSize();
 
   // Set up displacement field filter
   SizeType displacementFieldLargestSize;
@@ -117,10 +90,20 @@ StreamingResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionTy
   m_DisplacementFilter->SetOutputSize(displacementFieldLargestSize);
   m_DisplacementFilter->SetOutputIndex(this->GetOutputStartIndex());
 
-  // Generate input requested region
-  m_WarpFilter->SetInput(inputPtr);
-  m_WarpFilter->GetOutput()->UpdateOutputInformation();
-  m_WarpFilter->GetOutput()->SetRequestedRegion(requestedRegion);
+  m_WarpFilter->SetInput(this->GetInput());
+  m_WarpFilter->GraftOutput(this->GetOutput());
+  m_WarpFilter->UpdateOutputInformation();
+  this->GraftOutput(m_WarpFilter->GetOutput());
+}
+
+template <class TInputImage, class TOutputImage, class TInterpolatorPrecisionType>
+void
+StreamingResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionType>
+::PropagateRequestedRegion(itk::DataObject *output)
+{
+  if (this->m_Updating) return;
+
+  m_WarpFilter->GetOutput()->SetRequestedRegion(output);
   m_WarpFilter->GetOutput()->PropagateRequestedRegion();
 }
 
diff --git a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h
new file mode 100644
index 0000000..e60a091
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.h
@@ -0,0 +1,92 @@
+/*=========================================================================
+
+  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 __otbTwoNRIBandsImageToNComplexBandsImage_h
+#define __otbTwoNRIBandsImageToNComplexBandsImage_h
+
+#include "itkImageToImageFilter.h"
+#include "itkImage.h"
+#include "itkNumericTraits.h"
+
+/*
+ * Inputs : one single image made of 2N real bands 
+ * Output : one single image made of N complex bands
+ * 
+ * */
+
+
+namespace otb
+{
+
+
+template <class TInputImage, class TOutputImage>
+class ITK_EXPORT TwoNRIBandsImageToNComplexBandsImage :  public itk::ImageToImageFilter<TInputImage, TOutputImage>
+{
+public:
+  /**   Extract input and output image dimension */
+  itkStaticConstMacro(InputImageDimension,
+                      unsigned int,
+                      TInputImage::ImageDimension);
+  itkStaticConstMacro(OutputImageDimension,
+                      unsigned int,
+                      TOutputImage::ImageDimension);
+
+  typedef TInputImage  InputImageType;
+  typedef TOutputImage OutputImageType;
+
+  /** standard class typedefs */
+  typedef TwoNRIBandsImageToNComplexBandsImage                                           Self;
+  typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
+  typedef itk::SmartPointer<Self>                                  Pointer;
+  typedef itk::SmartPointer<const Self>                            ConstPointer;
+
+  /** Object factory management */
+  itkNewMacro(Self);
+
+  /** typemacro */
+  itkTypeMacro(TwoNRIBandsImageToNComplexBandsImage, ImageToImageFilter);
+
+  typedef typename InputImageType::PixelType                    InputPixelType;
+  typedef typename OutputImageType::PixelType                   OutputPixelType;
+  typedef typename itk::NumericTraits<InputPixelType>::RealType InputRealType;
+  typedef typename InputImageType::RegionType                   InputImageRegionType;
+  typedef typename OutputImageType::RegionType                  OutputImageRegionType;
+
+
+protected:
+  TwoNRIBandsImageToNComplexBandsImage();
+  virtual ~TwoNRIBandsImageToNComplexBandsImage() {}
+  void PrintSelf(std::ostream& os, itk::Indent indent) const;
+
+  void GenerateOutputInformation(void);
+  void BeforeThreadedGenerateData(void);
+  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
+                            itk::ThreadIdType threadId);
+
+private:
+  TwoNRIBandsImageToNComplexBandsImage(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+
+};
+} // end namespace otb
+
+#ifndef OTB_MANUAL_INSTANTIATION
+#include "otbTwoNRIBandsImageToNComplexBandsImage.txx"
+#endif
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.txx b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.txx
new file mode 100644
index 0000000..c61f07a
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/include/otbTwoNRIBandsImageToNComplexBandsImage.txx
@@ -0,0 +1,143 @@
+/*=========================================================================
+
+  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 __otbTwoNRIBandsImageToNComplexBandsImage_txx
+#define __otbTwoNRIBandsImageToNComplexBandsImage_txx
+
+#include "otbTwoNRIBandsImageToNComplexBandsImage.h"
+
+#include "itkImageRegionIterator.h"
+#include "itkImageRegionConstIterator.h"
+#include "itkProgressReporter.h"
+#include "itkVariableLengthVector.h"
+
+
+
+
+namespace otb
+{
+
+/**
+ *
+ */
+template <class TInputImage, class TOutputImage>
+TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutputImage>::TwoNRIBandsImageToNComplexBandsImage()
+{
+	//this->SetNumberOfThreads(1);
+}
+
+/**
+ * GenerateOutputInformation
+ */
+template<class TInputImage, class TOutputImage>
+void
+TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutputImage>
+::GenerateOutputInformation(void)
+{
+  Superclass::GenerateOutputInformation();
+  
+  unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
+  
+  if ( (nbCompo % 2) != 0 )
+  {
+	itkExceptionMacro("Number of bands of the input images must be an even number");
+  }
+  else
+	this->GetOutput()->SetNumberOfComponentsPerPixel(nbCompo/2);
+	
+	std::cout << "GenerateOutputInformation : " << this->GetOutput()->GetNumberOfComponentsPerPixel() << std::endl;
+  
+}
+
+/**
+ * BeforeThreadedGenerateData
+ */
+template <class TInputImage, class TOutputImage>
+void
+TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutputImage>
+::BeforeThreadedGenerateData(void)
+{
+	unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
+			
+	if ( (nbCompo % 2) != 0 )
+	  itkExceptionMacro("Number of bands of the input images must be an even number");
+		
+}
+
+/**
+ * ThreadedGenerateData
+ */
+template<class TInputImage, class TOutputImage>
+void TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutputImage>::ThreadedGenerateData(
+  const OutputImageRegionType&     outputRegionForThread,
+  itk::ThreadIdType threadId
+  )
+{
+ 
+  unsigned int nbCompo = this->GetInput()->GetNumberOfComponentsPerPixel();
+  
+  itk::VariableLengthVector< std::complex< typename InputPixelType::ValueType > > vlv(nbCompo/2);
+  
+ 
+  // support progress methods/callbacks
+  itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());	
+
+  itk::ImageRegionConstIterator<TInputImage>  inIt;
+  inIt = itk::ImageRegionConstIterator<TInputImage>(this->GetInput(), outputRegionForThread);	
+	
+  itk::ImageRegionIterator<OutputImageType>      outIt;
+  outIt = itk::ImageRegionIterator<OutputImageType>(this->GetOutput(), outputRegionForThread);
+  
+
+  inIt.GoToBegin();
+  outIt.GoToBegin();
+
+  while (!outIt.IsAtEnd())
+  {
+	  
+	  unsigned int k=0;
+	  for (unsigned int i=0; i<nbCompo-1; i=i+2)
+	  {
+		  vlv[k] = std::complex< typename InputPixelType::ValueType >(inIt.Get()[i],inIt.Get()[i+1]);
+		  k++;
+	  }
+
+	  
+	  outIt.Set(vlv);
+	  
+
+	  ++inIt;
+	  ++outIt;
+	  
+	  progress.CompletedPixel();
+  }
+  
+}
+
+/**
+ * Standard "PrintSelf" method
+ */
+template <class TInputImage, class TOutput>
+void
+TwoNRIBandsImageToNComplexBandsImage<TInputImage, TOutput>::PrintSelf(std::ostream& os, itk::Indent indent) const
+{
+  Superclass::PrintSelf(os, indent);
+}
+
+} // end namespace otb
+
+#endif
diff --git a/Modules/Filtering/ImageManipulation/otb-module.cmake b/Modules/Filtering/ImageManipulation/otb-module.cmake
index ca49464..6a14156 100644
--- a/Modules/Filtering/ImageManipulation/otb-module.cmake
+++ b/Modules/Filtering/ImageManipulation/otb-module.cmake
@@ -10,6 +10,7 @@ otb_module(OTBImageManipulation
     OTBCommon
     OTBITK
     OTBImageBase
+    OTBMetadata
     OTBInterpolation
     OTBObjectList
     OTBStreaming
diff --git a/Modules/Filtering/ImageManipulation/test/CMakeLists.txt b/Modules/Filtering/ImageManipulation/test/CMakeLists.txt
index a167f9c..3019412 100644
--- a/Modules/Filtering/ImageManipulation/test/CMakeLists.txt
+++ b/Modules/Filtering/ImageManipulation/test/CMakeLists.txt
@@ -70,6 +70,12 @@ otbSpectralAngleDistanceImageFilter.cxx
 otbFunctionWithNeighborhoodToImageFilterNew.cxx
 otbEuclideanDistanceMetricWithMissingValue.cxx
 otbEuclideanDistanceMetricWithMissingValueNew.cxx
+otbNRIBandImagesToOneNComplexBandsImage.cxx
+otbOneRIBandImageToOneComplexBandImage.cxx
+otbTwoNRIBandsImageToNComplexBandsImage.cxx
+otbChangeNoDataValueFilter.cxx
+otbImageToNoDataMaskFilter.cxx
+otbChangeInformationImageFilter.cxx
 )
 
 add_executable(otbImageManipulationTestDriver ${OTBImageManipulationTests})
@@ -669,3 +675,44 @@ otb_add_test(NAME bfTvEuclideanDistanceMetricWithMissingValue COMMAND otbImageMa
   otbEuclideanDistanceMetricWithMissingValue)
 otb_add_test(NAME bfTuEuclideanDistanceMetricWithMissingValueNew COMMAND otbImageManipulationTestDriver
   otbEuclideanDistanceMetricWithMissingValueNew)
+
+otb_add_test(NAME bfTvTwoNRIBandsImageToNComplexBandsImage COMMAND otbImageManipulationTestDriver
+  --compare-image ${EPSILON_7}
+  ${BASELINE}/bfTvNRIBandImagesToOneNComplexBandsImage.tif
+  ${TEMP}/bfTvTwoNRIBandsImageToNComplexBandsImage.tif
+  otbTwoNRIBandsImageToNComplexBandsImage
+  ${INPUTDATA}/RSAT_imagery_HH_HV_VV.tif
+  ${TEMP}/bfTvTwoNRIBandsImageToNComplexBandsImage.tif
+  )
+  
+  
+otb_add_test(NAME bfTvNRIBandImagesToOneNComplexBandsImage COMMAND otbImageManipulationTestDriver
+  --compare-image ${EPSILON_7}
+  ${BASELINE}/bfTvNRIBandImagesToOneNComplexBandsImage.tif
+  ${TEMP}/bfTvNRIBandImagesToOneNComplexBandsImage.tif
+  otbNRIBandImagesToOneNComplexBandsImage 
+  ${INPUTDATA}/RSAT_imagery_HH.tif
+  ${INPUTDATA}/RSAT_imagery_HV.tif
+  ${INPUTDATA}/RSAT_imagery_VV.tif
+  ${TEMP}/bfTvNRIBandImagesToOneNComplexBandsImage.tif
+  )
+  
+otb_add_test(NAME bfTvOneRIBandImageToOneComplexBandImage COMMAND otbImageManipulationTestDriver
+  --compare-image ${EPSILON_3}
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${TEMP}/bfTvOneRIBandImageToOneComplexBandImage.tif
+  otbOneRIBandImageToOneComplexBandImage
+  ${INPUTDATA}/RSAT_imagery_HH.tif
+  ${TEMP}/bfTvOneRIBandImageToOneComplexBandImage.tif
+  )
+
+otb_add_test(NAME filteringImageManipulationChangeNoDataValueFilter COMMAND otbImageManipulationTestDriver
+  otbChangeNoDataValueFilter)
+
+otb_add_test(NAME filteringImageManipulationImageToNoDataMaskFilter COMMAND otbImageManipulationTestDriver
+  otbImageToNoDataMaskFilter)
+
+otb_add_test(NAME bfTvChangeInformationImageFilter COMMAND  otbImageManipulationTestDriver
+  otbChangeInformationImageFilter
+  ${INPUTDATA}/WV2_PAN_ROI_1000_100.tif
+  )
diff --git a/Modules/Filtering/ImageManipulation/test/otbAmplitudeFunctorTest.cxx b/Modules/Filtering/ImageManipulation/test/otbAmplitudeFunctorTest.cxx
index e70bb07..6dfd9b6 100644
--- a/Modules/Filtering/ImageManipulation/test/otbAmplitudeFunctorTest.cxx
+++ b/Modules/Filtering/ImageManipulation/test/otbAmplitudeFunctorTest.cxx
@@ -21,6 +21,7 @@
 #include "itkVariableLengthVector.h"
 #include "itkRGBPixel.h"
 #include "itkRGBAPixel.h"
+#include "otbMath.h"
 
 int otbAmplitudeFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
 {
@@ -54,7 +55,7 @@ int otbAmplitudeFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
       funct.SetChannelList(channels);
       output = funct.operator ()(vectorPixel);
       result = vcl_sqrt(vectorPixel[i] * vectorPixel[i] + vectorPixel[j] * vectorPixel[j]);
-      if( abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
+      if( vcl_abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
         {
           std::cout << "vectorPixelType Test VectorPixelType failed for channels " << i<< " and "
               << j << " !" << std::endl;
@@ -78,7 +79,7 @@ int otbAmplitudeFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
       funct.SetChannelList(channels);
       output = funct.operator ()(rgbPixel);
       result = vcl_sqrt(rgbPixel[i] * rgbPixel[i] + rgbPixel[j] * rgbPixel[j]);
-      if( abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
+      if( vcl_abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
         {
           std::cout << "vectorPixelType Test RGBPixelType failed for channels " << i<< " and "
               << j << " !" << std::endl;
@@ -107,7 +108,7 @@ int otbAmplitudeFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
       funct.SetChannelList(channels);
       output = funct.operator ()(rgbaPixel);
       result = vcl_sqrt(rgbaPixel[i] * rgbaPixel[i] + rgbaPixel[j] * rgbaPixel[j]);
-      if( abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
+      if( std::abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
         {
           std::cout << "vectorPixelType Test RGBAPixelType failed for channels " << i<< " and "
               << j << " !" << std::endl;
diff --git a/Modules/Filtering/ImageManipulation/test/otbBoxAndWhiskerImageFilterNew.cxx b/Modules/Filtering/ImageManipulation/test/otbBoxAndWhiskerImageFilterNew.cxx
index bace7cb..827e79d 100644
--- a/Modules/Filtering/ImageManipulation/test/otbBoxAndWhiskerImageFilterNew.cxx
+++ b/Modules/Filtering/ImageManipulation/test/otbBoxAndWhiskerImageFilterNew.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx b/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx
new file mode 100644
index 0000000..2a6a7e2
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx
@@ -0,0 +1,66 @@
+/*=========================================================================
+
+  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 "otbChangeInformationImageFilter.h"
+#include "otbImageFileReader.h"
+#include "otbImage.h"
+
+int otbChangeInformationImageFilter(int itkNotUsed(argc), char * argv[])
+{
+  const char *inputFilename(argv[1]);
+
+  typedef otb::Image<float,2> ImageType;
+  typedef otb::ChangeInformationImageFilter<ImageType> FilterType;
+  typedef otb::ImageFileReader<ImageType> ReaderType;
+  
+  ReaderType::Pointer reader = ReaderType::New();
+  reader->SetFileName(inputFilename);
+  
+  FilterType::Pointer filter = FilterType::New();
+  filter->SetInput(reader->GetOutput());
+  // try to set a different ProjRef
+  std::string newProj("Fake ProjRef");
+  filter->SetOutputMetaData<std::string>(otb::MetaDataKey::ProjectionRefKey,&newProj);
+  // erase that choice
+  filter->SetOutputMetaData<std::string>(otb::MetaDataKey::ProjectionRefKey,NULL);
+  // add a no data to the image
+  std::vector<bool> flags;
+  flags.push_back(true);
+  std::vector<double> nodata;
+  nodata.push_back(0.0);
+  filter->SetOutputMetaData<std::vector<bool> >(otb::MetaDataKey::NoDataValueAvailable,&flags);
+  filter->SetOutputMetaData<std::vector<double> >(otb::MetaDataKey::NoDataValue,&nodata);
+  filter->UpdateOutputInformation();
+
+  ImageType::Pointer outImage = filter->GetOutput();
+  if (! outImage->GetProjectionRef().empty())
+    {
+    std::cout << "Projection is supposed to be removed but is still present !" << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  itk::MetaDataDictionary &dict = outImage->GetMetaDataDictionary();
+  if (!dict.HasKey(otb::MetaDataKey::NoDataValueAvailable) ||
+      !dict.HasKey(otb::MetaDataKey::NoDataValue))
+    {
+    std::cout << "Missing no data metadata !" << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  return EXIT_SUCCESS;
+}
+
diff --git a/Modules/Filtering/ImageManipulation/test/otbChangeNoDataValueFilter.cxx b/Modules/Filtering/ImageManipulation/test/otbChangeNoDataValueFilter.cxx
new file mode 100644
index 0000000..db37158
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/test/otbChangeNoDataValueFilter.cxx
@@ -0,0 +1,103 @@
+/*=========================================================================
+
+  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 "otbImage.h"
+#include "otbChangeNoDataValueFilter.h"
+#include "itkImageRegionIterator.h"
+
+int otbChangeNoDataValueFilter(int itkNotUsed(argc),char * itkNotUsed(argv) [])
+{
+
+  // Build an image
+  typedef otb::Image<double> ImageType;
+  ImageType::Pointer img = ImageType::New();
+
+  ImageType::SizeType size;
+  size.Fill(20);
+
+  ImageType::RegionType region;
+  region.SetSize(size);
+
+  // Fill it with a default value
+  img->SetRegions(region);
+  img->Allocate();
+  img->FillBuffer(10);
+
+  // Write no-data flags to it
+  std::vector<bool> flags(1,true);
+  std::vector<double> values(1,-10.);
+  otb::WriteNoDataFlags(flags,values,img->GetMetaDataDictionary());
+
+  // Fill half of the pixels with no-data values
+  itk::ImageRegionIterator<ImageType> it(img,region);
+  unsigned int count = 0;
+  for(it.GoToBegin();!it.IsAtEnd();++it,++count)
+    {
+    if (count%2 == 0)
+      it.Set(-10.);
+    }
+
+  // Instanciate filter
+  typedef otb::ChangeNoDataValueFilter<ImageType,ImageType> FilterType;
+  FilterType::Pointer filter = FilterType::New();
+
+  std::vector<double> newValues(1,-20.);
+
+  filter->SetInput(img);
+  filter->SetNewNoDataValues(newValues);
+  filter->Update();
+
+  // Check output
+  it = itk::ImageRegionIterator<ImageType>(filter->GetOutput(),region);
+  count = 0;
+
+  bool failed = false;
+  
+  for(it.GoToBegin();!it.IsAtEnd();++it,++count)
+    {
+    if (count%2 == 0 && it.Get()!=-20.)
+      {
+      std::cerr<<"Pixel should have new no-data value"<<std::endl;
+      failed = true;
+      }
+    else if(count%2 == 1 && it.Get()!=10.)
+      {
+      std::cerr<<"Pixel value should be unchanged"<<std::endl;
+      failed = true;
+      }
+    }
+  
+  otb::ReadNoDataFlags(filter->GetOutput()->GetMetaDataDictionary(),flags,values);
+
+  if(flags.empty() || !flags[0])
+    {
+    std::cerr<<"Output no-data flag should be [1] "<<std::endl;
+    failed = true;
+    }
+
+  if(values.empty() || values[0]!=-20)
+    {
+    std::cerr<<"Output no-data value should be [-20.]"<<std::endl;
+    failed = true;
+    }
+
+  if(failed)
+    return EXIT_FAILURE;
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/ImageManipulation/test/otbEuclideanDistanceMetricWithMissingValue.cxx b/Modules/Filtering/ImageManipulation/test/otbEuclideanDistanceMetricWithMissingValue.cxx
index 6fbf120..735ab48 100644
--- a/Modules/Filtering/ImageManipulation/test/otbEuclideanDistanceMetricWithMissingValue.cxx
+++ b/Modules/Filtering/ImageManipulation/test/otbEuclideanDistanceMetricWithMissingValue.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/test/otbEuclideanDistanceMetricWithMissingValueNew.cxx b/Modules/Filtering/ImageManipulation/test/otbEuclideanDistanceMetricWithMissingValueNew.cxx
index ce76201..2b29619 100644
--- a/Modules/Filtering/ImageManipulation/test/otbEuclideanDistanceMetricWithMissingValueNew.cxx
+++ b/Modules/Filtering/ImageManipulation/test/otbEuclideanDistanceMetricWithMissingValueNew.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx b/Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx
index 361248a..299f674 100644
--- a/Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx
+++ b/Modules/Filtering/ImageManipulation/test/otbImageManipulationTestDriver.cxx
@@ -76,4 +76,10 @@ void RegisterTests()
   REGISTER_TEST(otbFunctionWithNeighborhoodToImageFilterNew);
   REGISTER_TEST(otbEuclideanDistanceMetricWithMissingValue);
   REGISTER_TEST(otbEuclideanDistanceMetricWithMissingValueNew);
+  REGISTER_TEST(otbNRIBandImagesToOneNComplexBandsImage);
+  REGISTER_TEST(otbOneRIBandImageToOneComplexBandImage);
+  REGISTER_TEST(otbTwoNRIBandsImageToNComplexBandsImage);
+  REGISTER_TEST(otbChangeNoDataValueFilter);
+  REGISTER_TEST(otbImageToNoDataMaskFilter);
+  REGISTER_TEST(otbChangeInformationImageFilter);
 }
diff --git a/Modules/Filtering/ImageManipulation/test/otbImageToNoDataMaskFilter.cxx b/Modules/Filtering/ImageManipulation/test/otbImageToNoDataMaskFilter.cxx
new file mode 100644
index 0000000..d5c2b42
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/test/otbImageToNoDataMaskFilter.cxx
@@ -0,0 +1,88 @@
+/*=========================================================================
+
+  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 "otbImage.h"
+#include "otbImageToNoDataMaskFilter.h"
+#include "itkImageRegionIterator.h"
+
+int otbImageToNoDataMaskFilter(int itkNotUsed(argc),char * itkNotUsed(argv) [])
+{
+
+  // Build an image
+  typedef otb::Image<double> ImageType;
+  ImageType::Pointer img = ImageType::New();
+
+  ImageType::SizeType size;
+  size.Fill(20);
+
+  ImageType::RegionType region;
+  region.SetSize(size);
+
+  // Fill it with a default value
+  img->SetRegions(region);
+  img->Allocate();
+  img->FillBuffer(10);
+
+  // Write no-data flags to it
+  std::vector<bool> flags(1,true);
+  std::vector<double> values(1,-10.);
+  otb::WriteNoDataFlags(flags,values,img->GetMetaDataDictionary());
+
+  // Fill half of the pixels with no-data values
+  itk::ImageRegionIterator<ImageType> it(img,region);
+  unsigned int count = 0;
+  for(it.GoToBegin();!it.IsAtEnd();++it,++count)
+    {
+    if (count%2 == 0)
+      it.Set(-10.);
+    }
+
+  // Instanciate filter
+  typedef otb::ImageToNoDataMaskFilter<ImageType,ImageType> FilterType;
+  FilterType::Pointer filter = FilterType::New();
+
+  filter->SetInput(img);
+  filter->SetInsideValue(255);
+  filter->SetOutsideValue(0);
+  filter->Update();
+
+  // Check output
+  it = itk::ImageRegionIterator<ImageType>(filter->GetOutput(),region);
+  count = 0;
+
+  bool failed = false;
+  
+  for(it.GoToBegin();!it.IsAtEnd();++it,++count)
+    {
+    if (count%2 == 0 && it.Get()!=0)
+      {
+      std::cerr<<"Pixel should be masked"<<std::endl;
+      failed = true;
+      }
+    else if(count%2 == 1 && it.Get()!=255)
+      {
+      std::cerr<<"Pixel should not be masked"<<std::endl;
+      failed = true;
+      }
+    }
+  
+  if(failed)
+    return EXIT_FAILURE;
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/ImageManipulation/test/otbLocalGradientVectorImageFilter.cxx b/Modules/Filtering/ImageManipulation/test/otbLocalGradientVectorImageFilter.cxx
index 82de2de..9d16be6 100644
--- a/Modules/Filtering/ImageManipulation/test/otbLocalGradientVectorImageFilter.cxx
+++ b/Modules/Filtering/ImageManipulation/test/otbLocalGradientVectorImageFilter.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/ImageManipulation/test/otbNRIBandImagesToOneNComplexBandsImage.cxx b/Modules/Filtering/ImageManipulation/test/otbNRIBandImagesToOneNComplexBandsImage.cxx
new file mode 100644
index 0000000..778f421
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/test/otbNRIBandImagesToOneNComplexBandsImage.cxx
@@ -0,0 +1,62 @@
+/*=========================================================================
+
+  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 "itkMacro.h"
+
+#include "otbNRIBandImagesToOneNComplexBandsImage.h"
+
+#include "otbImage.h"
+#include "otbVectorImage.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
+
+int otbNRIBandImagesToOneNComplexBandsImage(int itkNotUsed(argc), char * argv[])
+{
+
+  typedef double PixelType;
+  typedef otb::VectorImage<PixelType,  2> InputImageType;
+    
+  typedef std::complex<double> OutputPixelType;
+  typedef otb::VectorImage<OutputPixelType, 2> OutputImageType;
+ 
+ 
+  typedef otb::NRIBandImagesToOneNComplexBandsImage<InputImageType, OutputImageType> FilterType;
+  typedef otb::ImageFileReader<InputImageType> ReaderType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
+
+  ReaderType::Pointer readerA = ReaderType::New();
+  ReaderType::Pointer readerB = ReaderType::New();
+  ReaderType::Pointer readerC = ReaderType::New();
+  FilterType::Pointer filter = FilterType::New();
+  WriterType::Pointer writer = WriterType::New();
+  
+  
+  readerA->SetFileName(argv[1]);
+  readerB->SetFileName(argv[2]);
+  readerC->SetFileName(argv[3]);
+  writer->SetFileName(argv[4]);
+
+  filter->SetInput(0,readerA->GetOutput());
+  filter->SetInput(1,readerB->GetOutput());
+  filter->SetInput(2,readerC->GetOutput());
+  writer->SetInput(filter->GetOutput());
+  writer->Update();
+
+
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/ImageManipulation/test/otbOneRIBandImageToOneComplexBandImage.cxx b/Modules/Filtering/ImageManipulation/test/otbOneRIBandImageToOneComplexBandImage.cxx
new file mode 100644
index 0000000..bbc4682
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/test/otbOneRIBandImageToOneComplexBandImage.cxx
@@ -0,0 +1,56 @@
+/*=========================================================================
+
+  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 "itkMacro.h"
+
+#include "otbOneRIBandImageToOneComplexBandImage.h"
+
+#include "otbImage.h"
+#include "otbVectorImage.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
+
+int otbOneRIBandImageToOneComplexBandImage(int itkNotUsed(argc), char * argv[])
+{
+
+  typedef double PixelType;
+  typedef otb::VectorImage<PixelType,  2> InputImageType;
+    
+  typedef std::complex<double> OutputPixelType;
+  typedef otb::Image<OutputPixelType, 2> OutputImageType;
+ 
+ 
+  typedef otb::OneRIBandImageToOneComplexBandImage<InputImageType, OutputImageType> FilterType;
+  typedef otb::ImageFileReader<InputImageType> ReaderType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
+
+  ReaderType::Pointer reader = ReaderType::New();
+  FilterType::Pointer filter = FilterType::New();
+  WriterType::Pointer writer = WriterType::New();
+  
+  
+  reader->SetFileName(argv[1]);
+  writer->SetFileName(argv[2]);
+
+  filter->SetInput(reader->GetOutput());
+  writer->SetInput(filter->GetOutput());
+  writer->Update();
+
+
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/ImageManipulation/test/otbPhaseFunctorTest.cxx b/Modules/Filtering/ImageManipulation/test/otbPhaseFunctorTest.cxx
index ff747d9..0d5d229 100644
--- a/Modules/Filtering/ImageManipulation/test/otbPhaseFunctorTest.cxx
+++ b/Modules/Filtering/ImageManipulation/test/otbPhaseFunctorTest.cxx
@@ -21,6 +21,7 @@
 #include "itkVariableLengthVector.h"
 #include "itkRGBPixel.h"
 #include "itkRGBAPixel.h"
+#include "otbMath.h"
 
 int otbPhaseFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
 {
@@ -54,7 +55,7 @@ int otbPhaseFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
       funct.SetChannelList(channels);
       output = funct.operator ()(vectorPixel);
       result = vcl_atan2(vectorPixel[j],vectorPixel[i]);
-      if( abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
+      if( vcl_abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
         {
           std::cout << "vectorPixelType Test VectorPixelType failed for channels " << i<< " and "
               << j << " !" << std::endl;
@@ -78,7 +79,7 @@ int otbPhaseFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
       funct.SetChannelList(channels);
       output = funct.operator ()(rgbPixel);
       result = vcl_atan2(rgbPixel[j],rgbPixel[i]);
-      if( abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
+      if( vcl_abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
         {
           std::cout << "vectorPixelType Test RGBPixelType failed for channels " << i<< " and "
               << j << " !" << std::endl;
@@ -107,7 +108,7 @@ int otbPhaseFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
       funct.SetChannelList(channels);
       output = funct.operator ()(rgbaPixel);
       result = vcl_atan2(rgbaPixel[j],rgbaPixel[i]);
-      if( abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
+      if( vcl_abs(static_cast<double>(result)-static_cast<double>(output[0])) > 0.0000001)
         {
           std::cout << "vectorPixelType Test RGBAPixelType failed for channels " << i<< " and "
               << j << " !" << std::endl;
diff --git a/Modules/Filtering/ImageManipulation/test/otbTwoNRIBandsImageToNComplexBandsImage.cxx b/Modules/Filtering/ImageManipulation/test/otbTwoNRIBandsImageToNComplexBandsImage.cxx
new file mode 100644
index 0000000..b4fed19
--- /dev/null
+++ b/Modules/Filtering/ImageManipulation/test/otbTwoNRIBandsImageToNComplexBandsImage.cxx
@@ -0,0 +1,56 @@
+/*=========================================================================
+
+  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 "itkMacro.h"
+
+#include "otbTwoNRIBandsImageToNComplexBandsImage.h"
+
+#include "otbImage.h"
+#include "otbVectorImage.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
+
+int otbTwoNRIBandsImageToNComplexBandsImage(int itkNotUsed(argc), char * argv[])
+{
+
+  typedef double PixelType;
+  typedef otb::VectorImage<PixelType,  2> InputImageType;
+    
+  typedef std::complex<double> OutputPixelType;
+  typedef otb::VectorImage<OutputPixelType, 2> OutputImageType;
+ 
+ 
+  typedef otb::TwoNRIBandsImageToNComplexBandsImage<InputImageType, OutputImageType> FilterType;
+  typedef otb::ImageFileReader<InputImageType> ReaderType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
+
+  ReaderType::Pointer reader = ReaderType::New();
+  FilterType::Pointer filter = FilterType::New();
+  WriterType::Pointer writer = WriterType::New();
+  
+  
+  reader->SetFileName(argv[1]);
+  writer->SetFileName(argv[2]);
+
+  filter->SetInput(0,reader->GetOutput());
+  writer->SetInput(filter->GetOutput());
+  writer->Update();
+
+
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h
index 487224a..0e54d13 100644
--- a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h
+++ b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.h
@@ -29,19 +29,14 @@ namespace otb
  * \brief Anti-speckle image filter
  *
  * Uses a negative exponential convolution kernel.
- * The output of the filter for pixel p is:
- *      \f$ \hat I_{s}=\sum_{p\in\eta_{p}} m_{p}I_{p} \f$
- *
- * where :   \f$ m_{p}=\frac{KC_{s}^{2}\exp(-KC_{s}^{2}d_{s, p})}{\sum_{p\in\eta_{p}} KC_{s}^{2}\exp(-KC_{s}^{2}d_{s, p})} \f$
- *    and  \f$ d_{s, p}=\sqrt{(i-i_{p})^2+(j-j_{p})^2} \f$
- *
- * \f$ K \f$     : the decrease coefficient
- * \f$ (i, j)\f$ : the coordinates of the pixel inside the region
- * defined by \f$ \eta_{s} \f$
- * \f$ (i_{p}, j_{p})\f$ : the coordinates of the pixels belonging to \f$ \eta_{p} \subset \eta_{s} \f$
- * \f$ C_{s}\f$ : the variation coefficient computed over \f$ \eta_{p}\f$
- *
+ * The kernel is defined as follows:
+ * exp(-A*D), where 
+ * D is the distance from the current pixel to the center pixel
+ * A = k*Ci*Ci  with Ci = VAR[I]/ (E[I]*E[I])
+ * The final result is normalized by the sum of the kernel coefficients.
  *
+ * (http://www.isprs.org/proceedings/XXXV/congress/comm2/papers/110.pdf)
+ * 
  * \ingroup OTBImageNoise
  */
 
@@ -92,9 +87,9 @@ public:
   /** Get the radius used to define the neighborhood for the filter calculation. */
   itkGetConstReferenceMacro(Radius, SizeType);
 
-  /** Set The numbers of view used for the filter calculation. */
+  /** Set the damping factor. */
   itkSetMacro(Deramp, double);
-  /** Get The numbers of view used for the filter calculation. */
+  /** Get the damping factor. */
   itkGetConstReferenceMacro(Deramp, double);
 
   /** To be allowed to use the pipeline method FrostImageFilter needs
diff --git a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.txx b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.txx
index 17197ea..bca00f9 100644
--- a/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.txx
+++ b/Modules/Filtering/ImageNoise/include/otbFrostImageFilter.txx
@@ -38,7 +38,7 @@ template <class TInputImage, class TOutputImage>
 FrostImageFilter<TInputImage, TOutputImage>::FrostImageFilter()
 {
   m_Radius.Fill(1);
-  m_Deramp = 0.1;
+  m_Deramp = 2;
 }
 
 template <class TInputImage, class TOutputImage>
@@ -135,54 +135,66 @@ void FrostImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
     unsigned int neighborhoodSize = bit.Size();
     it = itk::ImageRegionIterator<OutputImageType>(output, *fit);
     bit.OverrideBoundaryCondition(&nbc);
+    
     bit.GoToBegin();
+    it.GoToBegin();
 
     while (!bit.IsAtEnd())
       {
       sum  = itk::NumericTraits<InputRealType>::Zero;
       sum2 = itk::NumericTraits<InputRealType>::Zero;
+      
       for (i = 0; i < neighborhoodSize; ++i)
         {
         dPixel = static_cast<double>(bit.GetPixel(i));
         sum += dPixel;
-        sum2 += dPixel * dPixel;
         }
-      Mean   = sum  / double(neighborhoodSize);
-      Variance  = sum2 / double(neighborhoodSize) - Mean * Mean;
-
-      if (Mean == 0)
-        {
-        Alpha = 0;
-        }
-      else
-        {
-        Alpha = m_Deramp * Variance / (Mean * Mean);
-        }
-
-      NormFilter  = 0.0;
-      FrostFilter = 0.0;
-
-      const int rad_x = m_Radius[0];
-      const int rad_y = m_Radius[1];
-
-      for (int x = -rad_x; x <= rad_x; ++x)
+      Mean   = sum / static_cast<double>(neighborhoodSize);
+      
+      for (i = 0; i < neighborhoodSize; ++i)
         {
-        for (int y = -rad_y; y <= rad_y; ++y)
-          {
-          double Dist = vcl_sqrt(static_cast<double>(x * x + y * y));
-          off[0] = x;
-          off[1] = y;
-
-          dPixel = static_cast<double>(bit.GetPixel(off));
-
-          CoefFilter = Alpha * vcl_exp(-Alpha * Dist);
-          NormFilter += CoefFilter;
-          FrostFilter += (CoefFilter * dPixel);
-          }
+        dPixel = static_cast<double>(bit.GetPixel(i));
+        sum2 += (dPixel-Mean) * (dPixel-Mean);
         }
+      Variance  = sum2 / double(neighborhoodSize-1);
 
-      if (NormFilter == 0.) dPixel = 0.;
-      else dPixel = FrostFilter / NormFilter;
+      const double epsilon = 0.0000000001;
+      if (vcl_abs(Mean) < epsilon)
+      {
+        dPixel = itk::NumericTraits<OutputPixelType>::Zero;
+      }
+      else if (vcl_abs(Variance) < epsilon)
+      {
+		dPixel = Mean;
+      }
+	  else
+	  {
+		  Alpha = m_Deramp * Variance / (Mean * Mean);
+
+		  NormFilter  = 0.0;
+		  FrostFilter = 0.0;
+
+		  const int rad_x = m_Radius[0];
+		  const int rad_y = m_Radius[1];
+
+		  for (int x = -rad_x; x <= rad_x; ++x)
+			{
+			for (int y = -rad_y; y <= rad_y; ++y)
+			  {
+			  double Dist = vcl_sqrt(static_cast<double>(x * x + y * y));
+			  off[0] = x;
+			  off[1] = y;
+
+			  dPixel = static_cast<double>(bit.GetPixel(off));
+
+			  CoefFilter = vcl_exp(-Alpha * Dist);
+			  NormFilter += CoefFilter;
+			  FrostFilter += (CoefFilter * dPixel);
+			  }
+			}
+
+		  dPixel = FrostFilter / NormFilter;
+	  }
 
       it.Set(static_cast<OutputPixelType>(dPixel));
 
diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h
similarity index 69%
copy from Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h
copy to Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h
index e6e7179..a3fcfd4 100644
--- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h
+++ b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.h
@@ -15,8 +15,8 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-#ifndef __otbLeeImageFilter_h
-#define __otbLeeImageFilter_h
+#ifndef __otbGammaMAPImageFilter_h
+#define __otbGammaMAPImageFilter_h
 
 #include "itkImageToImageFilter.h"
 #include "itkImage.h"
@@ -25,24 +25,19 @@
 namespace otb
 {
 
-/** \class LeeImageFilter
+/** \class GammaMAPImageFilter
  * \brief Anti-speckle image filter
  *
- * This class implements Lee's filter for despeckleing of SAR
- * images. The estimated reflectivity \f$R\f$ is computed as follows:
-
-\f[R = E[I] + b(I-E[I]) \f] with
-\f$ b = C^2_r / ( C^2_r + C^2_v )\f$ and \f$C_v =
-\frac{1}{\sqrt{L}}\f$,  where
-\f$L\f$ the image number of looks and
-\f$C_r = \frac{\sqrt{Var(I)}}{E[I]} \f$ and  \f$Var(I) = E[I^2] - E[I]^2\f$.
- *
+ * This class implements Gamma MAP filter for despeckleing of SAR
+ * images. 
  *
+ * (http://www.isprs.org/proceedings/XXXV/congress/comm2/papers/110.pdf)
+ * 
  * \ingroup OTBImageNoise
  */
 
 template <class TInputImage, class TOutputImage>
-class ITK_EXPORT LeeImageFilter :  public itk::ImageToImageFilter<TInputImage, TOutputImage>
+class ITK_EXPORT GammaMAPImageFilter :  public itk::ImageToImageFilter<TInputImage, TOutputImage>
 {
 public:
   /**   Extract input and output image dimension */
@@ -57,7 +52,7 @@ public:
   typedef TOutputImage OutputImageType;
 
   /** standard class typedefs */
-  typedef LeeImageFilter                                           Self;
+  typedef GammaMAPImageFilter                                           Self;
   typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
   typedef itk::SmartPointer<Self>                                  Pointer;
   typedef itk::SmartPointer<const Self>                            ConstPointer;
@@ -66,7 +61,7 @@ public:
   itkNewMacro(Self);
 
   /** typemacro */
-  itkTypeMacro(LeeImageFilter, ImageToImageFilter);
+  itkTypeMacro(GammaMAPImageFilter, ImageToImageFilter);
 
   typedef typename InputImageType::PixelType                    InputPixelType;
   typedef typename OutputImageType::PixelType                   OutputPixelType;
@@ -86,8 +81,8 @@ public:
   /** Getthe number of look used for computation */
   itkGetConstReferenceMacro(NbLooks, double);
 
-  /** LeeImageFilter needs a larger input requested region than
-   * the output requested region.  As such, LeeImageFilter needs
+  /** GammaMAPImageFilter needs a larger input requested region than
+   * the output requested region.  As such, GammaMAPImageFilter needs
    * to provide an implementation for GenerateInputRequestedRegion()
    * in order to inform the pipeline execution model.
    *
@@ -96,25 +91,18 @@ public:
     throw(itk::InvalidRequestedRegionError);
 
 protected:
-  LeeImageFilter();
-  virtual ~LeeImageFilter() {}
+  GammaMAPImageFilter();
+  virtual ~GammaMAPImageFilter() {}
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
-  /** LeeImageFilter can be multithreaded.
-   * As such, it provides a definition of ThreadedGenerateData()
-   *
-   *  LEE filter:
-   *\f$   R = E[I] + b(I-E[I])\f$ with \f$  b  = C^2r / ( C^2r + C^2v )\f$
-   *          \f$ Cv = 1 / \sqrt(L) \f$ with L the number of look.
-   *          \f$ Cr = \sqrt(Var(I)) / E[I] avec Var(I) = E[I^2] - E[I]^2 \f$
-   *
-   * \sa ImageToImageFilter::ThreadedGenerateData(),
-   *     ImageToImageFilter::GenerateData() */
+  /** GammaMAPImageFilter can be multithreaded.
+   */
+  
   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
                             itk::ThreadIdType threadId);
 
 private:
-  LeeImageFilter(const Self &); //purposely not implemented
+  GammaMAPImageFilter(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
 
   /** Radius of the filter */
@@ -125,7 +113,7 @@ private:
 } // end namespace otb
 
 #ifndef OTB_MANUAL_INSTANTIATION
-#include "otbLeeImageFilter.txx"
+#include "otbGammaMAPImageFilter.txx"
 #endif
 
 #endif
diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.txx
similarity index 78%
copy from Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx
copy to Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.txx
index 0abcd2c..10883dd 100644
--- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx
+++ b/Modules/Filtering/ImageNoise/include/otbGammaMAPImageFilter.txx
@@ -15,10 +15,10 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-#ifndef __otbLeeImageFilter_txx
-#define __otbLeeImageFilter_txx
+#ifndef __otbGammaMAPImageFilter_txx
+#define __otbGammaMAPImageFilter_txx
 
-#include "otbLeeImageFilter.h"
+#include "otbGammaMAPImageFilter.h"
 
 #include "itkDataObject.h"
 #include "itkConstNeighborhoodIterator.h"
@@ -35,14 +35,14 @@ namespace otb
  *
  */
 template <class TInputImage, class TOutputImage>
-LeeImageFilter<TInputImage, TOutputImage>::LeeImageFilter()
+GammaMAPImageFilter<TInputImage, TOutputImage>::GammaMAPImageFilter()
 {
   m_Radius.Fill(1);
   SetNbLooks(1.0);
 }
 
 template <class TInputImage, class TOutputImage>
-void LeeImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegion() throw (itk::InvalidRequestedRegionError)
+void GammaMAPImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegion() throw (itk::InvalidRequestedRegionError)
   {
   // call the superclass' implementation of this method
   Superclass::GenerateInputRequestedRegion();
@@ -91,7 +91,7 @@ void LeeImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegion() t
   }
 
 template<class TInputImage, class TOutputImage>
-void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
+void GammaMAPImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
   const OutputImageRegionType&     outputRegionForThread,
   itk::ThreadIdType threadId
   )
@@ -102,7 +102,6 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
   itk::ConstNeighborhoodIterator<InputImageType> bit;
   itk::ImageRegionIterator<OutputImageType>      it;
 
-  // Allocate output
   typename OutputImageType::Pointer     output = this->GetOutput();
   typename InputImageType::ConstPointer input  = this->GetInput();
 
@@ -120,11 +119,11 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
   InputRealType sum;
   InputRealType sum2;
 
-  double Cr2, Cv2, E_I, I, Var_I, dPixel;
+  double Ci, Ci2, Cu, Cu2, E_I, I, Var_I, dPixel, alpha, b, d, Cmax;
 
   //Compute the ratio using the number of looks
-  Cv2 = 1. / (vcl_sqrt(m_NbLooks));
-  Cv2 *= Cv2;
+  Cu2 = 1.0/m_NbLooks;
+  Cu = vcl_sqrt(Cu2);
 
   // Process each of the boundary faces.  These are N-d regions which border
   // the edge of the buffer.
@@ -134,39 +133,71 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
     const unsigned int neighborhoodSize = bit.Size();
     it = itk::ImageRegionIterator<OutputImageType>(output, *fit);
     bit.OverrideBoundaryCondition(&nbc);
+    
     bit.GoToBegin();
+	it.GoToBegin();
+
 
     while (!bit.IsAtEnd())
       {
       sum = itk::NumericTraits<InputRealType>::Zero;
       sum2 = itk::NumericTraits<InputRealType>::Zero;
+      
       //Parcours du voisinage
       for (i = 0; i < neighborhoodSize; ++i)
         {
         dPixel = static_cast<double>(bit.GetPixel(i));
         sum += dPixel;
-        sum2 += dPixel * dPixel;
         }
       E_I   = sum / static_cast<double>(neighborhoodSize);
-      Var_I = sum2 / static_cast<double>(neighborhoodSize) - E_I * E_I;
+      
+      for (i = 0; i < neighborhoodSize; ++i)
+        {
+        dPixel = static_cast<double>(bit.GetPixel(i));
+        sum2 += (dPixel-E_I) * (dPixel-E_I);
+        }
+      Var_I = sum2 / static_cast<double>(neighborhoodSize -1);
+      
       I = static_cast<double>(bit.GetCenterPixel());
+      
+      Ci2 = Var_I / (E_I * E_I);
+      Ci  = vcl_sqrt(Ci2);
 
       const double epsilon = 0.0000000001;
       if (vcl_abs(E_I) < epsilon)
-        {
+      {
         dPixel = itk::NumericTraits<OutputPixelType>::Zero;
-        }
+      }
+      else if (vcl_abs(Var_I) < epsilon)
+      {
+		dPixel = E_I;
+      }
+      else if (Ci2 < Cu2)
+      {
+		dPixel = E_I;
+      }
       else
+      {
+        Cmax = vcl_sqrt(2.0) * Cu;
+      
+        if (Ci < Cmax) 
         {
-        Cr2    = Var_I / (E_I * E_I);
-        dPixel = E_I + ((I - E_I) * (Cr2)) / (Cr2 + Cv2);
-
+                alpha = (1 + Cu2) / (Ci2 - Cu2);
+                b = alpha - m_NbLooks - 1;
+                d = E_I * E_I * b * b + 4 * alpha * m_NbLooks * E_I * I;
+                dPixel = (b * E_I + vcl_sqrt(d)) / (2 * alpha);
         }
-      // get the mean value
+        else
+			dPixel = I;
+
+      }
+      
+      // set the weighted value
       it.Set(static_cast<OutputPixelType>(dPixel));
 
       ++bit;
       ++it;
+      
       progress.CompletedPixel();
       }
     }
@@ -177,7 +208,7 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
  */
 template <class TInputImage, class TOutput>
 void
-LeeImageFilter<TInputImage, TOutput>::PrintSelf(std::ostream& os, itk::Indent indent) const
+GammaMAPImageFilter<TInputImage, TOutput>::PrintSelf(std::ostream& os, itk::Indent indent) const
 {
   Superclass::PrintSelf(os, indent);
   os << indent << "Radius: " << m_Radius << std::endl;
diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h
similarity index 69%
copy from Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h
copy to Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h
index e6e7179..9008cce 100644
--- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h
+++ b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.h
@@ -15,8 +15,8 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-#ifndef __otbLeeImageFilter_h
-#define __otbLeeImageFilter_h
+#ifndef __otbKuanImageFilter_h
+#define __otbKuanImageFilter_h
 
 #include "itkImageToImageFilter.h"
 #include "itkImage.h"
@@ -25,24 +25,19 @@
 namespace otb
 {
 
-/** \class LeeImageFilter
+/** \class KuanImageFilter
  * \brief Anti-speckle image filter
  *
- * This class implements Lee's filter for despeckleing of SAR
- * images. The estimated reflectivity \f$R\f$ is computed as follows:
-
-\f[R = E[I] + b(I-E[I]) \f] with
-\f$ b = C^2_r / ( C^2_r + C^2_v )\f$ and \f$C_v =
-\frac{1}{\sqrt{L}}\f$,  where
-\f$L\f$ the image number of looks and
-\f$C_r = \frac{\sqrt{Var(I)}}{E[I]} \f$ and  \f$Var(I) = E[I^2] - E[I]^2\f$.
- *
+ * This class implements Kuan filter for despeckleing of SAR
+ * images. 
  *
+ * (http://www.isprs.org/proceedings/XXXV/congress/comm2/papers/110.pdf)
+ * 
  * \ingroup OTBImageNoise
  */
 
 template <class TInputImage, class TOutputImage>
-class ITK_EXPORT LeeImageFilter :  public itk::ImageToImageFilter<TInputImage, TOutputImage>
+class ITK_EXPORT KuanImageFilter :  public itk::ImageToImageFilter<TInputImage, TOutputImage>
 {
 public:
   /**   Extract input and output image dimension */
@@ -57,7 +52,7 @@ public:
   typedef TOutputImage OutputImageType;
 
   /** standard class typedefs */
-  typedef LeeImageFilter                                           Self;
+  typedef KuanImageFilter                                           Self;
   typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
   typedef itk::SmartPointer<Self>                                  Pointer;
   typedef itk::SmartPointer<const Self>                            ConstPointer;
@@ -66,7 +61,7 @@ public:
   itkNewMacro(Self);
 
   /** typemacro */
-  itkTypeMacro(LeeImageFilter, ImageToImageFilter);
+  itkTypeMacro(KuanImageFilter, ImageToImageFilter);
 
   typedef typename InputImageType::PixelType                    InputPixelType;
   typedef typename OutputImageType::PixelType                   OutputPixelType;
@@ -86,8 +81,8 @@ public:
   /** Getthe number of look used for computation */
   itkGetConstReferenceMacro(NbLooks, double);
 
-  /** LeeImageFilter needs a larger input requested region than
-   * the output requested region.  As such, LeeImageFilter needs
+  /** KuanImageFilter needs a larger input requested region than
+   * the output requested region.  As such, KuanImageFilter needs
    * to provide an implementation for GenerateInputRequestedRegion()
    * in order to inform the pipeline execution model.
    *
@@ -96,25 +91,18 @@ public:
     throw(itk::InvalidRequestedRegionError);
 
 protected:
-  LeeImageFilter();
-  virtual ~LeeImageFilter() {}
+  KuanImageFilter();
+  virtual ~KuanImageFilter() {}
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
-  /** LeeImageFilter can be multithreaded.
-   * As such, it provides a definition of ThreadedGenerateData()
-   *
-   *  LEE filter:
-   *\f$   R = E[I] + b(I-E[I])\f$ with \f$  b  = C^2r / ( C^2r + C^2v )\f$
-   *          \f$ Cv = 1 / \sqrt(L) \f$ with L the number of look.
-   *          \f$ Cr = \sqrt(Var(I)) / E[I] avec Var(I) = E[I^2] - E[I]^2 \f$
-   *
-   * \sa ImageToImageFilter::ThreadedGenerateData(),
-   *     ImageToImageFilter::GenerateData() */
+  /** KuanImageFilter can be multithreaded.
+   */
+  
   void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
                             itk::ThreadIdType threadId);
 
 private:
-  LeeImageFilter(const Self &); //purposely not implemented
+  KuanImageFilter(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
 
   /** Radius of the filter */
@@ -125,7 +113,7 @@ private:
 } // end namespace otb
 
 #ifndef OTB_MANUAL_INSTANTIATION
-#include "otbLeeImageFilter.txx"
+#include "otbKuanImageFilter.txx"
 #endif
 
 #endif
diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.txx
similarity index 82%
copy from Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx
copy to Modules/Filtering/ImageNoise/include/otbKuanImageFilter.txx
index 0abcd2c..351aed9 100644
--- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx
+++ b/Modules/Filtering/ImageNoise/include/otbKuanImageFilter.txx
@@ -15,10 +15,10 @@
      PURPOSE.  See the above copyright notices for more information.
 
 =========================================================================*/
-#ifndef __otbLeeImageFilter_txx
-#define __otbLeeImageFilter_txx
+#ifndef __otbKuanImageFilter_txx
+#define __otbKuanImageFilter_txx
 
-#include "otbLeeImageFilter.h"
+#include "otbKuanImageFilter.h"
 
 #include "itkDataObject.h"
 #include "itkConstNeighborhoodIterator.h"
@@ -35,14 +35,14 @@ namespace otb
  *
  */
 template <class TInputImage, class TOutputImage>
-LeeImageFilter<TInputImage, TOutputImage>::LeeImageFilter()
+KuanImageFilter<TInputImage, TOutputImage>::KuanImageFilter()
 {
   m_Radius.Fill(1);
   SetNbLooks(1.0);
 }
 
 template <class TInputImage, class TOutputImage>
-void LeeImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegion() throw (itk::InvalidRequestedRegionError)
+void KuanImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegion() throw (itk::InvalidRequestedRegionError)
   {
   // call the superclass' implementation of this method
   Superclass::GenerateInputRequestedRegion();
@@ -91,7 +91,7 @@ void LeeImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegion() t
   }
 
 template<class TInputImage, class TOutputImage>
-void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
+void KuanImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
   const OutputImageRegionType&     outputRegionForThread,
   itk::ThreadIdType threadId
   )
@@ -102,7 +102,6 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
   itk::ConstNeighborhoodIterator<InputImageType> bit;
   itk::ImageRegionIterator<OutputImageType>      it;
 
-  // Allocate output
   typename OutputImageType::Pointer     output = this->GetOutput();
   typename InputImageType::ConstPointer input  = this->GetInput();
 
@@ -120,11 +119,10 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
   InputRealType sum;
   InputRealType sum2;
 
-  double Cr2, Cv2, E_I, I, Var_I, dPixel;
+  double  Ci2, Cu2, w, E_I, I, Var_I, dPixel;
 
   //Compute the ratio using the number of looks
-  Cv2 = 1. / (vcl_sqrt(m_NbLooks));
-  Cv2 *= Cv2;
+  Cu2 = 1.0/m_NbLooks;
 
   // Process each of the boundary faces.  These are N-d regions which border
   // the edge of the buffer.
@@ -134,39 +132,60 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
     const unsigned int neighborhoodSize = bit.Size();
     it = itk::ImageRegionIterator<OutputImageType>(output, *fit);
     bit.OverrideBoundaryCondition(&nbc);
+    
     bit.GoToBegin();
+	it.GoToBegin();
+
 
     while (!bit.IsAtEnd())
       {
       sum = itk::NumericTraits<InputRealType>::Zero;
       sum2 = itk::NumericTraits<InputRealType>::Zero;
+      
       //Parcours du voisinage
       for (i = 0; i < neighborhoodSize; ++i)
         {
         dPixel = static_cast<double>(bit.GetPixel(i));
         sum += dPixel;
-        sum2 += dPixel * dPixel;
         }
       E_I   = sum / static_cast<double>(neighborhoodSize);
-      Var_I = sum2 / static_cast<double>(neighborhoodSize) - E_I * E_I;
+      
+      for (i = 0; i < neighborhoodSize; ++i)
+        {
+        dPixel = static_cast<double>(bit.GetPixel(i));
+        sum2 += (dPixel-E_I) * (dPixel-E_I);
+        }
+      Var_I = sum2 / static_cast<double>(neighborhoodSize -1);
+      
       I = static_cast<double>(bit.GetCenterPixel());
+      
+      Ci2 = Var_I / (E_I * E_I);
 
       const double epsilon = 0.0000000001;
       if (vcl_abs(E_I) < epsilon)
-        {
+      {
         dPixel = itk::NumericTraits<OutputPixelType>::Zero;
-        }
+      }
+      else if (vcl_abs(Var_I) < epsilon)
+      {
+		dPixel = E_I;
+      }
+      else if (Ci2 < Cu2)
+      {
+		dPixel = E_I;
+      }
       else
-        {
-        Cr2    = Var_I / (E_I * E_I);
-        dPixel = E_I + ((I - E_I) * (Cr2)) / (Cr2 + Cv2);
-
-        }
-      // get the mean value
+      {
+		w = (1 - Cu2 / Ci2) / (1+Cu2);
+		dPixel = I*w + E_I*(1-w);
+      }
+      
+      // set the weighted value
       it.Set(static_cast<OutputPixelType>(dPixel));
 
       ++bit;
       ++it;
+      
       progress.CompletedPixel();
       }
     }
@@ -177,7 +196,7 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
  */
 template <class TInputImage, class TOutput>
 void
-LeeImageFilter<TInputImage, TOutput>::PrintSelf(std::ostream& os, itk::Indent indent) const
+KuanImageFilter<TInputImage, TOutput>::PrintSelf(std::ostream& os, itk::Indent indent) const
 {
   Superclass::PrintSelf(os, indent);
   os << indent << "Radius: " << m_Radius << std::endl;
diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h
index e6e7179..b6e6f69 100644
--- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h
+++ b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.h
@@ -29,13 +29,15 @@ namespace otb
  * \brief Anti-speckle image filter
  *
  * This class implements Lee's filter for despeckleing of SAR
- * images. The estimated reflectivity \f$R\f$ is computed as follows:
-
-\f[R = E[I] + b(I-E[I]) \f] with
-\f$ b = C^2_r / ( C^2_r + C^2_v )\f$ and \f$C_v =
-\frac{1}{\sqrt{L}}\f$,  where
-\f$L\f$ the image number of looks and
-\f$C_r = \frac{\sqrt{Var(I)}}{E[I]} \f$ and  \f$Var(I) = E[I^2] - E[I]^2\f$.
+ * images. The estimated reflectivity R is computed as follows:
+ * 
+ * R=I*W+E[I]*(1-W), where
+ * W=1-Cu*Cu/(Ci*Ci)
+ * Cu = 1/sqrt(nb of look)
+ * Ci = sqrt(VAR[I])/E[I]
+ * 
+ * (http://www.isprs.org/proceedings/XXXV/congress/comm2/papers/110.pdf)
+ * 
  *
  *
  * \ingroup OTBImageNoise
diff --git a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx
index 0abcd2c..4c68f19 100644
--- a/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx
+++ b/Modules/Filtering/ImageNoise/include/otbLeeImageFilter.txx
@@ -102,7 +102,6 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
   itk::ConstNeighborhoodIterator<InputImageType> bit;
   itk::ImageRegionIterator<OutputImageType>      it;
 
-  // Allocate output
   typename OutputImageType::Pointer     output = this->GetOutput();
   typename InputImageType::ConstPointer input  = this->GetInput();
 
@@ -120,11 +119,10 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
   InputRealType sum;
   InputRealType sum2;
 
-  double Cr2, Cv2, E_I, I, Var_I, dPixel;
+  double Ci2, Cu2, w, E_I, I, Var_I, dPixel;
 
   //Compute the ratio using the number of looks
-  Cv2 = 1. / (vcl_sqrt(m_NbLooks));
-  Cv2 *= Cv2;
+  Cu2 = 1.0/m_NbLooks;
 
   // Process each of the boundary faces.  These are N-d regions which border
   // the edge of the buffer.
@@ -134,39 +132,60 @@ void LeeImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
     const unsigned int neighborhoodSize = bit.Size();
     it = itk::ImageRegionIterator<OutputImageType>(output, *fit);
     bit.OverrideBoundaryCondition(&nbc);
+    
     bit.GoToBegin();
+	it.GoToBegin();
+
 
     while (!bit.IsAtEnd())
       {
       sum = itk::NumericTraits<InputRealType>::Zero;
       sum2 = itk::NumericTraits<InputRealType>::Zero;
+      
       //Parcours du voisinage
       for (i = 0; i < neighborhoodSize; ++i)
         {
         dPixel = static_cast<double>(bit.GetPixel(i));
         sum += dPixel;
-        sum2 += dPixel * dPixel;
         }
       E_I   = sum / static_cast<double>(neighborhoodSize);
-      Var_I = sum2 / static_cast<double>(neighborhoodSize) - E_I * E_I;
+      
+      for (i = 0; i < neighborhoodSize; ++i)
+        {
+        dPixel = static_cast<double>(bit.GetPixel(i));
+        sum2 += (dPixel-E_I) * (dPixel-E_I);
+        }
+      Var_I = sum2 / static_cast<double>(neighborhoodSize -1);
+      
       I = static_cast<double>(bit.GetCenterPixel());
+      
+      Ci2    = Var_I / (E_I * E_I);
 
       const double epsilon = 0.0000000001;
       if (vcl_abs(E_I) < epsilon)
-        {
+      {
         dPixel = itk::NumericTraits<OutputPixelType>::Zero;
-        }
+      }
+      else if (vcl_abs(Var_I) < epsilon)
+      {
+		dPixel = E_I;
+      }
+      else if (Ci2 < Cu2)
+      {
+		dPixel = E_I;
+      }
       else
-        {
-        Cr2    = Var_I / (E_I * E_I);
-        dPixel = E_I + ((I - E_I) * (Cr2)) / (Cr2 + Cv2);
-
-        }
-      // get the mean value
+      {
+		w = 1 - Cu2 / Ci2;
+		dPixel = I*w + E_I*(1-w);
+      }
+      
+      // set the weighted value
       it.Set(static_cast<OutputPixelType>(dPixel));
 
       ++bit;
       ++it;
+      
       progress.CompletedPixel();
       }
     }
diff --git a/Modules/Filtering/ImageNoise/test/CMakeLists.txt b/Modules/Filtering/ImageNoise/test/CMakeLists.txt
index 6f19e04..ac38d0b 100644
--- a/Modules/Filtering/ImageNoise/test/CMakeLists.txt
+++ b/Modules/Filtering/ImageNoise/test/CMakeLists.txt
@@ -4,6 +4,8 @@ set(OTBImageNoiseTests
 otbImageNoiseTestDriver.cxx
 otbFrostFilter.cxx
 otbLeeFilter.cxx
+otbGammaMAPFilter.cxx
+otbKuanFilter.cxx
 otbFrostFilterNew.cxx
 )
 
@@ -17,7 +19,7 @@ otb_add_test(NAME bfTvFrostFilter COMMAND otbImageNoiseTestDriver
   --compare-image ${EPSILON_7}  ${BASELINE}/bfFiltreFrost_poupees_05_05_01.tif
   ${TEMP}/bfFiltreFrost_poupees_05_05_01.tif
   otbFrostFilter
-  ${INPUTDATA}/GomaAvant.png   #poupees.hdr
+  ${INPUTDATA}/GomaAvant.tif   #poupees.hdr
   ${TEMP}/bfFiltreFrost_poupees_05_05_01.tif
   05 05 0.1)
 
@@ -25,7 +27,7 @@ otb_add_test(NAME bfTvFiltreLee1CanalPoupees COMMAND otbImageNoiseTestDriver
   --compare-image ${EPSILON_7}  ${BASELINE}/bfFiltreLee_05_05_04.tif
   ${TEMP}/bfFiltreLee_05_05_04.tif
   otbLeeFilter
-  ${INPUTDATA}/GomaAvant.png                  #poupees_1canal.c1.hdr
+  ${INPUTDATA}/GomaAvant.tif                  #poupees_1canal.c1.hdr
   ${TEMP}/bfFiltreLee_05_05_04.tif
   05 05 4.0)
 
@@ -33,9 +35,27 @@ otb_add_test(NAME bfTvFiltreLee COMMAND otbImageNoiseTestDriver
   --compare-image ${EPSILON_7}  ${BASELINE}/bfFiltreLee_05_05_12.tif
   ${TEMP}/bfFiltreLee_05_05_12.tif
   otbLeeFilter
-  ${INPUTDATA}/GomaAvant.png    #poupees.hdr
+  ${INPUTDATA}/GomaAvant.tif    #poupees.hdr
   ${TEMP}/bfFiltreLee_05_05_12.tif
   05 05 12.0)
+  
+  
+otb_add_test(NAME bfTvFiltreGammaMAP COMMAND otbImageNoiseTestDriver
+  --compare-image ${EPSILON_7}  ${BASELINE}/bfFiltreGammaMAP_05_05_12.tif
+  ${TEMP}/bfFiltreGammaMAP_05_05_12.tif
+  otbGammaMAPFilter
+  ${INPUTDATA}/GomaAvant.tif    #poupees.hdr
+  ${TEMP}/bfFiltreGammaMAP_05_05_12.tif
+  05 05 12.0)  
+  
+otb_add_test(NAME bfTvFiltreKuan COMMAND otbImageNoiseTestDriver
+  --compare-image ${EPSILON_7}  ${BASELINE}/bfFiltreKuan_05_05_12.tif
+  ${TEMP}/bfFiltreKuan_05_05_12.tif
+  otbKuanFilter
+  ${INPUTDATA}/GomaAvant.tif    #poupees.hdr
+  ${TEMP}/bfFiltreKuan_05_05_12.tif
+  05 05 12.0)  
+  
 
 otb_add_test(NAME bfTuFrostFilterNew COMMAND otbImageNoiseTestDriver
   otbFrostFilterNew)
diff --git a/Modules/Filtering/ImageNoise/test/otbGammaMAPFilter.cxx b/Modules/Filtering/ImageNoise/test/otbGammaMAPFilter.cxx
new file mode 100644
index 0000000..d04068a
--- /dev/null
+++ b/Modules/Filtering/ImageNoise/test/otbGammaMAPFilter.cxx
@@ -0,0 +1,71 @@
+/*=========================================================================
+
+  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 "itkMacro.h"
+#include <iostream>
+
+#include "otbImage.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
+#include "otbGammaMAPImageFilter.h"
+
+int otbGammaMAPFilter(int itkNotUsed(argc), char * argv[])
+{
+  const char * inputFilename  = argv[1];
+  const char * outputFilename = argv[2];
+
+  unsigned int RadiusX((unsigned int) ::atoi(argv[3]));
+  unsigned int RadiusY((unsigned int) ::atoi(argv[4]));
+  double       NbLooks((double) ::atof(argv[5]));
+
+  typedef double InputPixelType;
+  typedef double OutputPixelType;
+  const unsigned int Dimension = 2;
+
+  typedef otb::Image<InputPixelType,  Dimension> InputImageType;
+  typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
+
+  typedef otb::ImageFileReader<InputImageType>  ReaderType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
+
+  typedef otb::GammaMAPImageFilter<InputImageType, OutputImageType> FilterType;
+
+  FilterType::SizeType Radius;
+  Radius[0] = RadiusX;
+  Radius[1] = RadiusY;
+
+  FilterType::Pointer filterLee = FilterType::New();
+
+  filterLee->SetRadius(Radius);
+  // OTB-FA-00018-CS
+  filterLee->SetNbLooks(NbLooks);
+
+  ReaderType::Pointer reader = ReaderType::New();
+  WriterType::Pointer writer = WriterType::New();
+
+  reader->SetFileName(inputFilename);
+  writer->SetFileName(outputFilename);
+
+  filterLee->SetInput(reader->GetOutput());
+  writer->SetInput(filterLee->GetOutput());
+
+  writer->Update();
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/ImageNoise/test/otbImageNoiseTestDriver.cxx b/Modules/Filtering/ImageNoise/test/otbImageNoiseTestDriver.cxx
index 40cf9f2..163f608 100644
--- a/Modules/Filtering/ImageNoise/test/otbImageNoiseTestDriver.cxx
+++ b/Modules/Filtering/ImageNoise/test/otbImageNoiseTestDriver.cxx
@@ -3,5 +3,7 @@ void RegisterTests()
 {
   REGISTER_TEST(otbFrostFilter);
   REGISTER_TEST(otbLeeFilter);
+  REGISTER_TEST(otbGammaMAPFilter);
+  REGISTER_TEST(otbKuanFilter);
   REGISTER_TEST(otbFrostFilterNew);
 }
diff --git a/Modules/Filtering/ImageNoise/test/otbKuanFilter.cxx b/Modules/Filtering/ImageNoise/test/otbKuanFilter.cxx
new file mode 100644
index 0000000..5c2d7a1
--- /dev/null
+++ b/Modules/Filtering/ImageNoise/test/otbKuanFilter.cxx
@@ -0,0 +1,71 @@
+/*=========================================================================
+
+  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 "itkMacro.h"
+#include <iostream>
+
+#include "otbImage.h"
+#include "otbImageFileReader.h"
+#include "otbImageFileWriter.h"
+#include "otbKuanImageFilter.h"
+
+int otbKuanFilter(int itkNotUsed(argc), char * argv[])
+{
+  const char * inputFilename  = argv[1];
+  const char * outputFilename = argv[2];
+
+  unsigned int RadiusX((unsigned int) ::atoi(argv[3]));
+  unsigned int RadiusY((unsigned int) ::atoi(argv[4]));
+  double       NbLooks((double) ::atof(argv[5]));
+
+  typedef double InputPixelType;
+  typedef double OutputPixelType;
+  const unsigned int Dimension = 2;
+
+  typedef otb::Image<InputPixelType,  Dimension> InputImageType;
+  typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
+
+  typedef otb::ImageFileReader<InputImageType>  ReaderType;
+  typedef otb::ImageFileWriter<OutputImageType> WriterType;
+
+  typedef otb::KuanImageFilter<InputImageType, OutputImageType> FilterType;
+
+  FilterType::SizeType Radius;
+  Radius[0] = RadiusX;
+  Radius[1] = RadiusY;
+
+  FilterType::Pointer filterLee = FilterType::New();
+
+  filterLee->SetRadius(Radius);
+  // OTB-FA-00018-CS
+  filterLee->SetNbLooks(NbLooks);
+
+  ReaderType::Pointer reader = ReaderType::New();
+  WriterType::Pointer writer = WriterType::New();
+
+  reader->SetFileName(inputFilename);
+  writer->SetFileName(outputFilename);
+
+  filterLee->SetInput(reader->GetOutput());
+  writer->SetInput(filterLee->GetOutput());
+
+  writer->Update();
+
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h
index d9fcbdd..eb8a373 100644
--- a/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h
+++ b/Modules/Filtering/MathParser/include/otbParserConditionDataNodeFeatureFunction.h
@@ -86,7 +86,7 @@ public:
 
   virtual OutputType Evaluate( const DataNodeType& node ) const;
 
-  std::string GetExpression(std::string expression) const
+  std::string GetExpression() const
   {
     return m_ParserConditionFunctor->GetExpression();
   }
diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx
index c8ab46e..61ba034 100644
--- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx
+++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx
@@ -243,6 +243,7 @@ void BandMathXImageFilter<TImage>
         oss << expression[i];
 
     oss << ")";
+    expressionToBePushed = oss.str();
   }
 
   if (m_ManyExpressions)
diff --git a/Modules/Filtering/MathParserX/include/otbParserX.h b/Modules/Filtering/MathParserX/include/otbParserX.h
index 01f381a..aad7ecf 100644
--- a/Modules/Filtering/MathParserX/include/otbParserX.h
+++ b/Modules/Filtering/MathParserX/include/otbParserX.h
@@ -20,7 +20,15 @@
 
 #include "itkLightObject.h"
 #include "itkObjectFactory.h"
+
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wc++11-extensions"
+#include "mpParser.h"
+#pragma GCC diagnostic pop
+#else
 #include "mpParser.h"
+#endif
 
 namespace otb
 {
@@ -76,7 +84,7 @@ public:
 
   /** Return the list of variables */
   const mup::var_maptype& GetVar() const;
- 
+
   /** Return the list of expression variables (only make sense after having set up an expression) */
   const mup::var_maptype& GetExprVar() const;
 
diff --git a/Modules/Filtering/MathParserX/include/otbParserXPlugins.h b/Modules/Filtering/MathParserX/include/otbParserXPlugins.h
index cc5bc51..cf557ec 100644
--- a/Modules/Filtering/MathParserX/include/otbParserXPlugins.h
+++ b/Modules/Filtering/MathParserX/include/otbParserXPlugins.h
@@ -385,6 +385,27 @@ public:
   };
 
 
+class vect2scal : public mup::ICallback
+  {
+public:
+    vect2scal():ICallback(mup::cmFUNC, "vect2scal", 1)
+    {}
+
+    virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc));
+
+    const mup::char_type* GetDesc() const
+    {
+      return "vect2scal - Convert one dimensional vector to scalar";
+    }
+
+    mup::IToken* Clone() const
+    {
+      return new vect2scal(*this);
+    }
+  };
+  
+  
+
 class vcos : public mup::ICallback
   {
 public:
@@ -405,6 +426,25 @@ public:
   };
 
 
+class vacos : public mup::ICallback
+  {
+public:
+    vacos():ICallback(mup::cmFUNC, "vacos", 1)
+    {}
+
+    virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc));
+
+    const mup::char_type* GetDesc() const
+    {
+      return "vacos - Arccosinus for noncomplex vectors & matrices";
+    }
+
+    mup::IToken* Clone() const
+    {
+      return new vacos(*this);
+    }
+  };
+
 class vsin : public mup::ICallback
   {
 public:
@@ -424,6 +464,25 @@ public:
     }
   };
 
+class vasin : public mup::ICallback
+  {
+public:
+    vasin():ICallback(mup::cmFUNC, "vasin", 1)
+    {}
+
+    virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc));
+
+    const mup::char_type* GetDesc() const
+    {
+      return "vasin - Arcsinus for noncomplex vectors & matrices";
+    }
+
+    mup::IToken* Clone() const
+    {
+      return new vasin(*this);
+    }
+  };
+
 
 class vtan : public mup::ICallback
   {
@@ -445,6 +504,26 @@ public:
   };
 
 
+class vatan : public mup::ICallback
+  {
+public:
+    vatan():ICallback(mup::cmFUNC, "vatan", 1)
+    {}
+
+    virtual void Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int itkNotUsed(a_iArgc));
+
+    const mup::char_type* GetDesc() const
+    {
+      return "vatan - Arctangent for noncomplex vectors & matrices";
+    }
+
+    mup::IToken* Clone() const
+    {
+      return new vatan(*this);
+    }
+  };
+  
+
 class vtanh : public mup::ICallback
   {
 public:
diff --git a/Modules/Filtering/MathParserX/src/otbParserX.cxx b/Modules/Filtering/MathParserX/src/otbParserX.cxx
index f06b32f..b967b67 100644
--- a/Modules/Filtering/MathParserX/src/otbParserX.cxx
+++ b/Modules/Filtering/MathParserX/src/otbParserX.cxx
@@ -77,7 +77,11 @@ public:
     m_MuParserX.DefineFun(new vnorm);
     m_MuParserX.DefineFun(new vmin);
     m_MuParserX.DefineFun(new vmax);
+    m_MuParserX.DefineFun(new vect2scal);
     m_MuParserX.DefineFun(new vcos);
+    m_MuParserX.DefineFun(new vacos);
+    m_MuParserX.DefineFun(new vasin);
+    m_MuParserX.DefineFun(new vatan);
     m_MuParserX.DefineFun(new vsin);
     m_MuParserX.DefineFun(new vtan);
     m_MuParserX.DefineFun(new vtanh);
diff --git a/Modules/Filtering/MathParserX/src/otbParserXPlugins.cxx b/Modules/Filtering/MathParserX/src/otbParserXPlugins.cxx
index 4e2e712..3eb9b87 100644
--- a/Modules/Filtering/MathParserX/src/otbParserXPlugins.cxx
+++ b/Modules/Filtering/MathParserX/src/otbParserXPlugins.cxx
@@ -66,7 +66,7 @@ void dotpr::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_
       int nbrows = m1.GetRows();
       int nbcols = m1.GetCols();
 
-      mup::matrix_type res(1,a_iArgc-1,0);
+      mup::matrix_type res(1,a_iArgc-1,0.);
 
       for (int k=1; k<a_iArgc; ++k)
       {
@@ -360,7 +360,7 @@ void cat::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iA
       }
 
       // The return value is passed by writing it to the reference ret
-      mup::matrix_type res(1,vect.size(),0);
+      mup::matrix_type res(1,vect.size(),0.);
       for (unsigned int j=0; j<vect.size(); j++)
             res.At(0,j) = vect[j];
       *ret = res;
@@ -410,7 +410,7 @@ void mean::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_i
       }
 
       // The return value is passed by writing it to the reference ret
-      mup::matrix_type res(1,vect.size(),0);
+      mup::matrix_type res(1,vect.size(),0.);
       for (unsigned int j=0; j<vect.size(); j++)
             res.At(0,j) = vect[j];
       *ret = res;
@@ -467,9 +467,9 @@ void var::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iA
       }
 
       // The return value is passed by writing it to the reference ret
-      mup::matrix_type res(1,vect.size(),0);
+      mup::matrix_type res(1,vect.size(),0.);
       for (unsigned int j=0; j<vect.size(); j++)
-            res.At(0,j) = vect[j];
+        res.At(0,j) = static_cast<mup::float_type>(vect[j]);
       *ret = res;
     }
 
@@ -567,9 +567,9 @@ void median::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a
       }
 
       // The return value is passed by writing it to the reference ret
-      mup::matrix_type res(1,vect.size(),0);
+      mup::matrix_type res(1,vect.size(),0.);
       for (unsigned int j=0; j<vect.size(); j++)
-            res.At(0,j) = vect[j];
+        res.At(0,j) = static_cast<mup::float_type>(vect[j]);
       *ret = res;
     }
 
@@ -634,9 +634,9 @@ void maj::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iA
       }
 
       // The return value is passed by writing it to the reference ret
-      mup::matrix_type res(1,vect.size(),0);
+      mup::matrix_type res(1,vect.size(),0.);
       for (unsigned int j=0; j<vect.size(); j++)
-            res.At(0,j) = vect[j];
+        res.At(0,j) = static_cast<mup::float_type>(vect[j]);
       *ret = res;
     }
 
@@ -734,6 +734,29 @@ void vmax::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_i
     }
 
 
+void vect2scal::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc)
+    {
+      if(a_iArgc != 1)
+        return;
+
+      assert(a_pArg[0]->GetType()=='m');
+
+      // Get the argument from the argument input vector
+      const mup::matrix_type a = a_pArg[0]->GetArray();
+
+      assert(a.GetRows() == 1);
+      assert(a.GetCols() == 1);
+
+      mup::float_type res;
+
+      res = a.At(0,0).GetFloat();
+          
+
+      // The return value is passed by writing it to the reference ret
+      *ret = res;
+    }
+
+
 void vcos::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc)
     {
       if(a_iArgc != 1)
@@ -758,6 +781,32 @@ void vcos::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_i
       // The return value is passed by writing it to the reference ret
       *ret = res;
     }
+    
+    
+void vacos::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc)
+    {
+      if(a_iArgc != 1)
+        return;
+
+      assert(a_pArg[0]->GetType()=='m');
+
+      // Get the argument from the argument input vector
+      const mup::matrix_type a = a_pArg[0]->GetArray();
+
+
+      int nbrows = a.GetRows();
+      int nbcols = a.GetCols();
+
+      mup::matrix_type res(nbrows,nbcols,0.);
+
+      for (int k=0; k<nbcols; ++k)
+        for (int p=0; p<nbrows; ++p)
+          res.At(p,k) = vcl_acos(a.At(p,k).GetFloat());
+          
+
+      // The return value is passed by writing it to the reference ret
+      *ret = res;
+    }
 
 
 void vsin::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc)
@@ -784,6 +833,32 @@ void vsin::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_i
     }
 
 
+void vasin::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc)
+    {
+      if(a_iArgc != 1)
+        return;
+
+      assert(a_pArg[0]->GetType()=='m');
+
+      // Get the argument from the argument input vector
+      const mup::matrix_type a = a_pArg[0]->GetArray();
+
+
+      int nbrows = a.GetRows();
+      int nbcols = a.GetCols();
+
+      mup::matrix_type res(nbrows,nbcols,0.);
+
+      for (int k=0; k<nbcols; ++k)
+        for (int p=0; p<nbrows; ++p)
+          res.At(p,k) = vcl_asin(a.At(p,k).GetFloat());
+          
+
+      // The return value is passed by writing it to the reference ret
+      *ret = res;
+    }
+
+
 void vtan::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc)
     {
       if(a_iArgc != 1)
@@ -808,6 +883,30 @@ void vtan::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_i
     }
 
 
+void vatan::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc)
+    {
+      if(a_iArgc != 1)
+        return;
+
+      assert(a_pArg[0]->GetType()=='m');
+
+      // Get the argument from the argument input vector
+      const mup::matrix_type a = a_pArg[0]->GetArray();
+
+      int nbrows = a.GetRows();
+      int nbcols = a.GetCols();
+
+      mup::matrix_type res(nbrows,nbcols,0.);
+
+      for (int k=0; k<nbcols; ++k)
+        for (int p=0; p<nbrows; ++p)
+          res.At(p,k) = vcl_atan(a.At(p,k).GetFloat());
+
+      // The return value is passed by writing it to the reference ret
+      *ret = res;
+    }
+
+
 void vtanh::Eval(mup::ptr_val_type &ret, const mup::ptr_val_type *a_pArg, int a_iArgc)
     {
       if(a_iArgc != 1)
diff --git a/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx b/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx
index a08c203..139e5a7 100644
--- a/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx
+++ b/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx
@@ -299,7 +299,7 @@ int otbBandMathXImageFilterConv( int itkNotUsed(argc), char* argv [])
   //filter->SetConstant("expo",expo);
   //filter->SetExpression("conv(kernel1,imageAb1N3x5,imageAb2N3x5); im2b1^1.1; vcos(canal3); mean(imageAb2N3x3); var(imageAb2N3x3); median(imageAb2N3x3)");
   filter->ImportContext(inputFilename); //Equivalent to three commands above
-  filter->SetExpression("(vmax(canal3b1N3x5)+vmin(canal3b1N3x5)) div {2.0} + {imageAb3Var} dv 2.0 + {imageAb2Mini / im2b1Maxi} mlt 3.4 + {imageAb3Mean / imageAb1Sum * imageAb3Var} pw 1.2");
+  filter->SetExpression("(vmax(canal3b1N3x5)+vmin(canal3b1N3x5)) div {2.0} + {imageAb3Var} dv 2.0 + {imageAb2Mini / im2b1Maxi} mlt 3.4 + {imageAb3Mean / imageAb1Sum * imageAb3Var} pw 1.2 ; vect2scal(vacos({0.5}) + vasin({0.5}) + vatan({0.5})) > 2.0 ?{1}:{0}");
   filter->Update();
 
   if (filter->GetNumberOfOutputs() != 2)
@@ -312,7 +312,7 @@ int otbBandMathXImageFilterConv( int itkNotUsed(argc), char* argv [])
   if (output1->GetNumberOfComponentsPerPixel() != 7)
     itkGenericExceptionMacro(<< "Wrong number of components per pixel (input 1).");
 
-  if (output2->GetNumberOfComponentsPerPixel() != 1)
+  if (output2->GetNumberOfComponentsPerPixel() != 2)
     itkGenericExceptionMacro(<< "Wrong number of components per pixel (input 2).");
 
   std::cout << "\n---  Standard Use\n";
@@ -370,6 +370,10 @@ int otbBandMathXImageFilterConv( int itkNotUsed(argc), char* argv [])
       vect2.push_back(it3.GetPixel(i)[0]);
     std::sort(vect2.begin(),vect2.end());
     px2[0] = (vect2.back() + vect2.front())/2.0 + imageAb3Var / 2.0 + (imageAb2Mini / im2b1Maxi)*3.4 + vcl_pow(imageAb3Mean / imageAb1Sum * imageAb3Var,1.2);
+    if ( vcl_acos(0.5)+vcl_asin(0.5)+vcl_atan(0.5) > 2.0 )
+		px2[1]=1.0;
+	else
+		px2[1]=0.0;
 
 
 
@@ -390,10 +394,13 @@ int otbBandMathXImageFilterConv( int itkNotUsed(argc), char* argv [])
 
     //expression 2
     double result8 = itoutput2.GetCenterPixel()[0];
+    double result9 = itoutput2.GetCenterPixel()[1];
     double expected8 = px2[0];
+    double expected9 = px2[1];
     double error8 = (result8 - expected8) * (result8 - expected8) / (result8 + expected8);
+    double error9 = (result9 - expected9) * (result9 - expected9) / (result9 + expected9);
 
-    if ( ( error1 > 1E-9 ) || ( error2 > 1E-9 ) || ( error3 > 1E-9 ) || ( error4 > 1E-9 ) || ( error5 > 1E-9 ) || ( error6 > 1E-9 ) || ( error7 > 1E-9 ) || (error8 > 1E-9) )
+    if ( ( error1 > 1E-9 ) || ( error2 > 1E-9 ) || ( error3 > 1E-9 ) || ( error4 > 1E-9 ) || ( error5 > 1E-9 ) || ( error6 > 1E-9 ) || ( error7 > 1E-9 ) || (error8 > 1E-9) || (error9 > 1E-9))
       {
       itkGenericExceptionMacro( << "TEST FAILLED" << std::endl
          << "Error1 = " << error1  << std::endl
@@ -419,7 +426,10 @@ int otbBandMathXImageFilterConv( int itkNotUsed(argc), char* argv [])
          << "     Expected7 =  " << expected7 << std::endl
          << "Error8 = " << error8 << std::endl
          << "     Result8 =  "   << result8
-         << "     Expected8 =  " << expected8 << std::endl);
+         << "     Expected8 =  " << expected8 << std::endl
+         << "Error9 = " << error9 << std::endl
+         << "     Result9 =  "   << result9
+         << "     Expected9 =  " << expected9 << std::endl);
       }
   }
 
diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.txx
index a60030b..3ad4732 100644
--- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.txx
+++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidAnalysisFilter.txx
@@ -210,7 +210,7 @@ MorphologicalPyramidAnalysisFilter<TInputImage, TOutputImage, TMorphoFilter>
 
     // New  Size
     size = morphoFilter->GetOutput()->GetLargestPossibleRegion().GetSize();
-    for (int j = 0; j < InputImageType::ImageDimension; ++j)
+    for (unsigned int j = 0; j < InputImageType::ImageDimension; ++j)
       {
       sizeTmp = size[j];
       // As we knwow that our values will always be positive ones, we can simulate round by ceil(value+0.5)
diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx
index 038f634..aecbfdb 100644
--- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx
+++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx
@@ -34,7 +34,7 @@ template <class TInputImage, class TOutputImage>
 Resampler<TInputImage, TOutputImage>
 ::Resampler()
 {
-  for (int i = 0; i < InputImageType::ImageDimension; ++i)
+  for (unsigned int i = 0; i < InputImageType::ImageDimension; ++i)
     {
     m_Size[i] = 0;
     }
diff --git a/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h b/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h
index 26ac0e5..0aa2d86 100644
--- a/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h
+++ b/Modules/Filtering/Polarimetry/include/otbMuellerToReciprocalCovarianceImageFilter.h
@@ -79,34 +79,29 @@ public:
     const double M12 =  static_cast<double>(Mueller[1]);
     const double M13 =  static_cast<double>(Mueller[2]);
     const double M14 =  static_cast<double>(Mueller[3]);
-    const double M21 =  static_cast<double>(Mueller[4]);
     const double M22 =  static_cast<double>(Mueller[5]);
     const double M23 =  static_cast<double>(Mueller[6]);
     const double M24 =  static_cast<double>(Mueller[7]);
-    const double M31 =  static_cast<double>(Mueller[8]);
-    const double M32 =  static_cast<double>(Mueller[9]);
     const double M33 =  static_cast<double>(Mueller[10]);
     const double M34 =  static_cast<double>(Mueller[11]);
-    const double M41 =  static_cast<double>(Mueller[12]);
-    const double M42 =  static_cast<double>(Mueller[13]);
-    const double M43 =  static_cast<double>(Mueller[14]);
     const double M44 =  static_cast<double>(Mueller[15]);
 
-    const ComplexType hhhh(M11+M22+M12+M21, 0.0);
-    const ComplexType hvhv(M11+M12-M21-M22, 0.0);
-    const ComplexType vvvv(M11+M22-M12-M21, 0.0);
-    const ComplexType hhhv(M13+M23, M14+M24);
-    const ComplexType hhvv(-M33-M44, M43-M34);
-    const ComplexType hvvv(M32-M31, M41-M42);
-
-    result[0] = static_cast<OutputValueType>( hhhh );
-    result[1] = static_cast<OutputValueType>( 2.* hhhv );
-    result[2] = static_cast<OutputValueType>( hhvv );
-    result[3] = static_cast<OutputValueType>( 4.* hvhv );
-    result[4] = static_cast<OutputValueType>( 2.* hvvv );
-    result[5] = static_cast<OutputValueType>( vvvv );
-
-    return 0.5*result;
+    
+    const ComplexType A(0.5*(M11+M22+2*M12));
+    const ComplexType B(0.5*vcl_sqrt(2.0)*(M13+M23), 0.5*vcl_sqrt(2.0)*(M14+M24));
+    const ComplexType C(-0.5*(M33+M44), -M34);
+    const ComplexType E(M11-M22, 0.0);
+    const ComplexType F(0.5*vcl_sqrt(2.0)*(M13-M23), 0.5*vcl_sqrt(2.0)*(M14-M24));
+    const ComplexType I(0.5*(M11+M22-2*M12));
+
+    result[0] = static_cast<OutputValueType>( A );
+    result[1] = static_cast<OutputValueType>( B );
+    result[2] = static_cast<OutputValueType>( C );
+    result[3] = static_cast<OutputValueType>( E );
+    result[4] = static_cast<OutputValueType>( F );
+    result[5] = static_cast<OutputValueType>( I );
+
+    return result;
   }
 
   unsigned int GetOutputSize()
diff --git a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx
index d465a98..e553984 100644
--- a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx
+++ b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx
@@ -40,6 +40,7 @@ MultiChannelsPolarimetricSynthesisFilter<TInputImage, TOutputImage, TFunction>
   SetEmissionH(false);
   SetEmissionV(false);
   SetGain(1);
+  SetMode(0);
   m_ArchitectureType = PolarimetricData::New();
 }
 
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h
index 1081c26..a025d9c 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalCoherencyToReciprocalMuellerImageFilter.h
@@ -30,26 +30,36 @@ namespace Functor {
  * \brief Evaluate the reciprocal Mueller matrix from the reciprocal coherency matrix image
  *
  * Outpus are:
- * - channel #0 : \f$ 0.5*\mathcal{Re}( Coherency[0]+Coherency[3]+Coherency[5]) \f$
- * - channel #1 : \f$ 0.5*\mathcal{Re}( Coherency[0]+Coherency[3]-Coherency[5]) \f$
- * - channel #2 : \f$ 0.5*\mathcal{Re}( Coherency[0]-Coherency[3]+Coherency[5]) \f$
- * - channel #3 : \f$ 0.5*\mathcal{Re}(-Coherency[0]+Coherency[3]+Coherency[5]) \f$
- * - channel #4 : \f$ \mathcal{Re}(Coherency[1]) \f$
- * - channel #5 : \f$ \mathcal{Re}(Coherency[2]) \f$
- * - channel #6 : \f$ \mathcal{Im}(Coherency[4]) \f$
- * - channel #7 : \f$ \mathcal{Re}(Coherency[4]) \f$
- * - channel #8 : \f$ \mathcal{Im}(Coherency[2]) \f$
- * - channel #9 : \f$ \mathcal{Im}(Coherency[1]) \f$
+ * - channel #0 : \f$ 0.5*( C_{11}+C_{22}+C_{33} ) \f$
+ * - channel #1 : \f$ Re(C_{12}) + Im(C_{22}) \f$
+ * - channel #2 : \f$ Re(C_{13}) \f$
+ * - channel #3 : \f$ Im(C_{23}) \f$
+ * - channel #4 : \f$ Re(C_{12}) \f$
+ * - channel #5 : \f$ 0.5*( C_{11}+C_{22}-C_{33} ) \f$
+ * - channel #6 : \f$ Re(C_{23}) \f$
+ * - channel #7 : \f$ Im(C_{13}) \f$
+ * - channel #8 : \f$ -Re(C_{13}) \f$
+ * - channel #9 : \f$ -Re(C_{23}) \f$
+ * - channel #10 : \f$ 0.5.Re(VAL1) \f$
+ * - channel #11 : \f$ 0.5.Im(VAL0) \f$
+ * - channel #12 : \f$ Im(C_{23}) \f$
+ * - channel #13 : \f$ Im(C_{13}) \f$
+ * - channel #14 : \f$ 0.5.Im(VAL1^{*}) \f$
+ * - channel #15 : \f$ 0.5.Re(VAL0) \f$
  *
+ * With:
+ * VAL0 = C_{33}+C_{12}-C_{11}-(C_{12}-C_{22})^{*}   
+ * VAL1 = -C_{33}+C_{12}-C_{11}-(C_{12}-C_{22})^{*} 
+ * 
  * Where Coherency is the input pixel and contains:
- * - channel #0 : \f$ (S_{hh}+S_{vv}).(S_{hh}+S_{vv})^{*} \f$
- * - channel #1 : \f$ (S_{hh}+S_{vv}).(S_{hh}-S_{vv})^{*} \f$
- * - channel #2 : \f$ (S_{hh}+S_{vv}).(2*S_{hv})^{*} \f$
- * - channel #3 : \f$ (S_{hh}-S_{vv}).(S_{hh}-S_{vv})^{*} \f$
- * - channel #4 : \f$ (S_{hh}-S_{vv}).(2*S_{hv})^{*} \f$
- * - channel #5 : \f$ (2*S_{hv}).(2*S_{hv})^{*} \f$
+ * - channel #0 : \f$ 0.5*(S_{hh}+S_{vv}).(S_{hh}+S_{vv})^{*} \f$
+ * - channel #1 : \f$ 0.5*(S_{hh}+S_{vv}).(S_{hh}-S_{vv})^{*} \f$
+ * - channel #2 : \f$ 0.5*(S_{hh}+S_{vv}).(2*S_{hv})^{*} \f$
+ * - channel #3 : \f$ 0.5*(S_{hh}-S_{vv}).(S_{hh}-S_{vv})^{*} \f$
+ * - channel #4 : \f$ 0.5*(S_{hh}-S_{vv}).(2*S_{hv})^{*} \f$
+ * - channel #5 : \f$ 0.5*(2*S_{hv}).(2*S_{hv})^{*} \f$
  *
- * The output pixel has 10 channels : the diagonal and the upper element of the matrix.
+ * The output pixel has 16 channels
  * Element are stored from left to right, line by line.
  *
  * \ingroup SARPolarimetry
@@ -72,17 +82,28 @@ public:
     const double T1 = static_cast<double>(Coherency[0].real());
     const double T2 = static_cast<double>(Coherency[3].real());
     const double T3 = static_cast<double>(Coherency[5].real());
-
-    result[0] = 0.5*(T1+T2+T3);                               // A0+B0
-    result[1] = 0.5*(T1+T2-T3);                               // A0+B
-    result[2] = 0.5*(T1-T2+T3);                               // A0-B
-    result[3] = 0.5*(-T1+T2+T3);                              // -A0+B0
-    result[4] = static_cast<double>( Coherency[1].real() );  // C
-    result[5] = static_cast<double>( Coherency[2].real() );  // H
-    result[6] = static_cast<double>( Coherency[4].imag() );  // F
-    result[7] = static_cast<double>( Coherency[4].real() );  // E
-    result[8] = static_cast<double>( Coherency[2].imag() );  // G
-    result[9] = -static_cast<double>( Coherency[1].imag() ); // D
+    
+    ComplexType VAL4 = static_cast<ComplexType>( (Coherency[1] - Coherency[3]) );
+    ComplexType VAL5 = static_cast<ComplexType>( (Coherency[1] - Coherency[0]) );
+	ComplexType VAL0 = static_cast<ComplexType>( Coherency[5] ) + VAL5 - vcl_conj(VAL4);
+    ComplexType VAL1 = static_cast<ComplexType>( -Coherency[5] ) + VAL5 - vcl_conj(VAL4);
+
+    result[0] = 0.5*(T1+T2+T3);                               
+    result[1] = static_cast<double>( Coherency[1].real()+Coherency[3].imag() );
+    result[2] = static_cast<double>( Coherency[2].real() );   
+    result[3] = static_cast<double>( Coherency[4].imag() );                           
+    result[4] = static_cast<double>( Coherency[1].real() );  
+    result[5] = 0.5*(T1+T2-T3); 
+    result[6] = static_cast<double>( Coherency[4].real() );
+    result[7] = static_cast<double>( Coherency[2].imag() ); 
+    result[8] = static_cast<double>( -Coherency[2].real() );
+    result[9] = static_cast<double>( -Coherency[4].real() );
+	result[10] = static_cast<double>( 0.5*VAL1.real() ); 
+	result[11] = static_cast<double>( 0.5*VAL0.imag() ); 
+	result[12] = static_cast<double>( Coherency[4].imag() ); 
+	result[13] = static_cast<double>( Coherency[2].imag() );
+	result[14] = static_cast<double>( 0.5*vcl_conj(VAL1).imag() ); 
+	result[15] = static_cast<double>( 0.5*VAL0.real() ); 
 
     return result;
     }
@@ -99,7 +120,7 @@ public:
    virtual ~ReciprocalCoherencyToReciprocalMuellerFunctor() {}
 
 private:
-   itkStaticConstMacro(NumberOfComponentsPerPixel, unsigned int, 10);
+   itkStaticConstMacro(NumberOfComponentsPerPixel, unsigned int, 16);
 };
 }
 
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h
index 3ad4b0b..f34b83c 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h
@@ -30,12 +30,12 @@ namespace Functor {
  * \brief Evaluate the Coherency matrix from the Covariance image
  *
  * Output value are:
- * - channel #0 : \f$ 0.5 * (S_{hh}+S_{vv}.(S_{hh}+S_{vv})^{*} \f$
- * - channel #1 : \f$ 0.5 * (S_{hh}+S_{vv}.(S_{hh}-S_{vv})^{*} \f$
- * - channel #2 : \f$ (S_{hh}+S_{vv}.(S_{hv})^{*} \f$
- * - channel #3 : \f$ 0.5 * (S_{hh}-S_{vv}.(S_{hh}-S_{vv})^{*} \f$
- * - channel #4 : \f$ (S_{hh}-S_{vv}.(S_{hv})^{*} \f$
- * - channel #5 : \f$ 2.0*S_{hv}.S_{hv}^{*} \f$
+ * - channel #0 : \f$ 0.5 . (C33 + C13 + C13^{*} + C11) \f$
+ * - channel #1 : \f$ 0.5 . (-C33 - C13 + C13^{*} + C11) \f$
+ * - channel #2 : \f$ 0.5 . (\sqrt{2}.C12 + \sqrt{2}.C23^{*}) \f$
+ * - channel #3 : \f$ 0.5 . (C33 - C13 - C13^{*} + C11 \f$)
+ * - channel #4 : \f$ 0.5 . (\sqrt{2}.C12 - \sqrt{2}.C23^{*}) \f$
+ * - channel #5 : \f$ 0.5 . (2 . C22) \f$
  *
  * The output pixel has 6 channels : the diagonal and the upper element of the reciprocal matrix.
  * Element are stored from left to right, line by line.
@@ -61,31 +61,25 @@ public:
     TOutput result;
     result.SetSize(m_NumberOfComponentsPerPixel);
 
-    /* Using the convention
-     * \f$ C_{11} = S_{hh}*S_{hh}^* \f$
-     * \f$ C_{12} = S_{hh}*S_{hv}^* \f$
-     * \f$ C_{13} = S_{hh}*S_{vv}^* \f$
-     * \f$ C_{22} = S_{hv}*S_{hv}^* \f$
-     * \f$ C_{23} = S_{hv}*S_{vv}^* \f$
-     * \f$ C_{33} = S_{vv}*S_{vv}^* \f$
-     */
+   
     const ComplexType C11 =  static_cast<ComplexType>(Covariance[0]);
     const ComplexType C12 =  static_cast<ComplexType>(Covariance[1]);
     const ComplexType C13 =  static_cast<ComplexType>(Covariance[2]);
     const ComplexType C22 =  static_cast<ComplexType>(Covariance[3]);
     const ComplexType C23 =  static_cast<ComplexType>(Covariance[4]);
     const ComplexType C33 =  static_cast<ComplexType>(Covariance[5]);
-
-    //const ComplexType C21 =  vcl_conj(C12);
-    const ComplexType C31 =  vcl_conj(C13);
-    const ComplexType C32 =  vcl_conj(C23);
-
-    result[0] = static_cast<OutputValueType>( 0.5*(C11 + C13 + C31 + C33) );
-    result[1] = static_cast<OutputValueType>( 0.5*(C11 - C13 + C31 - C33) );
-    result[2] = static_cast<OutputValueType>( C12 + C32 );
-    result[3] = static_cast<OutputValueType>( 0.5*(C11 - C13 - C31 + C33) );
-    result[4] = static_cast<OutputValueType>( C12 - C32 );
-    result[5] = static_cast<OutputValueType>( 2.0 * C22 );
+    
+    const ComplexType two = ComplexType(2.0, 0.0);
+    const ComplexType rootTwo = ComplexType(vcl_sqrt(2.0), 0.0);
+    
+    result[0] = static_cast<OutputValueType>( C33 + C13 + vcl_conj(C13) + C11 );
+    result[1] = static_cast<OutputValueType>( -C33 - C13 + vcl_conj(C13) + C11 );
+    result[2] = static_cast<OutputValueType>( rootTwo*C12 + rootTwo*vcl_conj(C23) );
+    result[3] = static_cast<OutputValueType>( C33 - C13 - vcl_conj(C13) + C11 );
+    result[4] = static_cast<OutputValueType>( rootTwo*C12 - rootTwo*vcl_conj(C23) );
+    result[5] = static_cast<OutputValueType>( two * C22 );
+
+    result /= 2.0;
 
     return result;
     }
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h
index f1747c5..0967d17 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalHAlphaImageFilter.h
@@ -78,13 +78,13 @@ public:
 
     VNLMatrixType vnlMat(3, 3, 0.);
     vnlMat[0][0] = ComplexType(T0,  0.);
-    vnlMat[0][1] = std::conj(ComplexType(Coherency[1]));
-    vnlMat[0][2] = std::conj(ComplexType(Coherency[2]));
-    vnlMat[1][0] = ComplexType(Coherency[1]);
+    vnlMat[0][1] = ComplexType(Coherency[1]);
+    vnlMat[0][2] = ComplexType(Coherency[2]);
+    vnlMat[1][0] = std::conj(ComplexType(Coherency[1]));
     vnlMat[1][1] = ComplexType(T1,  0.);
-    vnlMat[1][2] = std::conj(ComplexType(Coherency[4]));
-    vnlMat[2][0] = ComplexType(Coherency[2]);
-    vnlMat[2][1] = ComplexType(Coherency[4]);
+    vnlMat[1][2] = ComplexType(Coherency[4]);
+    vnlMat[2][0] = std::conj(ComplexType(Coherency[2]));
+    vnlMat[2][1] = std::conj(ComplexType(Coherency[4]));
     vnlMat[2][2] = ComplexType(T2,  0.);
 
     // Only compute the left symetry to respect the previous Hermitian Analisys code
@@ -95,6 +95,7 @@ public:
     // Entropy estimation
     double totalEigenValues(0.0);
     double p[3];
+    double plog[3];
     double entropy;
     double alpha;
     double anisotropy;
@@ -120,46 +121,33 @@ public:
           }
       }
 
-    totalEigenValues = sortedRealEigenValues[0] + sortedRealEigenValues[1] + sortedRealEigenValues[2];
-    if (totalEigenValues <m_Epsilon)
+    totalEigenValues = 0.0;
+    for (unsigned int k = 0; k < 3; ++k)
       {
-        totalEigenValues = m_Epsilon;
+        sortedRealEigenValues[k] = std::max(sortedRealEigenValues[k], 0.);
+        totalEigenValues += sortedRealEigenValues[k];
       }
 
+      
     for (unsigned int k = 0; k < 3; ++k)
       {
-        p[k] = std::max(sortedRealEigenValues[k], 0.) / totalEigenValues;
-      }
+        p[k] = sortedRealEigenValues[k] / totalEigenValues;
+        
+        if (p[k]<m_Epsilon) //n=log(n)-->0 when n-->0
+			plog[k]=0.0;
+		else
+			plog[k]=-p[k]*log(p[k])/log(3.0);
 
-    if ( (p[0] < m_Epsilon) || (p[1] < m_Epsilon) || (p[2] < m_Epsilon) )
-      {
-        entropy =0.0;
-      }
-    else
-      {
-        entropy = p[0]*log(p[0]) + p[1]*log(p[1]) + p[2]*log(p[2]);
-        entropy /= -log(3.);
       }
 
+	entropy = 0.0;
+	for (unsigned int k = 0; k < 3; ++k)
+			entropy += plog[k];
+
     // alpha estimation
     double val0, val1, val2;
     double a0, a1, a2;
 
-    for(unsigned int k = 0; k < 3; ++k)
-      {
-         p[k] = sortedRealEigenValues[k] / totalEigenValues;
-
-         if (p[k] < 0.)
-           {
-             p[k] = 0.;
-           }
-
-         if (p[k] > 1.)
-           {
-             p[k] = 1.;
-           }
-      }
-
     val0 = std::abs(sortedGreaterEigenVector[0]);
     a0=acos(vcl_abs(val0)) * CONST_180_PI;
 
@@ -171,14 +159,10 @@ public:
 
     alpha=p[0]*a0 + p[1]*a1 + p[2]*a2;
 
-    if (alpha>90)
-      {
-        alpha=0.;
-      }
-
     // Anisotropy estimation
     anisotropy=(sortedRealEigenValues[1] - sortedRealEigenValues[2])/(sortedRealEigenValues[1] + sortedRealEigenValues[2] + m_Epsilon);
 
+
     result[0] = static_cast<OutputValueType>(entropy);
     result[1] = static_cast<OutputValueType>(alpha);
     result[2] = static_cast<OutputValueType>(anisotropy);
diff --git a/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h b/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h
index 227b46a..8a8caa7 100644
--- a/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h
+++ b/Modules/Filtering/Polarimetry/include/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h
@@ -20,6 +20,7 @@
 #define __ReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter_h
 
 #include "itkUnaryFunctorImageFilter.h"
+#include "vcl_complex.h"
 
 namespace otb
  {
@@ -31,23 +32,14 @@ namespace Functor {
  *  Extract from Antennas for radar and communications Harold Mott p 317.
  *
  *  Output value are:
- *  - channel #0 : \f$ 0.25 * (C_{1}+C_{3}+4*C_{2}-2*C_{6}-4*C_{5}-4*C_{9}) \f$
- *  - channel #1 : \f$ 0.25 * (C_{1}-C_{3}+2*C_{5}+2*C_{9} - 0.5\mathcal{i}.(C_{4}+C_{7}+C_{8}) \f$
- *  - channel #2 : \f$ 0.25 * (C_{1}+C_{3}-4*C_{2}-2*C_{6} - \mathcal{i}.(C_{4}+C_{8}) \f$
- *  - channel #3 : \f$ 0.25 * (C_{1}+C_{3}+2*C_{6} \f$
- *  - channel #4 : \f$ 0.25 * (C_{1}-C_{3}+2*C_{5}-2*C_{9} - 0.5\mathcal{i}.(C_{4}-C_{7}+C_{8}) \f$
- *  - channel #5 : \f$ 0.25 * (C_{1}+C_{3}+4*C_{2}-2*C_{6}+4*C_{5}+4*C_{9}) \f$
+ *  - channel #0 : \f$ 0.25 * (C33-i.\sqrt{2}.C23-C13+i.\sqrt{2}.C23^{*}-C13^{*}+2.C22-i.\sqrt{2}.C12+i.\sqrt{2}.C12^{*}+C11) \f$
+ *  - channel #1 : \f$ 0.25 * (i.\sqrt{2}.C33+2.C23-i.\sqrt{2}.C13+i.\sqrt{2}.C13^{*}+2.C12^{*}-i.\sqrt{2}.C11) \f$
+ *  - channel #2 : \f$ 0.25 * (-C33+i.\sqrt{2}.C23+C13+i.\sqrt{2}.C23^{*}+C13^{*}+2.C22-i.\sqrt{2}.C12-i.\sqrt{2}.C12^{*}-C11 ) \f$
+ *  - channel #3 : \f$ 0.25 * (2.C33+2.C13+2.C13^{*}+2.C11)\f$
+ *  - channel #4 : \f$ 0.25 * (i.\sqrt{2}.C33+i.\sqrt{2}.C13+2.C23^{*}-i.\sqrt{2}.C13^{*}+2.C12-i.\sqrt{2}.C11) \f$
+ *  - channel #5 : \f$ 0.25 * (C33+i.\sqrt{2}.C23-C13-i.\sqrt{2}.C23^{*}-C13^{*}+2.C22+i.\sqrt{2}.C12-i.\sqrt{2}.C12^{*}+C11) \f$
  *
- *  Where:
- *  - \f$ C_{1} = S_{hh}*S_{hh}}^{*} = \mathcal{Re}(input[0]) \f$
- *  - \f$ C_{2} = S_{hv}*S_{hv}}^{*} = \mathcal{Re}(input[3]) \f$
- *  - \f$ C_{3} = S_{vv}*S_{vv}}^{*} = \mathcal{Re}(input[5]) \f$
- *  - \f$ C_{4} = \mathcal{Re}(S_{hh}*S_{hv}}^{*}) = \mathcal{Re}(input[1]) \f$
- *  - \f$ C_{5} = \mathcal{Im}(S_{hh}*S_{hv}}^{*}) = \mathcal{Im}(input[1]) \f$
- *  - \f$ C_{6} = \mathcal{Re}(S_{hh}*S_{vv}}^{*}) = \mathcal{Re}(input[2]) \f$
- *  - \f$ C_{7} = \mathcal{Im}(S_{hh}*S_{vv}}^{*}) = \mathcal{Im}(input[2]) \f$
- *  - \f$ C_{8} = \mathcal{Re}(S_{hv}*S_{vv}}^{*}) = \mathcal{Re}(input[4]) \f$
- *  - \f$ C_{9} = \mathcal{Im}(S_{hv}*S_{vv}}^{*} = \mathcal{Im}(input[4])) \f$
+ *  Where Cij are related to the elements of the reciprocal linear covariance matrix.
  *
  * The output pixel has 6 channels : the diagonal and the upper element of the reciprocal matrix.
  * Element are stored from left to right, line by line.
@@ -74,32 +66,27 @@ public:
     TOutput result;
     result.SetSize(m_NumberOfComponentsPerPixel);
     result.Fill(0.0);
-
-    const RealType C1 =  static_cast<RealType>(Covariance[0].real()); // C1  <hh.hh*>
-    const RealType C2 =  static_cast<RealType>(Covariance[3].real()); // C2  <hv.hv*>
-    const RealType C3 =  static_cast<RealType>(Covariance[5].real()); // C3  <vv.vv*>
-    const RealType C4 =  static_cast<RealType>(Covariance[1].real()); // C4  Re<hh.hv*>
-    const RealType C5 =  static_cast<RealType>(Covariance[1].imag()); // C5  Im<hh.hv*>
-    const RealType C6 =  static_cast<RealType>(Covariance[2].real()); // C6  Re<hh.vv*>
-    const RealType C7 =  static_cast<RealType>(Covariance[2].imag()); // C7  Im<hh.vv*>
-    const RealType C8 =  static_cast<RealType>(Covariance[4].real()); // C8  Re<hv.vv*>
-    const RealType C9 =  static_cast<RealType>(Covariance[4].imag()); // C9  Im<hv.vv*>
-
-    const RealType llrrReal = 0.25 * ( C1 + C3 - 4*C2 -2*C6);
-    const RealType llrrImag = -(C4 + C8);
-
-    const RealType lllrReal = 0.25 * ( C1 - C3 - 2*C5 + 2*C9);
-    const RealType lllrImag = -0.5*(C7+C4+C8);
-
-    const RealType rrlrReal = 0.25 * ( C1 -C3 + 2*C5 - 2*C9);
-    const RealType rrlrImag = 0.5 * (C4+C8-C7);
-
-    result[0] = ComplexType(0.25 * ( C1 + C3 + 4*C2 - 2*C6 - 4*C5 - 4*C9));
-    result[1] = ComplexType(lllrReal, lllrImag);
-    result[2] = ComplexType(llrrReal, llrrImag);
-    result[3] = ComplexType(0.25 * ( C1 + C3 + 2*C6));
-    result[4] = ComplexType(rrlrReal, -rrlrImag);
-    result[5] = ComplexType(0.25 * ( C1 + C3 + 4*C2 - 2*C6 + 4*C5 + 4*C9));
+    
+    
+    const ComplexType C11 =  static_cast<ComplexType>(  Covariance[0]    );     //   <hh.hh*>
+    const ComplexType C12 =  static_cast<ComplexType>(  Covariance[1]    );     //   <sqrt(2).hh.hv*>
+    const ComplexType C13 =  static_cast<ComplexType>(  Covariance[2]    );     //   <hh.vv*>
+    const ComplexType C22 =  static_cast<ComplexType>(  Covariance[3]    );     //   <2.hv.hv*>
+    const ComplexType C23 =  static_cast<ComplexType>(  Covariance[4]    );     //   <sqrt(2).hv.vv*>
+    const ComplexType C33 =  static_cast<ComplexType>(  Covariance[5]    );     //   <vv.vv*>
+    
+    
+    const ComplexType cst1 = ComplexType(0.0, vcl_sqrt(2.0));
+    const ComplexType two = ComplexType(2.0, 0 );
+
+    result[0] = static_cast<ComplexType>( C33-cst1*C23-C13+cst1*vcl_conj(C23)-vcl_conj(C13)+two*C22-cst1*C12+cst1*vcl_conj(C12)+C11  ) ;
+    result[1] = static_cast<ComplexType>( cst1*C33+two*C23-cst1*C13+cst1*vcl_conj(C13)+two*vcl_conj(C12)-cst1*C11 );
+    result[2] = static_cast<ComplexType>( -C33+cst1*C23+C13+cst1*vcl_conj(C23)+vcl_conj(C13)+two*C22-cst1*C12-cst1*vcl_conj(C12)-C11  ) ;
+    result[3] = static_cast<ComplexType>( two*C33+two*C13+two*vcl_conj(C13)+two*C11 ) ;
+    result[4] = static_cast<ComplexType>( cst1*C33+cst1*C13+two*vcl_conj(C23)-cst1*vcl_conj(C13)+two*C12-cst1*C11 ) ;
+    result[5] = static_cast<ComplexType>( C33+cst1*C23-C13-cst1*vcl_conj(C23)-vcl_conj(C13)+two*C22+cst1*C12-cst1*vcl_conj(C12)+C11 ) ;
+
+	result /= 4.0;
 
     return result;
     }
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h
index c3d4f81..08e10da 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToCircularCovarianceMatrixFunctor.h
@@ -42,9 +42,9 @@ namespace Functor
  *  - channel #9 : \f$ S_{rr}.S_{rr}^{*} \f$
  *
  * With:
- * - \f$ S_{ll} = 0.5 * (-S_{hh}-i*S_{hv}-i*S_{vh}+S_{vv}) \f$
- * - \f$ S_{lr} = 0.5 * (-S_{hh}+i*S_{hv}-i*S_{vh}+S_{vv}) \f$
- * - \f$ S_{rl} = 0.5 * (-S_{hh}-i*S_{hv}+i*S_{vh}-S_{vv}) \f$
+ * - \f$ S_{ll} = 0.5 * (S_{hh}+i*S_{hv}+i*S_{vh}-S_{vv}) \f$
+ * - \f$ S_{lr} = 0.5 * (i*S_{hh}+S_{hv}-S_{vh}+i*S_{vv}) \f$
+ * - \f$ S_{rl} = 0.5 * (i*S_{hh}-S_{hv}+S_{vh}+i*S_{vv}) \f$
  * - \f$ S_{rr} = 0.5 * (-S_{hh}+i*S_{hv}+i*S_{vh}+S_{vv}) \f$
  *
  * Extract from Antennas for radar and communications Harold Mott p 317.
@@ -89,12 +89,14 @@ public:
     result.SetSize(m_NumberOfComponentsPerPixel);
     const ComplexType jS_hv = S_hv * ComplexType(0., 1.);
     const ComplexType jS_vh = S_vh * ComplexType(0., 1.);
-
+    const ComplexType jS_hh = S_hh * ComplexType(0., 1.);
+    const ComplexType jS_vv = S_vv * ComplexType(0., 1.);
+    
     const ComplexType coef(0.5);
 
-    const ComplexType Sll = coef*( -S_hh-jS_hv-jS_vh+S_vv );
-    const ComplexType Slr = coef*( -S_hh+jS_hv-jS_vh-S_vv );
-    const ComplexType Srl = coef*( -S_hh-jS_hv+jS_vh-S_vv );
+    const ComplexType Sll = coef*( S_hh+jS_hv+jS_vh-S_vv );
+    const ComplexType Slr = coef*( jS_hh+S_hv-S_vh+jS_vv );
+    const ComplexType Srl = coef*( jS_hh-S_hv+S_vh+jS_vv );
     const ComplexType Srr = coef*( -S_hh+jS_hv+jS_vh+S_vv );
 
     //const ComplexType conjSll = vcl_conj(Sll);
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h
index 5d31c33..4bd338c 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToMuellerMatrixFunctor.h
@@ -50,8 +50,8 @@ namespace Functor
  * With :
  * - \f$ T_{xx} = -S_{hh} \f$
  * - \f$ T_{xy} = -S_{hv} \f$
- * - \f$ T_{yx} = -S_{vh} \f$
- * - \f$ T_{yy} = -S_{vv} \f$
+ * - \f$ T_{yx} = S_{vh} \f$
+ * - \f$ T_{yy} = S_{vv} \f$
  *
  * Output is a not a complex. The output pixel has 16 channels : each element of the Mueller matrix.
  * The order of the channels corresponds to :
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h
index 53c62b6..7dbb832 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h
@@ -80,14 +80,14 @@ public:
     const ComplexType coef(0.5);
 
     const ComplexType j2S_hv = S_hv * ComplexType(0.0, 2.0);
+    const ComplexType jS_hh = S_hh * ComplexType(0.0, 1.0);
+    const ComplexType jS_vv = S_vv * ComplexType(0.0, 1.0);
 
-    const ComplexType Sll = coef * ( -S_hh-j2S_hv+S_vv );
-    const ComplexType Slr = coef * ( -S_hh+-S_vv );
+
+    const ComplexType Sll = coef * ( S_hh+j2S_hv-S_vv );
+    const ComplexType Slr = coef * ( jS_hh + jS_vv );
     const ComplexType Srr = coef * ( -S_hh+j2S_hv+S_vv );
 
-    //const ComplexType conjSll = vcl_conj(Sll);
-    //const ComplexType conjSlr = vcl_conj(Slr);
-    //const ComplexType conjSrr = vcl_conj(Srr);
 
     SinclairToReciprocalCovarianceFunctorType funct;
     return ( funct(Sll, Slr, Srr ) );
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h
index e1d6743..7fb9ddc 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCoherencyMatrixFunctor.h
@@ -18,8 +18,10 @@
 #ifndef __otbSinclairToReciprocalCoherencyMatrixFunctor_h
 #define __otbSinclairToReciprocalCoherencyMatrixFunctor_h
 
-#include "vcl_complex.h"
 #include "itkMacro.h"
+#include "vcl_complex.h"
+#include "otbMath.h"
+#include "vnl/vnl_matrix.h"
 
 namespace otb
 {
@@ -62,6 +64,7 @@ class SinclairToReciprocalCoherencyMatrixFunctor
 public:
   /** Some typedefs. */
   typedef typename std::complex <double>           ComplexType;
+  typedef vnl_matrix<ComplexType>       		   VNLMatrixType;
   typedef typename TOutput::ValueType              OutputValueType;
   
   itkStaticConstMacro(NumberOfComponentsPerPixel, unsigned int, 6);
@@ -75,19 +78,23 @@ public:
     const ComplexType S_hh = static_cast<ComplexType>(Shh);
     const ComplexType S_hv = static_cast<ComplexType>(Shv);
     const ComplexType S_vv = static_cast<ComplexType>(Svv);
-
-    const ComplexType HHPlusVV  = S_hh + S_vv;
-    const ComplexType HHMinusVV = S_hh - S_vv;
-    const ComplexType twoHV     = ComplexType( 2.0 ) * S_hv;
-
-    result[0] = static_cast<OutputValueType>( std::norm(HHPlusVV) );
-    result[1] = static_cast<OutputValueType>( HHPlusVV * vcl_conj(HHMinusVV) );
-    result[2] = static_cast<OutputValueType>( HHPlusVV * vcl_conj(twoHV) );
-    result[3] = static_cast<OutputValueType>( std::norm(HHMinusVV) );
-    result[4] = static_cast<OutputValueType>( HHMinusVV *vcl_conj(twoHV) );
-    result[5] = static_cast<OutputValueType>( std::norm(twoHV) );
-
-    result /= 2.0;
+   
+    
+    VNLMatrixType f3p(3, 1, 0.);
+    f3p[0][0]= (S_hh + S_vv) / ComplexType( std::sqrt(2.0) , 0.0);
+    f3p[1][0]= (S_hh - S_vv) / ComplexType( std::sqrt(2.0) , 0.0);
+    f3p[2][0]= ComplexType( std::sqrt(2.0) , 0.0) * S_hv;
+
+
+    VNLMatrixType res = f3p*f3p.conjugate_transpose();
+    
+    result[0] = static_cast<OutputValueType>( res[0][0] );
+    result[1] = static_cast<OutputValueType>( res[0][1] );
+    result[2] = static_cast<OutputValueType>( res[0][2] );
+    result[3] = static_cast<OutputValueType>( res[1][1] );
+    result[4] = static_cast<OutputValueType>( res[1][2] );
+    result[5] = static_cast<OutputValueType>( res[2][2] );
+    
 
     return (result);
   }
diff --git a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h
index 98c7bba..6320336 100644
--- a/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h
+++ b/Modules/Filtering/Polarimetry/include/otbSinclairToReciprocalCovarianceMatrixFunctor.h
@@ -19,6 +19,8 @@
 #define __otbSinclairToReciprocalCovarianceMatrixFunctor_h
 
 #include "vcl_complex.h"
+#include "otbMath.h"
+#include "vnl/vnl_matrix.h"
 
 namespace otb
 {
@@ -30,10 +32,10 @@ namespace Functor
  *
  *  Output value are:
  *  - channel #0 : \f$ S_{hh}.S_{hh}^{*} \f$
- *  - channel #1 : \f$ S_{hh}.S_{hv}^{*} \f$
+ *  - channel #1 : \f$ \sqrt{2}.S_{hh}.S_{hv}^{*} \f$
  *  - channel #2 : \f$ S_{hh}.S_{vv}^{*} \f$
- *  - channel #3 : \f$ S_{hv}.S_{hv}^{*} \f$
- *  - channel #4 : \f$ S_{hv}.S_{vv}^{*} \f$
+ *  - channel #3 : \f$ 2.S_{hv}.S_{hv}^{*} \f$
+ *  - channel #4 : \f$ \sqrt{2}.S_{hv}.S_{vv}^{*} \f$
  *  - channel #5 : \f$ S_{vv}.S_{vv}^{*} \f$
  *
  * This is a adaptation of the SinclairToCovarianceMatrixFunctor, where \f$ S_{hv}=S_{vh} \f$.
@@ -61,6 +63,7 @@ class SinclairToReciprocalCovarianceMatrixFunctor
 public:
   /** Some typedefs. */
   typedef typename std::complex <double>           ComplexType;
+  typedef vnl_matrix<ComplexType>       		   VNLMatrixType;
   typedef typename TOutput::ValueType              OutputValueType;
   inline TOutput operator ()(const TInput1& Shh, const TInput2& Shv, const TInput3& Svv)
   {
@@ -71,13 +74,20 @@ public:
     const ComplexType S_hh = static_cast<ComplexType>(Shh);
     const ComplexType S_hv = static_cast<ComplexType>(Shv);
     const ComplexType S_vv = static_cast<ComplexType>(Svv);
-
-    result[0] = static_cast<OutputValueType>( std::norm( S_hh ) );
-    result[1] = static_cast<OutputValueType>( S_hh*vcl_conj(S_hv) );
-    result[2] = static_cast<OutputValueType>( S_hh*vcl_conj(S_vv) );
-    result[3] = static_cast<OutputValueType>( std::norm( S_hv ) );
-    result[4] = static_cast<OutputValueType>( S_hv*vcl_conj(S_vv) );
-    result[5] = static_cast<OutputValueType>( std::norm( S_vv ) );
+    
+    VNLMatrixType f3l(3, 1, 0.);
+    f3l[0][0]=S_hh;
+    f3l[1][0]=ComplexType(std::sqrt(2.0),0.0)*S_hv;
+    f3l[2][0]=S_vv;
+    
+    VNLMatrixType res = f3l*f3l.conjugate_transpose();
+    
+    result[0] = static_cast<OutputValueType>( res[0][0] );
+    result[1] = static_cast<OutputValueType>( res[0][1] );
+    result[2] = static_cast<OutputValueType>( res[0][2] );
+    result[3] = static_cast<OutputValueType>( res[1][1] );
+    result[4] = static_cast<OutputValueType>( res[1][2] );
+    result[5] = static_cast<OutputValueType>( res[2][2] );
 
     return (result);
   }
diff --git a/Modules/Filtering/Polarimetry/test/CMakeLists.txt b/Modules/Filtering/Polarimetry/test/CMakeLists.txt
index 06f729d..f69bd68 100644
--- a/Modules/Filtering/Polarimetry/test/CMakeLists.txt
+++ b/Modules/Filtering/Polarimetry/test/CMakeLists.txt
@@ -40,7 +40,7 @@ otb_module_target_label(otbPolarimetryTestDriver)
 # Tests Declaration
 
 otb_add_test(NAME saTvMuellerToPolarisationDegreeAndPowerImageFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvMuellerToPolarisationDegreeAndPowerImageFilter.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvMuellerToPolarisationDegreeAndPowerImageFilter.tif
   ${TEMP}/saTvMuellerToPolarisationDegreeAndPowerImageFilter.tif
   otbMuellerToPolarisationDegreeAndPowerImageFilter
   ${BASELINE}/saTvSinclairImageFilter_SinclairToMueller.tif
@@ -48,7 +48,7 @@ otb_add_test(NAME saTvMuellerToPolarisationDegreeAndPowerImageFilter COMMAND otb
   )
 
 otb_add_test(NAME saTvVectorMultiChannelsPolarimetricSynthesisFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvMultiPolarimetricSynthesis1.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvMultiPolarimetricSynthesis1.tif
   ${TEMP}/resMultiPolarimetricSynthesis1.tif
   otbVectorMultiChannelsPolarimetricSynthesisFilter
   ${INPUTDATA}/RSAT2_AltonaExtract_1000_1000_100_100.hdr
@@ -60,10 +60,13 @@ otb_add_test(NAME saTvVectorMultiChannelsPolarimetricSynthesisFilter COMMAND otb
   )
 
 otb_add_test(NAME saTvReciprocalHAlphaImageFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvReciprocalHAlphaImageFilter.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvReciprocalHAlphaImageFilter.tif
   ${TEMP}/saTvReciprocalHAlphaImageFilter.tif
   otbReciprocalHAlphaImageFilter
-  ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCoherency.tif
+  ${INPUTDATA}/RSAT_imagery_HH.tif
+  ${INPUTDATA}/RSAT_imagery_HV.tif
+  ${INPUTDATA}/RSAT_imagery_VV.tif
+  5
   ${TEMP}/saTvReciprocalHAlphaImageFilter.tif
   )
 
@@ -72,7 +75,7 @@ otb_add_test(NAME saTuReciprocalLinearCovarianceToReciprocalCircularCovarianceIm
   )
 
 otb_add_test(NAME saTvReciprocalCovarianceToReciprocalCoherencyImageFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvMLCToCoherencyImageFilter.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCoherency.tif
   ${TEMP}/saTvMLCToCoherencyImageFilter.tif
   otbReciprocalCovarianceToReciprocalCoherencyImageFilter
   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
@@ -91,7 +94,7 @@ otb_add_test(NAME saTuPolarimetricSynthesisFunctor COMMAND otbPolarimetryTestDri
   otbPolarimetricSynthesisFunctor )
 
 otb_add_test(NAME saTvMultiChannelsPolarimetricSynthesisFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvMultiPolarimetricSynthesis2.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvMultiPolarimetricSynthesis2.tif
   ${TEMP}/resMultiPolarimetricSynthesis2.tif
   otbMultiChannelsPolarimetricSynthesisFilter
   ${INPUTDATA}/RSAT_imagery_HH.tif
@@ -104,8 +107,22 @@ otb_add_test(NAME saTvMultiChannelsPolarimetricSynthesisFilter COMMAND otbPolari
   45.0     # KhiR
   )
 
+otb_add_test(NAME saTvMultiChannelsPolarimetricSynthesisFilter_C COMMAND otbPolarimetryTestDriver
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvMultiPolarimetricSynthesis2.tif
+  ${TEMP}/resMultiPolarimetricSynthesis2_C.tif
+  otbMultiChannelsPolarimetricSynthesisFilter
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${INPUTDATA}/RSAT_imageryC_HV.tif
+  ${INPUTDATA}/RSAT_imageryC_VV.tif
+  ${TEMP}/resMultiPolarimetricSynthesis2_C.tif
+  32.0     # PsiI
+  22.0     # KhiI
+  58.0     # PsiR
+  45.0     # KhiR
+  )
+
 otb_add_test(NAME saTvSinclairImageFilter_SinclairToMueller COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvSinclairImageFilter_SinclairToMueller.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToMueller.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToMueller.tif
   otbSinclairImageFilter
   SinclairToMuellerMatrix
@@ -114,9 +131,20 @@ otb_add_test(NAME saTvSinclairImageFilter_SinclairToMueller COMMAND otbPolarimet
   ${INPUTDATA}/RSAT_imagery_VV.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToMueller.tif
   )
+  
+otb_add_test(NAME saTvSinclairImageFilter_SinclairToMueller_C COMMAND otbPolarimetryTestDriver
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToMueller.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToMueller_C.tif
+  otbSinclairImageFilter
+  SinclairToMuellerMatrix
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${INPUTDATA}/RSAT_imageryC_HV.tif
+  ${INPUTDATA}/RSAT_imageryC_VV.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToMueller_C.tif
+  )
 
 otb_add_test(NAME saTvSinclairImageFilter_SinclairToCovariance COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCovariance.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCovariance.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToCovariance.tif
   otbSinclairImageFilter
   SinclairToCovarianceMatrix
@@ -125,13 +153,24 @@ otb_add_test(NAME saTvSinclairImageFilter_SinclairToCovariance COMMAND otbPolari
   ${INPUTDATA}/RSAT_imagery_VV.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToCovariance.tif
   )
+  
+otb_add_test(NAME saTvSinclairImageFilter_SinclairToCovariance_C COMMAND otbPolarimetryTestDriver
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCovariance.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToCovariance_C.tif
+  otbSinclairImageFilter
+  SinclairToCovarianceMatrix
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${INPUTDATA}/RSAT_imageryC_HV.tif
+  ${INPUTDATA}/RSAT_imageryC_VV.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToCovariance_C.tif
+  )
 
 otb_add_test(NAME saTuSinclairImageFilterNew COMMAND otbPolarimetryTestDriver
   otbSinclairImageFilterNew
   )
 
 otb_add_test(NAME saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix.tif
   otbSinclairImageFilter
   SinclairToCircularCovarianceMatrix
@@ -140,9 +179,20 @@ otb_add_test(NAME saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix COM
   ${INPUTDATA}/RSAT_imagery_VV.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix.tif
   )
+  
+otb_add_test(NAME saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix_C COMMAND otbPolarimetryTestDriver
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix_C.tif
+  otbSinclairImageFilter
+  SinclairToCircularCovarianceMatrix
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${INPUTDATA}/RSAT_imageryC_HV.tif
+  ${INPUTDATA}/RSAT_imageryC_VV.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToCircularCovarianceMatrix_C.tif
+  )
 
 otb_add_test(NAME saTvSinclairImageFilter_SinclairToCoherency COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCoherency.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCoherency.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToCoherency.tif
   otbSinclairImageFilter
   SinclairToCoherencyMatrix
@@ -151,6 +201,17 @@ otb_add_test(NAME saTvSinclairImageFilter_SinclairToCoherency COMMAND otbPolarim
   ${INPUTDATA}/RSAT_imagery_VV.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToCoherency.tif
   )
+  
+otb_add_test(NAME saTvSinclairImageFilter_SinclairToCoherency_C COMMAND otbPolarimetryTestDriver
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToCoherency.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToCoherency_C.tif
+  otbSinclairImageFilter
+  SinclairToCoherencyMatrix
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${INPUTDATA}/RSAT_imageryC_HV.tif
+  ${INPUTDATA}/RSAT_imageryC_VV.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToCoherency_C.tif
+  )
 
 otb_add_test(NAME saTuReciprocalCovarianceToReciprocalCoherencyImageFilterNew COMMAND otbPolarimetryTestDriver
   otbReciprocalCovarianceToReciprocalCoherencyImageFilterNew
@@ -165,7 +226,7 @@ otb_add_test(NAME saTuSinclairReciprocalImageFilterNew COMMAND otbPolarimetryTes
   )
 
 otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCovariance COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
   otbSinclairReciprocalImageFilter
   SinclairToReciprocalCovarianceMatrix
@@ -174,9 +235,20 @@ otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCovarian
   ${INPUTDATA}/RSAT_imagery_VV.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
   )
+  
+otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCovariance_C COMMAND otbPolarimetryTestDriver
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCovariance_C.tif
+  otbSinclairReciprocalImageFilter
+  SinclairToReciprocalCovarianceMatrix
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${INPUTDATA}/RSAT_imageryC_HV.tif
+  ${INPUTDATA}/RSAT_imageryC_VV.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCovariance_C.tif
+  )
 
 otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCircularCovarianceMatrix COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCircularCovarianceMatrix.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCircularCovarianceMatrix.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCircularCovarianceMatrix.tif
   otbSinclairReciprocalImageFilter
   SinclairToReciprocalCircularCovarianceMatrix
@@ -185,9 +257,21 @@ otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCircular
   ${INPUTDATA}/RSAT_imagery_VV.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCircularCovarianceMatrix.tif
   )
+  
+  
+otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCircularCovarianceMatrix_C COMMAND otbPolarimetryTestDriver
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCircularCovarianceMatrix.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCircularCovarianceMatrix_C.tif
+  otbSinclairReciprocalImageFilter
+  SinclairToReciprocalCircularCovarianceMatrix
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${INPUTDATA}/RSAT_imageryC_HV.tif
+  ${INPUTDATA}/RSAT_imageryC_VV.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCircularCovarianceMatrix_C.tif
+  )
 
 otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCoherency COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCoherency.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCoherency.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCoherency.tif
   otbSinclairReciprocalImageFilter
   SinclairToReciprocalCoherencyMatrix
@@ -196,9 +280,21 @@ otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCoherenc
   ${INPUTDATA}/RSAT_imagery_VV.tif
   ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCoherency.tif
   )
+  
+otb_add_test(NAME saTvSinclairReciprocalImageFilter_SinclairToReciprocalCoherency_C COMMAND otbPolarimetryTestDriver
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCoherency.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCoherency_C.tif
+  otbSinclairReciprocalImageFilter
+  SinclairToReciprocalCoherencyMatrix
+  ${INPUTDATA}/RSAT_imageryC_HH.tif
+  ${INPUTDATA}/RSAT_imageryC_HV.tif
+  ${INPUTDATA}/RSAT_imageryC_VV.tif
+  ${TEMP}/saTvSinclairImageFilter_SinclairToReciprocalCoherency_C.tif
+  )
+ 
 
 otb_add_test(NAME saTvReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvMLCToCircularCoherencyDegreeImageFilter.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCircularCovarianceMatrix.tif
   ${TEMP}/saTvMLCToCircularCoherencyDegreeImageFilter.tif
   otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter
   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
@@ -206,7 +302,7 @@ otb_add_test(NAME saTvReciprocalLinearCovarianceToReciprocalCircularCovarianceIm
   )
 
 otb_add_test(NAME saTvReciprocalCoherencyToReciprocalMuellerImageFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvReciprocalCoherencyToMuellerImageFilter.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToMueller.tif 
   ${TEMP}/saTvReciprocalCoherencyToMuellerImageFilter.tif
   otbReciprocalCoherencyToReciprocalMuellerImageFilter
   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCoherency.tif
@@ -222,7 +318,7 @@ otb_add_test(NAME saTuReciprocalCovarianceToCoherencyDegreeImageFilterNew COMMAN
   )
 
 otb_add_test(NAME saTvMuellerToReciprocalCovarianceImageFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvMuellerToMLCImageFilter.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
   ${TEMP}/saTvMuellerToMLCImageFilter.tif
   otbMuellerToReciprocalCovarianceImageFilter
   ${BASELINE}/saTvSinclairImageFilter_SinclairToMueller.tif
@@ -270,7 +366,7 @@ otb_add_test(NAME saTuSinclairToCovarianceMatrixFunctor COMMAND otbPolarimetryTe
   )
 
 otb_add_test(NAME saTvReciprocalCovarianceToCoherencyDegreeImageFilter COMMAND otbPolarimetryTestDriver
-  --compare-image ${EPSILON_12}   ${BASELINE}/saTvMLCToCoherencyDegreeImageFilter.tif
+  --compare-image ${EPSILON_7}   ${BASELINE}/saTvMLCToCoherencyDegreeImageFilter.tif
   ${TEMP}/saTvMLCToCoherencyDegreeImageFilter.tif
   otbReciprocalCovarianceToCoherencyDegreeImageFilter
   ${BASELINE}/saTvSinclairImageFilter_SinclairToReciprocalCovariance.tif
diff --git a/Modules/Filtering/Polarimetry/test/otbMuellerToReciprocalCovarianceFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbMuellerToReciprocalCovarianceFunctor.cxx
index e52054b..db596e6 100644
--- a/Modules/Filtering/Polarimetry/test/otbMuellerToReciprocalCovarianceFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbMuellerToReciprocalCovarianceFunctor.cxx
@@ -43,12 +43,12 @@ int otbMuellerToReciprocalCovarianceFunctor(int itkNotUsed(argc), char * itkNotU
       val += 0.5;
     }
 
-  result[0] = ComplexType(2.5, 0.);
-  result[1] = ComplexType(4., 5.);
-  result[2] = ComplexType(-6.25, 0.75);
-  result[3] = ComplexType(-8, 0.);
-  result[4] = ComplexType(0.5, -0.5);
-  result[5] = ComplexType(0., 0.);
+  result[0] = ComplexType(1.75,0);
+  result[1] = ComplexType(2.82842712474619,3.53553390593274);
+  result[2] = ComplexType(-6.25,-5.5);
+  result[3] = ComplexType(-2.5,0);
+  result[4] = ComplexType(-1.4142135623731,-1.4142135623731);
+  result[5] = ComplexType(0.75,0);
 
   FunctorType funct;
   outputFunct = funct.operator ()( input );
diff --git a/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx b/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx
index 702a2da..8855b9d 100644
--- a/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbReciprocalHAlphaImageFilter.cxx
@@ -24,35 +24,80 @@
 #include "otbImageFileReader.h"
 #include "otbImageFileWriter.h"
 #include "otbReciprocalHAlphaImageFilter.h"
+#include "itkMeanImageFilter.h"
+#include "otbPerBandVectorImageFilter.h"
+#include "otbSinclairReciprocalImageFilter.h"
+#include "otbSinclairToReciprocalCoherencyMatrixFunctor.h"
+
 
 int otbReciprocalHAlphaImageFilter(int itkNotUsed(argc), char * argv[])
 {
-  const char * inputFilename  = argv[1];
-  const char * outputFilename = argv[2];
-
-  typedef double                   PixelType;
-  typedef std::complex<PixelType>  InputPixelType;
-  const unsigned int Dimension = 2;
+  const char * inputFilenameHH = argv[1];
+  const char * inputFilenameHV = argv[2];
+  const char * inputFilenameVV = argv[3];
+  int size = atoi(argv[4]);
+  const char * outputFilename = argv[5];
 
 
-  typedef otb::VectorImage<InputPixelType, Dimension>  ImageType;
-  typedef otb::VectorImage<PixelType, Dimension>       RealImageType;
-
-  typedef otb::ReciprocalHAlphaImageFilter<ImageType, RealImageType> FilterType;
+  typedef std::complex<double>  ComplexPixelType;
+  const unsigned int Dimension = 2;
 
-  typedef otb::ImageFileReader<ImageType>  ReaderType;
-  typedef otb::ImageFileWriter<RealImageType> WriterType;
 
-  ReaderType::Pointer reader = ReaderType::New();
+  typedef otb::Image<ComplexPixelType, Dimension>  	   ComplexImageType;
+  typedef otb::VectorImage<ComplexPixelType, Dimension>  ComplexVectorImageType;
+  typedef otb::VectorImage<double, Dimension>          RealVectorImageType;
+
+
+
+  typedef otb::ImageFileReader<ComplexImageType>  ReaderType;
+  typedef otb::ImageFileWriter<RealVectorImageType> WriterType;
+  
+  
+  typedef otb::SinclairReciprocalImageFilter<ComplexImageType, ComplexImageType, ComplexImageType, ComplexVectorImageType, 
+  otb::Functor::SinclairToReciprocalCovarianceMatrixFunctor<ComplexImageType::PixelType,
+                                    ComplexImageType::PixelType,
+                                    ComplexImageType::PixelType,
+                                    ComplexVectorImageType::PixelType> > SinclaireToC3FilterType;
+  
+  
+  typedef itk::MeanImageFilter<ComplexImageType, ComplexImageType>         MeanFilterType;
+  typedef otb::PerBandVectorImageFilter<ComplexVectorImageType, ComplexVectorImageType, MeanFilterType> PerBandMeanFilterType;
+  
+  
+  typedef otb::ReciprocalHAlphaImageFilter<ComplexVectorImageType, RealVectorImageType> HAlphaFilterType;
+  
+  
+
+  ReaderType::Pointer readerHH = ReaderType::New();
+  ReaderType::Pointer readerHV = ReaderType::New();
+  ReaderType::Pointer readerVV = ReaderType::New();
+  
   WriterType::Pointer writer = WriterType::New();
 
-  reader->SetFileName(inputFilename);
-
-  FilterType::Pointer filter = FilterType::New();
-  filter->SetInput(reader->GetOutput());
+  SinclaireToC3FilterType::Pointer sinclairtoc3 = SinclaireToC3FilterType::New();
+  PerBandMeanFilterType::Pointer perBand = PerBandMeanFilterType::New();
+  HAlphaFilterType::Pointer haafilter = HAlphaFilterType::New();
+        
+  
+  MeanFilterType::InputSizeType radius;
+  radius.Fill( size );
+  perBand->GetFilter()->SetRadius(radius);
+ 
+ 
+  readerHH->SetFileName(inputFilenameHH);
+  readerHV->SetFileName(inputFilenameHV);
+  readerVV->SetFileName(inputFilenameVV);
+  
+  sinclairtoc3->SetInputHH(readerHH->GetOutput());
+  sinclairtoc3->SetInputHV_VH(readerHV->GetOutput());
+  sinclairtoc3->SetInputVV(readerVV->GetOutput());
+ 
+  perBand->SetInput(sinclairtoc3->GetOutput());
+  
+  haafilter->SetInput(perBand->GetOutput());
 
   writer->SetFileName(outputFilename);
-  writer->SetInput(filter->GetOutput());
+  writer->SetInput(haafilter->GetOutput());
   writer->Update();
 
   return EXIT_SUCCESS;
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToCircularCovarianceMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToCircularCovarianceMatrixFunctor.cxx
index c883bde..030cc9b 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToCircularCovarianceMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToCircularCovarianceMatrixFunctor.cxx
@@ -31,14 +31,14 @@ int otbSinclairToCircularCovarianceMatrixFunctor(int itkNotUsed(argc), char * it
   OutputType outputFunct;
 
   result[0] = ComplexType( 32.,  0. );
-  result[1] = ComplexType(  0., 24. );
-  result[2] = ComplexType(  0., 16.);
-  result[3] = ComplexType( -8.,   0  );
+  result[1] = ComplexType(  24., 0. );
+  result[2] = ComplexType(  16., 0.);
+  result[3] = ComplexType( 8.,   0  );
   result[4] = ComplexType( 18.,   0. );
   result[5] = ComplexType( 12. ,  0. );
-  result[6] = ComplexType(  0. ,  6. );
+  result[6] = ComplexType(  6. ,  0. );
   result[7] = ComplexType(  8,    0. );
-  result[8] = ComplexType(  0,    4. );
+  result[8] = ComplexType(  4.,   0. );
   result[9] = ComplexType(  2,    0. );
 
   outputFunct = funct.operator ()( ComplexType(1., 4.), ComplexType(2., 3.), ComplexType(3., 2.), ComplexType(4., 1.) );
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx
index 18c8d48..af4666a 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx
@@ -31,11 +31,11 @@ int otbSinclairToReciprocalCircularCovarianceMatrixFunctor(int itkNotUsed(argc),
   OutputType outputFunct;
 
   result[0] = ComplexType( 25.,  0.);
-  result[1] = ComplexType(  1., 18.);
-  result[2] = ComplexType(-11.,  2.);
-  result[3] = ComplexType( 13.,  0.);
-  result[4] = ComplexType(  1.,  8.);
-  result[5] = ComplexType(  5.,  0.);
+  result[1] = ComplexType( 25.4558441227157,-1.4142135623731);
+  result[2] = ComplexType( 11.,  -2.);
+  result[3] = ComplexType( 26.,  0.);
+  result[4] = ComplexType( 11.3137084989848,-1.41421356237309);
+  result[5] = ComplexType( 5, .0);
 
   outputFunct = funct.operator ()( ComplexType(1., 4.), ComplexType(2., 3.), ComplexType(3., 2.) );
 
@@ -46,6 +46,7 @@ int otbSinclairToReciprocalCircularCovarianceMatrixFunctor(int itkNotUsed(argc),
       vcl_abs(result[4]-outputFunct[4]) > 1e-10 ||
       vcl_abs(result[5]-outputFunct[5]) > 1e-10   )
   {
+	  std::cout.precision(15);
     std::cout<<"Test gives :"<<std::endl;
     std::cout<<outputFunct<<std::endl;
     std::cout<<"Wanted results are :"<<std::endl;
diff --git a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx
index 36ee6b1..bdf3ce3 100644
--- a/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx
+++ b/Modules/Filtering/Polarimetry/test/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx
@@ -32,10 +32,10 @@ int otbSinclairToReciprocalCovarianceMatrixFunctor(int itkNotUsed(argc), char *
   OutputType outputFunct;
 
   result[0] = ComplexType(17.,  0.);
-  result[1] = ComplexType(14.,  5.);
+  result[1] = ComplexType(19.7989898732233,7.07106781186548);
   result[2] = ComplexType(11., 10.);
-  result[3] = ComplexType(13.,  0.);
-  result[4] = ComplexType(12.,  5.);
+  result[3] = ComplexType(26.,  0.);
+  result[4] = ComplexType(16.9705627484771,7.07106781186548);
   result[5] = ComplexType(13.,  0.);
 
   outputFunct = funct.operator ()( ComplexType(1., 4.), ComplexType(2., 3.), ComplexType(3., 2.) );
diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h
index 2b5c5a7..9442c16 100644
--- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h
+++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.h
@@ -264,6 +264,9 @@ public:
     m_Resampler->SetDisplacementFilterNumberOfThreads(nbThread);
   }
 
+  /** Override itk::ProcessObject method to let the internal filter do the propagation */
+  virtual void PropagateRequestedRegion(itk::DataObject *output);
+
 protected:
   GenericRSResampleImageFilter();
   /** Destructor */
@@ -273,8 +276,6 @@ protected:
 
   virtual void GenerateOutputInformation();
 
-  virtual void GenerateInputRequestedRegion();
-
   virtual void UpdateTransform();
 
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx
index 42eedb9..bd60be8 100644
--- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx
+++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx
@@ -67,7 +67,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage>
   progress->RegisterInternalFilter(m_Resampler, 1.f);
 
   m_Resampler->GraftOutput(this->GetOutput());
-  m_Resampler->Update();
+  m_Resampler->UpdateOutputData(m_Resampler->GetOutput());
   this->GraftOutput(m_Resampler->GetOutput());
 }
 
@@ -82,36 +82,35 @@ void
 GenericRSResampleImageFilter<TInputImage, TOutputImage>
 ::GenerateOutputInformation()
 {
-  // call the superclass's implementation of this method
-  Superclass::GenerateOutputInformation();
-
-  typename OutputImageType::Pointer outputPtr = this->GetOutput();
-
-  outputPtr->SetSpacing( this->GetOutputSpacing() );
-  outputPtr->SetOrigin( this->GetOutputOrigin() );
+  // Estimate the output rpc Model if needed
+  if (m_EstimateOutputRpcModel)
+    this->EstimateOutputRpcModel();
 
-  typename OutputImageType::RegionType region;
-  region.SetSize(this->GetOutputSize());
-  region.SetIndex(this->GetOutputStartIndex() );
+  // Estimate the input rpc model if it is needed
+  if (m_EstimateInputRpcModel && !m_RpcEstimationUpdated)
+    {
+    this->EstimateInputRpcModel();
+    }
 
-  outputPtr->SetLargestPossibleRegion(region);
+  // Instanciate the RS transform
+  this->UpdateTransform();
 
-  // Get the Output MetaData Dictionary
-  itk::MetaDataDictionary& dict = outputPtr->GetMetaDataDictionary();
+  m_Resampler->SetInput(this->GetInput());
+  m_Resampler->SetTransform(m_Transform);
+  m_Resampler->SetDisplacementFieldSpacing(this->GetDisplacementFieldSpacing());
+  m_Resampler->GraftOutput(this->GetOutput());
+  m_Resampler->UpdateOutputInformation();
+  this->GraftOutput(m_Resampler->GetOutput());
 
-  // Encapsulate the   metadata set by the user
+  // Encapsulate output projRef and keywordlist
+  itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
   itk::EncapsulateMetaData<std::string>(dict, MetaDataKey::ProjectionRefKey,
                                         this->GetOutputProjectionRef());
-
   if (this->GetOutputKeywordList().GetSize() > 0)
     {
     itk::EncapsulateMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey,
                                                this->GetOutputKeywordList());
     }
-
-  // Estimate the output rpc Model if needed
-  if (m_EstimateOutputRpcModel)
-    this->EstimateOutputRpcModel();
 }
 
 /**
@@ -122,13 +121,14 @@ void
 GenericRSResampleImageFilter<TInputImage, TOutputImage>
 ::EstimateOutputRpcModel()
 {
-  // Get the output dictionary
-  itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
-
   // Temp image : not allocated but with the same metadata than the
   // output
   typename OutputImageType::Pointer tempPtr = OutputImageType::New();
-  tempPtr->SetRegions(this->GetOutput()->GetLargestPossibleRegion());
+
+  typename OutputImageType::RegionType region;
+  region.SetSize(this->GetOutputSize());
+  region.SetIndex(this->GetOutputStartIndex() );
+  tempPtr->SetRegions(region);
 
   // Encapsulate the output metadata in the temp image
   itk::MetaDataDictionary& tempDict = tempPtr->GetMetaDataDictionary();
@@ -144,10 +144,6 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage>
   // Encapsulate the estimated rpc model in the output
   if (m_OutputRpcEstimator->GetOutput()->GetImageKeywordlist().GetSize() > 0)
     {
-    // Fill the output dict
-    itk::EncapsulateMetaData<ImageKeywordlist>(dict,
-                                               MetaDataKey::OSSIMKeywordlistKey,
-                                               m_OutputRpcEstimator->GetOutput()->GetImageKeywordlist());
     // Fill the transform with the right kwl
     m_Transform->SetInputKeywordList( m_OutputRpcEstimator->GetOutput()->GetImageKeywordlist());
     }
@@ -171,41 +167,17 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage>
   m_Transform->InstanciateTransform();
 }
 
- /**
-  * Generate Input requested region does only propagate the output
-  * requested region.
-  */
- template <class TInputImage, class TOutputImage>
- void
- GenericRSResampleImageFilter<TInputImage, TOutputImage>
- ::GenerateInputRequestedRegion()
- {
-   // Retrieve output pointer
-   OutputImageType * outputPtr = this->GetOutput();
-
-   // Retrieve input pointer
-   const InputImageType * inputPtr = this->GetInput();
-
-   // Retrieve output requested region
-   RegionType requestedRegion = outputPtr->GetRequestedRegion();
-
-   // Estimate the input rpc model if it is needed
-   if (m_EstimateInputRpcModel && !m_RpcEstimationUpdated)
-     {
-     this->EstimateInputRpcModel();
-     }
-
-   // Instanciate the RS transform
-   this->UpdateTransform();
-
-   // Generate input requested region
-   m_Resampler->SetInput(inputPtr);
-   m_Resampler->SetTransform(m_Transform);
-   m_Resampler->SetDisplacementFieldSpacing(this->GetDisplacementFieldSpacing());
-   m_Resampler->GetOutput()->UpdateOutputInformation();
-   m_Resampler->GetOutput()->SetRequestedRegion(requestedRegion);
-   m_Resampler->GetOutput()->PropagateRequestedRegion();
- }
+template <class TInputImage, class TOutputImage>
+void
+GenericRSResampleImageFilter<TInputImage, TOutputImage>
+::PropagateRequestedRegion(itk::DataObject *output)
+{
+  if (this->m_Updating) return;
+
+  // Retrieve output requested region
+  m_Resampler->GetOutput()->SetRequestedRegion(output);
+  m_Resampler->GetOutput()->PropagateRequestedRegion();
+}
 
 
  /**
diff --git a/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.txx b/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.txx
index d3e16f5..51bdfec 100644
--- a/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.txx
+++ b/Modules/Filtering/Projection/include/otbOrthoRectificationFilter.txx
@@ -67,6 +67,7 @@ OrthoRectificationFilter<TInputImage, TOutputImage, TMapProjection, TInterpolato
 
     // Fill the GenericRSTransform with those information
     this->SetOutputProjectionRef(projectionRef);
+    this->UpdateTransform();
     }
 }
 
diff --git a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h
index d022c8a..feaa3e6 100644
--- a/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h
+++ b/Modules/Filtering/Projection/include/otbProjectiveProjectionImageFilter.h
@@ -60,7 +60,7 @@ public:
     m_OutputSize = m_ProjectionDirection.Size();
   }
 
-  bool operator !=(const ProjectiveProjectionFunctor& other) const
+  bool operator !=(const ProjectiveProjectionFunctor& itkNotUsed(other)) const
   {
     return false;
   }
diff --git a/Modules/Filtering/Projection/include/otbROIdataConversion.h b/Modules/Filtering/Projection/include/otbROIdataConversion.h
index 247f61c..541eddb 100644
--- a/Modules/Filtering/Projection/include/otbROIdataConversion.h
+++ b/Modules/Filtering/Projection/include/otbROIdataConversion.h
@@ -9,8 +9,6 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) GET / ENST Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Projection/include/otbROIdataConversion.txx b/Modules/Filtering/Projection/include/otbROIdataConversion.txx
index 142bb6f..b8513a0 100644
--- a/Modules/Filtering/Projection/include/otbROIdataConversion.txx
+++ b/Modules/Filtering/Projection/include/otbROIdataConversion.txx
@@ -9,8 +9,6 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) GET / ENST Bretagne. All rights reserved.
-  See GETCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx
index 0f88a55..839b978 100644
--- a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx
+++ b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx
@@ -19,7 +19,7 @@
 #define __otbVectorDataIntoImageProjectionFilter_txx
 
 #include "otbVectorDataIntoImageProjectionFilter.h"
-#include "boost/algorithm/string.hpp"
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Filtering/Projection/otb-module.cmake b/Modules/Filtering/Projection/otb-module.cmake
index 723a642..9d6f9b5 100644
--- a/Modules/Filtering/Projection/otb-module.cmake
+++ b/Modules/Filtering/Projection/otb-module.cmake
@@ -7,7 +7,7 @@ solvers, re-project input vector data over input images, and so on.")
 
 otb_module(OTBProjection
   DEPENDS
-    OTBBoost
+    OTBBoostAdapters
     OTBCommon
     OTBGDAL
     OTBGdalAdapters
diff --git a/Modules/Filtering/Projection/src/otbGeometriesProjectionFilter.cxx b/Modules/Filtering/Projection/src/otbGeometriesProjectionFilter.cxx
index 7d73f31..24c477c 100644
--- a/Modules/Filtering/Projection/src/otbGeometriesProjectionFilter.cxx
+++ b/Modules/Filtering/Projection/src/otbGeometriesProjectionFilter.cxx
@@ -32,14 +32,6 @@
 
 
 /*===========================================================================*/
-/*===============================[ constants ]===============================*/
-/*===========================================================================*/
-namespace
-{ // Anonymous namespace
-const double k_averageElevation = -32768.0;
-} // Anonymous namespace
-
-/*===========================================================================*/
 /*======================[ Reprojection Transformation ]======================*/
 /*===========================================================================*/
 
diff --git a/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx b/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx
index b0c7f1b..223b841 100644
--- a/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx
+++ b/Modules/Filtering/Projection/test/otbGCPsToRPCSensorModelImageFilterAndOrtho.cxx
@@ -116,6 +116,7 @@ int otbGCPsToRPCSensorModelImageFilterAndOrtho(int argc, char* argv[])
   orthoRectifFilter->SetMapProjection(utmMapProjection);
 
   ImageType::PixelType no_data(reader->GetOutput()->GetNumberOfComponentsPerPixel());
+  no_data.Fill(0.0);
   orthoRectifFilter->SetEdgePaddingValue(no_data);
 
   // Displacement Field spacing
diff --git a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx
index 88c61d5..55d75bb 100644
--- a/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx
+++ b/Modules/Filtering/Smoothing/include/otbMeanShiftSmoothingImageFilter.txx
@@ -375,7 +375,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
   neighborhoodRegion.SetSize(regionSize);
 
   RealType weightSum = 0;
-  RealVector jointNeighbor(ImageDimension + m_NumberOfComponentsPerPixel), shifts(ImageDimension + m_NumberOfComponentsPerPixel);
+  RealVector shifts(jointDimension);
 
   // An iterator on the neighborhood of the current pixel (in joint
   // spatial-range domain)
@@ -385,7 +385,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
   it.GoToBegin();
   while (!it.IsAtEnd())
     {
-    jointNeighbor = it.Get();
+    const RealType *jointNeighbor = it.GetPixelPointer();
 
     // Compute the squared norm of the difference
     // This is the L2 norm, TODO: replace by the templated norm
@@ -393,7 +393,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
     for (unsigned int comp = 0; comp < jointDimension; comp++)
       {
       shifts[comp] = jointNeighbor[comp] - jointPixel[comp];
-      double d = shifts[comp]/bandwidth[comp];
+      double d = shifts[comp] / bandwidth[comp];
       norm2 += d*d;
       }
 
@@ -554,7 +554,7 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
   typename OutputImageType::PixelType rangePixel(m_NumberOfComponentsPerPixel);
   typename OutputSpatialImageType::PixelType spatialPixel(ImageDimension);
 
-  RealVector jointPixel;
+  RealVector jointPixel(jointDimension);
 
   RealVector bandwidth(jointDimension);
   for (unsigned int comp = 0; comp < ImageDimension; comp++)
@@ -612,7 +612,9 @@ void MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIt
 
     // get input pixel in the joint spatial-range domain (with components
     // normalized by bandwith)
-    jointPixel = jointIt.Get(); // Pixel in the joint spatial-range domain
+    const RealVector &jointPixelVal = jointIt.Get(); // Pixel in the joint spatial-range domain
+    for (unsigned int comp = 0; comp < jointDimension; comp++)
+      jointPixel[comp] = jointPixelVal[comp];
 
     for (unsigned int comp = ImageDimension; comp < jointDimension; comp++)
       bandwidth[comp] = m_RangeBandwidthRamp*jointPixel[comp]+m_RangeBandwidth;
diff --git a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h
index 9a2923f..e5b3888 100644
--- a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h
+++ b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.h
@@ -195,7 +195,8 @@ protected:
   NormalizeVectorImageFilter ();
   virtual ~NormalizeVectorImageFilter() { }
 
-  void BeforeThreadedGenerateData();
+  void GenerateOutputInformation();
+
 
 private:
   NormalizeVectorImageFilter ( const Self & );
diff --git a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.txx b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.txx
index ba39563..9d578bf 100644
--- a/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.txx
+++ b/Modules/Filtering/Statistics/include/otbNormalizeVectorImageFilter.txx
@@ -35,12 +35,22 @@ NormalizeVectorImageFilter< TInputImage, TOutputImage >
   m_CovarianceEstimator = CovarianceEstimatorFilterType::New();
 }
 
+
 template < class TInputImage, class TOutputImage >
 void
 NormalizeVectorImageFilter< TInputImage, TOutputImage >
-::BeforeThreadedGenerateData ()
+::GenerateOutputInformation()
 {
-  if ( !m_UseMean )
+  // Call superclass implementation
+  Superclass::GenerateOutputInformation();
+
+  if( (m_UseMean && !m_IsGivenMean) || (m_UseStdDev && !m_IsGivenStdDev))
+    {
+    m_CovarianceEstimator->SetInput( const_cast<InputImageType*>( this->GetInput() ) );
+    m_CovarianceEstimator->Update();
+    }
+
+    if ( !m_UseMean )
   {
     typename TInputImage::PixelType vector ( this->GetInput()->GetNumberOfComponentsPerPixel() );
     vector.Fill( itk::NumericTraits< typename TInputImage::PixelType::ValueType >::Zero );
@@ -56,9 +66,6 @@ NormalizeVectorImageFilter< TInputImage, TOutputImage >
 
   if ( !m_IsGivenMean )
   {
-    m_CovarianceEstimator->SetInput( const_cast<InputImageType*>( this->GetInput() ) );
-    m_CovarianceEstimator->Update();
-
     this->GetFunctor().SetMean( m_CovarianceEstimator->GetMean() );
 
     if ( !m_IsGivenStdDev && m_UseStdDev )
@@ -71,6 +78,7 @@ NormalizeVectorImageFilter< TInputImage, TOutputImage >
       this->GetFunctor().SetStdDev( sigma );
     }
   }
+
 }
 
 } // end of namespace otb
diff --git a/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h b/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h
index 8644947..2a5b07a 100644
--- a/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h
+++ b/Modules/Filtering/Statistics/include/otbShiftScaleSampleListFilter.h
@@ -31,6 +31,9 @@ namespace Statistics {
  *
  *  \f[ output = \frac{input - shift}{scale} \f]
  *
+ *  Beware that the behaviour differs from itk::ShiftScaleImageFilter
+ *  (which add shift instead of subtracting it).
+ *
  * Standard casting is applied between input and output type.
  *
  * Shifts and scales can be set via the SetShift() and SetScales() methods.
diff --git a/Modules/Filtering/Statistics/test/CMakeLists.txt b/Modules/Filtering/Statistics/test/CMakeLists.txt
index be612f3..18d97b6 100644
--- a/Modules/Filtering/Statistics/test/CMakeLists.txt
+++ b/Modules/Filtering/Statistics/test/CMakeLists.txt
@@ -74,6 +74,10 @@ otb_add_test(NAME bfTuStreamingHistogramVIFilterNew COMMAND otbStatisticsTestDri
   otbStreamingHistogramVectorImageFilterNew
   )
 
+otb_add_test(NAME bfTvStreamingHistogramVIFilterTest COMMAND otbStatisticsTestDriver
+  otbStreamingHistogramVectorImageFilterTest
+  )
+
 otb_add_test(NAME bfTuStreamingStatisticsVectorImageFilterNew COMMAND otbStatisticsTestDriver
   otbStreamingStatisticsVectorImageFilterNew)
 
diff --git a/Modules/Filtering/Statistics/test/otbStatisticsTestDriver.cxx b/Modules/Filtering/Statistics/test/otbStatisticsTestDriver.cxx
index e9d2185..cc7f85a 100644
--- a/Modules/Filtering/Statistics/test/otbStatisticsTestDriver.cxx
+++ b/Modules/Filtering/Statistics/test/otbStatisticsTestDriver.cxx
@@ -8,6 +8,7 @@ void RegisterTests()
   REGISTER_TEST(otbStreamingStatisticsImageFilterNew);
   REGISTER_TEST(otbListSampleToVariableDimensionHistogramGeneratorNew);
   REGISTER_TEST(otbStreamingHistogramVectorImageFilterNew);
+  REGISTER_TEST(otbStreamingHistogramVectorImageFilterTest);
   REGISTER_TEST(otbStreamingStatisticsVectorImageFilterNew);
   REGISTER_TEST(otbRealImageToComplexImageFilterTest);
   REGISTER_TEST(otbHistogramStatisticsFunction);
diff --git a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx b/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
index 45620f8..da051ca 100644
--- a/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
+++ b/Modules/Filtering/Statistics/test/otbStreamingHistogramVectorImageFilter.cxx
@@ -18,10 +18,16 @@
 
 #include "otbStreamingHistogramVectorImageFilter.h"
 #include "otbVectorImage.h"
+#include "itkImageRegionIteratorWithIndex.h"
+#include "otbObjectList.h"
+#include "itkHistogram.h"
 
 typedef otb::VectorImage<unsigned char>               VectorImageType;
 typedef otb::StreamingHistogramVectorImageFilter<VectorImageType>                SHVIFType;
-
+typedef itk::NumericTraits< VectorImageType::InternalPixelType >::RealType RealType;
+typedef RealType MeasurementType;
+typedef itk::Statistics::Histogram< MeasurementType > Histogram;
+typedef otb::ObjectList< Histogram > HistogramList;
 
 
 int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
@@ -33,3 +39,108 @@ int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNo
 
   return EXIT_SUCCESS;
 }
+
+int otbStreamingHistogramVectorImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv) [])
+{
+// Allocate input image
+  const unsigned int nbComp = 2;
+  VectorImageType::SizeType size;
+  size.Fill(4);
+  VectorImageType::IndexType idx;
+  idx.Fill(0);
+  VectorImageType::RegionType region;
+  region.SetSize(size);
+  region.SetIndex(idx);
+
+  VectorImageType::Pointer image = VectorImageType::New();
+
+  image->SetRegions(region);
+  image->SetNumberOfComponentsPerPixel(nbComp);
+  image->Allocate();
+
+  typedef itk::ImageRegionIteratorWithIndex<VectorImageType> IteratorType;
+  IteratorType it(image, region);
+
+  it.GoToBegin();
+
+  VectorImageType::PixelType pixel(nbComp);
+  VectorImageType::IndexType index;
+
+  while( !it.IsAtEnd() )
+    {
+    index = it.GetIndex();
+    pixel[0]=index[0];
+    pixel[1]=index[1];
+
+    it.Set(pixel);
+    ++it;
+    }
+//Histogram computation
+  SHVIFType::Pointer SHVIFFilter = SHVIFType::New();
+
+  SHVIFFilter->GetFilter()->SetInput(image);
+  SHVIFType::FilterType::CountVectorType bins( nbComp );
+  bins[0]=2;
+  bins[1]=2;
+  SHVIFFilter->GetFilter()->SetNumberOfBins( bins );
+
+  VectorImageType::PixelType pixelMin(nbComp);
+  pixelMin[0]=0;
+  pixelMin[1]=0;
+  VectorImageType::PixelType pixelMax(nbComp);
+  pixelMax[0]=3;
+  pixelMax[1]=3;
+
+  SHVIFFilter->GetFilter()->SetHistogramMin( pixelMin );
+  SHVIFFilter->GetFilter()->SetHistogramMax( pixelMax );
+
+  SHVIFFilter->Update();
+
+  HistogramList::Pointer histograms = SHVIFFilter->GetHistogramList();
+
+  std::cout << "Histogram list size " << histograms->Size() << std::endl;
+  unsigned int channel = 0;  // first channel
+  Histogram::Pointer histogram( histograms->GetNthElement( channel ) );
+
+  unsigned int histogramSize = histogram->Size();
+
+  std::cout << "Histogram size " << histogramSize << std::endl;
+
+  
+
+  std::cout << "Histogram of the first component" << std::endl;
+
+ // We expect to have 2 bins, each with a frequency of 8.
+  const unsigned int expectedFrequency = 8;
+
+  for( unsigned int bin=0; bin < histogramSize; bin++ )
+    {
+    if( histogram->GetFrequency( bin, channel ) != expectedFrequency )
+      {
+      std::cerr << "Error in bin= " << bin << " channel = " << channel << std::endl;
+      std::cerr << "Frequency was= " <<  histogram->GetFrequency( bin, channel ) << " Instead of the expected " << expectedFrequency << std::endl;
+      return EXIT_FAILURE;
+      }
+    }
+
+  channel = 1;
+  histogram = histograms->GetNthElement( channel ) ;
+
+  histogramSize = histogram->Size();
+
+  std::cout << "Histogram size " << histogramSize << std::endl;
+
+  std::cout << "Histogram of the second component" << std::endl;
+
+  for( unsigned int bin=0; bin < histogramSize; bin++ )
+    {
+    if( histogram->GetFrequency( bin, 0 ) != expectedFrequency )
+      {
+      std::cerr << "Error in bin= " << bin << " channel = " << channel << std::endl;
+      std::cerr << "Frequency was= " <<  histogram->GetFrequency( bin, 0 ) << " Instead of the expected " << expectedFrequency << std::endl;
+      return EXIT_FAILURE;
+      }
+    }
+  //FIXME: whe should test also here the support of no data value
+  return EXIT_SUCCESS;
+}
diff --git a/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h b/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h
index b903287..9ac69af 100644
--- a/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h
+++ b/Modules/Filtering/VectorDataRendering/include/otbMapnikAdapter.h
@@ -19,6 +19,10 @@
 #ifndef __otbMapnikAdapter_h
 #define __otbMapnikAdapter_h
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include <mapnik/datasource_cache.hpp>
 #include <mapnik/font_engine_freetype.hpp>
 #include <mapnik/agg_renderer.hpp>
@@ -30,6 +34,20 @@
 #include <mapnik/layer.hpp>
 #include <mapnik/map.hpp>
 #include <mapnik/value.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <mapnik/datasource_cache.hpp>
+#include <mapnik/font_engine_freetype.hpp>
+#include <mapnik/agg_renderer.hpp>
+#include <mapnik/filter_factory.hpp>
+#include <mapnik/color_factory.hpp>
+#include <mapnik/image_util.hpp>
+#include <mapnik/config_error.hpp>
+#include <mapnik/memory_datasource.hpp>
+#include <mapnik/layer.hpp>
+#include <mapnik/map.hpp>
+#include <mapnik/value.hpp>
+#endif
 
 #ifdef OTB_MAPNIK_COMPATIBILITY_API07
 namespace mapnik {
diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h
index c9bf649..c4c63e3 100644
--- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h
+++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataStyle.h
@@ -21,7 +21,16 @@
 
 #include "itkLightObject.h"
 #include "itkObjectFactory.h"
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#include <mapnik/map.hpp>
+#pragma GCC diagnostic pop
+#else
 #include <mapnik/map.hpp>
+#endif
 
 namespace otb
 {
diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h
index f0e5503..86777f9 100644
--- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h
+++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h
@@ -23,8 +23,18 @@
 #include "otbRGBAPixelConverter.h"
 #include "otbVectorDataExtractROI.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include <mapnik/memory_datasource.hpp>
 #include <mapnik/map.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <mapnik/memory_datasource.hpp>
+#include <mapnik/map.hpp>
+#endif
+
 
 namespace otb
 {
diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h
index b6cc09f..a965bab 100644
--- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h
+++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h
@@ -23,8 +23,18 @@
 #include "otbRGBAPixelConverter.h"
 #include "otbVectorDataExtractROI.h"
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include <mapnik/memory_datasource.hpp>
 #include <mapnik/map.hpp>
+#pragma GCC diagnostic pop
+#else
+#include <mapnik/memory_datasource.hpp>
+#include <mapnik/map.hpp>
+#endif
+
 
 namespace otb
 {
diff --git a/Modules/Filtering/VectorDataRendering/src/CMakeLists.txt b/Modules/Filtering/VectorDataRendering/src/CMakeLists.txt
index 010fadb..e840764 100644
--- a/Modules/Filtering/VectorDataRendering/src/CMakeLists.txt
+++ b/Modules/Filtering/VectorDataRendering/src/CMakeLists.txt
@@ -2,8 +2,12 @@ set(OTBVectorDataRendering_SRC
   otbVectorDataStyle.cxx
   )
 
+if(CMAKE_COMPILER_IS_GNUCXX)
+  set_source_files_properties( ${CMAKE_CURRENT_SOURCE_DIR}/otbVectorDataStyle.cxx COMPILE_FLAGS "-fno-var-tracking")
+endif()
+
 add_library(OTBVectorDataRendering ${OTBVectorDataRendering_SRC})
-target_link_libraries(OTBVectorDataRendering 
+target_link_libraries(OTBVectorDataRendering
   ${OTBMapnik_LIBRARIES}
   ${OTBVectorDataBase_LIBRARIES}
 
diff --git a/Modules/Filtering/VectorDataRendering/src/otbVectorDataStyle.cxx b/Modules/Filtering/VectorDataRendering/src/otbVectorDataStyle.cxx
index e95ac02..acd24b5 100644
--- a/Modules/Filtering/VectorDataRendering/src/otbVectorDataStyle.cxx
+++ b/Modules/Filtering/VectorDataRendering/src/otbVectorDataStyle.cxx
@@ -17,12 +17,27 @@
 =========================================================================*/
 
 #include "otbVectorDataStyle.h"
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
 #include <mapnik/filter_factory.hpp>
 #include <mapnik/rule.hpp>
 #include <mapnik/text_symbolizer.hpp>
 #ifndef OTB_MAPNIK_COMPATIBILITY_API07
 #include <mapnik/feature_type_style.hpp>
 #endif
+#pragma GCC diagnostic pop
+#else
+#include <mapnik/filter_factory.hpp>
+#include <mapnik/rule.hpp>
+#include <mapnik/text_symbolizer.hpp>
+#ifndef OTB_MAPNIK_COMPATIBILITY_API07
+#include <mapnik/feature_type_style.hpp>
+#endif
+#endif
+
+
 
 namespace otb
 {
diff --git a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h
index 0e900de..92ac961 100644
--- a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h
+++ b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.txx b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.txx
index 2474aca..0375f39 100644
--- a/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.txx
+++ b/Modules/Filtering/Wavelet/include/otbSubsampleImageFilter.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h
index 68b477b..c219f71 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx
index 35ff142..21ba8cd 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx
+++ b/Modules/Filtering/Wavelet/include/otbWaveletFilterBank.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h b/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h
index ae8a87b..68be4ad 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletGenerator.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h b/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h
index 1f51a4d..f680eea 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletHighPassOperator.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h b/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h
index 0742709..2b612a2 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletLowPassOperator.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletOperator.h b/Modules/Filtering/Wavelet/include/otbWaveletOperator.h
index c512f90..a6d9394 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletOperator.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletOperator.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h
index c3598d3..d17c1df 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.txx b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.txx
index 2270f23..8b76a31 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.txx
+++ b/Modules/Filtering/Wavelet/include/otbWaveletOperatorBase.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h b/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h
index c07570b..e87374c 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletPacketDecompositionCosts.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h
index 76449b9..24e4028 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.txx b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.txx
index dea2820..2d0e628 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.txx
+++ b/Modules/Filtering/Wavelet/include/otbWaveletPacketTransform.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletTransform.h b/Modules/Filtering/Wavelet/include/otbWaveletTransform.h
index 1c16dff..c80ea80 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletTransform.h
+++ b/Modules/Filtering/Wavelet/include/otbWaveletTransform.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/include/otbWaveletTransform.txx b/Modules/Filtering/Wavelet/include/otbWaveletTransform.txx
index fcccb78..93eac94 100644
--- a/Modules/Filtering/Wavelet/include/otbWaveletTransform.txx
+++ b/Modules/Filtering/Wavelet/include/otbWaveletTransform.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx b/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx
index 04b4ee1..a70046a 100644
--- a/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx
+++ b/Modules/Filtering/Wavelet/src/otbWaveletGenerator.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
@@ -45,7 +45,7 @@ WaveletGenerator<TMotherWaveletOperator>
 template <Wavelet::Wavelet TMotherWaveletOperator>
 void
 WaveletGenerator<TMotherWaveletOperator>
-::GetLowPassCoefficientVector(CoefficientVector& coeff) const
+::GetLowPassCoefficientVector(CoefficientVector& itkNotUsed(coeff)) const
 {
   std::ostringstream msg;
   msg << "The mother wavelet ID " << TMotherWaveletOperator;
@@ -56,7 +56,7 @@ WaveletGenerator<TMotherWaveletOperator>
 template <Wavelet::Wavelet TMotherWaveletOperator>
 void
 WaveletGenerator<TMotherWaveletOperator>
-::GetHighPassCoefficientVector(CoefficientVector& coeff) const
+::GetHighPassCoefficientVector(CoefficientVector& itkNotUsed(coeff)) const
 {
   std::ostringstream msg;
   msg << "The mother wavelet ID " << TMotherWaveletOperator;
diff --git a/Modules/Filtering/Wavelet/test/otbSubsampleImageFilter.cxx b/Modules/Filtering/Wavelet/test/otbSubsampleImageFilter.cxx
index a5f08b7..10721ee 100644
--- a/Modules/Filtering/Wavelet/test/otbSubsampleImageFilter.cxx
+++ b/Modules/Filtering/Wavelet/test/otbSubsampleImageFilter.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/test/otbSubsampleImageFilterNew.cxx b/Modules/Filtering/Wavelet/test/otbSubsampleImageFilterNew.cxx
index e3ccf38..538cdfe 100644
--- a/Modules/Filtering/Wavelet/test/otbSubsampleImageFilterNew.cxx
+++ b/Modules/Filtering/Wavelet/test/otbSubsampleImageFilterNew.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/test/otbWaveletFilterBank.cxx b/Modules/Filtering/Wavelet/test/otbWaveletFilterBank.cxx
index b90dfbd..3878fb7 100644
--- a/Modules/Filtering/Wavelet/test/otbWaveletFilterBank.cxx
+++ b/Modules/Filtering/Wavelet/test/otbWaveletFilterBank.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/test/otbWaveletInverseTransformNew.cxx b/Modules/Filtering/Wavelet/test/otbWaveletInverseTransformNew.cxx
index 34ecd15..ff27846 100644
--- a/Modules/Filtering/Wavelet/test/otbWaveletInverseTransformNew.cxx
+++ b/Modules/Filtering/Wavelet/test/otbWaveletInverseTransformNew.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/test/otbWaveletOperator.cxx b/Modules/Filtering/Wavelet/test/otbWaveletOperator.cxx
index 9b2baa4..a1c2150 100644
--- a/Modules/Filtering/Wavelet/test/otbWaveletOperator.cxx
+++ b/Modules/Filtering/Wavelet/test/otbWaveletOperator.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/test/otbWaveletOperatorNew.cxx b/Modules/Filtering/Wavelet/test/otbWaveletOperatorNew.cxx
index 866104b..712a7a8 100644
--- a/Modules/Filtering/Wavelet/test/otbWaveletOperatorNew.cxx
+++ b/Modules/Filtering/Wavelet/test/otbWaveletOperatorNew.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/test/otbWaveletPacketInverseTransformNew.cxx b/Modules/Filtering/Wavelet/test/otbWaveletPacketInverseTransformNew.cxx
index 8735db6..b89cc7d 100644
--- a/Modules/Filtering/Wavelet/test/otbWaveletPacketInverseTransformNew.cxx
+++ b/Modules/Filtering/Wavelet/test/otbWaveletPacketInverseTransformNew.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/test/otbWaveletPacketTransform.cxx b/Modules/Filtering/Wavelet/test/otbWaveletPacketTransform.cxx
index 5726576..b7e6d00 100644
--- a/Modules/Filtering/Wavelet/test/otbWaveletPacketTransform.cxx
+++ b/Modules/Filtering/Wavelet/test/otbWaveletPacketTransform.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Filtering/Wavelet/test/otbWaveletTransform.cxx b/Modules/Filtering/Wavelet/test/otbWaveletTransform.cxx
index 053f5fe..4774374 100644
--- a/Modules/Filtering/Wavelet/test/otbWaveletTransform.cxx
+++ b/Modules/Filtering/Wavelet/test/otbWaveletTransform.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h
index 39d04f6..ce25b90 100644
--- a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h
+++ b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h
@@ -164,6 +164,7 @@ protected:
                      const KernelIteratorType kernelBegin,
                      const KernelIteratorType kernelEnd);
 
+  virtual void GenerateOutputInformation();
 
 private:
   NeighborhoodMajorityVotingImageFilter(const Self&); //purposely not implemented
diff --git a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx
index 2889cf1..93c05d6 100644
--- a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx
+++ b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx
@@ -23,6 +23,9 @@
 // gets integrated into the main directories.
 
 #include "otbNeighborhoodMajorityVotingImageFilter.h"
+#include "itkDefaultConvertPixelTraits.h"
+#include "itkMetaDataObject.h"
+#include "otbMetaDataKey.h"
 
 namespace otb
 {
@@ -118,6 +121,30 @@ const KernelIteratorType kernelEnd)
   return majorityLabel;
 }
 
+template<class TInputImage, class TOutputImage, class TKernel>
+void
+NeighborhoodMajorityVotingImageFilter<TInputImage, TOutputImage, TKernel>
+::GenerateOutputInformation()
+{
+  Superclass::GenerateOutputInformation();
+
+  TOutputImage* outputPtr = this->GetOutput();
+
+  // Set the NoData value using the background
+  const unsigned int & nbBands =  outputPtr->GetNumberOfComponentsPerPixel();
+  std::vector<bool> noDataValueAvailable;
+  noDataValueAvailable.resize(nbBands,true);
+  std::vector<double> noDataValue;
+  noDataValue.resize(nbBands,0.0);
+  for (unsigned int i=0 ; i<nbBands ; ++i)
+    {
+    noDataValue[i] = itk::DefaultConvertPixelTraits<PixelType>::GetNthComponent(i,m_LabelForNoDataPixels);
+    }
+  itk::MetaDataDictionary& dict = outputPtr->GetMetaDataDictionary();
+  itk::EncapsulateMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+  itk::EncapsulateMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValue);
+}
+
 } // end namespace otb
 
 #endif
diff --git a/Modules/Fusion/MajorityVoting/otb-module.cmake b/Modules/Fusion/MajorityVoting/otb-module.cmake
index bc585bf..8643c50 100644
--- a/Modules/Fusion/MajorityVoting/otb-module.cmake
+++ b/Modules/Fusion/MajorityVoting/otb-module.cmake
@@ -5,6 +5,7 @@ this label value (see also DempsterShafer module).")
 otb_module(OTBMajorityVoting
   DEPENDS
     OTBITK
+    OTBOSSIMAdapters
 
   TEST_DEPENDS
     OTBTestKernel
diff --git a/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.txx b/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.txx
index c0a4e0b..0a2cc11 100644
--- a/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.txx
+++ b/Modules/Fusion/PanSharpening/include/otbBayesianFusionFilter.txx
@@ -227,7 +227,7 @@ BayesianFusionFilter<TInputMultiSpectralImage,
    *  To modify using - method operator. If we use it now -> exceptionmacro (no GetClassName...)
    * S = S-xxTbTb;
    **/
-  if ((S.Cols() != xxTbTb.Cols()) || (S.Cols() != xxTbTb.Cols()))
+  if ((S.Rows() != xxTbTb.Rows()) || (S.Cols() != xxTbTb.Cols()))
     {
     itkExceptionMacro(<< "Matrix with size (" << S.Rows() << "," <<
                       S.Cols() << ") cannot be subtracted from matrix with size (" <<
@@ -281,8 +281,8 @@ BayesianFusionFilter<TInputMultiSpectralImage,
    *  To modify using + method operator. If we use it now -> exceptionmacro (no GetClassName...)
    *  m_Vcondopt = 2 *m_Lambda*varPan+2*m_CovarianceInvMatrix*(1-m_Lambda)+eye;
    **/
-  if ((m_Vcondopt.Cols() != varPan.Cols()) || (m_Vcondopt.Cols() != varPan.Cols())
-      || (m_Vcondopt.Cols() != m_CovarianceInvMatrix.Cols()) || (m_Vcondopt.Cols() != m_CovarianceInvMatrix.Cols()))
+  if ((m_Vcondopt.Rows() != varPan.Rows()) || (m_Vcondopt.Cols() != varPan.Cols())
+      || (m_Vcondopt.Rows() != m_CovarianceInvMatrix.Rows()) || (m_Vcondopt.Cols() != m_CovarianceInvMatrix.Cols()))
     {
     itkExceptionMacro(<< "Matrix with size (" << m_Vcondopt.Rows() << "," <<
                       m_Vcondopt.Cols() << ") cannot be subtracted from matrix with size (" <<
diff --git a/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.txx b/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.txx
index 049b084..c9892f0 100644
--- a/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.txx
+++ b/Modules/Hyperspectral/EndmembersExtraction/include/otbVirtualDimensionality.txx
@@ -24,7 +24,7 @@ for details.
 #include "otbVirtualDimensionality.h"
 
 #include <vcl_algorithm.h>
-#include <boost/math/distributions/normal.hpp>
+#include "otb_boost_math_normal_header.h"
 
 namespace otb
 {
diff --git a/Modules/Hyperspectral/EndmembersExtraction/otb-module.cmake b/Modules/Hyperspectral/EndmembersExtraction/otb-module.cmake
index f11c3c1..4888db3 100644
--- a/Modules/Hyperspectral/EndmembersExtraction/otb-module.cmake
+++ b/Modules/Hyperspectral/EndmembersExtraction/otb-module.cmake
@@ -9,7 +9,7 @@ otb_module(OTBEndmembersExtraction
     OTBDimensionalityReduction
     OTBImageManipulation
     OTBProjection
-    OTBBoost
+    OTBBoostAdapters
     OTBCommon
 
   TEST_DEPENDS
diff --git a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx
index 4b1bb48..a8e71af 100644
--- a/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx
+++ b/Modules/Hyperspectral/Unmixing/include/otbISRAUnmixingImageFilter.txx
@@ -52,7 +52,7 @@ ISRAUnmixingFunctor<TInput, TOutput, TPrecision>
 template <class TInput, class TOutput, class TPrecision>
 bool
 ISRAUnmixingFunctor<TInput, TOutput, TPrecision>
-::operator != (const Self& other) const
+::operator != (const Self& itkNotUsed(other)) const
 {
   return true;
 }
@@ -60,7 +60,7 @@ ISRAUnmixingFunctor<TInput, TOutput, TPrecision>
 template <class TInput, class TOutput, class TPrecision>
 bool
 ISRAUnmixingFunctor<TInput, TOutput, TPrecision>
-::operator == (const Self& other) const
+::operator == (const Self& itkNotUsed(other)) const
 {
   return false;
 }
diff --git a/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.txx
index 32172e5..2a2a030 100644
--- a/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.txx
+++ b/Modules/Hyperspectral/Unmixing/include/otbMDMDNMFImageFilter.txx
@@ -193,13 +193,13 @@ MDMDNMFImageFilter<TInputImage, TOutputImage>
   //    = (A*S-X) * (transpose(S)) + m_LambdD*(A-1/nbBands*ones(L, L)*A)
   //    = (A*S-X) * (transpose(S)) + m_LambdD*A- m_LambdD*/nbBands*ones(L, L)*A)
 
-  MatrixType onesA;
   VectorType sumColulmnsOfA;
   sumColulmnsOfA.set_size(A.cols());
   unsigned int nbBands = A.rows();
 
-  // Computing vector onesA
-  for (unsigned int j=0; j<onesA.size(); ++j)
+  // Computing ones*A : all rows are the same,
+  // (ones*A)[i,j] = sum(k=0 to nbBands, A[k,j])
+  for (unsigned int j=0; j<A.cols(); ++j)
     {
     sumColulmnsOfA(j) = A.get_column(j).sum();
     }
diff --git a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx
index 719e338..7c7a201 100644
--- a/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx
+++ b/Modules/Hyperspectral/Unmixing/include/otbNCLSUnmixingImageFilter.txx
@@ -52,7 +52,7 @@ NCLSUnmixingFunctor<TInput, TOutput, TPrecision>
 template <class TInput, class TOutput, class TPrecision>
 bool
 NCLSUnmixingFunctor<TInput, TOutput, TPrecision>
-::operator != (const Self& other) const
+::operator != (const Self& itkNotUsed(other)) const
 {
   return true;
 }
@@ -60,7 +60,7 @@ NCLSUnmixingFunctor<TInput, TOutput, TPrecision>
 template <class TInput, class TOutput, class TPrecision>
 bool
 NCLSUnmixingFunctor<TInput, TOutput, TPrecision>
-::operator == (const Self& other) const
+::operator == (const Self& itkNotUsed(other)) const
 {
   return false;
 }
diff --git a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h
index 74c678e..4a869df 100644
--- a/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h
+++ b/Modules/Hyperspectral/Unmixing/include/otbUnConstrainedLeastSquareImageFilter.h
@@ -54,7 +54,7 @@ public:
     return m_OutputSize;
   }
 
-  bool operator != (const UnConstrainedLeastSquareFunctor& other) const
+  bool operator != (const UnConstrainedLeastSquareFunctor& itkNotUsed(other)) const
   {
     return true;
   }
diff --git a/Modules/IO/ExtendedFilename/otb-module.cmake b/Modules/IO/ExtendedFilename/otb-module.cmake
index f9d5aad..61cda21 100644
--- a/Modules/IO/ExtendedFilename/otb-module.cmake
+++ b/Modules/IO/ExtendedFilename/otb-module.cmake
@@ -7,7 +7,7 @@ product by skipping either geographic or sensor-model information.")
 otb_module(OTBExtendedFilename
   DEPENDS
     OTBIOGDAL
-    OTBBoost
+    OTBBoostAdapters
     OTBITK
 
   TEST_DEPENDS
diff --git a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx b/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx
index eb08b5e..49cd5f4 100644
--- a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx
+++ b/Modules/IO/ExtendedFilename/src/otbExtendedFilenameHelper.cxx
@@ -16,8 +16,7 @@
 
 =========================================================================*/
 #include "otbExtendedFilenameHelper.h"
-#include <boost/algorithm/string.hpp>
-
+#include "otb_boost_string_header.h"
 namespace otb
 {
 
@@ -30,6 +29,7 @@ ExtendedFilenameHelper
     itkGenericExceptionMacro( << "Filename is NULL" );
   }
   this->m_ExtendedFileName = extFname;
+  this->m_OptionMap.clear();
   std::vector<std::string> tmp1;
   std::vector<std::string> tmp2;
   if (!m_ExtendedFileName.empty())
@@ -57,7 +57,7 @@ ExtendedFilenameHelper
 								itkWarningMacro("Duplicated option detected: " << tmp[0] << ". Using value " << tmp[1] << ".");
 							}
 					  }
-				  else 
+				  else
 					itkGenericExceptionMacro( << "Value for option '" << tmp[0] << "' is not set.");
 				}
         }
@@ -74,4 +74,3 @@ ExtendedFilenameHelper
 }
 
 } // end namespace otb
-
diff --git a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameToReaderOptions.cxx b/Modules/IO/ExtendedFilename/src/otbExtendedFilenameToReaderOptions.cxx
index 9b71a02..aa744ee 100644
--- a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameToReaderOptions.cxx
+++ b/Modules/IO/ExtendedFilename/src/otbExtendedFilenameToReaderOptions.cxx
@@ -16,7 +16,7 @@
 
 =========================================================================*/
 #include "otbExtendedFilenameToReaderOptions.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
@@ -43,7 +43,7 @@ ExtendedFilenameToReaderOptions
 
   m_Options.skipGeom.first  = false;
   m_Options.skipGeom.second = false;
-  
+
   m_Options.skipRpcTag.first  = false;
   m_Options.skipRpcTag.second = false;
 
@@ -122,7 +122,7 @@ ExtendedFilenameToReaderOptions
       m_Options.skipRpcTag.second = true;
       }
     }
-  
+
   //Option Checking
   MapIteratorType it;
   for ( it=map.begin(); it != map.end(); it++ )
diff --git a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameToWriterOptions.cxx b/Modules/IO/ExtendedFilename/src/otbExtendedFilenameToWriterOptions.cxx
index eafd3d9..534b0ef 100644
--- a/Modules/IO/ExtendedFilename/src/otbExtendedFilenameToWriterOptions.cxx
+++ b/Modules/IO/ExtendedFilename/src/otbExtendedFilenameToWriterOptions.cxx
@@ -16,11 +16,9 @@
 
 =========================================================================*/
 #include "otbExtendedFilenameToWriterOptions.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 #include <itksys/RegularExpression.hxx>
-
-#include <boost/foreach.hpp>
-#include <boost/tokenizer.hpp>
+#include "otb_boost_tokenizer_header.h"
 
 namespace otb
 {
diff --git a/Modules/IO/IOGDAL/include/otbOGRIOHelper.h b/Modules/IO/IOGDAL/include/otbOGRIOHelper.h
index baf02bd..6df03e2 100644
--- a/Modules/IO/IOGDAL/include/otbOGRIOHelper.h
+++ b/Modules/IO/IOGDAL/include/otbOGRIOHelper.h
@@ -21,8 +21,9 @@
 #include <vector>
 
 #include "otbVectorData.h"
+#include "otbOGRVersionProxy.h"
 
-class OGRDataSource;
+class GDALDataset;
 class OGRGeometryCollection;
 class OGRLayer;
 class OGRSpatialReference;
@@ -63,14 +64,14 @@ public:
 
 
   unsigned int ProcessNodeWrite(InternalTreeNodeType * source,
-                                OGRDataSource * m_DataSource,
+                                ogr::version_proxy::GDALDatasetType * m_DataSource,
                                 OGRGeometryCollection * ogrCollection,
                                 OGRLayer * ogrCurrentLayer,
                                 OGRSpatialReference * oSRS);
 
   /** Return a list of OGRLayer * */
   std::vector<OGRLayer*> ConvertDataTreeNodeToOGRLayers(InternalTreeNodeType * source,
-                                                        OGRDataSource * dummyDatasource,
+                                                        ogr::version_proxy::GDALDatasetType * dummyDatasource,
                                                         OGRLayer* ogrCurrentLayer,
                                                         OGRSpatialReference * oSRS);
 
diff --git a/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h b/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h
index f7ae24d..4a2d5dc 100644
--- a/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h
+++ b/Modules/IO/IOGDAL/include/otbOGRVectorDataIO.h
@@ -19,11 +19,11 @@
 #define __otbOGRVectorDataIO_h
 
 #include <string>
+#include <cassert>
 
 #include "otbVectorDataIOBase.h"
 #include "otbVectorData.h"
-
-class OGRDataSource;
+#include "otbOGRVersionProxy.h"
 
 namespace otb
 {
@@ -116,7 +116,9 @@ private:
 
   std::string GetOGRDriverName(std::string name) const;
 
-  OGRDataSource * m_DataSource;
+  void CloseInternalDataSource();
+
+  ogr::version_proxy::GDALDatasetType * m_DataSource;
 
 };
 
diff --git a/Modules/IO/IOGDAL/otb-module.cmake b/Modules/IO/IOGDAL/otb-module.cmake
index 98ca5b9..a1304de 100644
--- a/Modules/IO/IOGDAL/otb-module.cmake
+++ b/Modules/IO/IOGDAL/otb-module.cmake
@@ -10,7 +10,7 @@ otb_module(OTBIOGDAL
     OTBCommon
     OTBTinyXML
     OTBGDAL
-    OTBBoost
+    OTBBoostAdapters
     OTBOSSIMAdapters
 
   TEST_DEPENDS
diff --git a/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx b/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx
index 95a1397..33fd313 100644
--- a/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx
+++ b/Modules/IO/IOGDAL/src/otbGDALDriverManagerWrapper.cxx
@@ -17,7 +17,7 @@
 =========================================================================*/
 #include "otbGDALDriverManagerWrapper.h"
 #include <vector>
-#include <boost/algorithm/string/predicate.hpp>
+#include "otb_boost_string_header.h"
 #include "otbSystem.h"
 
 namespace otb
@@ -65,7 +65,7 @@ GDALDatasetWrapper::IsJPEG2000() const
 GDALDriverManagerWrapper::GDALDriverManagerWrapper()
 {
     GDALAllRegister();
-    
+
     GDALDriver* driver = 0;
 
     // Ignore incompatible Jpeg2000 drivers (Jasper)
diff --git a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
index 8a5ce35..ec881c3 100644
--- a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
+++ b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
@@ -40,7 +40,8 @@
 
 #include "otbGDALDriverManagerWrapper.h"
 
-#include <boost/algorithm/string/predicate.hpp>
+#include "otb_boost_string_header.h"
+
 #include "otbOGRHelpers.h"
 
 #include "stdint.h" //needed for uintptr_t
@@ -487,17 +488,19 @@ void GDALImageIO::ReadImageInformation()
 }
 
 unsigned int GDALImageIO::GetOverviewsCount()
-{ 
+{
   GDALDataset* dataset = m_Dataset->GetDataSet();
- 
+
   // JPEG2000 case : use the number of overviews actually in the dataset
   if (m_Dataset->IsJPEG2000())
     {
-    return dataset->GetRasterBand(1)->GetOverviewCount();
+    // Include the full resolution in overviews count
+    return dataset->GetRasterBand(1)->GetOverviewCount()+1;
     }
 
   if (dataset->GetRasterBand(1)->GetOverviewCount())
-    return dataset->GetRasterBand(1)->GetOverviewCount();
+    // Include the full resolution in overviews count
+    return dataset->GetRasterBand(1)->GetOverviewCount()+1;
 
   // default case: compute overviews until one of the dimensions is 1
   bool flagStop = false;
@@ -520,26 +523,54 @@ unsigned int GDALImageIO::GetOverviewsCount()
 std::vector<std::string> GDALImageIO::GetOverviewsInfo()
 {
   std::vector<std::string> desc;
-  unsigned lOverviewsCount = this->GetOverviewsCount();
-  if ( lOverviewsCount == 0)
+
+  // This should never happen, according to implementation of GetOverviewCount()
+  if (this->GetOverviewsCount() == 0)
     return desc;
-    
-  unsigned int originalWidth = m_OriginalDimensions[0];
-  unsigned int originalHeight = m_OriginalDimensions[1];  
- 
-  // Get the overview sizes
-  for( unsigned int iOverview = 0; iOverview < lOverviewsCount; iOverview++ )
-    {
-    // For each resolution we will compute the tile dim and image dim
-    std::ostringstream oss;    
-    unsigned int w = uint_ceildivpow2( originalWidth, iOverview);
-    unsigned int h = uint_ceildivpow2( originalHeight, iOverview);
-    
-    oss << "Overview level: " << iOverview << " (Image [w x h]: " << w << "x" << h << ")";
-    
+
+  std::ostringstream oss;
+
+  // If gdal exposes actual overviews
+  unsigned int lOverviewsCount = m_Dataset->GetDataSet()->GetRasterBand(1)->GetOverviewCount();
+
+  if (lOverviewsCount)
+    {
+    unsigned int x = m_OriginalDimensions[0];
+    unsigned int y = m_OriginalDimensions[1];
+
+    oss.str("");
+    oss << "Resolution: 0 (Image [w x h]: " << x << "x" << y << ")";
     desc.push_back(oss.str());
+
+    for( unsigned int iOverview = 0; iOverview < lOverviewsCount; iOverview++ )
+      {
+      x = m_Dataset->GetDataSet()->GetRasterBand(1)->GetOverview(iOverview)->GetXSize();
+      y = m_Dataset->GetDataSet()->GetRasterBand(1)->GetOverview(iOverview)->GetYSize();
+      oss.str("");
+      oss << "Resolution: " << iOverview+1 << " (Image [w x h]: " << x << "x" << y << ")";
+      desc.push_back(oss.str());
+      }
     }
-    
+  else
+    {
+    // Fall back to gdal implicit overviews
+    lOverviewsCount = this->GetOverviewsCount();
+
+    unsigned int originalWidth = m_OriginalDimensions[0];
+    unsigned int originalHeight = m_OriginalDimensions[1];
+
+    // Get the overview sizes
+    for( unsigned int iOverview = 0; iOverview < lOverviewsCount; iOverview++ )
+      {
+      // For each resolution we will compute the tile dim and image dim
+      unsigned int w = uint_ceildivpow2( originalWidth, iOverview);
+      unsigned int h = uint_ceildivpow2( originalHeight, iOverview);
+      oss.str("");
+      oss << "Resolution: " << iOverview << " (Image [w x h]: " << w << "x" << h << ")";
+      desc.push_back(oss.str());
+      }
+    }
+
   return desc;
 }
 
@@ -548,7 +579,7 @@ void GDALImageIO::InternalReadImageInformation()
   itk::ExposeMetaData<unsigned int>(this->GetMetaDataDictionary(),
                                     MetaDataKey::ResolutionFactor,
                                     m_ResolutionFactor);
-                                    
+
   itk::ExposeMetaData<unsigned int>(this->GetMetaDataDictionary(),
                                     MetaDataKey::SubDatasetIndex,
                                     m_DatasetNumber);
@@ -1072,13 +1103,13 @@ void GDALImageIO::InternalReadImageInformation()
         {
         std::string key;
         int cptOffset = CSLCount(papszMetadata);
-        
+
         for (int cpt = 0; gmlMetadata[cpt] != NULL; ++cpt)
           {
           std::ostringstream lStream;
           lStream << MetaDataKey::MetadataKey << (cpt+cptOffset);
           key = lStream.str();
-          
+
           itk::EncapsulateMetaData<std::string>(dict, key,
                                                 static_cast<std::string>(gmlMetadata[cpt]));
           }
@@ -1192,6 +1223,34 @@ void GDALImageIO::InternalReadImageInformation()
     this->SetPixelType(VECTOR);
     }
 
+
+  // Read no data value if present
+  std::vector<bool> isNoDataAvailable(dataset->GetRasterCount(),false);
+  std::vector<double> noDataValues(dataset->GetRasterCount(),0);
+
+  bool noDataFound = false;
+
+  for (int iBand = 0; iBand < dataset->GetRasterCount(); iBand++)
+    {
+    GDALRasterBandH hBand = GDALGetRasterBand(dataset, iBand + 1);
+
+    int success;
+
+    double ndv = GDALGetRasterNoDataValue(hBand,&success);
+
+    if(success)
+      {
+      noDataFound = true;
+      isNoDataAvailable[iBand]=true;
+      noDataValues[iBand]=ndv;
+      }
+    }
+
+  if(noDataFound)
+    {
+    itk::EncapsulateMetaData<MetaDataKey::BoolVectorType>(dict, MetaDataKey::NoDataValueAvailable, isNoDataAvailable);
+    itk::EncapsulateMetaData<MetaDataKey::VectorType>(dict,MetaDataKey::NoDataValue,noDataValues);
+    }
 }
 
 bool GDALImageIO::CanWriteFile(const char* name)
@@ -1651,6 +1710,28 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
     {
     dataset->SetProjection(projectionRef.c_str());
     }
+  else
+    {
+    /* -------------------------------------------------------------------- */
+    /* Set the RPC coeffs if no projection available (since GDAL 1.10.0)    */
+    /* -------------------------------------------------------------------- */
+#if GDAL_VERSION_NUM >= 1100000
+    ImageKeywordlist otb_kwl;
+    itk::ExposeMetaData<ImageKeywordlist>(dict,
+                                          MetaDataKey::OSSIMKeywordlistKey,
+                                          otb_kwl);
+    if( otb_kwl.GetSize() != 0 )
+      {
+      GDALRPCInfo gdalRpcStruct;
+      if ( otb_kwl.convertToGDALRPC(gdalRpcStruct) )
+        {
+        char **rpcMetadata = RPCInfoToMD(&gdalRpcStruct);
+        dataset->SetMetadata(rpcMetadata, "RPC");
+        CSLDestroy( rpcMetadata );
+        }
+      }
+#endif
+    }
 
   /* -------------------------------------------------------------------- */
   /*  Set the six coefficients of affine geoTransform                     */
@@ -1691,23 +1772,6 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
       }
     }
 
-#if GDAL_VERSION_NUM >= 1100000
-  // Report any RPC coefficients (feature available since GDAL 1.10.0)
-  ImageKeywordlist otb_kwl;
-  itk::ExposeMetaData<ImageKeywordlist>(dict,
-                                        MetaDataKey::OSSIMKeywordlistKey,
-                                        otb_kwl);
-  if( otb_kwl.GetSize() != 0 )
-    {
-    GDALRPCInfo gdalRpcStruct;
-    if ( otb_kwl.convertToGDALRPC(gdalRpcStruct) )
-      {
-      char **rpcMetadata = RPCInfoToMD(&gdalRpcStruct);
-      dataset->SetMetadata(rpcMetadata, "RPC");
-      CSLDestroy( rpcMetadata );
-      }
-    }
-#endif
 
   // END
 
@@ -1729,6 +1793,23 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
   otbMsgDevMacro( << "GCP Projection Ref: "<< dataset->GetGCPProjection() );
   otbMsgDevMacro( << "GCP Count: " << dataset->GetGCPCount() );
 
+  // Write no-data flags
+  std::vector<bool> noDataValueAvailable;
+  bool ret = itk::ExposeMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+
+  std::vector<double> noDataValues;
+  itk::ExposeMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValues);
+
+  if(ret)
+    {
+    for (int iBand = 0; iBand < dataset->GetRasterCount(); iBand++)
+      {
+      if(noDataValueAvailable[iBand])
+        {
+        dataset->GetRasterBand(iBand+1)->SetNoDataValue(noDataValues[iBand]);
+        }
+      }
+    }
 }
 
 std::string GDALImageIO::FilenameToGdalDriverShortName(const std::string& name) const
diff --git a/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx b/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx
index 4216a78..6cc3890 100644
--- a/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx
+++ b/Modules/IO/IOGDAL/src/otbOGRIOHelper.cxx
@@ -649,7 +649,7 @@ void OGRIOHelper
 
 unsigned int OGRIOHelper
 ::ProcessNodeWrite(InternalTreeNodeType * source,
-                   OGRDataSource * m_DataSource,
+                   ogr::version_proxy::GDALDatasetType * m_DataSource,
                    OGRGeometryCollection * ogrCollection,
                    OGRLayer * ogrCurrentLayer,
                    OGRSpatialReference * oSRS)
@@ -1025,7 +1025,7 @@ unsigned int OGRIOHelper
  **/
 std::vector<OGRLayer*> OGRIOHelper
 ::ConvertDataTreeNodeToOGRLayers(InternalTreeNodeType * source,
-                                 OGRDataSource * inMemoryDataSource,
+                                 ogr::version_proxy::GDALDatasetType * inMemoryDataSource,
                                  OGRLayer* ogrCurrentLayer,
                                  OGRSpatialReference * oSRS)
 {
@@ -1034,8 +1034,8 @@ std::vector<OGRLayer*> OGRIOHelper
   if (inMemoryDataSource == NULL)
     {
     const char * driverName = "Memory";
-    OGRSFDriver * ogrDriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driverName);
-    inMemoryDataSource = ogrDriver->CreateDataSource("tempDataSource",NULL);
+    ogr::version_proxy::GDALDriverType * ogrDriver = ogr::version_proxy::GetDriverByName(driverName);
+    inMemoryDataSource = ogr::version_proxy::Create(ogrDriver,"tempDataSource");
     }
 
   std::vector<OGRLayer*>  ogrLayerVector;
diff --git a/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx b/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx
index cd2b744..ec46d6e 100644
--- a/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx
+++ b/Modules/IO/IOGDAL/src/otbOGRVectorDataIO.cxx
@@ -46,7 +46,7 @@ OGRVectorDataIO::~OGRVectorDataIO()
 {
   if (m_DataSource != NULL)
     {
-    OGRDataSource::DestroyDataSource(m_DataSource);
+    this->CloseInternalDataSource();
     }
 }
 
@@ -54,13 +54,15 @@ OGRVectorDataIO::~OGRVectorDataIO()
 bool
 OGRVectorDataIO::CanReadFile(const char* filename) const
 {
-  OGRDataSource * poDS = OGRSFDriverRegistrar::Open(filename, FALSE);
+  otb::ogr::version_proxy::GDALDatasetType * poDS = ogr::version_proxy::Open(filename, true);
+  
   if (poDS == NULL)
     {
+    std::cerr<<"Can not read file "<<filename<<" with GDALOpen"<<std::endl;
     return false;
     }
 //     std::cout << poDS->GetDriver()->GetName() << std::endl;
-  OGRDataSource::DestroyDataSource(poDS);
+  ogr::version_proxy::Close(poDS);
   return true;
 }
 
@@ -88,10 +90,10 @@ OGRVectorDataIO
 
   if (m_DataSource != NULL)
     {
-    OGRDataSource::DestroyDataSource(m_DataSource);
+    this->CloseInternalDataSource();
     }
 
-  m_DataSource = OGRSFDriverRegistrar::Open(this->m_FileName.c_str(), FALSE);
+  m_DataSource = ogr::version_proxy::Open(this->m_FileName.c_str(),true);
 
   if (m_DataSource == NULL)
     {
@@ -176,7 +178,13 @@ OGRVectorDataIO
 
     } // end For each layer
 
-  OGRDataSource::DestroyDataSource(m_DataSource);
+  this->CloseInternalDataSource();
+}
+
+void OGRVectorDataIO::CloseInternalDataSource()
+{
+  assert(m_DataSource != NULL && "m_DataSource cannot be NULL");
+  ogr::version_proxy::Close(m_DataSource);
   m_DataSource = NULL;
 }
 
@@ -194,7 +202,7 @@ bool OGRVectorDataIO::CanWriteFile(const char* filename) const
 }
 
 
-void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** papszOptions)
+void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** /** unused */)
 {
   itk::TimeProbe chrono;
   chrono.Start();
@@ -208,8 +216,8 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** papszOptions)
 
 
   //Find first the OGR driver
-  OGRSFDriver * ogrDriver =
-    OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(this->GetOGRDriverName(this->m_FileName).data());
+  ogr::version_proxy::GDALDriverType * ogrDriver =
+    ogr::version_proxy::GetDriverByName(this->GetOGRDriverName(this->m_FileName).data());
 
   if (ogrDriver == NULL)
     {
@@ -219,25 +227,14 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** papszOptions)
   // free an existing previous data source, if any
   if (m_DataSource != NULL)
     {
-    OGRDataSource::DestroyDataSource(m_DataSource);
+    ogr::version_proxy::Close(m_DataSource);
     }
 
   // Erase the dataSource if already exist
-  //TODO investigate the possibility of giving the option OVERWRITE=YES to the CreateDataSource method
-  OGRDataSource * poDS = OGRSFDriverRegistrar::Open(this->m_FileName.c_str(), TRUE);
-  if (poDS != NULL)
-    {
-    //Erase the data if possible
-    if (poDS->GetDriver()->TestCapability(ODrCDeleteDataSource))
-      {
-      //Delete datasource
-      poDS->GetDriver()->DeleteDataSource(this->m_FileName.c_str());
-      }
-    }
-  OGRDataSource::DestroyDataSource(poDS);
+  ogr::version_proxy::Delete(this->m_FileName.c_str());
 
   // m_DataSource = OGRSFDriverRegistrar::Open(this->m_FileName.c_str(), TRUE);
-  m_DataSource = ogrDriver->CreateDataSource(this->m_FileName.c_str(), papszOptions);
+  m_DataSource = ogr::version_proxy::Create(ogrDriver,this->m_FileName.c_str());
 
   // check the created data source
   if (m_DataSource == NULL)
@@ -292,7 +289,7 @@ void OGRVectorDataIO::Write(const itk::DataObject* datag, char ** papszOptions)
   otbMsgDevMacro( << "layerKept " << layerKept );
   (void)layerKept; // keep compiler happy
 
-  OGRDataSource::DestroyDataSource(m_DataSource);
+  otb::ogr::version_proxy::Close(m_DataSource);
   m_DataSource = NULL;
 
   if (oSRS != NULL)
diff --git a/Modules/IO/IOGDAL/test/otbGDALOverviewsBuilder.cxx b/Modules/IO/IOGDAL/test/otbGDALOverviewsBuilder.cxx
index 44f9419..3b16727 100644
--- a/Modules/IO/IOGDAL/test/otbGDALOverviewsBuilder.cxx
+++ b/Modules/IO/IOGDAL/test/otbGDALOverviewsBuilder.cxx
@@ -58,8 +58,11 @@ int otbGDALOverviewsBuilder(int itkNotUsed(argc), char* argv[])
   io->ReadImageInformation();
   //std::cout << io->GetOverviewsCount() << std::endl;
 
-  if (io->GetOverviewsCount() != static_cast<unsigned int>(nbResolution)-1 )
+  if (io->GetOverviewsCount() != static_cast<unsigned int>(nbResolution) )
+    {
+    std::cout << "Got "<<io->GetOverviewsCount()<< " overviews, expected "<< nbResolution << std::endl;
     return EXIT_FAILURE;
+    }
 
   return EXIT_SUCCESS;
 }
diff --git a/Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx b/Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx
index 12fb3db..e98c1a7 100644
--- a/Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx
+++ b/Modules/IO/IOJPEG2000/src/otbJPEG2000ImageIO.cxx
@@ -920,7 +920,8 @@ unsigned int JPEG2000ImageIO::GetOverviewsCount()
     itkExceptionMacro(<< "Available resolutions in JPEG2000 is empty");
     }
 
-  return tempResList.size() - 1;
+  // count includes full resolution
+  return tempResList.size();
 }
 
 // Read image
diff --git a/Modules/IO/IOLUM/src/otbLUMImageIO.cxx b/Modules/IO/IOLUM/src/otbLUMImageIO.cxx
index d523cf2..6c515cc 100644
--- a/Modules/IO/IOLUM/src/otbLUMImageIO.cxx
+++ b/Modules/IO/IOLUM/src/otbLUMImageIO.cxx
@@ -218,6 +218,7 @@ bool LUMImageIO::InternalReadHeaderInformation(std::fstream& file, const bool re
   char        TypeCode[5];
   file.seekg(8, std::ios::beg);
   file.read((char*) (TypeCode), 4);
+  TypeCode[4] = '\0';
   int lTaille = CaiGetTypeLum(TypeCode,
                               lStrTypeImage,
                               lNbBits,
diff --git a/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx b/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx
index a12b633..7ac218c 100644
--- a/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx
+++ b/Modules/IO/IOMSTAR/src/otbMSTARImageIO.cxx
@@ -704,26 +704,26 @@ void MSTARImageIO::PrintSelf(std::ostream& os, itk::Indent indent) const
 float MSTARImageIO::byteswap_SR_IR(unsigned char *pointer)
 {
   float *       temp;
-  unsigned char iarray[4], *charptr;
-
+  unsigned char iarray[4];
+  void *vptr;
   iarray[0] = *(pointer + 3);
   iarray[1] = *(pointer + 2);
   iarray[2] = *(pointer + 1);
   iarray[3] = *(pointer);
-  charptr = iarray;
-  temp    = (float *) charptr;
+  vptr = static_cast<void*>(iarray);
+  temp = static_cast<float*>(vptr);
   return *(temp);
 }
 
 unsigned short MSTARImageIO::byteswap_SUS_IUS(unsigned char *pointer)
 {
   unsigned short *temp;
-  unsigned char   iarray[2], *charptr;
-
+  unsigned char   iarray[2];
+  void *vptr;
   iarray[0] = *(pointer + 1);
   iarray[1] = *(pointer);
-  charptr = iarray;
-  temp    = (unsigned short *) charptr;
+  vptr = static_cast<void*>(iarray);
+  temp = static_cast<unsigned short*>(vptr);
   return *(temp);
 }
 
diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.h b/Modules/IO/ImageIO/include/otbImageFileReader.h
index 3e8fe38..b24dd91 100644
--- a/Modules/IO/ImageIO/include/otbImageFileReader.h
+++ b/Modules/IO/ImageIO/include/otbImageFileReader.h
@@ -18,7 +18,14 @@
 #ifndef __otbImageFileReader_h
 #define __otbImageFileReader_h
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
 #include "itkImageSource.h"
+#pragma GCC diagnostic pop
+#else
+#include "itkImageSource.h"
+#endif
 #include "otbImageIOBase.h"
 #include "itkExceptionObject.h"
 #include "itkImageRegion.h"
@@ -141,13 +148,13 @@ public:
   /** Get the resolution information from the file */
   bool GetResolutionsInfo( std::vector<unsigned int>& res,
                           std::vector<std::string>& desc);
-  
+
   /** Get the number of overviews available into the file specified
    * Returns: overview count, zero if none. */
-  unsigned int GetOverviewsCount(); 
-  
-  
-  /** Get description about overviews available into the file specified 
+  unsigned int GetOverviewsCount();
+
+
+  /** Get description about overviews available into the file specified
    * Returns: overview info, empty if none.*/
   std::vector<std::string> GetOverviewsInfo();
 
diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.txx b/Modules/IO/ImageIO/include/otbImageFileWriter.txx
index 64adaf9..29ad20d 100644
--- a/Modules/IO/ImageIO/include/otbImageFileWriter.txx
+++ b/Modules/IO/ImageIO/include/otbImageFileWriter.txx
@@ -42,8 +42,7 @@
 #include "otbRAMDrivenTiledStreamingManager.h"
 #include "otbRAMDrivenAdaptativeStreamingManager.h"
 
-#include <boost/foreach.hpp>
-#include <boost/tokenizer.hpp>
+#include "otb_boost_tokenizer_header.h"
 
 namespace otb
 {
diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h
index ada4080..75bee26 100644
--- a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h
+++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
          This software is distributed WITHOUT ANY WARRANTY; without even
          the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
@@ -110,7 +110,7 @@ protected:
   /** TestBandSelection
    * Tests the coherency of the Meta File (especifically band selection) with the image types
    */
-  virtual void TestBandSelection(std::vector<unsigned int>& bands) {}
+  virtual void TestBandSelection(std::vector<unsigned int>& itkNotUsed(bands)) {}
 
   /** GenerateData
    * This method will be specialised if template definitions follow:
diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx
index eaed4aa..0bafea5 100644
--- a/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx
+++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReader.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
          This software is distributed WITHOUT ANY WARRANTY; without even
          the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
@@ -47,7 +47,7 @@ ImageSeriesFileReader<TImage, TInternalImage>
 template <class TImage, class TInternalImage>
 void
 ImageSeriesFileReader<TImage, TInternalImage>
-::GenerateData(DataObjectPointerArraySizeType idx)
+::GenerateData(DataObjectPointerArraySizeType itkNotUsed(idx))
 {
   std::ostringstream msg;
   msg << "Something wrong... Check the template definition of this class in the program...\n";
diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h
index cb1aa3a..06ce1a6 100644
--- a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h
+++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
          This software is distributed WITHOUT ANY WARRANTY; without even
          the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.txx b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.txx
index 5d355b4..60ddc4d 100644
--- a/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.txx
+++ b/Modules/IO/ImageIO/include/otbImageSeriesFileReaderBase.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
          This software is distributed WITHOUT ANY WARRANTY; without even
          the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/IO/ImageIO/include/otbStreamingImageFileWriter.h b/Modules/IO/ImageIO/include/otbStreamingImageFileWriter.h
deleted file mode 100644
index b4845fb..0000000
--- a/Modules/IO/ImageIO/include/otbStreamingImageFileWriter.h
+++ /dev/null
@@ -1,72 +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.
-
-=========================================================================*/
-#ifndef __otbStreamingImageFileWriter_h
-#define __otbStreamingImageFileWriter_h
-
-#include "vcl_deprecated_header.h"
-
-#include "otbImageFileWriter.h"
-
-namespace otb
-{
-/** \class StreamingImageFileWriter
- *  \brief Deprecated streaming-enabled image writing class
- *
- *  StreamingImageFileWriter is deprecated and provided for backward
- *  compatibility only. Full support of streaming is now provided by
- *  otb::ImageFileWriter, and StreamingImageFileWriter is a simple
- *  alias of this class.
- *
- *  \sa ImageFileWriter
- *
- * \ingroup OTBImageIO
- */
-template <class TInputImage> class ITK_EXPORT StreamingImageFileWriter : public ImageFileWriter<TInputImage>
-{
-public:
-  /** Standard class typedefs. */
-  typedef StreamingImageFileWriter       Self;
-  typedef ImageFileWriter<TInputImage>   Superclass;
-  typedef itk::SmartPointer<Self>        Pointer;
-  typedef itk::SmartPointer<const Self>  ConstPointer;
-
-  /** Method for creation through the object factory. */
-  itkNewMacro(Self);
-
-  /** Run-time type information (and related methods). */
-  itkTypeMacro(ImageFileWriter, itk::ImageFileWriter);
-
- /** Dimension of input image. */
-  itkStaticConstMacro(InputImageDimension, unsigned int,
-                      Superclass::InputImageDimension);
-
-protected:
-  /** Constructor */
-  StreamingImageFileWriter(){}
-
-  /** Destructor */
-  virtual ~StreamingImageFileWriter(){}
-
-private:
-  StreamingImageFileWriter(const StreamingImageFileWriter &); //purposely not implemented
-  void operator =(const StreamingImageFileWriter&); //purposely not implemented
-};
-
-} // end namespace otb
-
-#endif
diff --git a/Modules/IO/ImageIO/otb-module.cmake b/Modules/IO/ImageIO/otb-module.cmake
index 1433853..8c0a036 100644
--- a/Modules/IO/ImageIO/otb-module.cmake
+++ b/Modules/IO/ImageIO/otb-module.cmake
@@ -3,7 +3,7 @@ writing of remote sensing images.")
 
 otb_module(OTBImageIO
   DEPENDS
-    OTBBoost
+    OTBBoostAdapters
     OTBCommon
     OTBExtendedFilename
     OTBIOBSQ
diff --git a/Modules/IO/ImageIO/test/CMakeLists.txt b/Modules/IO/ImageIO/test/CMakeLists.txt
index 8472de5..ecd67c8 100644
--- a/Modules/IO/ImageIO/test/CMakeLists.txt
+++ b/Modules/IO/ImageIO/test/CMakeLists.txt
@@ -255,7 +255,6 @@ otb_add_test(NAME ioTvStreamingIFWriterLUMWithoutStreaming COMMAND otbImageIOTes
   otbStreamingImageFileWriterTest
   ${TEMP}/ioImageFileReaderPNG2LUM.lum
   ${TEMP}/ioStreamingImageFileWriterLUM2LUMWithoutStreaming.lum
-  0 # StreamingImageFileWriter
   0 # NumberOfStreamDivisions
   )
 set_property(TEST ioTvStreamingIFWriterLUMWithoutStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2LUM)
@@ -266,7 +265,6 @@ otb_add_test(NAME ioTvStreamingIFWriterBSQWithoutStreaming COMMAND otbImageIOTes
   otbStreamingImageFileWriterTest
   ${INPUTDATA}/poupees_1canal.c1.hdr
   ${TEMP}/ioStreamingImageFileWriterBSQWithoutStreaming.hdr
-  0 # Streaming
   0
   )
 set_property(TEST ioTvStreamingIFWriterBSQWithoutStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2BSQ)
@@ -277,7 +275,6 @@ otb_add_test(NAME ioTvStreamingWithIFWriterLUMWithStreaming COMMAND otbImageIOTe
   otbStreamingImageFileWriterTest
   ${TEMP}/ioImageFileReaderPNG2LUM.lum
   ${TEMP}/ioStreamingWithImageFileWriterLUM2LUMWithStreaming_10.lum
-  0 # StreamingImageFileWriter
   10 # NumberOfStreamDivisions
   )
 set_property(TEST ioTvStreamingWithIFWriterLUMWithStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2LUM)
@@ -288,7 +285,6 @@ otb_add_test(NAME ioTvStreamingWithIFWriterBSQWithStreaming COMMAND otbImageIOTe
   otbStreamingImageFileWriterTest
   ${TEMP}/ioImageFileReaderPNG2BSQ.hd
   ${TEMP}/ioStreamingWithImageFileWriterBSQ2BSQWithStreaming_10.hd
-  0 # StreamingImageFileWriter
   10 # NumberOfStreamDivisions
   )
 set_property(TEST ioTvStreamingWithIFWriterBSQWithStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2BSQ)
@@ -299,7 +295,6 @@ otb_add_test(NAME ioTvStreamingIFWriterBSQWithStreaming COMMAND otbImageIOTestDr
   otbStreamingImageFileWriterTest
   ${INPUTDATA}/poupees_1canal.c1.hdr
   ${TEMP}/ioStreamingImageFileWriterBSQWithStreaming_100.hdr
-  1 # Streaming
   100
   )
 set_property(TEST ioTvStreamingIFWriterBSQWithStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2BSQ)
@@ -310,7 +305,6 @@ otb_add_test(NAME ioTvStreamingIFWriterLUMWithStreaming COMMAND otbImageIOTestDr
   otbStreamingImageFileWriterTest
   ${TEMP}/ioImageFileReaderPNG2LUM.lum
   ${TEMP}/ioStreamingImageFileWriterLUM2LUMWithStreaming_10.lum
-  1 # StreamingImageFileWriter
   10 # NumberOfStreamDivisions
   )
 set_property(TEST ioTvStreamingIFWriterLUMWithStreaming PROPERTY DEPENDS ioTvImageFileReaderPNG2LUM)
@@ -322,7 +316,7 @@ otb_add_test(NAME ioTvReadingComplexDataIntoComplexImage COMMAND otbImageIOTestD
   )
 
 otb_add_test(NAME ioTvStreamingImageFilterBSQ2PNG COMMAND otbImageIOTestDriver
-   --compare-image ${EPSILON_9}   
+   --compare-image ${EPSILON_9}
    ${TEMP}/ioImageFileReaderPNG2BSQ.hd
    ${TEMP}/ioStreamingImageFilterTestBSQ.png
    otbStreamingImageFilterTest
@@ -1308,4 +1302,3 @@ otb_add_test(NAME  ioTvImageFileReaderPNG2ENVI COMMAND otbImageIOTestDriver
         ${INPUTDATA}/cthead1.png
         ${TEMP}/ioImageFileReaderPNG2ENVI.hdr )
 set_tests_properties(ioTvImageFileReaderPNG2ENVI PROPERTIES DEPENDS ioTvImageFileReaderPNG2BSQ)
-
diff --git a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
index bc95c38..21b2b10 100644
--- a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
+++ b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
@@ -24,7 +24,6 @@ void RegisterTests()
   REGISTER_TEST(otbVectorImageStreamingFileWriterComplexTestWithoutInputFloat);
   REGISTER_TEST(otbVectorImageStreamingFileWriterComplexTestWithoutInputDouble);
   REGISTER_TEST(otbReadingComplexDataIntoComplexImageTest);
-  REGISTER_TEST(otbStreamingImageFileWriterTest);
   REGISTER_TEST(otbImageFileReaderRADInt);
   REGISTER_TEST(otbImageFileReaderRGBTest);
   REGISTER_TEST(otbImageMetadataStreamingFileWriterTest);
@@ -83,6 +82,7 @@ void RegisterTests()
   REGISTER_TEST(otbImageFileReaderRADComplexDouble);
   REGISTER_TEST(otbPipeline);
   REGISTER_TEST(otbStreamingImageFilterTest);
+  REGISTER_TEST(otbStreamingImageFileWriterTest);
   REGISTER_TEST(otbImageFileWriterRGBTest);
   REGISTER_TEST(otbMonobandScalarToImageComplexFloat);
   REGISTER_TEST(otbMonobandScalarToImageComplexDouble);
diff --git a/Modules/IO/ImageIO/test/otbImageSeriesFileReader.cxx b/Modules/IO/ImageIO/test/otbImageSeriesFileReader.cxx
index 47bf8c6..aea4736 100644
--- a/Modules/IO/ImageIO/test/otbImageSeriesFileReader.cxx
+++ b/Modules/IO/ImageIO/test/otbImageSeriesFileReader.cxx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom / Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  Copyright (c) Institut Mines-Telecom. All rights reserved.
+  See IMTCopyright.txt for details.
 
          This software is distributed WITHOUT ANY WARRANTY; without even
          the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/IO/ImageIO/test/otbStreamingImageFileWriterTest.cxx b/Modules/IO/ImageIO/test/otbStreamingImageFileWriterTest.cxx
index 6679dc2..60a76ca 100644
--- a/Modules/IO/ImageIO/test/otbStreamingImageFileWriterTest.cxx
+++ b/Modules/IO/ImageIO/test/otbStreamingImageFileWriterTest.cxx
@@ -24,16 +24,14 @@
 #include "otbImage.h"
 
 #include "otbImageFileReader.h"
-#include "otbStreamingImageFileWriter.h"
+#include "otbImageFileWriter.h"
 
 int otbStreamingImageFileWriterTest(int itkNotUsed(argc), char* argv[])
 {
   // Verify the number of parameters in the command line
   const char * inputFilename  = argv[1];
   const char * outputFilename = argv[2];
-  int          iStreaming(::atoi(argv[3]));
-  bool         streaming = (bool) (iStreaming);
-  int          NumberOfStreamDivisions(::atoi(argv[4]));
+  int          NumberOfStreamDivisions(::atoi(argv[3]));
 
   typedef unsigned char InputPixelType;
   typedef unsigned char OutputPixelType;
@@ -43,23 +41,10 @@ int otbStreamingImageFileWriterTest(int itkNotUsed(argc), char* argv[])
   typedef otb::Image<OutputPixelType, Dimension> OutputImageType;
 
   typedef otb::ImageFileReader<InputImageType>           ReaderType;
-  typedef otb::StreamingImageFileWriter<OutputImageType> StreamingWriterType;
   typedef otb::ImageFileWriter<OutputImageType>          WriterType;
 
   ReaderType::Pointer reader = ReaderType::New();
   reader->SetFileName(inputFilename);
-
-  if (streaming == true)
-    {
-    std::cout << "Streaming writing test" << std::endl;
-    StreamingWriterType::Pointer writer = StreamingWriterType::New();
-    writer->SetFileName(outputFilename);
-    writer->SetNumberOfDivisionsStrippedStreaming(NumberOfStreamDivisions);
-    writer->SetInput(reader->GetOutput());
-    writer->Update();
-    }
-  else
-    {
     std::cout << "Writing test" << std::endl;
     WriterType::Pointer writer = WriterType::New();
     if (NumberOfStreamDivisions > 1)
@@ -72,7 +57,6 @@ int otbStreamingImageFileWriterTest(int itkNotUsed(argc), char* argv[])
     writer->SetFileName(outputFilename);
     writer->SetInput(reader->GetOutput());
     writer->Update();
-    }
 
   return EXIT_SUCCESS;
 }
diff --git a/Modules/IO/TestKernel/src/otbTestDriver.cxx b/Modules/IO/TestKernel/src/otbTestDriver.cxx
index 7372ee2..4fbeeb7 100644
--- a/Modules/IO/TestKernel/src/otbTestDriver.cxx
+++ b/Modules/IO/TestKernel/src/otbTestDriver.cxx
@@ -31,7 +31,7 @@
 
 // include SharedForward to avoid duplicating the code which find the library path variable
 // name and the path separator
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-function"
 #include "itksys/SharedForward.h"
@@ -179,7 +179,7 @@ int main(int ac, char* av[])
   argv[remainingArgs.size() + 1] = NULL;
 
   /** Call to the otbTestMain */
-  return otbTestMain(remainingArgs.size(), argv);
+  return otbTestMain(static_cast<int>(remainingArgs.size()), argv);
 
 }
 
diff --git a/Modules/IO/TestKernel/src/otbTestHelper.cxx b/Modules/IO/TestKernel/src/otbTestHelper.cxx
index 2b1e9f6..36dd1ee 100644
--- a/Modules/IO/TestKernel/src/otbTestHelper.cxx
+++ b/Modules/IO/TestKernel/src/otbTestHelper.cxx
@@ -27,6 +27,15 @@
 #include <algorithm>
 #include <string>
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#include "ogrsf_frmts.h"
+#pragma GCC diagnostic pop
+#else
+#include "ogrsf_frmts.h"
+#endif
+
 #include "itksys/SystemTools.hxx"
 #include "itksys/Directory.hxx"
 #include "itksys/RegularExpression.hxx"
@@ -37,6 +46,9 @@
 #include "otbDifferenceImageFilter.h"
 #include "otbPrintableImageFilter.h"
 #include "otbStreamingShrinkImageFilter.h"
+#include "otbOGRVersionProxy.h"
+
+#include "otbConfigure.h"
 
 #define ITK_TEST_DIMENSION_MAX 6
 
@@ -44,16 +56,6 @@
 #include "cpl_conv.h"
 #include "cpl_string.h"
 #include "cpl_multiproc.h"
-#include "ogr_api.h"
-
-#ifdef __GNUC__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wshadow"
-#include "ogrsf_frmts.h"
-#pragma GCC diagnostic pop
-#else
-#include "ogrsf_frmts.h"
-#endif
 
 #define otbPrintDiff(comment, refStr, testStr) \
   std::cout << "   ----    '" << comment << "' checking   ---------------------------" << std::endl; \
@@ -1074,33 +1076,33 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b
   /* -------------------------------------------------------------------- */
   /*      Open data source.                                               */
   /* -------------------------------------------------------------------- */
-  OGRDataSource *ref_poDS = NULL;
-  OGRSFDriver *  ref_poDriver = NULL;
+  otb::ogr::version_proxy::GDALDatasetType *ref_poDS = NULL;
+  otb::ogr::version_proxy::GDALDriverType *  ref_poDriver = NULL;
   //OGRGeometry *  ref_poSpatialFilter = NULL;
-  OGRDataSource *test_poDS = NULL;
-  OGRSFDriver *  test_poDriver = NULL;
+  otb::ogr::version_proxy::GDALDatasetType *test_poDS = NULL;
+  otb::ogr::version_proxy::GDALDriverType *  test_poDriver = NULL;
   //OGRGeometry *  test_poSpatialFilter = NULL;
 
-  OGRRegisterAll();
-
-  ref_poDS = OGRSFDriverRegistrar::Open(ref_pszDataSource, !bReadOnly, &ref_poDriver);
+  ref_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, false);
   if (ref_poDS == NULL && !bReadOnly)
     {
-    ref_poDS = OGRSFDriverRegistrar::Open(ref_pszDataSource, FALSE, &ref_poDriver);
+    ref_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, true);
+    bReadOnly = TRUE;
     if (ref_poDS != NULL && m_ReportErrors)
       {
-      std::cout << "Had to open REF data source read-only.\n";
-      bReadOnly = TRUE;
+      std::cout << "Had to open REF data source read-only."<<std::endl;
       }
     }
-  test_poDS = OGRSFDriverRegistrar::Open(test_pszDataSource, !bReadOnly, &test_poDriver);
+  test_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, bReadOnly);
   if (test_poDS == NULL && !bReadOnly)
     {
-    test_poDS = OGRSFDriverRegistrar::Open(test_pszDataSource, FALSE, &test_poDriver);
+    test_poDS = otb::ogr::version_proxy::Open(ref_pszDataSource, bReadOnly);
+
+    bReadOnly = TRUE;
+
     if (test_poDS != NULL && m_ReportErrors)
       {
-      std::cout << "Had to open REF data source read-only.\n";
-      bReadOnly = TRUE;
+      std::cout << "Had to open TEST data source read-only."<<std::endl;
       }
     }
   /* -------------------------------------------------------------------- */
@@ -1108,49 +1110,67 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b
   /* -------------------------------------------------------------------- */
   if (ref_poDS == NULL)
     {
-    OGRSFDriverRegistrar *ref_poR = OGRSFDriverRegistrar::GetRegistrar();
 
     if (m_ReportErrors)
-      std::cout << "FAILURE:\n"
-      "Unable to open REF datasource `" << ref_pszDataSource << "' with the following drivers." << std::endl;
-    for (int iDriver = 0; iDriver < ref_poR->GetDriverCount(); ++iDriver)
       {
-      std::cout << "  -> " << ref_poR->GetDriver(iDriver)->GetName() << std::endl;
+      std::cout << "FAILURE:\n" "Unable to open REF datasource `" << ref_pszDataSource << "' with the following drivers." << std::endl;
+
+      std::vector<std::string> drivers = ogr::version_proxy::GetAvailableDriversAsStringVector();
+
+      for (std::vector<std::string>::const_iterator it = drivers.begin();it!=drivers.end();++it)
+        {
+        std::cout << "  -> " << *it << std::endl;
+        }
       }
     return (1);
     }
+  ref_poDriver = ref_poDS->GetDriver();
   CPLAssert(ref_poDriver != NULL);
 
   if (test_poDS == NULL)
     {
-    OGRSFDriverRegistrar *test_poR = OGRSFDriverRegistrar::GetRegistrar();
-
     if (m_ReportErrors)
-      std::cout << "FAILURE:\n"
-      "Unable to open TEST datasource `" << test_pszDataSource << "' with the following drivers." << std::endl;
-    for (int iDriver = 0; iDriver < test_poR->GetDriverCount(); ++iDriver)
       {
-      std::cout << "  -> " << test_poR->GetDriver(iDriver)->GetName() << std::endl;
+      std::cout << "FAILURE:\n""Unable to open TEST datasource `" << test_pszDataSource << "' with the following drivers." << std::endl;
+
+      std::vector<std::string> drivers = ogr::version_proxy::GetAvailableDriversAsStringVector();
+
+      for (std::vector<std::string>::const_iterator it = drivers.begin();it!=drivers.end();++it)
+        {
+        std::cout << "  -> " << *it << std::endl;
+        }
       }
     return (1);
     }
+  test_poDriver = test_poDS->GetDriver();
   CPLAssert(test_poDriver != NULL);
 
   /* -------------------------------------------------------------------- */
   /*      Some information messages.                                      */
   /* -------------------------------------------------------------------- */
-  otbCheckStringValue("INFO: using driver", ref_poDriver->GetName(), test_poDriver->GetName(), nbdiff, m_ReportErrors);
+  otbCheckStringValue("INFO: using driver", GDALGetDriverShortName(ref_poDriver), GDALGetDriverShortName(test_poDriver), nbdiff, m_ReportErrors);
+
+  // TODO: Improve this check as it will stop as soon as one of the
+  // list ends (i.e. it does not guarantee that all files are present)
+  std::vector<std::string> refFileList = otb::ogr::version_proxy::GetFileListAsStringVector(ref_poDS);
+  std::vector<std::string> testFileList = otb::ogr::version_proxy::GetFileListAsStringVector(test_poDS);
 
-  std::string strRefName(ref_poDS->GetName());
-  std::string strTestName(test_poDS->GetName());
-  if (strRefName != strTestName)
+  unsigned int fileId = 0;
+
+  while (fileId < refFileList.size() && fileId < testFileList.size())
     {
-    if (!m_ReportErrors)
+    std::string strRefName(refFileList[fileId]);
+    std::string strTestName(testFileList[fileId]);
+    if (strRefName != strTestName)
       {
-      otbPrintDiff("WARNING: INFO: Internal data source name poDS->GetName() were different",
-                   strRefName,
-                   strTestName);
+      if (!m_ReportErrors)
+        {
+        otbPrintDiff("WARNING: INFO: Internal data source files were different",
+                     strRefName,
+                     strTestName);
+        }
       }
+    ++fileId;
     }
 
   /* -------------------------------------------------------------------- */
@@ -1240,8 +1260,8 @@ int TestHelper::RegressionTestOgrFile(const char *testOgrFilename, const char *b
   /* -------------------------------------------------------------------- */
   /*      Close down.                                                     */
   /* -------------------------------------------------------------------- */
-  OGRDataSource::DestroyDataSource( ref_poDS );
-  OGRDataSource::DestroyDataSource( test_poDS );
+  GDALClose( ref_poDS );
+  GDALClose( test_poDS );
 
   return (nbdiff != 0) ? 1 : 0;
 }
@@ -1256,7 +1276,7 @@ void TestHelper::DumpOGRFeature(FILE* fpOut, OGRFeature* feature, char** papszOp
     return;
     }
 
-  fprintf(fpOut, "OGRFeature:%ld\n", feature->GetFID());
+  fprintf(fpOut, "OGRFeature:%lld\n", (GIntBig) feature->GetFID());
 
   const char* pszDisplayFields =
     CSLFetchNameValue(papszOptions, "DISPLAY_FIELDS");
@@ -1374,6 +1394,8 @@ void TestHelper::DumpOGRGeometry(FILE* fp, OGRGeometry* geometry, const char * p
         }
       case wkbLinearRing:
         break;
+      default:
+        break;
       }
     }
   else if (pszDisplayGeometry == NULL || CSLTestBoolean(pszDisplayGeometry) ||
diff --git a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h
index 2c38108..84b093f 100644
--- a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h
+++ b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.h
@@ -139,6 +139,8 @@ protected:
   /** Destructor */
   virtual ~DSFusionOfClassifiersImageFilter() {}
 
+  /** Generate output information */
+  virtual void GenerateOutputInformation();
   /** Threaded generate data */
   virtual void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId);
   /** Before threaded generate data */
diff --git a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.txx b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.txx
index 65c5771..5305fa3 100644
--- a/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.txx
+++ b/Modules/Learning/DempsterShafer/include/otbDSFusionOfClassifiersImageFilter.txx
@@ -22,6 +22,9 @@
 #include "itkImageRegionIterator.h"
 #include "itkProgressReporter.h"
 
+#include "itkMetaDataObject.h"
+#include "otbMetaDataKey.h"
+
 namespace otb
 {
 /**
@@ -84,6 +87,23 @@ DSFusionOfClassifiersImageFilter<TInputImage, TOutputImage, TMaskImage>
 }
 /* ************************************************************************************************************** */
 
+template <class TInputImage, class TOutputImage, class TMaskImage>
+void
+DSFusionOfClassifiersImageFilter<TInputImage, TOutputImage, TMaskImage>
+::GenerateOutputInformation()
+{
+  Superclass::GenerateOutputInformation();
+
+  // Set the NoData value
+  std::vector<bool> noDataValueAvailable;
+  noDataValueAvailable.push_back(true);
+  std::vector<double> noDataValue;
+  noDataValue.push_back(m_LabelForNoDataPixels);
+  itk::MetaDataDictionary& dict = this->GetOutput()->GetMetaDataDictionary();
+  itk::EncapsulateMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+  itk::EncapsulateMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValue);
+}
+/* ************************************************************************************************************** */
 
 template <class TInputImage, class TOutputImage, class TMaskImage>
 void
diff --git a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h
index 6937b06..ecc4cb2 100644
--- a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h
+++ b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Some parts of this code are covered by the GET copyright.
-  See GETCopyright.txt for details.
+  Some parts of this code are covered by the IMT copyright.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.txx b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.txx
index a1edbe7..d420d84 100644
--- a/Modules/Learning/LearningBase/include/otbGaussianModelComponent.txx
+++ b/Modules/Learning/LearningBase/include/otbGaussianModelComponent.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Some parts of this code are covered by the GET copyright.
-  See GETCopyright.txt for details.
+  Some parts of this code are covered by the IMT copyright.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/LearningBase/include/otbSEMClassifier.h b/Modules/Learning/LearningBase/include/otbSEMClassifier.h
index 6f7e5e7..e23db49 100644
--- a/Modules/Learning/LearningBase/include/otbSEMClassifier.h
+++ b/Modules/Learning/LearningBase/include/otbSEMClassifier.h
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Some parts of this code are covered by the GET copyright.
-  See GETCopyright.txt for details.
+  Some parts of this code are covered by the IMT copyright.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/LearningBase/include/otbSEMClassifier.txx b/Modules/Learning/LearningBase/include/otbSEMClassifier.txx
index afe3461..9222684 100644
--- a/Modules/Learning/LearningBase/include/otbSEMClassifier.txx
+++ b/Modules/Learning/LearningBase/include/otbSEMClassifier.txx
@@ -9,8 +9,8 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Some parts of this code are covered by the GET copyright.
-  See GETCopyright.txt for details.
+  Some parts of this code are covered by the IMT copyright.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
@@ -150,7 +150,7 @@ SEMClassifier<TInputImage, TOutputImage>
   else
     {
     otbMsgDebugMacro(<< "m_ClassLabels size = " << GetClassLabels().size() << " / m_Sample size = " << m_NbSamples);
-    throw itk::ExceptionObject(__FILE__, __LINE__, "Vector size missmatch", ITK_LOCATION);
+    throw itk::ExceptionObject(__FILE__, __LINE__, "Vector size mismatch", ITK_LOCATION);
     }
 }
 
@@ -214,7 +214,7 @@ SEMClassifier<TInputImage, TOutputImage>
     otbMsgDebugMacro(
       << "m_ClassLabels size = " << GetClassLabels().size() << " size of the image = " << theSize <<
       " / m_Sample size = " << m_NbSamples);
-    throw itk::ExceptionObject(__FILE__, __LINE__, "Vector size missmatch", ITK_LOCATION);
+    throw itk::ExceptionObject(__FILE__, __LINE__, "Vector size mismatch", ITK_LOCATION);
     }
 }
 
@@ -264,7 +264,7 @@ SEMClassifier<TInputImage, TOutputImage>
     typename TInputImage::SizeType size = m_Sample->GetBufferedRegion().GetSize();
     if ((size[0] * size[1]) != m_ClassLabels.size())
       throw itk::ExceptionObject(__FILE__, __LINE__,
-                                 "Vector size missmatch", ITK_LOCATION);
+                                 "Vector size mismatch", ITK_LOCATION);
     }
 }
 
@@ -315,7 +315,7 @@ SEMClassifier<TInputImage,TOutputImage>
   m_ComponentVector.clear();
   m_ComponentVector.resize(this->GetNumberOfClasses());
   m_ComponentDeclared = 0;
-  
+
 }
 
 template <class TInputImage, class TOutputImage>
@@ -353,7 +353,7 @@ SEMClassifier<TInputImage, TOutputImage>
         {
         //label = (int) floor( 0.5 + nbClassesDbl * ran / double(RAND_MAX+1) );
         label = rand() % nbClasses;
-        if (label >= nbClasses) 
+        if (label >= nbClasses)
           {
           label = nbClasses - 1;
           }
diff --git a/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h b/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h
index ec8f232..171d21f 100644
--- a/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h
+++ b/Modules/Learning/Markov/include/otbMRFEnergyFisherClassification.h
@@ -22,7 +22,7 @@
 
 #include "otbMRFEnergy.h"
 #include "otbMath.h"
-#include <boost/math/special_functions/gamma.hpp>
+#include "otb_boost_math_gamma_header.h"
 
 namespace otb
 {
diff --git a/Modules/Learning/Markov/otb-module.cmake b/Modules/Learning/Markov/otb-module.cmake
index a895463..d2236e2 100644
--- a/Modules/Learning/Markov/otb-module.cmake
+++ b/Modules/Learning/Markov/otb-module.cmake
@@ -5,7 +5,7 @@ than the ITK one.")
 
 otb_module(OTBMarkov
   DEPENDS
-    OTBBoost
+    OTBBoostAdapters
     OTBCommon
     OTBITK
 
diff --git a/Modules/Learning/SOM/include/otbCzihoSOMLearningBehaviorFunctor.h b/Modules/Learning/SOM/include/otbCzihoSOMLearningBehaviorFunctor.h
index 7a68fa6..19fdf31 100644
--- a/Modules/Learning/SOM/include/otbCzihoSOMLearningBehaviorFunctor.h
+++ b/Modules/Learning/SOM/include/otbCzihoSOMLearningBehaviorFunctor.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SOM/include/otbCzihoSOMNeighborhoodBehaviorFunctor.h b/Modules/Learning/SOM/include/otbCzihoSOMNeighborhoodBehaviorFunctor.h
index a81df3e..a364d57 100644
--- a/Modules/Learning/SOM/include/otbCzihoSOMNeighborhoodBehaviorFunctor.h
+++ b/Modules/Learning/SOM/include/otbCzihoSOMNeighborhoodBehaviorFunctor.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SOM/include/otbPeriodicSOM.h b/Modules/Learning/SOM/include/otbPeriodicSOM.h
index 7bc01e4..835aeff 100644
--- a/Modules/Learning/SOM/include/otbPeriodicSOM.h
+++ b/Modules/Learning/SOM/include/otbPeriodicSOM.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SOM/include/otbPeriodicSOM.txx b/Modules/Learning/SOM/include/otbPeriodicSOM.txx
index 1618b77..352817b 100644
--- a/Modules/Learning/SOM/include/otbPeriodicSOM.txx
+++ b/Modules/Learning/SOM/include/otbPeriodicSOM.txx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SOM/include/otbSOM.h b/Modules/Learning/SOM/include/otbSOM.h
index 7205dc7..ff020cd 100644
--- a/Modules/Learning/SOM/include/otbSOM.h
+++ b/Modules/Learning/SOM/include/otbSOM.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SOM/include/otbSOM.txx b/Modules/Learning/SOM/include/otbSOM.txx
index f30b97c..cdc5066 100644
--- a/Modules/Learning/SOM/include/otbSOM.txx
+++ b/Modules/Learning/SOM/include/otbSOM.txx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Learning/SOM/include/otbSOMLearningBehaviorFunctor.h b/Modules/Learning/SOM/include/otbSOMLearningBehaviorFunctor.h
index 3db9aec..4e38167 100644
--- a/Modules/Learning/SOM/include/otbSOMLearningBehaviorFunctor.h
+++ b/Modules/Learning/SOM/include/otbSOMLearningBehaviorFunctor.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SOM/include/otbSOMMap.h b/Modules/Learning/SOM/include/otbSOMMap.h
index 0027647..9135f1c 100644
--- a/Modules/Learning/SOM/include/otbSOMMap.h
+++ b/Modules/Learning/SOM/include/otbSOMMap.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All right reserved.
-See GETCopyright.txt for details.
+See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Learning/SOM/include/otbSOMMap.txx b/Modules/Learning/SOM/include/otbSOMMap.txx
index 9f027e6..e36e4d6 100644
--- a/Modules/Learning/SOM/include/otbSOMMap.txx
+++ b/Modules/Learning/SOM/include/otbSOMMap.txx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom Bretagne. All right reserved.
-See GETCopyright.txt for details.
+See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Learning/SOM/include/otbSOMWithMissingValue.h b/Modules/Learning/SOM/include/otbSOMWithMissingValue.h
index 9421931..51aef37 100644
--- a/Modules/Learning/SOM/include/otbSOMWithMissingValue.h
+++ b/Modules/Learning/SOM/include/otbSOMWithMissingValue.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SOM/include/otbSOMWithMissingValue.txx b/Modules/Learning/SOM/include/otbSOMWithMissingValue.txx
index 0e62e47..2e316af 100644
--- a/Modules/Learning/SOM/include/otbSOMWithMissingValue.txx
+++ b/Modules/Learning/SOM/include/otbSOMWithMissingValue.txx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
@@ -84,13 +84,13 @@ SOMWithMissingValue<TListSample, TMap, TSOMLearningBehaviorFunctor, TSOMNeighbor
 
     // The neighborhood is of elliptic shape
     double theDistance = itk::NumericTraits<double>::Zero;
-    for (int j = 0; j < MapType::ImageDimension; ++j)
+    for (unsigned int j = 0; j < MapType::ImageDimension; ++j)
       theDistance += pow(static_cast<double>(offset[j]), 2.0)
                      / pow(static_cast<double>(radius[j]), 2.0);
 
     if (theDistance <= 1.0)
       {
-      for (int j = 0; j < MapType::ImageDimension; ++j)
+      for (unsigned int j = 0; j < MapType::ImageDimension; ++j)
         {
         int pos = offset[j] + position[j];
         positionToUpdate[j] = (pos >= 0) ?
diff --git a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h
index 47b1fb2..5935f10 100644
--- a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h
+++ b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.txx b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.txx
index a5f9b46..6e6e4f1 100644
--- a/Modules/Learning/SOM/include/otbSOMbasedImageFilter.txx
+++ b/Modules/Learning/SOM/include/otbSOMbasedImageFilter.txx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Learning/SOM/test/otbSOMWithMissingValueNew.cxx b/Modules/Learning/SOM/test/otbSOMWithMissingValueNew.cxx
index 75b8fab..3720430 100644
--- a/Modules/Learning/SOM/test/otbSOMWithMissingValueNew.cxx
+++ b/Modules/Learning/SOM/test/otbSOMWithMissingValueNew.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Learning/SOM/test/otbSOMbasedImageFilterNew.cxx b/Modules/Learning/SOM/test/otbSOMbasedImageFilterNew.cxx
index 8e8bbfc..a47be5f 100644
--- a/Modules/Learning/SOM/test/otbSOMbasedImageFilterNew.cxx
+++ b/Modules/Learning/SOM/test/otbSOMbasedImageFilterNew.cxx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
 
      This software is distributed WITHOUT ANY WARRANTY; without even
diff --git a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h
index 55c06db..e66afd9 100644
--- a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h
+++ b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx
index a10c5ad..cc7ad7f 100644
--- a/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx
+++ b/Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx
@@ -10,7 +10,7 @@
   See OTBCopyright.txt for details.
 
   Copyright (c) Institut Telecom; Telecom bretagne. All rights reserved.
-  See ITCopyright.txt for details.
+  See IMTCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Learning/SVMLearning/include/otbSVMModel.h b/Modules/Learning/SVMLearning/include/otbSVMModel.h
index 682f3d7..f64af6c 100644
--- a/Modules/Learning/SVMLearning/include/otbSVMModel.h
+++ b/Modules/Learning/SVMLearning/include/otbSVMModel.h
@@ -307,6 +307,12 @@ public:
     return static_cast<bool>(m_Parameters.probability);
   }
 
+  /** Test if the model has probabilities */
+  bool HasProbabilities(void) const
+    {
+    return static_cast<bool>(svm_check_probability_model(m_Model));
+    }
+
   /** Return number of support vectors */
   int GetNumberOfSupportVectors(void) const
   {
diff --git a/Modules/Learning/SVMLearning/include/otbSVMModel.txx b/Modules/Learning/SVMLearning/include/otbSVMModel.txx
index 07bc7ee..d7a59f3 100644
--- a/Modules/Learning/SVMLearning/include/otbSVMModel.txx
+++ b/Modules/Learning/SVMLearning/include/otbSVMModel.txx
@@ -464,7 +464,7 @@ SVMModel<TValue, TLabel>::EvaluateProbabilities(const MeasurementType& measure)
     itkExceptionMacro(<< "Model is not up-to-date, can not predict probabilities");
     }
 
-  if (svm_check_probability_model(m_Model) == 0)
+  if (!this->HasProbabilities())
     {
     throw itk::ExceptionObject(__FILE__, __LINE__,
                                "Model does not support probability estimates", ITK_LOCATION);
@@ -622,7 +622,7 @@ SVMModel<TValue, TLabel>::SetSupportVectors(svm_node ** sv, int nbOfSupportVecto
 
 template <class TValue, class TLabel>
 void
-SVMModel<TValue, TLabel>::SetAlpha(double ** alpha, int nbOfSupportVector)
+SVMModel<TValue, TLabel>::SetAlpha(double ** alpha, int itkNotUsed(nbOfSupportVector))
 {
   if (!m_Model)
     {
diff --git a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h
index eb82efc..a812eca 100644
--- a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.h
@@ -40,19 +40,17 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                     InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>       InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>    InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                    TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>              TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType>   TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
-  itkTypeMacro(BoostMachineLearningModel, itk::MachineLearningModel);
+  itkTypeMacro(BoostMachineLearningModel, MachineLearningModel);
 
   /** Setters/Getters to the Boost type
    *  It can be CvBoost::DISCRETE, CvBoost::REAL, CvBoost::LOGIT, CvBoost::GENTLE
@@ -94,12 +92,10 @@ public:
   itkGetMacro(MaxDepth, int);
   itkSetMacro(MaxDepth, int);
 
-
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string & filename, const std::string & name="");
diff --git a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.txx
index 8f6bca1..15a9d5c 100644
--- a/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbBoostMachineLearningModel.txx
@@ -37,6 +37,7 @@ BoostMachineLearningModel<TInputValue,TOutputValue>
  m_SplitCrit(CvBoost::DEFAULT),
  m_MaxDepth(1)
 {
+  this->m_ConfidenceIndex = true;
 }
 
 
@@ -76,7 +77,7 @@ template <class TInputValue, class TOutputValue>
 typename BoostMachineLearningModel<TInputValue,TOutputValue>
 ::TargetSampleType
 BoostMachineLearningModel<TInputValue,TOutputValue>
-::Predict(const InputSampleType & input) const
+::Predict(const InputSampleType & input, ConfidenceValueType *quality) const
 {
   //convert listsample to Mat
   cv::Mat sample;
@@ -91,6 +92,12 @@ BoostMachineLearningModel<TInputValue,TOutputValue>
 
   target[0] = static_cast<TOutputValue>(result);
 
+  if (quality != NULL)
+    {
+    (*quality) = static_cast<ConfidenceValueType>(
+      m_BoostModel->predict(sample,missing,cv::Range::all(),false,true));
+    }
+
   return target;
 }
 
diff --git a/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx b/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx
index 4a08c8a..efe2189 100644
--- a/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx
+++ b/Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx
@@ -70,7 +70,7 @@ ConfusionMatrixCalculator<TRefListLabel, TProdListLabel>
     {
     otbMsgDebugMacro(<< "refLabels size = " << m_ReferenceLabels->Size() <<
                      " / proLabels size = " << m_ProducedLabels->Size());
-    throw itk::ExceptionObject(__FILE__, __LINE__, "ListSample size missmatch", ITK_LOCATION);
+    throw itk::ExceptionObject(__FILE__, __LINE__, "ListSample size mismatch", ITK_LOCATION);
     }
 
   m_NumberOfSamples = m_ReferenceLabels->Size();
diff --git a/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h b/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h
new file mode 100644
index 0000000..536a760
--- /dev/null
+++ b/Modules/Learning/Supervised/include/otbCvRTreesWrapper.h
@@ -0,0 +1,64 @@
+/*=========================================================================
+
+  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 __otbCvRTreesWrapper_h
+#define __otbCvRTreesWrapper_h
+
+#include "otbOpenCVUtils.h"
+#include <vector>
+
+namespace otb
+{
+
+/** \class CvRTreesWrapper
+ * \brief Wrapper for OpenCV Random Trees
+ *
+ * \ingroup OTBSupervised
+ */
+class CV_EXPORTS_W CvRTreesWrapper : public CvRTrees
+{
+public:
+  typedef std::vector<unsigned int> VotesVectorType;
+  CvRTreesWrapper();
+  virtual ~CvRTreesWrapper();
+
+  /** Compute the number of votes for each class. */
+  void get_votes(const cv::Mat& sample, 
+                 const cv::Mat& missing,
+                 VotesVectorType& vote_count) const;
+  
+  /** Predict the confidence of the classifcation by computing the proportion
+      of trees which voted for the majority class.
+  */
+  float predict_confidence(const cv::Mat& sample, 
+                           const cv::Mat& missing = 
+                           cv::Mat()) const;
+
+  /** Predict the confidence margin of the classifcation by computing the 
+      difference in votes between the first and second most voted classes.
+      This measure is preferred to the proportion of votes of the majority
+      class, since it provides information about the conflict between the
+      most likely classes.
+  */
+  float predict_margin(const cv::Mat& sample, 
+                          const cv::Mat& missing = 
+                          cv::Mat()) const;
+};
+
+}
+
+#endif
diff --git a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h
index 6e11039..651a48f 100644
--- a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.h
@@ -40,19 +40,17 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                     InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>       InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>    InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                    TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>              TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType>   TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
-  itkTypeMacro(DecisionTreeMachineLearningModel, itk::MachineLearningModel);
+  itkTypeMacro(DecisionTreeMachineLearningModel, MachineLearningModel);
 
   /** Setters/Getters to the maximum depth of the tree.
    * The maximum possible depth of the tree. That is the training algorithms attempts to split a node
@@ -149,17 +147,10 @@ public:
     return m_Priors;
   }
 
-  /** Setters/Getters to IsRegression flag
-   *  Default is False
-   */
-  itkGetMacro(IsRegression, bool);
-  itkSetMacro(IsRegression, bool);
-
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string & filename, const std::string & name="");
@@ -199,7 +190,6 @@ private:
   int m_MaxCategories;
   int m_CVFolds;
   bool m_Use1seRule;
-  bool m_IsRegression;
   bool m_TruncatePrunedTree;
   std::vector<float> m_Priors;
 
diff --git a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.txx
index 3bed1a3..283fb03 100644
--- a/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbDecisionTreeMachineLearningModel.txx
@@ -38,9 +38,9 @@ DecisionTreeMachineLearningModel<TInputValue,TOutputValue>
  m_MaxCategories(10),
  m_CVFolds(10),
  m_Use1seRule(true),
- m_IsRegression(false),
  m_TruncatePrunedTree(true)
 {
+  this->m_IsRegressionSupported = true;
 }
 
 
@@ -73,7 +73,7 @@ DecisionTreeMachineLearningModel<TInputValue,TOutputValue>
   cv::Mat var_type = cv::Mat(this->GetInputListSample()->GetMeasurementVectorSize() + 1, 1, CV_8U );
   var_type.setTo(cv::Scalar(CV_VAR_NUMERICAL) ); // all inputs are numerical
 
-  if (!m_IsRegression) //Classification
+  if (!this->m_RegressionMode) //Classification
     var_type.at<uchar>(this->GetInputListSample()->GetMeasurementVectorSize(), 0) = CV_VAR_CATEGORICAL;
 
   m_DTreeModel->train(samples,CV_ROW_SAMPLE,labels,cv::Mat(),cv::Mat(),var_type,cv::Mat(),params);
@@ -83,7 +83,7 @@ template <class TInputValue, class TOutputValue>
 typename DecisionTreeMachineLearningModel<TInputValue,TOutputValue>
 ::TargetSampleType
 DecisionTreeMachineLearningModel<TInputValue,TOutputValue>
-::Predict(const InputSampleType & input) const
+::Predict(const InputSampleType & input, ConfidenceValueType *quality) const
 {
   //convert listsample to Mat
   cv::Mat sample;
@@ -96,6 +96,14 @@ DecisionTreeMachineLearningModel<TInputValue,TOutputValue>
 
   target[0] = static_cast<TOutputValue>(result);
 
+  if (quality != NULL)
+    {
+    if (!this->m_ConfidenceIndex)
+      {
+      itkExceptionMacro("Confidence index not available for this classifier !");
+      }
+    }
+
   return target;
 }
 
diff --git a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h
index ffec57b..f10a89c 100644
--- a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.h
@@ -40,19 +40,17 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                     InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>       InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>    InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                    TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>              TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType>   TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
-  itkTypeMacro(GradientBoostedTreeMachineLearningModel, itk::MachineLearningModel);
+  itkTypeMacro(GradientBoostedTreeMachineLearningModel, MachineLearningModel);
 
   /** Type of the loss function used for training.
    * It must be one of the following types: CvGBTrees::SQUARED_LOSS, CvGBTrees::ABSOLUTE_LOSS,
@@ -102,12 +100,10 @@ public:
   itkGetMacro(UseSurrogates, bool);
   itkSetMacro(UseSurrogates, bool);
 
-
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string & filename, const std::string & name="");
@@ -146,7 +142,6 @@ private:
   double m_SubSamplePortion;
   int m_MaxDepth;
   bool m_UseSurrogates;
-  bool m_IsRegression;
 
 
 };
diff --git a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.txx
index 21e8b5f..d08abec 100644
--- a/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbGradientBoostedTreeMachineLearningModel.txx
@@ -36,9 +36,9 @@ GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue>
  m_Shrinkage(0.01),
  m_SubSamplePortion(0.8),
  m_MaxDepth(3),
- m_UseSurrogates(false),
- m_IsRegression(false)
+ m_UseSurrogates(false)
 {
+  this->m_IsRegressionSupported = true;
 }
 
 
@@ -62,7 +62,6 @@ GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue>
   cv::Mat labels;
   otb::ListSampleToMat<TargetListSampleType>(this->GetTargetListSample(),labels);
 
-
   CvGBTreesParams params = CvGBTreesParams(m_LossFunctionType, m_WeakCount, m_Shrinkage, m_SubSamplePortion,
                                            m_MaxDepth, m_UseSurrogates);
 
@@ -70,7 +69,7 @@ GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue>
   cv::Mat var_type = cv::Mat(this->GetInputListSample()->GetMeasurementVectorSize() + 1, 1, CV_8U );
   var_type.setTo(cv::Scalar(CV_VAR_NUMERICAL) ); // all inputs are numerical
 
-  if (!m_IsRegression) //Classification
+  if (!this->m_RegressionMode) //Classification
     var_type.at<uchar>(this->GetInputListSample()->GetMeasurementVectorSize(), 0) = CV_VAR_CATEGORICAL;
 
   m_GBTreeModel->train(samples,CV_ROW_SAMPLE,labels,cv::Mat(),cv::Mat(),var_type,cv::Mat(),params, false);
@@ -80,7 +79,7 @@ template <class TInputValue, class TOutputValue>
 typename GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue>
 ::TargetSampleType
 GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue>
-::Predict(const InputSampleType & input) const
+::Predict(const InputSampleType & input, ConfidenceValueType *quality) const
 {
   //convert listsample to Mat
   cv::Mat sample;
@@ -93,6 +92,14 @@ GradientBoostedTreeMachineLearningModel<TInputValue,TOutputValue>
 
   target[0] = static_cast<TOutputValue>(result);
 
+  if (quality != NULL)
+    {
+    if (!this->m_ConfidenceIndex)
+      {
+      itkExceptionMacro("Confidence index not available for this classifier !");
+      }
+    }
+
   return target;
 }
 
diff --git a/Modules/Learning/Supervised/include/otbImageClassificationFilter.h b/Modules/Learning/Supervised/include/otbImageClassificationFilter.h
index 2c79315..f6ed68a 100644
--- a/Modules/Learning/Supervised/include/otbImageClassificationFilter.h
+++ b/Modules/Learning/Supervised/include/otbImageClassificationFilter.h
@@ -20,6 +20,7 @@
 
 #include "itkImageToImageFilter.h"
 #include "otbMachineLearningModel.h"
+#include "otbImage.h"
 
 namespace otb
 {
@@ -68,6 +69,9 @@ public:
   typedef MachineLearningModel<ValueType, LabelType> ModelType;
   typedef typename ModelType::Pointer    ModelPointerType;
 
+  typedef otb::Image<double>                    ConfidenceImageType;
+  typedef typename ConfidenceImageType::Pointer ConfidenceImagePointerType;
+
   /** Set/Get the model */
   itkSetObjectMacro(Model, ModelType);
   itkGetObjectMacro(Model, ModelType);
@@ -76,6 +80,10 @@ public:
   itkSetMacro(DefaultLabel, LabelType);
   itkGetMacro(DefaultLabel, LabelType);
 
+  /** Set/Get the confidence map flag */
+  itkSetMacro(UseConfidenceMap, bool);
+  itkGetMacro(UseConfidenceMap, bool);
+
   /**
    * If set, only pixels within the mask will be classified.
    * All pixels with a value greater than 0 in the mask, will be classified.
@@ -89,6 +97,11 @@ public:
    */
   const MaskImageType * GetInputMask(void);
 
+  /**
+   * Get the output confidence map
+   */
+  ConfidenceImageType * GetOutputConfidence(void);
+
 protected:
   /** Constructor */
   ImageClassificationFilter();
@@ -110,7 +123,8 @@ private:
   ModelPointerType m_Model;
   /** Default label for invalid pixels (when using a mask) */
   LabelType m_DefaultLabel;
-
+  /** Flag to produce the confidence map (if the model supports it) */
+  bool m_UseConfidenceMap;
 };
 } // End namespace otb
 #ifndef OTB_MANUAL_INSTANTIATION
diff --git a/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx b/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx
index 06225af..b0a5d5e 100644
--- a/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx
+++ b/Modules/Learning/Supervised/include/otbImageClassificationFilter.txx
@@ -34,6 +34,11 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
   this->SetNumberOfIndexedInputs(2);
   this->SetNumberOfRequiredInputs(1);
   m_DefaultLabel = itk::NumericTraits<LabelType>::ZeroValue();
+
+  this->SetNumberOfRequiredOutputs(2);
+  this->SetNthOutput(0,TOutputImage::New());
+  this->SetNthOutput(1,ConfidenceImageType::New());
+  m_UseConfidenceMap = false;
 }
 
 template <class TInputImage, class TOutputImage, class TMaskImage>
@@ -58,6 +63,19 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
 }
 
 template <class TInputImage, class TOutputImage, class TMaskImage>
+typename ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
+::ConfidenceImageType *
+ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
+::GetOutputConfidence()
+{
+  if (this->GetNumberOfOutputs() < 2)
+    {
+    return 0;
+    }
+  return static_cast<ConfidenceImageType *>(this->itk::ProcessObject::GetOutput(1));
+}
+
+template <class TInputImage, class TOutputImage, class TMaskImage>
 void
 ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
 ::BeforeThreadedGenerateData()
@@ -77,6 +95,7 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
   InputImageConstPointerType inputPtr     = this->GetInput();
   MaskImageConstPointerType  inputMaskPtr  = this->GetInputMask();
   OutputImagePointerType     outputPtr    = this->GetOutput();
+  ConfidenceImagePointerType confidencePtr = this->GetOutputConfidence();
 
   // Progress reporting
   itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels());
@@ -85,6 +104,7 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
   typedef itk::ImageRegionConstIterator<InputImageType> InputIteratorType;
   typedef itk::ImageRegionConstIterator<MaskImageType>  MaskIteratorType;
   typedef itk::ImageRegionIterator<OutputImageType>     OutputIteratorType;
+  typedef itk::ImageRegionIterator<ConfidenceImageType> ConfidenceMapIteratorType;
 
   InputIteratorType inIt(inputPtr, outputRegionForThread);
   OutputIteratorType outIt(outputPtr, outputRegionForThread);
@@ -97,7 +117,17 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
     maskIt.GoToBegin();
     }
 
+  // setup iterator for confidence map
+  bool computeConfidenceMap(m_UseConfidenceMap && m_Model->HasConfidenceIndex() && !m_Model->GetRegressionMode());
+  ConfidenceMapIteratorType confidenceIt;
+  if (computeConfidenceMap)
+    {
+    confidenceIt = ConfidenceMapIteratorType(confidencePtr,outputRegionForThread);
+    confidenceIt.GoToBegin();
+    }
+
   bool validPoint = true;
+  double confidenceIndex = 0.0;
 
   // Walk the part of the image
   for (inIt.GoToBegin(), outIt.GoToBegin(); !inIt.IsAtEnd() && !outIt.IsAtEnd(); ++inIt, ++outIt)
@@ -112,12 +142,25 @@ ImageClassificationFilter<TInputImage, TOutputImage, TMaskImage>
     if (validPoint)
       {
       // Classifify
-      outIt.Set(m_Model->Predict(inIt.Get())[0]);
+      if (computeConfidenceMap)
+        {
+        outIt.Set(m_Model->Predict(inIt.Get(),&confidenceIndex)[0]);
+        }
+      else
+        {
+        outIt.Set(m_Model->Predict(inIt.Get())[0]);
+        }
       }
     else
       {
       // else, set default value
       outIt.Set(m_DefaultLabel);
+      confidenceIndex = 0.0;
+      }
+    if (computeConfidenceMap)
+      {
+      confidenceIt.Set(confidenceIndex);
+      ++confidenceIt;
       }
     progress.CompletedPixel();
     }
diff --git a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h
index a456086..3f29a10 100644
--- a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.h
@@ -39,19 +39,17 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                     InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>       InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>    InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                    TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>              TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType>   TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
-  itkTypeMacro(KNearestNeighborsMachineLearningModel, itk::MachineLearningModel);
+  itkTypeMacro(KNearestNeighborsMachineLearningModel, MachineLearningModel);
 
   /** Setters/Getters to the number of neighbors to use
    *  Default is 32
@@ -60,18 +58,23 @@ public:
   itkGetMacro(K, int);
   itkSetMacro(K, int);
 
-  /** Setters/Getters to IsRegression flag
-   *  Default is False
-   *  \see http://docs.opencv.org/modules/ml/doc/k_nearest_neighbors.html
+  /** Decision rule once the KNN are found :
+   *  [for classification]
+   *   - KNN_VOTING : output value with maximum occurences (for classification)
+   *  [for regression]
+   *   - KNN_MEAN : output mean value of neighbors
+   *   - KNN_MEDIAN : output median value of neighbors
    */
-  itkGetMacro(IsRegression, bool);
-  itkSetMacro(IsRegression, bool);
+  enum {KNN_VOTING, KNN_MEAN, KNN_MEDIAN};
+
+  /** Setters/Getters to the decision rule */
+  itkGetMacro(DecisionRule, int);
+  itkSetMacro(DecisionRule, int);
 
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string & filename, const std::string & name="");
@@ -104,7 +107,8 @@ private:
 
   CvKNearest * m_KNearestModel;
   int m_K;
-  bool m_IsRegression;
+
+  int m_DecisionRule;
 };
 } // end namespace otb
 
diff --git a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx
index d313220..fd33b7c 100644
--- a/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbKNearestNeighborsMachineLearningModel.txx
@@ -23,6 +23,7 @@
 #include "otbOpenCVUtils.h"
 
 #include <fstream>
+#include <set>
 #include "itkMacro.h"
 
 namespace otb
@@ -33,8 +34,10 @@ KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
 ::KNearestNeighborsMachineLearningModel() :
  m_KNearestModel (new CvKNearest),
  m_K(32),
- m_IsRegression(false)
+ m_DecisionRule(KNN_VOTING)
 {
+  this->m_ConfidenceIndex = true;
+  this->m_IsRegressionSupported = true;
 }
 
 
@@ -58,26 +61,75 @@ KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
   cv::Mat labels;
   otb::ListSampleToMat<TargetListSampleType>(this->GetTargetListSample(), labels);
 
+  // update decision rule if needed
+  if (this->m_RegressionMode)
+    {
+    if (this->m_DecisionRule == KNN_VOTING)
+      {
+      this->SetDecisionRule(KNN_MEAN);
+      }
+    }
+  else
+    {
+    if (this->m_DecisionRule != KNN_VOTING)
+      {
+      this->SetDecisionRule(KNN_VOTING);
+      }
+    }
+
   //train the KNN model
-  m_KNearestModel->train(samples, labels, cv::Mat(), m_IsRegression, m_K, false);
+  m_KNearestModel->train(samples, labels, cv::Mat(), this->m_RegressionMode, m_K, false);
 }
 
 template <class TInputValue, class TTargetValue>
 typename KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
 ::TargetSampleType
 KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
-::Predict(const InputSampleType & input) const
+::Predict(const InputSampleType & input, ConfidenceValueType *quality) const
 {
   //convert listsample to Mat
   cv::Mat sample;
   otb::SampleToMat<InputSampleType>(input, sample);
 
-  double result = m_KNearestModel->find_nearest(sample, m_K);
+  float result;
+  cv::Mat nearest(1,m_K,CV_32FC1);
+  result = m_KNearestModel->find_nearest(sample, m_K,0,0,&nearest,0);
+
+  // compute quality if asked (only happens in classification mode)
+  if (quality != NULL)
+    {
+    assert(!this->m_RegressionMode);
+    unsigned int accuracy = 0;
+    for (int k=0 ; k < m_K ; ++k)
+      {
+      if (nearest.at<float>(0,k) == result)
+        {
+        accuracy++;
+        }
+      }
+    (*quality) = static_cast<ConfidenceValueType>(accuracy);
+    }
+
+  // Decision rule :
+  //  VOTING is OpenCV default behaviour for classification
+  //  MEAN is OpenCV default behaviour for regression
+  //  MEDIAN : only case that must be handled here
+  if (this->m_DecisionRule == KNN_MEDIAN)
+    {
+    std::multiset<float> values;
+    for (int k=0 ; k < m_K ; ++k)
+      {
+      values.insert(nearest.at<float>(0,k));
+      }
+    std::multiset<float>::iterator median = values.begin();
+    int pos = (m_K >> 1);
+    for (int k=0 ; k < pos ; ++k , ++median) {}
+    result = *median;
+    }
 
   TargetSampleType target;
 
   target[0] = static_cast<TTargetValue>(result);
-
   return target;
 }
 
@@ -87,12 +139,17 @@ KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
 ::Save(const std::string & filename, const std::string & itkNotUsed(name))
 {
   //there is no m_KNearestModel->save(filename.c_str(), name.c_str()).
-  //We need to save the K parameter and IsRegression flag used and the samples.
+  //We need to save the K parameter, IsRegression flag, DecisionRule and the samples.
 
   std::ofstream ofs(filename.c_str());
   //Save K parameter and IsRegression flag.
   ofs << "K=" << m_K << "\n";
-  ofs << "IsRegression=" << m_IsRegression << "\n";
+  ofs << "IsRegression=" << this->m_RegressionMode << "\n";
+  // Save the DecisionRule if regression
+  if (this->m_RegressionMode)
+    {
+    ofs << "DecisionRule=" << m_DecisionRule << "\n";
+    }
 
   //Save the samples. First column is the Label and other columns are the sample data.
   typename InputListSampleType::ConstIterator sampleIt = this->GetInputListSample()->Begin();
@@ -135,8 +192,15 @@ KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
   std::getline(ifs, line);
   pos = line.find_first_of("=", 0);
   nextpos = line.find_first_of(" \n\r", pos+1);
-  this->SetIsRegression(boost::lexical_cast<bool>(line.substr(pos+1, nextpos-pos-1)));
-
+  this->SetRegressionMode(boost::lexical_cast<bool>(line.substr(pos+1, nextpos-pos-1)));
+  //third line is the DecisionRule parameter (only for regression)
+  if (this->m_RegressionMode)
+    {
+    std::getline(ifs, line);
+    pos = line.find_first_of("=", 0);
+    nextpos = line.find_first_of(" \n\r", pos+1);
+    this->SetDecisionRule(boost::lexical_cast<int>(line.substr(pos+1, nextpos-pos-1)));
+    }
   //Clear previous listSample (if any)
   typename InputListSampleType::Pointer samples = InputListSampleType::New();
   typename TargetListSampleType::Pointer labels = TargetListSampleType::New();
@@ -181,7 +245,7 @@ KNearestNeighborsMachineLearningModel<TInputValue,TTargetValue>
 
   this->SetInputListSample(samples);
   this->SetTargetListSample(labels);
-  Train();
+  this->Train();
 }
 
 template <class TInputValue, class TTargetValue>
diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h
index 3c49700..6229237 100644
--- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h
@@ -40,15 +40,13 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                     InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>       InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>    InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                    TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>              TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType>   TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
 
   // LibSVM related typedefs
   typedef otb::Functor::VariableLengthVectorToMeasurementVectorFunctor<InputSampleType> MeasurementVectorFunctorType;
@@ -59,13 +57,12 @@ public:
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
-  itkTypeMacro(SVMMachineLearningModel, itk::MachineLearningModel);
+  itkTypeMacro(SVMMachineLearningModel, MachineLearningModel);
 
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string &filename, const std::string & name="");
@@ -83,23 +80,40 @@ public:
   //@}
 
   //Setters/Getters to SVM model
-  // itkGetMacro(SVMType, int);
-  // itkSetMacro(SVMType, int);
+  otbGetObjectMemberMacro(SVMestimator, SVMType, int);
+  otbSetObjectMemberMacro(SVMestimator, SVMType, int);
+
+  otbGetObjectMemberMacro(SVMestimator, KernelType, int);
+  otbSetObjectMemberMacro(SVMestimator, KernelType, int);
+
+  otbGetObjectMemberMacro(SVMestimator, C, double);
+  otbSetObjectMemberMacro(SVMestimator, C, double);
+
+  // TODO : we should harmonize this parameter name : ParameterOptimization -> ParametersOptimization
+  bool GetParameterOptimization()
+    {
+    return this->m_SVMestimator->GetParametersOptimization();
+    }
+  void SetParameterOptimization(bool value)
+    {
+    this->m_SVMestimator->SetParametersOptimization(value);
+    this->Modified();
+    }
 
-  itkGetMacro(KernelType, int);
-  itkSetMacro(KernelType, int);
+  otbGetObjectMemberMacro(SVMestimator, DoProbabilityEstimates, bool);
+  void SetDoProbabilityEstimates(bool value)
+    {
+    this->m_SVMestimator->DoProbabilityEstimates(value);
+    }
 
-  itkGetMacro(C, float);
-  itkSetMacro(C, float);
+  otbGetObjectMemberMacro(SVMestimator, Epsilon, double);
+  otbSetObjectMemberMacro(SVMestimator, Epsilon, double);
 
-  itkGetMacro(ParameterOptimization, bool);
-  itkSetMacro(ParameterOptimization, bool);
- 
-  itkGetMacro(DoProbabilityEstimates, bool);
-  itkSetMacro(DoProbabilityEstimates, bool);
+  otbGetObjectMemberMacro(SVMestimator, P, double);
+  otbSetObjectMemberMacro(SVMestimator, P, double);
 
-  // itkGetMacro(Epsilon, int);
-  // itkSetMacro(Epsilon, int);
+  otbGetObjectMemberMacro(SVMestimator, Nu, double);
+  otbSetObjectMemberMacro(SVMestimator, Nu, double);
 
 protected:
   /** Constructor */
@@ -115,10 +129,6 @@ private:
   LibSVMMachineLearningModel(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
 
-  int m_KernelType;
-  float m_C;
-  bool m_ParameterOptimization;
-  bool m_DoProbabilityEstimates;
   typename SVMEstimatorType::Pointer m_SVMestimator;
 };
 } // end namespace otb
diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx
index bbdbc02..e95e975 100644
--- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx
@@ -20,10 +20,6 @@
 
 #include <fstream>
 #include "otbLibSVMMachineLearningModel.h"
-//#include "otbOpenCVUtils.h"
-
-// SVM estimator
-//#include "otbSVMSampleListModelEstimator.h"
 
 namespace otb
 {
@@ -32,15 +28,14 @@ template <class TInputValue, class TOutputValue>
 LibSVMMachineLearningModel<TInputValue,TOutputValue>
 ::LibSVMMachineLearningModel()
 {
-  // m_SVMModel = new CvSVM;
-  // m_SVMType = CvSVM::C_SVC;
-  m_KernelType = LINEAR;
-  // m_TermCriteriaType = CV_TERMCRIT_ITER;
-  m_C = 1.0;
-  // m_Epsilon = 1e-6;
-  m_ParameterOptimization = false;
-  m_DoProbabilityEstimates = false;
   m_SVMestimator = SVMEstimatorType::New();
+  m_SVMestimator->SetSVMType(C_SVC);
+  m_SVMestimator->SetC(1.0);
+  m_SVMestimator->SetKernelType(LINEAR);
+  m_SVMestimator->SetParametersOptimization(false);
+  m_SVMestimator->DoProbabilityEstimates(false);
+  //m_SVMestimator->SetEpsilon(1e-6);
+  this->m_IsRegressionSupported = true;
 }
 
 
@@ -64,32 +59,51 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue>
   // params.term_crit   = cvTermCriteria(m_TermCriteriaType, m_MaxIter, m_Epsilon);
 
   // // Train the SVM
-
-  m_SVMestimator->SetC(m_C);
-  m_SVMestimator->SetKernelType(m_KernelType);
-  m_SVMestimator->SetParametersOptimization(m_ParameterOptimization);
-  m_SVMestimator->DoProbabilityEstimates(m_DoProbabilityEstimates);
-
   m_SVMestimator->SetInputSampleList(this->GetInputListSample());
   m_SVMestimator->SetTrainingSampleList(this->GetTargetListSample());
 
   m_SVMestimator->Update();
+
+  this->m_ConfidenceIndex = this->GetDoProbabilityEstimates();
 }
 
 template <class TInputValue, class TOutputValue>
 typename LibSVMMachineLearningModel<TInputValue,TOutputValue>
 ::TargetSampleType
 LibSVMMachineLearningModel<TInputValue,TOutputValue>
-::Predict(const InputSampleType & input) const
+::Predict(const InputSampleType & input, ConfidenceValueType *quality) const
 {
   TargetSampleType target;
 
-  otbMsgDevMacro(<< "Starting iterations ");
-
   MeasurementVectorFunctorType mfunctor;
 
   target = m_SVMestimator->GetModel()->EvaluateLabel(mfunctor(input));
 
+  if (quality != NULL)
+    {
+    if (!this->m_ConfidenceIndex)
+      {
+      itkExceptionMacro("Confidence index not available for this classifier !");
+      }
+    typename SVMEstimatorType::ModelType::ProbabilitiesVectorType probaVector =
+        m_SVMestimator->GetModel()->EvaluateProbabilities(mfunctor(input));
+    double maxProb = 0.0;
+    double secProb = 0.0;
+    for (unsigned int i=0 ; i<probaVector.Size() ; ++i)
+      {
+      if (maxProb < probaVector[i])
+        {
+          secProb = maxProb;
+          maxProb = probaVector[i];
+        }
+      else if (secProb < probaVector[i])
+        {
+          secProb = probaVector[i];
+        }
+      }
+    (*quality) = static_cast<ConfidenceValueType>(maxProb - secProb);
+    }
+
   return target;
 }
 
@@ -107,6 +121,8 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue>
 ::Load(const std::string & filename, const std::string & itkNotUsed(name))
 {
   m_SVMestimator->GetModel()->LoadModel(filename.c_str());
+
+  this->m_ConfidenceIndex = m_SVMestimator->GetModel()->HasProbabilities();
 }
 
 template <class TInputValue, class TOutputValue>
@@ -114,28 +130,28 @@ bool
 LibSVMMachineLearningModel<TInputValue,TOutputValue>
 ::CanReadFile(const std::string & file)
 {
-   //TODO: Rework.
-   std::ifstream ifs;
-   ifs.open(file.c_str());
-
-   if(!ifs)
-   {
-      std::cerr<<"Could not read file "<<file<<std::endl;
-      return false;
-   }
-
-   //Read only the first line.
-   std::string line;
-   std::getline(ifs, line);
-
-   //if (line.find(m_SVMModel->getName()) != std::string::npos)
-   if (line.find("svm_type") != std::string::npos)
-   {
-      //std::cout<<"Reading a libSVM model"<<std::endl;
-      return true;
-   }
-   ifs.close();
-   return false;
+  //TODO: Rework.
+  std::ifstream ifs;
+  ifs.open(file.c_str());
+
+  if(!ifs)
+    {
+    std::cerr<<"Could not read file "<<file<<std::endl;
+    return false;
+    }
+
+  //Read only the first line.
+  std::string line;
+  std::getline(ifs, line);
+
+  //if (line.find(m_SVMModel->getName()) != std::string::npos)
+  if (line.find("svm_type") != std::string::npos)
+    {
+    //std::cout<<"Reading a libSVM model"<<std::endl;
+    return true;
+    }
+  ifs.close();
+  return false;
 }
 
 template <class TInputValue, class TOutputValue>
diff --git a/Modules/Core/Common/include/otbMachineLearningModel.h b/Modules/Learning/Supervised/include/otbMachineLearningModel.h
similarity index 84%
rename from Modules/Core/Common/include/otbMachineLearningModel.h
rename to Modules/Learning/Supervised/include/otbMachineLearningModel.h
index 9ecd77e..b18e39e 100644
--- a/Modules/Core/Common/include/otbMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbMachineLearningModel.h
@@ -58,9 +58,9 @@ namespace otb
  * \sa ImageClassificationFilter
  *
  *
- * \ingroup OTBCommon
+ * \ingroup OTBSupervised
  */
-template <class TInputValue, class TTargetValue>
+template <class TInputValue, class TTargetValue, class TConfidenceValue = double >
 class ITK_EXPORT MachineLearningModel
   : public itk::Object
 {
@@ -87,6 +87,9 @@ public:
   typedef itk::Statistics::ListSample<TargetSampleType> TargetListSampleType;
   //@}
 
+  /**\name Confidence value typedef */
+  typedef TConfidenceValue                              ConfidenceValueType;
+
   /**\name Standard macros */
   //@{
   /** Run-time type information (and related methods). */
@@ -94,10 +97,10 @@ public:
   //@}
 
   /** Train the machine learning model */
-  virtual void Train() = 0;
+  virtual void Train() =0;
 
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType& input) const = 0;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality = NULL) const = 0;
 
   /** Classify all samples in InputListSample and fill TargetListSample with the associated label */
   void PredictAll();
@@ -120,6 +123,9 @@ public:
   virtual bool CanWriteFile(const std::string &)  = 0;
   //@}
 
+  /** Query capacity to produce a confidence index */
+  bool HasConfidenceIndex() const {return m_ConfidenceIndex;}
+
   /**\name Input list of samples accessors */
   //@{
   itkSetObjectMacro(InputListSample,InputListSampleType);
@@ -134,6 +140,12 @@ public:
   itkGetObjectMacro(TargetListSample,TargetListSampleType);
   //@}
 
+  /**\name Use model in regression mode */
+  //@{
+  itkGetMacro(RegressionMode,bool);
+  void SetRegressionMode(bool flag);
+  //@}
+
 protected:
   /** Constructor */
   MachineLearningModel();
@@ -150,6 +162,16 @@ protected:
   /** Target list sample */
   typename TargetListSampleType::Pointer m_TargetListSample;
 
+  /** flag to choose between classification and regression modes */
+  bool m_RegressionMode;
+  
+  /** flag that indicates if the model supports regression, child
+   *  classes should modify it in their constructor if they support
+   *  regression mode */
+  bool m_IsRegressionSupported;
+
+  /** flag that tells if the model support confidence index output */
+  bool m_ConfidenceIndex;
 private:
   MachineLearningModel(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
diff --git a/Modules/Core/Common/include/otbMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbMachineLearningModel.txx
similarity index 53%
rename from Modules/Core/Common/include/otbMachineLearningModel.txx
rename to Modules/Learning/Supervised/include/otbMachineLearningModel.txx
index 9281aa2..8cc8205 100644
--- a/Modules/Core/Common/include/otbMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbMachineLearningModel.txx
@@ -23,20 +23,39 @@
 namespace otb
 {
 
-template <class TInputValue, class TOutputValue>
-MachineLearningModel<TInputValue,TOutputValue>
-::MachineLearningModel()
+template <class TInputValue, class TOutputValue, class TConfidenceValue>
+MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue>
+::MachineLearningModel() :
+  m_RegressionMode(false),
+  m_IsRegressionSupported(false),
+  m_ConfidenceIndex(false)
 {}
 
 
-template <class TInputValue, class TOutputValue>
-MachineLearningModel<TInputValue,TOutputValue>
+template <class TInputValue, class TOutputValue, class TConfidenceValue>
+MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue>
 ::~MachineLearningModel()
 {}
 
-template <class TInputValue, class TOutputValue>
+template <class TInputValue, class TOutputValue, class TConfidenceValue>
 void
-MachineLearningModel<TInputValue,TOutputValue>
+MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue>
+::SetRegressionMode(bool flag)
+{
+  if (flag && !m_IsRegressionSupported)
+    {
+    itkGenericExceptionMacro(<< "Regression mode not implemented.");
+    }
+  if (m_RegressionMode != flag)
+    {
+    m_RegressionMode = flag;
+    this->Modified();
+    }
+}
+
+template <class TInputValue, class TOutputValue, class TConfidenceValue>
+void
+MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue>
 ::PredictAll()
 {
   TargetListSampleType * targets = this->GetTargetListSample();
@@ -49,9 +68,9 @@ MachineLearningModel<TInputValue,TOutputValue>
     }
 }
 
-template <class TInputValue, class TOutputValue>
+template <class TInputValue, class TOutputValue, class TConfidenceValue>
 void
-MachineLearningModel<TInputValue,TOutputValue>
+MachineLearningModel<TInputValue,TOutputValue,TConfidenceValue>
 ::PrintSelf(std::ostream& os, itk::Indent indent) const
 {
   // Call superclass implementation
diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h
index ff2d6de..8f4f182 100644
--- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.h
@@ -21,8 +21,25 @@
 #include "otbRequiresOpenCVCheck.h"
 
 #include <opencv2/core/core_c.h>
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-align"
+#include <opencv2/core/core.hpp>
+#pragma GCC diagnostic pop
+#else
 #include <opencv2/core/core.hpp>
+#endif
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#include <opencv2/ml/ml.hpp>
+#pragma GCC diagnostic pop
+#else
 #include <opencv2/ml/ml.hpp>
+#endif
+
 #include "itkLightObject.h"
 #include "itkFixedArray.h"
 #include "otbMachineLearningModel.h"
@@ -40,21 +57,19 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                     InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>       InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>    InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                    TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>              TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType>   TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
 
   typedef std::map<TargetValueType, unsigned int>         MapOfLabelsType;
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
-  itkTypeMacro(NeuralNetworkMachineLearningModel, itk::MachineLearningModel);
+  itkTypeMacro(NeuralNetworkMachineLearningModel, MachineLearningModel);
 
   /** Setters/Getters to the train method
    *  2 methods are available:
@@ -155,9 +170,8 @@ public:
 
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string & filename, const std::string & name="");
@@ -190,6 +204,10 @@ private:
   NeuralNetworkMachineLearningModel(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
 
+  void CreateNetwork();
+  CvANN_MLP_TrainParams SetNetworkParameters();
+  void SetupNetworkAndTrain(cv::Mat& labels);
+
   CvANN_MLP * m_ANNModel;
   int m_TrainMethod;
   int m_ActivateFunction;
diff --git a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx
index 8a63062..f55eb53 100644
--- a/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbNeuralNetworkMachineLearningModel.txx
@@ -42,6 +42,8 @@ NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::NeuralNetworkMachi
   m_Epsilon(0.01),
   m_CvMatOfLabels(0)
 {
+  this->m_ConfidenceIndex = true;
+  this->m_IsRegressionSupported = true;
 }
 
 template<class TInputValue, class TOutputValue>
@@ -51,7 +53,7 @@ NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::~NeuralNetworkMach
   cvReleaseMat(&m_CvMatOfLabels);
 }
 
-/** Train the machine learning model */
+/** Sets the topology of the NN */
 template<class TInputValue, class TOutputValue>
 void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::SetLayerSizes(const std::vector<unsigned int> layers)
 {
@@ -71,10 +73,14 @@ template<class TInputValue, class TOutputValue>
 void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::LabelsToMat(const TargetListSampleType * labels,
                                                                                cv::Mat & output)
 {
-  unsigned int nbSamples = labels->Size();
+  unsigned int nbSamples = 0;
+  if (labels != NULL)
+    {
+    nbSamples = labels->Size();
+    }
 
   // Check for valid listSample
-  if (labels != NULL && nbSamples > 0)
+  if (nbSamples > 0)
     {
     // Build an iterator
     typename TargetListSampleType::ConstIterator labelSampleIt = labels->Begin();
@@ -129,9 +135,8 @@ void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::LabelsToMat(c
     }
 }
 
-/** Train the machine learning model */
 template<class TInputValue, class TOutputValue>
-void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Train()
+void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::CreateNetwork()
 {
   //Create the neural network
   const unsigned int nbLayers = m_LayerSizes.size();
@@ -146,14 +151,11 @@ void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Train()
     }
 
   m_ANNModel->create(layers, m_ActivateFunction, m_Alpha, m_Beta);
+}
 
-  //convert listsample to opencv matrix
-  cv::Mat samples;
-  otb::ListSampleToMat<InputListSampleType>(this->GetInputListSample(), samples);
-
-  cv::Mat matOutputANN;
-  LabelsToMat(this->GetTargetListSample(), matOutputANN);
-
+template<class TInputValue, class TOutputValue>
+CvANN_MLP_TrainParams NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::SetNetworkParameters()
+{
   CvANN_MLP_TrainParams params;
   params.train_method = m_TrainMethod;
   params.bp_dw_scale = m_BackPropDWScale;
@@ -162,14 +164,43 @@ void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Train()
   params.rp_dw_min = m_RegPropDWMin;
   CvTermCriteria term_crit = cvTermCriteria(m_TermCriteriaType, m_MaxIter, m_Epsilon);
   params.term_crit = term_crit;
+  return params;
+}
 
+template<class TInputValue, class TOutputValue>
+void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::SetupNetworkAndTrain(cv::Mat& labels)
+{
+  //convert listsample to opencv matrix
+  cv::Mat samples;
+  otb::ListSampleToMat<InputListSampleType>(this->GetInputListSample(), samples);
+  this->CreateNetwork();
+  CvANN_MLP_TrainParams params = this->SetNetworkParameters();
   //train the Neural network model
-  m_ANNModel->train(samples, matOutputANN, cv::Mat(), cv::Mat(), params);
+  m_ANNModel->train(samples, labels, cv::Mat(), cv::Mat(), params);
+}
+
+/** Train the machine learning model for classification*/
+template<class TInputValue, class TOutputValue>
+void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Train()
+{
+  //Transform the targets into a matrix of labels
+  cv::Mat matOutputANN;
+  if (this->m_RegressionMode)
+    {
+    // MODE REGRESSION
+    otb::ListSampleToMat<TargetListSampleType>(this->GetTargetListSample(), matOutputANN);
+    }
+  else
+    {
+    // MODE CLASSIFICATION : store the map between internal labels and output labels
+    LabelsToMat(this->GetTargetListSample(), matOutputANN);
+    }
+  this->SetupNetworkAndTrain(matOutputANN);
 }
 
 template<class TInputValue, class TOutputValue>
 typename NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::TargetSampleType NeuralNetworkMachineLearningModel<
-    TInputValue, TOutputValue>::Predict(const InputSampleType & input) const
+  TInputValue, TOutputValue>::Predict(const InputSampleType & input, ConfidenceValueType *quality) const
 {
   //convert listsample to Mat
   cv::Mat sample;
@@ -182,6 +213,16 @@ typename NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::TargetSam
   TargetSampleType target;
   float currentResponse = 0;
   float maxResponse = response.at<float> (0, 0);
+
+  if (this->m_RegressionMode)
+    {
+    // MODE REGRESSION : only output first response
+    target[0] = maxResponse;
+    return target;
+    }
+
+  // MODE CLASSIFICATION : find the highest response
+  float secondResponse = -1e10;
   target[0] = m_CvMatOfLabels->data.i[0];
 
   unsigned int nbClasses = m_CvMatOfLabels->cols;
@@ -190,9 +231,22 @@ typename NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::TargetSam
     currentResponse = response.at<float> (0, itLabel);
     if (currentResponse > maxResponse)
       {
+      secondResponse = maxResponse;
       maxResponse = currentResponse;
       target[0] = m_CvMatOfLabels->data.i[itLabel];
       }
+    else
+      {
+      if (currentResponse > secondResponse)
+        {
+        secondResponse = currentResponse;
+        }
+      }
+    }
+
+  if (quality != NULL)
+    {
+    (*quality) = static_cast<ConfidenceValueType>(maxResponse) - static_cast<ConfidenceValueType>(secondResponse);
     }
 
   return target;
@@ -227,27 +281,28 @@ void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Load(const st
   if ( !name.empty() )
     lname = name.c_str();
 
-  CvFileStorage* fs = 0;
-  CvFileNode* model_node = 0;
-  fs = cvOpenFileStorage(filename.c_str(), 0, CV_STORAGE_READ);
-  if ( !fs )
+  cv::FileNode model_node;
+  cv::FileStorage fs(filename,cv::FileStorage::READ);
+  if (!fs.isOpened())
     {
     itkExceptionMacro("Could not open the file " << filename << " for reading");
     }
 
   if( lname )
-    model_node = cvGetFileNodeByName(fs, 0, lname);
+    model_node = fs[lname];
   else
     {
-    CvFileNode* root = cvGetRootFileNode( fs );
-    if( root->data.seq->total > 0 )
-      model_node = (CvFileNode*)cvGetSeqElem( root->data.seq, 0 );
+    cv::FileNode root = fs.root();
+    if ( root.size() > 0)
+      {
+      model_node = *(root.begin());
+      }
     }
 
-  m_ANNModel->read(fs, model_node);
-  m_CvMatOfLabels = (CvMat*)cvReadByName( fs, model_node, "class_labels" );
+  m_ANNModel->read(*fs,*model_node);
+  m_CvMatOfLabels = (CvMat*)cvReadByName( *fs, *model_node, "class_labels" );
 
-  cvReleaseFileStorage(&fs);
+  fs.release();
 }
 
 template<class TInputValue, class TOutputValue>
diff --git a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h
index 3689e6e..8ecfcd2 100644
--- a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.h
@@ -40,25 +40,22 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                     InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>       InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>    InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                    TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>              TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType>   TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
-  itkTypeMacro(NormalBayesMachineLearningModel, itk::MachineLearningModel);
+  itkTypeMacro(NormalBayesMachineLearningModel, MachineLearningModel);
 
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string & filename, const std::string & name="");
diff --git a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.txx
index 7deb443..7538f02 100644
--- a/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbNormalBayesMachineLearningModel.txx
@@ -61,7 +61,7 @@ template <class TInputValue, class TOutputValue>
 typename NormalBayesMachineLearningModel<TInputValue,TOutputValue>
 ::TargetSampleType
 NormalBayesMachineLearningModel<TInputValue,TOutputValue>
-::Predict(const InputSampleType & input) const
+::Predict(const InputSampleType & input, ConfidenceValueType *quality) const
 {
   //convert listsample to Mat
   cv::Mat sample;
@@ -76,6 +76,14 @@ NormalBayesMachineLearningModel<TInputValue,TOutputValue>
 
   target[0] = static_cast<TOutputValue>(result);
 
+  if (quality != NULL)
+    {
+    if (!this->HasConfidenceIndex())
+      {
+      itkExceptionMacro("Confidence index not available for this classifier !");
+      }
+    }
+
   return target;
 }
 
diff --git a/Modules/Learning/Supervised/include/otbOpenCVUtils.h b/Modules/Learning/Supervised/include/otbOpenCVUtils.h
index 850831e..607c6cc 100644
--- a/Modules/Learning/Supervised/include/otbOpenCVUtils.h
+++ b/Modules/Learning/Supervised/include/otbOpenCVUtils.h
@@ -19,8 +19,27 @@
 #define __otbOpenCVUtils_h
 
 #include <opencv2/core/core_c.h>
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-align"
+#include <opencv2/core/core.hpp>
+#pragma GCC diagnostic pop
+#else
 #include <opencv2/core/core.hpp>
+#endif
+
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#include <opencv2/ml/ml.hpp>
+#pragma GCC diagnostic pop
+#else
 #include <opencv2/ml/ml.hpp>
+#endif
+
+
+
 #include "itkListSample.h"
 
 namespace otb
diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h
index 5f2241d..942e3de 100644
--- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.h
@@ -24,8 +24,9 @@
 #include "itkFixedArray.h"
 #include "otbMachineLearningModel.h"
 #include "itkVariableSizeMatrix.h"
+#include "otbCvRTreesWrapper.h"
 
-class CvRTrees;
+class CvRTreesWrapper;
 
 namespace otb
 {
@@ -40,32 +41,29 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                   InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>     InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>  InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                  TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>            TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType> TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
   
   // Other
   typedef itk::VariableSizeMatrix<float>                VariableImportanceMatrixType;
 
 
   //opencv typedef
-  typedef CvRTrees RFType;
+  typedef CvRTreesWrapper RFType;
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
-  itkTypeMacro(RandomForestsMachineLearningModel, itk::MachineLearningModel);
+  itkTypeMacro(RandomForestsMachineLearningModel, MachineLearningModel);
 
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string & filename, const std::string & name="");
@@ -123,8 +121,8 @@ public:
   itkGetMacro(TerminationCriteria, int);
   itkSetMacro(TerminationCriteria, int);
 
-  itkGetMacro(RegressionMode, bool);
-  itkSetMacro(RegressionMode, bool);
+  itkGetMacro(ComputeMargin, bool);
+  itkSetMacro(ComputeMargin, bool);
 
   /** Returns a matrix containing variable importance */
   VariableImportanceMatrixType GetVariableImportance();
@@ -151,7 +149,7 @@ private:
   RandomForestsMachineLearningModel(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
 
-  CvRTrees * m_RFModel;
+  CvRTreesWrapper * m_RFModel;
   /** The depth of the tree. A low value will likely underfit and conversely a
    * high value will likely overfit. The optimal value can be obtained using cross
    * validation or other suitable methods. */
@@ -195,7 +193,7 @@ private:
    * first category. */
   std::vector<float> m_Priors;
   /** If true then variable importance will be calculated and then it can be
-   * retrieved by CvRTrees::get_var_importance(). */
+   * retrieved by CvRTreesWrapper::get_var_importance(). */
   bool m_CalculateVariableImportance;
   /** The size of the randomly selected subset of features at each tree node and
    * that are used to find the best split(s). If you set it to 0 then the size will
@@ -211,8 +209,10 @@ private:
   float m_ForestAccuracy;
   /** The type of the termination criteria */
   int m_TerminationCriteria;
-  /** Perform regression instead of classification */
-  bool m_RegressionMode;
+  /** Wether to compute margin (difference in probability between the
+   * 2 most voted classes) instead of confidence (probability of the most
+   * voted class) in prediction*/
+  bool m_ComputeMargin;
 };
 } // end namespace otb
 
diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.txx
index 80c343e..aa0f054 100644
--- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModel.txx
@@ -29,19 +29,21 @@ namespace otb
 template <class TInputValue, class TOutputValue>
 RandomForestsMachineLearningModel<TInputValue,TOutputValue>
 ::RandomForestsMachineLearningModel() :
- m_RFModel (new CvRTrees),
- m_MaxDepth(5),
- m_MinSampleCount(10),
- m_RegressionAccuracy(0),
- m_ComputeSurrogateSplit(false),
- m_MaxNumberOfCategories(10),
- m_CalculateVariableImportance(false),
- m_MaxNumberOfVariables(0),
- m_MaxNumberOfTrees(100),
- m_ForestAccuracy(0.01),
- m_TerminationCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS),
- m_RegressionMode(false)
+  m_RFModel (new CvRTreesWrapper),
+  m_MaxDepth(5),
+  m_MinSampleCount(10),
+  m_RegressionAccuracy(0.01),
+  m_ComputeSurrogateSplit(false),
+  m_MaxNumberOfCategories(10),
+  m_CalculateVariableImportance(false),
+  m_MaxNumberOfVariables(0),
+  m_MaxNumberOfTrees(100),
+  m_ForestAccuracy(0.01),
+  m_TerminationCriteria(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS),
+  m_ComputeMargin(false)
 {
+  this->m_ConfidenceIndex = true;
+  this->m_IsRegressionSupported = true;
 }
 
 
@@ -90,12 +92,12 @@ RandomForestsMachineLearningModel<TInputValue,TOutputValue>
                                  m_MaxNumberOfTrees,            // max number of trees in the forest
                                  m_ForestAccuracy,              // forest accuracy
                                  m_TerminationCriteria          // termination criteria
-                                 );
+    );
 
   cv::Mat var_type = cv::Mat(this->GetInputListSample()->GetMeasurementVectorSize() + 1, 1, CV_8U );
   var_type.setTo(cv::Scalar(CV_VAR_NUMERICAL) ); // all inputs are numerical
 
-  if(m_RegressionMode)
+  if(this->m_RegressionMode)
     var_type.at<uchar>(this->GetInputListSample()->GetMeasurementVectorSize(), 0) = CV_VAR_NUMERICAL;
   else
     var_type.at<uchar>(this->GetInputListSample()->GetMeasurementVectorSize(), 0) = CV_VAR_CATEGORICAL;
@@ -109,7 +111,7 @@ template <class TInputValue, class TOutputValue>
 typename RandomForestsMachineLearningModel<TInputValue,TOutputValue>
 ::TargetSampleType
 RandomForestsMachineLearningModel<TInputValue,TOutputValue>
-::Predict(const InputSampleType & value) const
+::Predict(const InputSampleType & value, ConfidenceValueType *quality) const
 {
   //convert listsample to Mat
   cv::Mat sample;
@@ -122,6 +124,14 @@ RandomForestsMachineLearningModel<TInputValue,TOutputValue>
 
   target[0] = static_cast<TOutputValue>(result);
 
+  if (quality != NULL)
+    {
+    if(m_ComputeMargin)
+      (*quality) = m_RFModel->predict_margin(sample);
+    else
+      (*quality) = m_RFModel->predict_confidence(sample);
+    }
+
   return target[0];
 }
 
@@ -152,30 +162,30 @@ bool
 RandomForestsMachineLearningModel<TInputValue,TOutputValue>
 ::CanReadFile(const std::string & file)
 {
-   std::ifstream ifs;
-   ifs.open(file.c_str());
+  std::ifstream ifs;
+  ifs.open(file.c_str());
 
-   if(!ifs)
-   {
-      std::cerr<<"Could not read file "<<file<<std::endl;
-      return false;
-   }
+  if(!ifs)
+    {
+    std::cerr<<"Could not read file "<<file<<std::endl;
+    return false;
+    }
 
 
-   while (!ifs.eof())
-   {
-      std::string line;
-      std::getline(ifs, line);
+  while (!ifs.eof())
+    {
+    std::string line;
+    std::getline(ifs, line);
 
-      //if (line.find(m_RFModel->getName()) != std::string::npos)
-      if (line.find(CV_TYPE_NAME_ML_RTREES) != std::string::npos)
+    //if (line.find(m_RFModel->getName()) != std::string::npos)
+    if (line.find(CV_TYPE_NAME_ML_RTREES) != std::string::npos)
       {
-         //std::cout<<"Reading a "<<CV_TYPE_NAME_ML_RTREES<<" model"<<std::endl;
-         return true;
+      //std::cout<<"Reading a "<<CV_TYPE_NAME_ML_RTREES<<" model"<<std::endl;
+      return true;
       }
-   }
-   ifs.close();
-   return false;
+    }
+  ifs.close();
+  return false;
 }
 
 template <class TInputValue, class TOutputValue>
diff --git a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h
index 8579803..7a3e7e3 100644
--- a/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h
+++ b/Modules/Learning/Supervised/include/otbRandomForestsMachineLearningModelFactory.h
@@ -53,7 +53,7 @@ public:
   /** Register one factory of this type  */
   static void RegisterOneFactory(void)
   {
-    RandomForestsMachineLearningModelFactory::Pointer RFFactory = RandomForestsMachineLearningModelFactory::New();
+    Pointer RFFactory = RandomForestsMachineLearningModelFactory::New();
     itk::ObjectFactoryBase::RegisterFactory(RFFactory);
   }
 
diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h
index 0780cd3..c976d66 100644
--- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h
+++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.h
@@ -28,6 +28,14 @@ class CvSVM;
 
 namespace otb
 {
+/** 
+* \brief OpenCV implementation of SVM algorithm.
+* 
+* This machine learning model uses the OpenCV implementation of the
+* SVM algorithm. Since this implementation is buggy in the linear
+* case, we recommend users to use the LibSVM implementation instead,
+* through the otb::LibSVMMachineLearningModel.
+*/ 
 template <class TInputValue, class TTargetValue>
 class ITK_EXPORT SVMMachineLearningModel
   : public MachineLearningModel <TInputValue, TTargetValue>
@@ -39,15 +47,13 @@ public:
   typedef itk::SmartPointer<Self>                         Pointer;
   typedef itk::SmartPointer<const Self>                   ConstPointer;
 
-  // Input related typedefs
-  typedef TInputValue                                     InputValueType;
-  typedef itk::VariableLengthVector<InputValueType>       InputSampleType;
-  typedef itk::Statistics::ListSample<InputSampleType>    InputListSampleType;
-
-  // Target related typedefs
-  typedef TTargetValue                                    TargetValueType;
-  typedef itk::FixedArray<TargetValueType,1>              TargetSampleType;
-  typedef itk::Statistics::ListSample<TargetSampleType>   TargetListSampleType;
+  typedef typename Superclass::InputValueType             InputValueType;
+  typedef typename Superclass::InputSampleType            InputSampleType;
+  typedef typename Superclass::InputListSampleType        InputListSampleType;
+  typedef typename Superclass::TargetValueType            TargetValueType;
+  typedef typename Superclass::TargetSampleType           TargetSampleType;
+  typedef typename Superclass::TargetListSampleType       TargetListSampleType;
+  typedef typename Superclass::ConfidenceValueType        ConfidenceValueType;
 
   /** Run-time type information (and related methods). */
   itkNewMacro(Self);
@@ -55,9 +61,8 @@ public:
 
   /** Train the machine learning model */
   virtual void Train();
-
   /** Predict values using the model */
-  virtual TargetSampleType Predict(const InputSampleType & input) const;
+  virtual TargetSampleType Predict(const InputSampleType& input, ConfidenceValueType *quality=NULL) const;
 
   /** Save the model to file */
   virtual void Save(const std::string & filename, const std::string & name="");
diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.txx
index 743cd76..9d0b7d6 100644
--- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.txx
+++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModel.txx
@@ -49,6 +49,8 @@ SVMMachineLearningModel<TInputValue,TOutputValue>
  m_OutputNu(0),
  m_OutputP(0)
 {
+  this->m_ConfidenceIndex = true;
+  this->m_IsRegressionSupported = true;
 }
 
 
@@ -65,6 +67,14 @@ void
 SVMMachineLearningModel<TInputValue,TOutputValue>
 ::Train()
 {
+  // Check that the SVM type is compatible with the chosen mode (classif/regression)
+  if ( bool(m_SVMType == CvSVM::NU_SVR || m_SVMType == CvSVM::EPS_SVR) != this->m_RegressionMode)
+    {
+    itkGenericExceptionMacro("SVM type incompatible with chosen mode (classification or regression."
+                             "SVM types for classification are C_SVC, NU_SVC, ONE_CLASS. "
+                             "SVM types for regression are NU_SVR, EPS_SVR");
+    }
+
   //convert listsample to opencv matrix
   cv::Mat samples;
   otb::ListSampleToMat<InputListSampleType>(this->GetInputListSample(), samples);
@@ -108,7 +118,7 @@ template <class TInputValue, class TOutputValue>
 typename SVMMachineLearningModel<TInputValue,TOutputValue>
 ::TargetSampleType
 SVMMachineLearningModel<TInputValue,TOutputValue>
-::Predict(const InputSampleType & input) const
+::Predict(const InputSampleType & input, ConfidenceValueType *quality) const
 {
   //convert listsample to Mat
   cv::Mat sample;
@@ -121,6 +131,11 @@ SVMMachineLearningModel<TInputValue,TOutputValue>
 
   target[0] = static_cast<TOutputValue>(result);
 
+  if (quality != NULL)
+    {
+    (*quality) = m_SVMModel->predict(sample,true);
+    }
+
   return target;
 }
 
@@ -129,10 +144,10 @@ void
 SVMMachineLearningModel<TInputValue,TOutputValue>
 ::Save(const std::string & filename, const std::string & name)
 {
-       if (name == "")
-              m_SVMModel->save(filename.c_str(), 0);
-       else
-              m_SVMModel->save(filename.c_str(), name.c_str());
+  if (name == "")
+    m_SVMModel->save(filename.c_str(), 0);
+  else
+    m_SVMModel->save(filename.c_str(), name.c_str());
 }
 
 template <class TInputValue, class TOutputValue>
@@ -141,9 +156,9 @@ SVMMachineLearningModel<TInputValue,TOutputValue>
 ::Load(const std::string & filename, const std::string & name)
 {
   if (name == "")
-         m_SVMModel->load(filename.c_str(), 0);
+    m_SVMModel->load(filename.c_str(), 0);
   else
-         m_SVMModel->load(filename.c_str(), name.c_str());
+    m_SVMModel->load(filename.c_str(), name.c_str());
 }
 
 template <class TInputValue, class TOutputValue>
@@ -151,29 +166,29 @@ bool
 SVMMachineLearningModel<TInputValue,TOutputValue>
 ::CanReadFile(const std::string & file)
 {
-   std::ifstream ifs;
-   ifs.open(file.c_str());
-
-   if(!ifs)
-   {
-      std::cerr<<"Could not read file "<<file<<std::endl;
-      return false;
-   }
-
-   while (!ifs.eof())
-   {
-      std::string line;
-      std::getline(ifs, line);
-
-      //if (line.find(m_SVMModel->getName()) != std::string::npos)
-      if (line.find(CV_TYPE_NAME_ML_SVM) != std::string::npos)
+  std::ifstream ifs;
+  ifs.open(file.c_str());
+
+  if(!ifs)
+    {
+    std::cerr<<"Could not read file "<<file<<std::endl;
+    return false;
+    }
+
+  while (!ifs.eof())
+    {
+    std::string line;
+    std::getline(ifs, line);
+
+    //if (line.find(m_SVMModel->getName()) != std::string::npos)
+    if (line.find(CV_TYPE_NAME_ML_SVM) != std::string::npos)
       {
-         //std::cout<<"Reading a "<<CV_TYPE_NAME_ML_SVM<<" model"<<std::endl;
-         return true;
+      //std::cout<<"Reading a "<<CV_TYPE_NAME_ML_SVM<<" model"<<std::endl;
+      return true;
       }
-   }
-   ifs.close();
-   return false;
+    }
+  ifs.close();
+  return false;
 }
 
 template <class TInputValue, class TOutputValue>
diff --git a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h b/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h
index 395d9af..bc91145 100644
--- a/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h
+++ b/Modules/Learning/Supervised/include/otbSVMMachineLearningModelFactory.h
@@ -53,7 +53,7 @@ public:
   /** Register one factory of this type  */
   static void RegisterOneFactory(void)
   {
-    SVMMachineLearningModelFactory::Pointer SVMFactory = SVMMachineLearningModelFactory::New();
+    Pointer SVMFactory = SVMMachineLearningModelFactory::New();
     itk::ObjectFactoryBase::RegisterFactory(SVMFactory);
   }
 
diff --git a/Modules/Learning/Supervised/otb-module.cmake b/Modules/Learning/Supervised/otb-module.cmake
index 4535970..a3f8f47 100644
--- a/Modules/Learning/Supervised/otb-module.cmake
+++ b/Modules/Learning/Supervised/otb-module.cmake
@@ -1,4 +1,4 @@
-set(DOCUMENTATION "This module provides the Orfeo Toolbox supervised 
+set(DOCUMENTATION "This module provides the Orfeo Toolbox supervised
 classification and regression framework, currently based on
 OpenCV and/or libSVM")
 
@@ -7,6 +7,7 @@ otb_module(OTBSupervised
     OTBBoost
     OTBCommon
     OTBITK
+    OTBImageBase
 
   OPTIONAL_DEPENDS
     OTBOpenCV
@@ -16,6 +17,7 @@ otb_module(OTBSupervised
     OTBTestKernel
     OTBImageIO
     OTBImageBase
+    OTBBoost
 
   DESCRIPTION
     "${DOCUMENTATION}"
diff --git a/Modules/Learning/Supervised/src/CMakeLists.txt b/Modules/Learning/Supervised/src/CMakeLists.txt
index aa05eb7..b99187d 100644
--- a/Modules/Learning/Supervised/src/CMakeLists.txt
+++ b/Modules/Learning/Supervised/src/CMakeLists.txt
@@ -2,8 +2,12 @@ set(OTBSupervised_SRC
   otbMachineLearningModelFactoryBase.cxx
   )
 
+if(OTB_USE_OPENCV)
+list(APPEND OTBSupervised_SRC otbCvRTreesWrapper.cxx)
+endif()
+
 add_library(OTBSupervised ${OTBSupervised_SRC})
-target_link_libraries(OTBSupervised 
+target_link_libraries(OTBSupervised
   ${OTBCommon_LIBRARIES}
   ${OTBSVMLearning_LIBRARIES}
   ${OTBOpenCV_LIBRARIES}
diff --git a/Modules/Learning/Supervised/src/otbCvRTreesWrapper.cxx b/Modules/Learning/Supervised/src/otbCvRTreesWrapper.cxx
new file mode 100644
index 0000000..e4ac2d9
--- /dev/null
+++ b/Modules/Learning/Supervised/src/otbCvRTreesWrapper.cxx
@@ -0,0 +1,76 @@
+/*=========================================================================
+
+  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 "otbCvRTreesWrapper.h"
+#include <algorithm>
+
+
+namespace otb
+{
+
+CvRTreesWrapper::CvRTreesWrapper(){}
+
+CvRTreesWrapper::~CvRTreesWrapper(){}
+
+void CvRTreesWrapper::get_votes(const cv::Mat& sample, 
+                                const cv::Mat& missing,
+                                CvRTreesWrapper::VotesVectorType& vote_count) const
+{
+  vote_count.resize(nclasses);
+  for( int k = 0; k < ntrees; k++ )
+    {
+    CvDTreeNode* predicted_node = trees[k]->predict( sample, missing );
+    int class_idx = predicted_node->class_idx;
+    CV_Assert( 0 <= class_idx && class_idx < nclasses );
+    ++vote_count[class_idx];
+    }
+}
+
+float CvRTreesWrapper::predict_margin(const cv::Mat& sample, 
+                                      const cv::Mat& missing) const
+{
+  // Sanity check (division by ntrees later on)
+  if(ntrees == 0)
+    {
+    return 0.;
+    }
+  std::vector<unsigned int> classVotes;
+  this->get_votes(sample, missing, classVotes);
+// We only sort the 2 greatest elements
+  std::nth_element(classVotes.begin(), classVotes.begin()+1, 
+                   classVotes.end(), std::greater<unsigned int>());
+  float margin = static_cast<float>(classVotes[0]-classVotes[1])/ntrees;
+  return margin;
+}
+
+float CvRTreesWrapper::predict_confidence(const cv::Mat& sample, 
+                                  const cv::Mat& missing) const
+{
+  // Sanity check (division by ntrees later on)
+  if(ntrees == 0)
+    {
+    return 0.;
+    }
+  std::vector<unsigned int> classVotes;
+  this->get_votes(sample, missing, classVotes);
+  unsigned int max_votes = *(std::max_element(classVotes.begin(), 
+                                              classVotes.end()));
+  float confidence = static_cast<float>(max_votes)/ntrees;
+  return confidence;
+}
+
+}
diff --git a/Modules/Learning/Supervised/test/CMakeLists.txt b/Modules/Learning/Supervised/test/CMakeLists.txt
index 7ffe875..abca168 100644
--- a/Modules/Learning/Supervised/test/CMakeLists.txt
+++ b/Modules/Learning/Supervised/test/CMakeLists.txt
@@ -7,6 +7,7 @@ otbConfusionMatrixMeasurementsTest.cxx
 otbMachineLearningModelCanRead.cxx
 otbTrainMachineLearningModel.cxx
 otbImageClassificationFilter.cxx
+otbMachineLearningRegressionTests.cxx
 )
 
 add_executable(otbSupervisedTestDriver ${OTBSupervisedTests})
diff --git a/Modules/Learning/Supervised/test/otbMachineLearningRegressionTests.cxx b/Modules/Learning/Supervised/test/otbMachineLearningRegressionTests.cxx
new file mode 100644
index 0000000..2b0554d
--- /dev/null
+++ b/Modules/Learning/Supervised/test/otbMachineLearningRegressionTests.cxx
@@ -0,0 +1,671 @@
+/*=========================================================================
+
+ 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 "otbConfigure.h"
+
+#include "itkMersenneTwisterRandomVariateGenerator.h"
+
+#if defined(OTB_USE_OPENCV) || defined(OTB_USE_LIBSVM)
+const double otb_epsilon_01 = 0.1;
+#endif
+
+#ifdef OTB_USE_OPENCV
+#include "otbNeuralNetworkMachineLearningModel.h"
+#include "otbSVMMachineLearningModel.h"
+#include "otbBoostMachineLearningModel.h"
+#include "otbDecisionTreeMachineLearningModel.h"
+#include "otbGradientBoostedTreeMachineLearningModel.h"
+#include "otbKNearestNeighborsMachineLearningModel.h"
+#include "otbRandomForestsMachineLearningModel.h"
+#endif
+
+#ifdef OTB_USE_LIBSVM
+#include "otbLibSVMMachineLearningModel.h"
+#endif
+
+typedef float PrecisionType;
+typedef otb::MachineLearningModel<PrecisionType,PrecisionType>   MachineLearningModelRegressionType;
+typedef MachineLearningModelRegressionType::InputValueType       InputValueRegressionType;
+typedef MachineLearningModelRegressionType::InputSampleType      InputSampleRegressionType;
+typedef MachineLearningModelRegressionType::InputListSampleType  InputListSampleRegressionType;
+typedef MachineLearningModelRegressionType::TargetValueType      TargetValueRegressionType;
+typedef MachineLearningModelRegressionType::TargetSampleType     TargetSampleRegressionType;
+typedef MachineLearningModelRegressionType::TargetListSampleType TargetListSampleRegressionType;
+typedef itk::Statistics::MersenneTwisterRandomVariateGenerator   RandomGeneratorType;
+
+typedef struct RegressionTestParamStruct
+{
+  double vMin;
+  double vMax;
+  size_t count;
+  double eps;
+} RegressionTestParam;
+
+template <typename TPrecision>
+struct LinearFunctionSampleGenerator
+{
+  typedef TPrecision PrecisionType;
+  LinearFunctionSampleGenerator(TPrecision a, TPrecision b)
+    : m_a(a), m_b(b), m_NbInputVars(1), m_NbOutputVars(1) {
+    m_isl = InputListSampleRegressionType::New();
+    m_tsl = TargetListSampleRegressionType::New();
+  };
+  void GenerateSamples(TPrecision sMin, TPrecision sMax, size_t nbSamples)
+  {
+    m_isl->Clear();
+    m_tsl->Clear();
+    m_isl->SetMeasurementVectorSize(m_NbInputVars);
+    m_tsl->SetMeasurementVectorSize(m_NbOutputVars);
+
+    RandomGeneratorType::Pointer randomGenerator = RandomGeneratorType::GetInstance();
+    InputSampleRegressionType inputSample;
+    inputSample.SetSize(m_NbInputVars);
+    TargetSampleRegressionType outputSample;
+
+    TPrecision sampleStep = (sMax-sMin)/nbSamples;
+    for(size_t i=0; i<nbSamples; ++i)
+      {
+      TPrecision x = randomGenerator->GetUniformVariate(0.0, 1.0) * static_cast<TPrecision>(nbSamples);
+      TPrecision inputValue = sMin+ x*sampleStep;
+      inputSample[0] = inputValue;
+      outputSample[0] = m_a*inputValue+m_b;
+      m_isl->PushBack(inputSample);
+      m_tsl->PushBack(outputSample);
+      }
+  }
+
+  TPrecision m_a;
+  TPrecision m_b;
+  const size_t m_NbInputVars;
+  const size_t m_NbOutputVars;
+  InputListSampleRegressionType::Pointer m_isl;
+  TargetListSampleRegressionType::Pointer m_tsl;
+};
+
+template <typename TPrecision>
+struct BilinearFunctionSampleGenerator
+{
+  typedef TPrecision PrecisionType;
+  BilinearFunctionSampleGenerator(TPrecision a, TPrecision b, TPrecision c)
+    : m_a(a), m_b(b), m_c(c), m_NbInputVars(2), m_NbOutputVars(1) {
+    m_isl = InputListSampleRegressionType::New();
+    m_tsl = TargetListSampleRegressionType::New();
+  };
+  void GenerateSamples(TPrecision sMin, TPrecision sMax, size_t nbSamples)
+  {
+    m_isl->Clear();
+    m_tsl->Clear();
+    m_isl->SetMeasurementVectorSize(m_NbInputVars);
+    m_tsl->SetMeasurementVectorSize(m_NbOutputVars);
+
+    RandomGeneratorType::Pointer randomGenerator = RandomGeneratorType::GetInstance();
+    InputSampleRegressionType inputSample;
+    inputSample.SetSize(m_NbInputVars);
+    TargetSampleRegressionType outputSample;
+
+    TPrecision sampleStep = (sMax-sMin)/nbSamples;
+    for(size_t i=0; i<nbSamples; ++i)
+      {
+      TPrecision x = randomGenerator->GetUniformVariate(0.0, 1.0) * static_cast<TPrecision>(nbSamples);
+      TPrecision inputValue1 = sMin+ x*sampleStep;
+      x = randomGenerator->GetUniformVariate(0.0, 1.0) * static_cast<TPrecision>(nbSamples);
+      TPrecision inputValue2 = sMin+ x*sampleStep;
+      inputSample[0] = inputValue1;
+      inputSample[1] = inputValue2;
+      outputSample[0] = m_a*inputValue1+m_b*inputValue2+m_c;
+      m_isl->PushBack(inputSample);
+      m_tsl->PushBack(outputSample);
+      }
+  }
+
+  TPrecision m_a;
+  TPrecision m_b;
+  TPrecision m_c;
+  const size_t m_NbInputVars;
+  const size_t m_NbOutputVars;
+  InputListSampleRegressionType::Pointer m_isl;
+  TargetListSampleRegressionType::Pointer m_tsl;
+};
+
+template <typename TPrecision>
+struct PolynomialFunctionSampleGenerator
+{
+  typedef TPrecision PrecisionType;
+  PolynomialFunctionSampleGenerator(std::vector<TPrecision> c)
+    : m_c(c), m_NbInputVars(1), m_NbOutputVars(1) {
+    m_isl = InputListSampleRegressionType::New();
+    m_tsl = TargetListSampleRegressionType::New();
+  };
+  void GenerateSamples(TPrecision sMin, TPrecision sMax, size_t nbSamples)
+  {
+    m_isl->Clear();
+    m_tsl->Clear();
+    m_isl->SetMeasurementVectorSize(m_NbInputVars);
+    m_tsl->SetMeasurementVectorSize(m_NbOutputVars);
+
+    RandomGeneratorType::Pointer randomGenerator = RandomGeneratorType::GetInstance();
+    InputSampleRegressionType inputSample;
+    inputSample.SetSize(m_NbInputVars);
+    TargetSampleRegressionType outputSample;
+
+    TPrecision sampleStep = (sMax-sMin)/nbSamples;
+    for(size_t i=0; i<nbSamples; ++i)
+      {
+      TPrecision x = randomGenerator->GetUniformVariate(0.0, 1.0) * static_cast<TPrecision>(nbSamples);
+      TPrecision inputValue = sMin+ x*sampleStep;
+      inputSample[0] = inputValue;
+      TPrecision y = 0.0;
+      for (unsigned int j=0; j<m_c.size() ; ++j)
+        {
+        y += m_c[j] * pow(static_cast<double>(inputValue), static_cast<double>(j));
+        }
+      outputSample[0] = y;
+      m_isl->PushBack(inputSample);
+      m_tsl->PushBack(outputSample);
+      }
+  }
+
+  std::vector<TPrecision> m_c;
+  const size_t m_NbInputVars;
+  const size_t m_NbOutputVars;
+  InputListSampleRegressionType::Pointer m_isl;
+  TargetListSampleRegressionType::Pointer m_tsl;
+};
+
+template <typename SampleGeneratorType, typename RegressionType>
+int testRegression(SampleGeneratorType& sg, RegressionType& rgrsn, RegressionTestParam param)
+{
+  std::cout << "Generating training samples" << std::endl;
+  sg.GenerateSamples(param.vMin, param.vMax, param.count);
+
+  rgrsn->SetInputListSample(sg.m_isl);
+  rgrsn->SetTargetListSample(sg.m_tsl);
+  std::cout << "Training" << std::endl;
+  rgrsn->Train();
+
+  std::cout << "Generate validation samples"<<std::endl;
+  sg.GenerateSamples(param.vMin, param.vMax, param.count);
+
+  std::cout << "Validation" << std::endl;
+  //Check the prediction accuracy
+  typename InputListSampleRegressionType::Iterator sampleIt = sg.m_isl->Begin();
+  typename TargetListSampleRegressionType::Iterator resultIt = sg.m_tsl->Begin();
+  typename InputListSampleRegressionType::Iterator sampleLast = sg.m_isl->End();
+  typename TargetListSampleRegressionType::Iterator resultLast = sg.m_tsl->End();
+  typename SampleGeneratorType::PrecisionType rmse = 0.0;
+  while(sampleIt != sampleLast && resultIt != resultLast)
+    {
+    //typename SampleGeneratorType::PrecisionType invalue = sampleIt.GetMeasurementVector()[0];
+    typename SampleGeneratorType::PrecisionType prediction = rgrsn->Predict(sampleIt.GetMeasurementVector())[0];
+    typename SampleGeneratorType::PrecisionType expected = resultIt.GetMeasurementVector()[0];
+    rmse += std::pow(prediction - expected, static_cast<PrecisionType>(2.0));
+    ++sampleIt;
+    ++resultIt;
+    }
+
+  rmse = sqrt( rmse / static_cast<double>(param.count) );
+  std::cout << "RMSE = "<< rmse << std::endl;
+  if(rmse > param.eps)
+    {
+    std::cout << "Failed : RMSE above expected precision !" << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  return EXIT_SUCCESS;
+}
+
+#ifdef OTB_USE_LIBSVM
+MachineLearningModelRegressionType::Pointer getLibSVMRegressionModel()
+{
+  typedef otb::LibSVMMachineLearningModel<InputValueRegressionType,
+                                       TargetValueRegressionType>
+    libsvmType;
+  libsvmType::Pointer regression = libsvmType::New();
+  regression->SetRegressionMode(true);
+  regression->SetSVMType(EPSILON_SVR);
+  regression->SetKernelType(RBF);
+  regression->SetEpsilon(1e-5);
+  regression->SetParameterOptimization(true);
+  return regression.GetPointer();
+}
+
+int otbLibSVMRegressionTests(int itkNotUsed(argc),
+                             char * itkNotUsed(argv) [])
+{
+  int status = EXIT_SUCCESS;
+  int ret;
+  MachineLearningModelRegressionType::Pointer regression;
+
+  RegressionTestParam param;
+  param.vMin = -0.5;
+  param.vMax = 0.5;
+  param.count = 200;
+  param.eps = otb_epsilon_01;
+
+  std::cout << "Testing regression on a linear monovariate function" << std::endl;
+  LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0);
+  regression = getLibSVMRegressionModel();
+  ret = testRegression(lfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a bilinear function" << std::endl;
+  BilinearFunctionSampleGenerator<PrecisionType> bfsg(2.0,-1.0,1.0);
+  regression = getLibSVMRegressionModel();
+  ret = testRegression(bfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a polynomial function" << std::endl;
+  std::vector<PrecisionType> coeffs;
+  coeffs.push_back(0.0);
+  coeffs.push_back(-1.0);
+  coeffs.push_back(0.0);
+  coeffs.push_back(4.0);
+  PolynomialFunctionSampleGenerator<PrecisionType> pfsg(coeffs);
+  regression = getLibSVMRegressionModel();
+  ret = testRegression(pfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  return status;
+}
+
+#endif
+
+#ifdef OTB_USE_OPENCV
+MachineLearningModelRegressionType::Pointer getNeuralNetworkRegressionModel(unsigned int nbInputVar)
+{
+  typedef otb::NeuralNetworkMachineLearningModel<InputValueRegressionType,
+                                                 TargetValueRegressionType>
+    NeuralNetworkType;
+  NeuralNetworkType::Pointer regression = NeuralNetworkType::New();
+
+  regression->SetRegressionMode(1);
+  regression->SetTrainMethod(CvANN_MLP_TrainParams::BACKPROP);
+  std::vector<unsigned int> layerSizes;
+  layerSizes.push_back(nbInputVar);
+  layerSizes.push_back(5);
+  layerSizes.push_back(1);
+  regression->SetLayerSizes(layerSizes);
+  regression->SetActivateFunction(CvANN_MLP::SIGMOID_SYM);
+  regression->SetAlpha(1.0);
+  regression->SetBeta(1.0);
+  regression->SetBackPropDWScale(0.1);
+  regression->SetBackPropMomentScale(0.1);
+  regression->SetRegPropDW0(0.1);
+  regression->SetRegPropDWMin(1e-7);
+  regression->SetTermCriteriaType(CV_TERMCRIT_EPS);
+  regression->SetEpsilon(1e-5);
+  regression->SetMaxIter(1e4);
+  return regression.GetPointer();
+}
+
+int otbNeuralNetworkRegressionTests(int itkNotUsed(argc),
+                                    char * itkNotUsed(argv) [])
+{
+  int status = EXIT_SUCCESS;
+  int ret;
+  MachineLearningModelRegressionType::Pointer regression;
+
+  RegressionTestParam param;
+  param.vMin = -0.5;
+  param.vMax = 0.5;
+  param.count = 20000;
+  param.eps = otb_epsilon_01;
+
+  std::cout << "Testing regression on a linear monovariate function" << std::endl;
+  LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0);
+  regression = getNeuralNetworkRegressionModel(1);
+  ret = testRegression(lfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a bilinear function" << std::endl;
+  BilinearFunctionSampleGenerator<PrecisionType> bfsg(2.0,-1.0,1.0);
+  regression = getNeuralNetworkRegressionModel(2);
+  ret = testRegression(bfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a polynomial function" << std::endl;
+  std::vector<PrecisionType> coeffs;
+  coeffs.push_back(0.0);
+  coeffs.push_back(-1.0);
+  coeffs.push_back(0.0);
+  coeffs.push_back(4.0);
+  PolynomialFunctionSampleGenerator<PrecisionType> pfsg(coeffs);
+  regression = getNeuralNetworkRegressionModel(1);
+  ret = testRegression(pfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  return status;
+}
+
+
+MachineLearningModelRegressionType::Pointer getSVMRegressionModel()
+{
+  typedef otb::SVMMachineLearningModel<InputValueRegressionType,
+                                       TargetValueRegressionType>
+    SVMType;
+  SVMType::Pointer regression = SVMType::New();
+
+  regression->SetRegressionMode(1);
+  regression->SetSVMType(CvSVM::NU_SVR);
+  regression->SetNu(0.5);
+  regression->SetKernelType(CvSVM::RBF);
+  regression->SetTermCriteriaType(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS);
+  regression->SetMaxIter(100000);
+  regression->SetEpsilon(1e-5);
+  regression->SetParameterOptimization(true);
+  return regression.GetPointer();
+}
+
+int otbSVMRegressionTests(int itkNotUsed(argc),
+                                      char * itkNotUsed(argv) [])
+{
+  int status = EXIT_SUCCESS;
+  int ret;
+  MachineLearningModelRegressionType::Pointer regression;
+
+  RegressionTestParam param;
+  param.vMin = -0.5;
+  param.vMax = 0.5;
+  param.count = 200;
+  param.eps = otb_epsilon_01;
+
+  std::cout << "Testing regression on a linear monovariate function" << std::endl;
+  LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0);
+  regression = getSVMRegressionModel();
+  ret = testRegression(lfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a bilinear function" << std::endl;
+  BilinearFunctionSampleGenerator<PrecisionType> bfsg(2.0,-1.0,1.0);
+  regression = getSVMRegressionModel();
+  ret = testRegression(bfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a polynomial function" << std::endl;
+  std::vector<PrecisionType> coeffs;
+  coeffs.push_back(0.0);
+  coeffs.push_back(-1.0);
+  coeffs.push_back(0.0);
+  coeffs.push_back(4.0);
+  PolynomialFunctionSampleGenerator<PrecisionType> pfsg(coeffs);
+  regression = getSVMRegressionModel();
+  ret = testRegression(pfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  return status;
+}
+
+
+MachineLearningModelRegressionType::Pointer getDecisionTreeRegressionModel()
+{
+  typedef otb::DecisionTreeMachineLearningModel<InputValueRegressionType,
+                                       TargetValueRegressionType>
+    DTreeType;
+  DTreeType::Pointer regression = DTreeType::New();
+  regression->SetRegressionMode(true);
+  regression->SetRegressionAccuracy(0.005);
+  return regression.GetPointer();
+}
+
+int otbDecisionTreeRegressionTests(int itkNotUsed(argc),
+                                      char * itkNotUsed(argv) [])
+{
+  int status = EXIT_SUCCESS;
+  int ret;
+  MachineLearningModelRegressionType::Pointer regression;
+
+  RegressionTestParam param;
+  param.vMin = -0.5;
+  param.vMax = 0.5;
+  param.count = 200;
+  param.eps = otb_epsilon_01;
+
+  std::cout << "Testing regression on a linear monovariate function" << std::endl;
+  LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0);
+  regression = getDecisionTreeRegressionModel();
+  ret = testRegression(lfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a bilinear function" << std::endl;
+  BilinearFunctionSampleGenerator<PrecisionType> bfsg(2.0,-1.0,1.0);
+  regression = getDecisionTreeRegressionModel();
+  // increase the number of training samples for bilinear function
+  param.count = 1000;
+  ret = testRegression(bfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a polynomial function" << std::endl;
+  std::vector<PrecisionType> coeffs;
+  coeffs.push_back(0.0);
+  coeffs.push_back(-1.0);
+  coeffs.push_back(0.0);
+  coeffs.push_back(4.0);
+  PolynomialFunctionSampleGenerator<PrecisionType> pfsg(coeffs);
+  param.count = 200;
+  regression = getDecisionTreeRegressionModel();
+  ret = testRegression(pfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  return status;
+}
+
+
+MachineLearningModelRegressionType::Pointer getGradientBoostedTreeRegressionModel()
+{
+  typedef otb::GradientBoostedTreeMachineLearningModel<InputValueRegressionType,
+                                       TargetValueRegressionType>
+    GBTreeType;
+  GBTreeType::Pointer regression = GBTreeType::New();
+  regression->SetRegressionMode(true);
+  regression->SetShrinkage(0.1);
+  regression->SetSubSamplePortion(0.8);
+  regression->SetLossFunctionType(CvGBTrees::SQUARED_LOSS);
+  return regression.GetPointer();
+}
+
+int otbGradientBoostedTreeRegressionTests(int itkNotUsed(argc),
+                                      char * itkNotUsed(argv) [])
+{
+  int status = EXIT_SUCCESS;
+  int ret;
+  MachineLearningModelRegressionType::Pointer regression;
+
+  RegressionTestParam param;
+  param.vMin = -0.5;
+  param.vMax = 0.5;
+  param.count = 200;
+  param.eps = otb_epsilon_01;
+
+  std::cout << "Testing regression on a linear monovariate function" << std::endl;
+  LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0);
+  regression = getGradientBoostedTreeRegressionModel();
+  ret = testRegression(lfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a bilinear function" << std::endl;
+  BilinearFunctionSampleGenerator<PrecisionType> bfsg(2.0,-1.0,1.0);
+  // increase number of training samples for bilinear function
+  param.count = 1000;
+  regression = getGradientBoostedTreeRegressionModel();
+  ret = testRegression(bfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a polynomial function" << std::endl;
+  std::vector<PrecisionType> coeffs;
+  coeffs.push_back(0.0);
+  coeffs.push_back(-1.0);
+  coeffs.push_back(0.0);
+  coeffs.push_back(4.0);
+  PolynomialFunctionSampleGenerator<PrecisionType> pfsg(coeffs);
+  param.count = 200;
+  regression = getGradientBoostedTreeRegressionModel();
+  ret = testRegression(pfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  return status;
+}
+
+
+MachineLearningModelRegressionType::Pointer getKNearestNeighborsRegressionModel()
+{
+  typedef otb::KNearestNeighborsMachineLearningModel<InputValueRegressionType,
+                                       TargetValueRegressionType>
+    KNNType;
+  KNNType::Pointer regression = KNNType::New();
+  regression->SetRegressionMode(true);
+  regression->SetK(5);
+  regression->SetDecisionRule(KNNType::KNN_MEDIAN);
+  return regression.GetPointer();
+}
+
+int otbKNearestNeighborsRegressionTests(int itkNotUsed(argc),
+                                      char * itkNotUsed(argv) [])
+{
+  int status = EXIT_SUCCESS;
+  int ret;
+  MachineLearningModelRegressionType::Pointer regression;
+
+  RegressionTestParam param;
+  param.vMin = -0.5;
+  param.vMax = 0.5;
+  param.count = 200;
+  param.eps = otb_epsilon_01;
+
+  std::cout << "Testing regression on a linear monovariate function" << std::endl;
+  LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0);
+  regression = getKNearestNeighborsRegressionModel();
+  ret = testRegression(lfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a bilinear function" << std::endl;
+  BilinearFunctionSampleGenerator<PrecisionType> bfsg(2.0,-1.0,1.0);
+  regression = getKNearestNeighborsRegressionModel();
+  ret = testRegression(bfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a polynomial function" << std::endl;
+  std::vector<PrecisionType> coeffs;
+  coeffs.push_back(0.0);
+  coeffs.push_back(-1.0);
+  coeffs.push_back(0.0);
+  coeffs.push_back(4.0);
+  PolynomialFunctionSampleGenerator<PrecisionType> pfsg(coeffs);
+  regression = getKNearestNeighborsRegressionModel();
+  ret = testRegression(pfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  return status;
+}
+
+
+MachineLearningModelRegressionType::Pointer getRandomForestsRegressionModel()
+{
+  typedef otb::RandomForestsMachineLearningModel<InputValueRegressionType,
+                                       TargetValueRegressionType>
+    RFType;
+  RFType::Pointer regression = RFType::New();
+  regression->SetRegressionMode(true);
+  regression->SetRegressionAccuracy(0.005);
+  return regression.GetPointer();
+}
+
+
+int otbRandomForestsRegressionTests(int itkNotUsed(argc),
+                                      char * itkNotUsed(argv) [])
+{
+  int status = EXIT_SUCCESS;
+  int ret;
+  MachineLearningModelRegressionType::Pointer regression;
+
+  RegressionTestParam param;
+  param.vMin = -0.5;
+  param.vMax = 0.5;
+  param.count = 200;
+  param.eps = otb_epsilon_01;
+
+  std::cout << "Testing regression on a linear monovariate function" << std::endl;
+  LinearFunctionSampleGenerator<PrecisionType> lfsg(2.0, 1.0);
+  regression = getRandomForestsRegressionModel();
+  ret = testRegression(lfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a bilinear function" << std::endl;
+  BilinearFunctionSampleGenerator<PrecisionType> bfsg(2.0,-1.0,1.0);
+  // increase number of training samples for bilinear function
+  param.count = 1000;
+  regression = getRandomForestsRegressionModel();
+  ret = testRegression(bfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  std::cout << "Testing regression on a polynomial function" << std::endl;
+  std::vector<PrecisionType> coeffs;
+  coeffs.push_back(0.0);
+  coeffs.push_back(-1.0);
+  coeffs.push_back(0.0);
+  coeffs.push_back(4.0);
+  PolynomialFunctionSampleGenerator<PrecisionType> pfsg(coeffs);
+  param.count = 200;
+  regression = getRandomForestsRegressionModel();
+  ret = testRegression(pfsg,regression,param);
+  if (ret == EXIT_FAILURE)
+    {
+    status = EXIT_FAILURE;
+    }
+  return status;
+}
+#endif
diff --git a/Modules/Learning/Supervised/test/otbSupervisedTestDriver.cxx b/Modules/Learning/Supervised/test/otbSupervisedTestDriver.cxx
index e498bd0..2bf373c 100644
--- a/Modules/Learning/Supervised/test/otbSupervisedTestDriver.cxx
+++ b/Modules/Learning/Supervised/test/otbSupervisedTestDriver.cxx
@@ -28,6 +28,7 @@ void RegisterTests()
   #ifdef OTB_USE_LIBSVM
   REGISTER_TEST(otbLibSVMMachineLearningModelNew);
   REGISTER_TEST(otbLibSVMMachineLearningModel);
+  REGISTER_TEST(otbLibSVMRegressionTests);
   #endif
   
   #ifdef OTB_USE_OPENCV
@@ -48,8 +49,14 @@ void RegisterTests()
   REGISTER_TEST(otbDecisionTreeMachineLearningModel);
   REGISTER_TEST(otbGradientBoostedTreeMachineLearningModelNew);
   REGISTER_TEST(otbGradientBoostedTreeMachineLearningModel);
-  #endif
+  REGISTER_TEST(otbNeuralNetworkRegressionTests);
+  REGISTER_TEST(otbSVMRegressionTests);
+  REGISTER_TEST(otbDecisionTreeRegressionTests);
+  REGISTER_TEST(otbGradientBoostedTreeRegressionTests);
+  REGISTER_TEST(otbKNearestNeighborsRegressionTests);
+  REGISTER_TEST(otbRandomForestsRegressionTests);
+#endif
   
-  REGISTER_TEST(otbImageClassificationFilterNew);
+    REGISTER_TEST(otbImageClassificationFilterNew);
   REGISTER_TEST(otbImageClassificationFilter);
 }
diff --git a/Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx b/Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx
index 4a38c09..cb71eba 100644
--- a/Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx
+++ b/Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx
@@ -23,6 +23,7 @@
 #include <otbMachineLearningModel.h>
 #include "otbConfusionMatrixCalculator.h"
 
+#include "otb_boost_string_header.h"
 
 typedef otb::MachineLearningModel<float,short>         MachineLearningModelType;
 typedef MachineLearningModelType::InputValueType       InputValueType;
@@ -59,11 +60,11 @@ bool ReadDataFile(const std::string & infname, InputListSampleType * samples, Ta
     {
     std::string line;
     std::getline(ifs, line);
+    boost::algorithm::trim(line);
 
     if(nbfeatures == 0)
       {
-      nbfeatures = std::count(line.begin(),line.end(),' ')-1;
-      //std::cout<<"Found "<<nbfeatures<<" features per samples"<<std::endl;
+      nbfeatures = std::count(line.begin(),line.end(),' ');
       }
 
     if(line.size()>1)
@@ -84,7 +85,7 @@ bool ReadDataFile(const std::string & infname, InputListSampleType * samples, Ta
         {
         std::string::size_type nextpos = line.find_first_of(" ", pos+1);
 
-        if(nextpos == std::string::npos)
+        if(pos == std::string::npos)
           {
           endOfLine = true;
           nextpos = line.size()-1;
@@ -380,20 +381,12 @@ int otbSVMMachineLearningRegressionModel(int argc, char * argv[])
   SVMType::Pointer classifier = SVMType::New();
 
   //Init SVM type in regression mode
-  //Available mode for regression in  openCV are eps_svr and nu_svr
+  classifier->SetRegressionMode(1);
   classifier->SetSVMType(CvSVM::EPS_SVR);
-  //classifier->SetSVMType(CvSVM::NU_SVR);
-
-  //P should be >0. Increasing value give better result. Need to investigate why.
   classifier->SetP(10);
-
-  //IN case you're using nu_svr you should set nu to a positive value between 0
-  //and 1.
-  //classifier->SetNu(0.9);
-
-  //Use RBF kernel.Don't know what is recommended in case of svm regression
   classifier->SetKernelType(CvSVM::RBF);
 
+
   classifier->SetInputListSample(samples);
   classifier->SetTargetListSample(labels);
   classifier->Train();
@@ -431,6 +424,7 @@ int otbSVMMachineLearningRegressionModel(int argc, char * argv[])
     }
   else
     {
+    std::cout << age << "\t" << predicted->GetMeasurementVector(0)[0] << "\n";
     return EXIT_FAILURE;
     }
 }
@@ -446,9 +440,9 @@ int otbKNearestNeighborsMachineLearningModel(int argc, char * argv[])
 {
   if (argc != 3 )
     {
-      std::cout<<"Wrong number of arguments "<<std::endl;
-      std::cout<<"Usage : sample file, output file"<<std::endl;
-      return EXIT_FAILURE;
+    std::cout<<"Wrong number of arguments "<<std::endl;
+    std::cout<<"Usage : sample file, output file"<<std::endl;
+    return EXIT_FAILURE;
     }
 
   typedef otb::KNearestNeighborsMachineLearningModel<InputValueType,TargetValueType> KNearestNeighborsType;
@@ -527,11 +521,11 @@ int otbRandomForestsMachineLearningModelNew(int itkNotUsed(argc), char * itkNotU
 int otbRandomForestsMachineLearningModel(int argc, char * argv[])
 {
   if (argc != 3 )
-  {
+    {
     std::cout<<"Wrong number of arguments "<<std::endl;
     std::cout<<"Usage : sample file, output file "<<std::endl;
     return EXIT_FAILURE;
-  }
+    }
 
   typedef otb::RandomForestsMachineLearningModel<InputValueType,TargetValueType> RandomForestType;
   InputListSampleType::Pointer samples = InputListSampleType::New();
@@ -619,9 +613,9 @@ int otbBoostMachineLearningModel(int argc, char * argv[])
 {
   if (argc != 3 )
     {
-      std::cout<<"Wrong number of arguments "<<std::endl;
-      std::cout<<"Usage : sample file, output file "<<std::endl;
-      return EXIT_FAILURE;
+    std::cout<<"Wrong number of arguments "<<std::endl;
+    std::cout<<"Usage : sample file, output file "<<std::endl;
+    return EXIT_FAILURE;
     }
 
   typedef otb::BoostMachineLearningModel<InputValueType, TargetValueType> BoostType;
diff --git a/Modules/Learning/Supervised/test/tests-libsvm.cmake b/Modules/Learning/Supervised/test/tests-libsvm.cmake
index 04764df..30dc7ee 100644
--- a/Modules/Learning/Supervised/test/tests-libsvm.cmake
+++ b/Modules/Learning/Supervised/test/tests-libsvm.cmake
@@ -22,3 +22,7 @@ otb_add_test(NAME leTuLibSVMMachineLearningModelCanRead COMMAND otbSupervisedTes
   ${TEMP}/libsvm_model.txt
   )
 set_property(TEST leTuLibSVMMachineLearningModelCanRead PROPERTY DEPENDS leTvLibSVMMachineLearningModel)
+
+otb_add_test(NAME leTvLibSVMMachineLearningModelReg COMMAND otbSupervisedTestDriver
+  otbLibSVMRegressionTests
+  )
diff --git a/Modules/Learning/Supervised/test/tests-opencv.cmake b/Modules/Learning/Supervised/test/tests-opencv.cmake
index 55855a4..3be269f 100644
--- a/Modules/Learning/Supervised/test/tests-opencv.cmake
+++ b/Modules/Learning/Supervised/test/tests-opencv.cmake
@@ -10,6 +10,32 @@ otb_add_test(NAME leTvANNMachineLearningModel COMMAND otbSupervisedTestDriver
   ${TEMP}/ann_model.txt
   )
 
+# ------------------ Regression tests --------------------
+otb_add_test(NAME leTvANNMachineLearningModelReg COMMAND otbSupervisedTestDriver
+  otbNeuralNetworkRegressionTests
+  )
+
+otb_add_test(NAME leTvSVMMachineLearningModelReg COMMAND otbSupervisedTestDriver
+  otbSVMRegressionTests
+  )
+
+otb_add_test(NAME leTvDecisionTreeMachineLearningModelReg COMMAND otbSupervisedTestDriver
+  otbDecisionTreeRegressionTests
+  )
+
+otb_add_test(NAME leTvGradientBoostedTreeMachineLearningModelReg COMMAND otbSupervisedTestDriver
+  otbGradientBoostedTreeRegressionTests
+  )
+
+otb_add_test(NAME leTvKNearestNeighborsMachineLearningModelReg COMMAND otbSupervisedTestDriver
+  otbKNearestNeighborsRegressionTests
+  )
+
+otb_add_test(NAME leTvRandomForestsMachineLearningModelReg COMMAND otbSupervisedTestDriver
+  otbRandomForestsRegressionTests
+  )
+# --------------------------------------------------------------
+
 otb_add_test(NAME leTuSVMMachineLearningModelNew COMMAND otbSupervisedTestDriver
   otbSVMMachineLearningModelNew)
 
diff --git a/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.txx b/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.txx
index 4a4c4d2..91de9df 100644
--- a/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.txx
+++ b/Modules/OBIA/RCC8/include/otbImageToImageRCC8Calculator.txx
@@ -142,7 +142,7 @@ ImageToImageRCC8Calculator<TInputImage>
   typename ImageType::SizeType  size;
   typename ImageType::IndexType index;
 
-  for (int i = 0; i < ImageType::ImageDimension; ++i)
+  for (unsigned int i = 0; i < ImageType::ImageDimension; ++i)
     {
     index[i] = std::min(region1.GetIndex()[i], region2.GetIndex()[i]);
     int potSize = std::max(region1.GetIndex()[i] + region1.GetSize()[i],
diff --git a/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h b/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h
index e8a919c..1ce5150 100644
--- a/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h
+++ b/Modules/OBIA/RCC8/include/otbPolygonListToRCC8GraphFilter.h
@@ -75,7 +75,8 @@ public:
   typedef RCC8InEdgeIterator<OutputGraphType>  InEdgeIteratorType;
   typedef RCC8OutEdgeIterator<OutputGraphType> OutEdgeIteratorType;
 
-  typedef std::pair<unsigned int, unsigned int> EdgePairType;
+  typedef typename VertexIteratorType::VertexDescriptorType EdgePairElementType;
+  typedef std::pair<EdgePairElementType, EdgePairElementType> EdgePairType;
   typedef std::map<EdgePairType, RCC8ValueType> EdgeMapType;
   typedef std::vector<EdgeMapType>              EdgeMapVectorType;
 
diff --git a/Modules/OBIA/RCC8/include/otbRCC8Graph.h b/Modules/OBIA/RCC8/include/otbRCC8Graph.h
index d0ab149..7b7e80e 100644
--- a/Modules/OBIA/RCC8/include/otbRCC8Graph.h
+++ b/Modules/OBIA/RCC8/include/otbRCC8Graph.h
@@ -26,8 +26,7 @@
 #define BOOST_NO_0X_HDR_INITIALIZER_LIST
 #endif
 
-#include <boost/graph/graph_traits.hpp>
-#include <boost/graph/adjacency_list.hpp>
+#include "otb_boost_graph_header.h"
 
 #include "otbImage.h"
 #include "otbImageList.h"
diff --git a/Modules/OBIA/RCC8/otb-module.cmake b/Modules/OBIA/RCC8/otb-module.cmake
index 8f8fa9c..74988b7 100644
--- a/Modules/OBIA/RCC8/otb-module.cmake
+++ b/Modules/OBIA/RCC8/otb-module.cmake
@@ -12,7 +12,7 @@ otb_module(OTBRCC8
     OTBImageManipulation
     OTBPath
     OTBCommon
-    OTBBoost
+    OTBBoostAdapters
     OTBObjectList
 
   TEST_DEPENDS
diff --git a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h
index 8ca617b..5cc401b 100644
--- a/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h
+++ b/Modules/Radiometry/OpticalCalibration/include/otbAtmosphericRadiativeTerms.h
@@ -181,7 +181,8 @@ public:
 
   typedef AtmosphericRadiativeTermsSingleChannel::Pointer ValueType;
   typedef std::vector<ValueType>                          VectorValueType;
-  typedef std::vector<double>                             DataVectorType;
+  typedef std::vector<double>                                DataVectorType;
+  typedef DataVectorType::size_type                      DataVectorSizeType;
   /**
    * Set/Get the values.
    */
@@ -255,7 +256,7 @@ public:
   const ValueType GetValueByIndex(unsigned int id) const;
 
   /** Initialization method.*/
-  void ValuesInitialization(unsigned int nbChannel);
+  void ValuesInitialization(DataVectorSizeType nbChannel);
 
 protected:
   /** Constructor */
diff --git a/Modules/Radiometry/OpticalCalibration/otb-module.cmake b/Modules/Radiometry/OpticalCalibration/otb-module.cmake
index 74d9489..d8bdb1b 100644
--- a/Modules/Radiometry/OpticalCalibration/otb-module.cmake
+++ b/Modules/Radiometry/OpticalCalibration/otb-module.cmake
@@ -6,7 +6,7 @@ into account the neighborhood contribution.")
 otb_module(OTBOpticalCalibration
   DEPENDS
     OTB6S
-    OTBBoost
+    OTBBoostAdapters
     OTBCommon
     OTBITK
     OTBImageBase
diff --git a/Modules/Radiometry/OpticalCalibration/src/otbAtmosphericRadiativeTerms.cxx b/Modules/Radiometry/OpticalCalibration/src/otbAtmosphericRadiativeTerms.cxx
index 8497a6d..bf19269 100644
--- a/Modules/Radiometry/OpticalCalibration/src/otbAtmosphericRadiativeTerms.cxx
+++ b/Modules/Radiometry/OpticalCalibration/src/otbAtmosphericRadiativeTerms.cxx
@@ -64,9 +64,9 @@ AtmosphericRadiativeTerms
 
 void
 AtmosphericRadiativeTerms
-::ValuesInitialization(unsigned int nbChannel)
+::ValuesInitialization(DataVectorSizeType nbChannel)
 {
-  for (unsigned int j = 0; j < nbChannel; ++j)
+  for (DataVectorSizeType j = 0; j < nbChannel; ++j)
     {
     ValueType temp = AtmosphericRadiativeTermsSingleChannel::New();
     m_Values.push_back(temp);
diff --git a/Modules/Radiometry/OpticalCalibration/src/otbSpectralSensitivityReader.cxx b/Modules/Radiometry/OpticalCalibration/src/otbSpectralSensitivityReader.cxx
index 5015183..403bbe6 100644
--- a/Modules/Radiometry/OpticalCalibration/src/otbSpectralSensitivityReader.cxx
+++ b/Modules/Radiometry/OpticalCalibration/src/otbSpectralSensitivityReader.cxx
@@ -21,7 +21,7 @@
 #include <fstream>
 #include <algorithm>
 #include <cctype>
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 #include "itksys/SystemTools.hxx"
 
 #include "otbSpotImageMetadataInterface.h"
diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h
index 541afff..1331f74 100644
--- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h
+++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.h
@@ -18,13 +18,11 @@
 #ifndef __otbSarRadiometricCalibrationFunction_h
 #define __otbSarRadiometricCalibrationFunction_h
 
-#include "otbSarRadiometricCalibrationFunctor.h"
 #include "otbSarParametricMapFunction.h"
-
-
+#include "otbSarCalibrationLookupData.h"
+#include "otbMath.h"
 namespace otb
 {
-
 /**
  * \class SarRadiometricCalibrationFunction
  * \brief Calculate the backscatter for the given pixel
@@ -71,33 +69,31 @@ public:
 
   itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
 
-
   /** Datatype used for the evaluation */
   typedef double                                                 RealType;
-  typedef otb::Functor::SarRadiometricCalibrationFunctor<RealType, RealType>           FunctorType;
-  typedef typename FunctorType::RealType                        FunctorRealType;
+//  typedef otb::Functor::SarRadiometricCalibrationFunctor<RealType, RealType>           FunctorType;
+//  typedef typename FunctorType::RealType                        FunctorRealType;
 
   typedef otb::SarParametricMapFunction<InputImageType>               ParametricFunctionType;
   typedef typename ParametricFunctionType::Pointer                    ParametricFunctionPointer;
   typedef typename ParametricFunctionType::ConstPointer               ParametricFunctionConstPointer;
 
-  /** Evaluate the function at non-integer positions */
-  virtual OutputType Evaluate(const PointType& point) const;
-
   /** Evalulate the function at specified index */
-  virtual OutputType EvaluateAtIndex(const IndexType& index) const
+  virtual OutputType EvaluateAtIndex(const IndexType& index) const;
+
+  /** Evaluate the function at non-integer positions */
+  virtual OutputType Evaluate(const PointType& point) const
   {
-    PointType point;
-    this->GetInputImage()->TransformIndexToPhysicalPoint( index, point);
-    return this->Evaluate(point);
+    IndexType index;
+    this->ConvertPointToNearestIndex(point, index);
+    return this->EvaluateAtIndex(index);
   }
 
-  virtual OutputType EvaluateAtContinuousIndex(
-    const ContinuousIndexType& cindex) const
+  virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType& cindex) const
   {
-    PointType point;
-    this->GetInputImage()->TransformContinuousIndexToPhysicalPoint( cindex, point);
-    return this->Evaluate(point);
+    IndexType index;
+    this->ConvertContinuousIndexToNearestIndex(cindex, index);
+    return this->EvaluateAtIndex(index);
   }
 
   /** Set the input image.
@@ -108,10 +104,10 @@ public:
 
 
   /** Get/Set the Scale value */
-  itkSetMacro(Scale, FunctorRealType);
-  itkGetMacro(Scale, FunctorRealType);
+  itkSetMacro(Scale, RealType);
+  itkGetMacro(Scale, RealType);
 
-  /** Get/Set the Offset value */
+  /** Get/Set the Noise value */
   itkSetObjectMacro(Noise, ParametricFunctionType);
   itkGetConstObjectMacro(Noise, ParametricFunctionType);
   itkGetObjectMacro(Noise, ParametricFunctionType);
@@ -140,23 +136,66 @@ public:
   itkGetConstObjectMacro(RangeSpreadLoss, ParametricFunctionType);
   itkGetObjectMacro(RangeSpreadLoss, ParametricFunctionType);
 
+  /** Set the RescalingFactor value */
+  itkSetMacro(RescalingFactor, RealType);
+
+  /** Get/Set flag to indicate if these are used */
+  itkSetMacro(ApplyAntennaPatternGain, bool);
+  itkGetMacro(ApplyAntennaPatternGain, bool);
+
+  itkSetMacro(ApplyIncidenceAngleCorrection, bool);
+  itkGetMacro(ApplyIncidenceAngleCorrection, bool);
+
+  itkSetMacro(ApplyRangeSpreadLossCorrection, bool);
+  itkGetMacro(ApplyRangeSpreadLossCorrection, bool);
+
+  itkSetMacro(ApplyLookupDataCorrection, bool);
+  itkGetMacro(ApplyLookupDataCorrection, bool);
+
+  itkSetMacro(ApplyRescalingFactor, bool);
+  itkGetMacro(ApplyRescalingFactor, bool);
+
+    typedef SarCalibrationLookupData::Pointer LookupDataPointer;
+
+  /** Set SetCalibrationLookupData instance */
+  void SetCalibrationLookupData(LookupDataPointer lut)
+  {
+    m_Lut = lut;
+  }
 
 protected:
+
+  /** ctor */
   SarRadiometricCalibrationFunction();
+
+  /** default, empty, virtual dtor */
   virtual ~SarRadiometricCalibrationFunction(){}
+
+  /** print method */
   void PrintSelf(std::ostream& os, itk::Indent indent) const;
 
+  /** Flags to indiciate if these values needs to be applied in calibration*/
+
 private:
   SarRadiometricCalibrationFunction(const Self &);  //purposely not implemented
   void operator =(const Self&);  //purposely not implemented
 
-  FunctorRealType             m_Scale;
-  ParametricFunctionPointer   m_Noise;
+  RealType             m_Scale;
   bool                        m_EnableNoise;
+  RealType             m_RescalingFactor;
+  bool                        m_ApplyAntennaPatternGain;
+  bool                        m_ApplyIncidenceAngleCorrection;
+  bool                        m_ApplyRangeSpreadLossCorrection;
+  bool                        m_ApplyLookupDataCorrection;
+  bool                        m_ApplyRescalingFactor;
+  ParametricFunctionPointer   m_Noise;
   ParametricFunctionPointer   m_AntennaPatternNewGain;
   ParametricFunctionPointer   m_AntennaPatternOldGain;
   ParametricFunctionPointer   m_IncidenceAngle;
   ParametricFunctionPointer   m_RangeSpreadLoss;
+  LookupDataPointer   m_Lut;
+
+
 };
 
 } // end namespace otb
diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.txx b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.txx
index b04ee4c..4e22a24 100644
--- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.txx
+++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunction.txx
@@ -24,27 +24,38 @@
 
 namespace otb
 {
-
 /**
  * Constructor
  */
 template <class TInputImage, class TCoordRep>
 SarRadiometricCalibrationFunction<TInputImage, TCoordRep>
-::SarRadiometricCalibrationFunction():
-  m_Scale(1.0)
+::SarRadiometricCalibrationFunction()
+: m_Scale(1.0)
+, m_EnableNoise(false)
+, m_RescalingFactor(1.0)
+, m_ApplyAntennaPatternGain(true)
+, m_ApplyIncidenceAngleCorrection(true)
+, m_ApplyRangeSpreadLossCorrection(true)
+, m_ApplyLookupDataCorrection(false)
+, m_ApplyRescalingFactor(false)
+
 {
+  /* intialize parametric functions */
   m_Noise = ParametricFunctionType::New();
   m_AntennaPatternNewGain = ParametricFunctionType::New();
   m_AntennaPatternOldGain = ParametricFunctionType::New();
   m_IncidenceAngle = ParametricFunctionType::New();
   m_RangeSpreadLoss = ParametricFunctionType::New();
 
+  /* intialize default values in paramerticFunction instances  */
   m_Noise->SetConstantValue(0.0);
-  m_EnableNoise = true;
   m_AntennaPatternNewGain->SetConstantValue(1.0);
   m_AntennaPatternOldGain->SetConstantValue(1.0);
   m_IncidenceAngle->SetConstantValue(CONST_PI_2);
   m_RangeSpreadLoss->SetConstantValue(1.0);
+
+//  m_Lut = 0; //new LookupTableBase();
+
 }
 
 /**
@@ -65,7 +76,7 @@ SarRadiometricCalibrationFunction<TInputImage, TCoordRep>
 }
 
 /**
- *
+ * Print
  */
 template <class TInputImage, class TCoordRep>
 void
@@ -75,23 +86,16 @@ SarRadiometricCalibrationFunction<TInputImage, TCoordRep>
   this->Superclass::PrintSelf(os, indent);
 }
 
-/**
- *
- */
+/* Function: EvaluateAtIndex. This computes the required values for each pixel
+* whose index is given in indexType argument. To convert index to point it uses
+* InputImage::TransformIndexToPhysicalPoint(). IncidenceAngle and similar are
+* computed based on this calculated point in SarParametricFunction   */
 template <class TInputImage, class TCoordRep>
 typename SarRadiometricCalibrationFunction<TInputImage, TCoordRep>
 ::OutputType
 SarRadiometricCalibrationFunction<TInputImage, TCoordRep>
-::Evaluate(const PointType& point) const
+::EvaluateAtIndex(const IndexType& index) const
 {
-  IndexType index;
-  this->GetInputImage()->TransformPhysicalPointToIndex(point, index);
-
-  if (!this->GetInputImage())
-    {
-    itkDebugMacro( <<"ERROR with GetInputImage()");
-    return (itk::NumericTraits<OutputType>::max());
-    }
 
   if (!this->IsInsideBuffer(index))
     {
@@ -99,21 +103,69 @@ SarRadiometricCalibrationFunction<TInputImage, TCoordRep>
     return (itk::NumericTraits<OutputType>::max());
     }
 
-  FunctorType functor;
+  /* convert index to point */
+  PointType point;
+  if (m_ApplyAntennaPatternGain || m_ApplyIncidenceAngleCorrection || m_ApplyRangeSpreadLossCorrection)
+    this->GetInputImage()->TransformIndexToPhysicalPoint( index, point);
+
+  /** digitalNumber:
+    * For complex pixel type, vcl_abs() returns the modulus. which is
+    * sqrt((I*I) + (Q*Q)). Where I and Q are real and imaginary part of the
+    * complex pixel. So to to get (I*I) + (Q*Q) in our calculation, the output
+    * of vcl_abs() is squared. See below (digitalNumber * digitalNumber) where
+    * digitalNumber is the output of vcl_abs() which is sqrt((I*I) + (Q*Q)). For
+    * non-complex pixel types, vcl_abs() simply returns absolute value.
+    */
+
+  RealType digitalNumber = static_cast<RealType>(vcl_abs(this->GetInputImage()->GetPixel(index)));
+  RealType sigma = m_Scale * digitalNumber * digitalNumber;
+
+  /** substract noise if enabled. */
   if (m_EnableNoise)
     {
-    functor.SetNoise(static_cast<FunctorRealType>(m_Noise->Evaluate(point)));
+    sigma  -= static_cast<RealType>(m_Noise->Evaluate(point));
+    }
+
+  /** Apply incidence angle correction if needed */
+  if (m_ApplyIncidenceAngleCorrection)
+    {
+    sigma *= vcl_sin(static_cast<RealType>(m_IncidenceAngle->Evaluate(point)));
     }
-  functor.SetScale(m_Scale);
-  functor.SetAntennaPatternNewGain(static_cast<FunctorRealType>(m_AntennaPatternNewGain->Evaluate(point)));
-  functor.SetAntennaPatternOldGain(static_cast<FunctorRealType>(m_AntennaPatternOldGain->Evaluate(point)));
-  functor.SetIncidenceAngle(static_cast<FunctorRealType>(m_IncidenceAngle->Evaluate(point)));
-  functor.SetRangeSpreadLoss(static_cast<FunctorRealType>(m_RangeSpreadLoss->Evaluate(point)));
 
-  const RealType value = static_cast<RealType>(vcl_abs(this->GetInputImage()->GetPixel(index)));
-  RealType result = functor(value);
+  /** Apply old and new antenna pattern gain. */
+  if (m_ApplyAntennaPatternGain)
+    {
+    sigma *= static_cast<RealType>(m_AntennaPatternNewGain->Evaluate(point));
+    sigma /= static_cast<RealType>(m_AntennaPatternOldGain->Evaluate(point));
+    }
+
+  /** Apply range spread loss if needed. */
+  if (m_ApplyRangeSpreadLossCorrection)
+    {
+    sigma *= static_cast<RealType>(m_RangeSpreadLoss->Evaluate(point));
+    }
+
+  /** Lookup value has effect on for some sensors which does not required the
+    * above values (incidence angle, rangespreadloss etc.. */
+  if (m_ApplyLookupDataCorrection)
+    {
+    RealType lutVal = static_cast<RealType>(m_Lut->GetValue(index[0], index[1]));
+    sigma /= lutVal * lutVal;
+    }
+
+  /** rescaling factor has effect only with CosmoSkymed Products */
+  if (m_ApplyRescalingFactor)
+    {
+    sigma /= m_RescalingFactor;
+    }
+
+
+  if(sigma < 0.0)
+    {
+    sigma = 0.0;
+    }
 
-  return static_cast<OutputType>(result);
+  return static_cast<OutputType>(sigma);
 }
 
 } // end namespace otb
diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunctor.h b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunctor.h
deleted file mode 100644
index db02de3..0000000
--- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationFunctor.h
+++ /dev/null
@@ -1,161 +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.
-
-=========================================================================*/
-
-#ifndef __otbSarRadiometricCalibrationFunctor_h
-#define __otbSarRadiometricCalibrationFunctor_h
-
-#include "otbMath.h"
-#include "itkNumericTraits.h"
-
-namespace otb
-{
-
-namespace Functor
-{
-/**
- * \class SarRadiometricCalibrationFunctor
- * \brief Compute the backscatter value.
- *  \f$ \sigma^{0} = (scale * DN^{2} + offset) * sin( \theta_{inc}) * OldGain / NewGain * RangeSpreadLoss \f$
- *
- *
- * \ingroup OTBSARCalibration
- */
-template<class TInput, class TOutput>
-class ITK_EXPORT SarRadiometricCalibrationFunctor
-{
-public:
-  typedef TInput                                            InputType;
-  typedef TOutput                                           OutputType;
-  typedef typename itk::NumericTraits<InputType>::AbsType   RealType;
-
-  SarRadiometricCalibrationFunctor()
-  {
-    m_Noise = 0.0;
-    m_Scale = 1.0;
-    m_IncidenceAngle = CONST_PI_2;
-    m_AntennaPatternOldGain = 1.0;
-    m_AntennaPatternNewGain = 1.0;
-    m_RangeSpreadLoss = 1.0;
-  };
-
-  ~SarRadiometricCalibrationFunctor(){};
-
-  inline TOutput operator ()(const TInput& value) const
-  {
-    RealType digitalNumber = static_cast<RealType> (vcl_abs(value));
-    RealType sigma;
-
-    sigma  = m_Scale * (digitalNumber * digitalNumber - m_Noise);
-    sigma *= vcl_sin(m_IncidenceAngle);
-    sigma *= m_AntennaPatternOldGain;
-    sigma /= m_AntennaPatternNewGain;
-    sigma *= m_RangeSpreadLoss;
-
-    if(sigma < 0.0)
-    {
-      sigma = 0.0;
-    }
-
-    return static_cast<OutputType>(sigma);
-  }
-
-  /** Set offset method */
-  void SetNoise(RealType value)
-  {
-    m_Noise = value;
-  }
-
-  /** Get offset method */
-  RealType GetNoise() const
-  {
-    return m_Noise;
-  }
-
-  /** Set scale method */
-  void SetScale(RealType value)
-  {
-    m_Scale = value;
-  }
-
-  /** Get scale method */
-  RealType GetScale() const
-  {
-    return m_Scale;
-  }
-
-  /** Set antennaPatternNewGain method */
-  void SetAntennaPatternNewGain(RealType value)
-  {
-    m_AntennaPatternNewGain = value;
-  }
-
-  /** Get antennaPatternNewGain method */
-  RealType GetAntennaPatternNewGain() const
-  {
-    return m_AntennaPatternNewGain;
-  }
-
-  /** Set antennaPatternOldGain method */
-  void SetAntennaPatternOldGain(RealType value)
-  {
-    m_AntennaPatternOldGain = value;
-  }
-
-  /** Get antennaPatternOldGain method */
-  RealType GetAntennaPatternOldGain() const
-  {
-    return m_AntennaPatternOldGain;
-  }
-
-  /** Set incidenceAngle method */
-  void SetIncidenceAngle(RealType value)
-  {
-    m_IncidenceAngle = value;
-  }
-
-  /** Get incidenceAngle method */
-  RealType GetIncidenceAngle() const
-  {
-    return m_IncidenceAngle;
-  }
-
-  /** Set rangeSpreadLoss method */
-  void SetRangeSpreadLoss(RealType value)
-  {
-    m_RangeSpreadLoss = value;
-  }
-
-  /** Get scale method */
-  RealType GetRangeSpreadLoss() const
-  {
-    return m_RangeSpreadLoss;
-  }
-
-private:
-  RealType   m_Noise;
-  RealType   m_Scale;
-  RealType   m_AntennaPatternNewGain;
-  RealType   m_AntennaPatternOldGain;
-  RealType   m_IncidenceAngle;
-  RealType   m_RangeSpreadLoss;
-};
-}
-
-}
-
-#endif
diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h
index 1212e9a..523cdbc 100644
--- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h
+++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.h
@@ -28,9 +28,29 @@ namespace otb
 {
 
 /** \class SarRadiometricCalibrationToImageFilter
-  * \brief Evaluates the SarRadiometricCalibrationFunction onto a source image
+ * \brief Evaluates the SarRadiometricCalibrationFunction onto a source image
+ * The BeforeThreadedGenerateData create a SarImageMetadataInterface based on
+ * input metadata dictionary. The nature of product(TerrSARX, Sentinel1, etc..)
+ * are thus detected  automatically from this. The filter then reads necessary
+ * parameters required to perform SarCalibration in a generic way.
  *
- * The function has to inherit from itkImageFunction
+ * BeforeThreadedGenerateData() instanciate a SarRadiometricCalibrationFunction
+ * and pass the values taken from SarImageMetadataInterface instance to it. This
+ * is where the actual computation of sigma (backscatter) occurs.
+ *
+ * Noise, Antenna pattern gain (old && new), range spread loss, incidence angle
+ * data members used in this class are all instances of SarPrametricFunction
+ * class. Each have a Evaluate() method and a special
+ * EvaluateParametricCoefficient() which computes the actual value.
+ *
+ * The technical details and more discussion of SarCalibration can be found in jira
+ * story #863.
+ *
+ * \see \c otb::SarParametricFunction
+ * \see \c otb::SarCalibrationLookupBase
+ * References (Retreived on 08-Sept-2015)
+ * Sentinel1 - https://sentinel.esa.int/web/sentinel/sentinel-1-sar-wiki/-/wiki/Sentinel%20One/Application+of+Radiometric+Calibration+LUT
+ * Radarsat2 - http://gs.mdacorporation.com/products/sensor/radarsat2/RS2_Product_Description.pdf
  *
  * \ingroup ImageFilters
  *
@@ -76,20 +96,37 @@ public:
   typedef typename FunctionType::ParametricFunctionConstPointer ParametricFunctionConstPointer;
   typedef typename FunctionType::ParametricFunctionType         ParametricFunctionType;
 
+
+  /** Enable/disable the noise flag in SarRadiometricCalibrationFunction */
   void SetEnableNoise(bool inArg)
   {
     this->GetFunction()->SetEnableNoise(inArg);
   }
+
+  itkSetMacro(LookupSelected, short);
+  itkGetConstMacro(LookupSelected, short);
+
 protected:
+  /** Default ctor */
   SarRadiometricCalibrationToImageFilter();
+
+  /** Empty, default virtual dtor */
   virtual ~SarRadiometricCalibrationToImageFilter() {}
 
+  /** Generate output information */
+  virtual void GenerateOutputInformation();
+
   /** Update the function list and input parameters*/
   virtual void BeforeThreadedGenerateData();
+
 private:
+
   SarRadiometricCalibrationToImageFilter(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
 
+
+  short m_LookupSelected;
+
 };
 
 } // end namespace otb
diff --git a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.txx b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.txx
index 15b09c7..ad0f5b4 100644
--- a/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.txx
+++ b/Modules/Radiometry/SARCalibration/include/otbSarRadiometricCalibrationToImageFilter.txx
@@ -22,8 +22,8 @@
 #define __otbSarRadiometricCalibrationToImageFilter_txx
 
 #include "otbSarRadiometricCalibrationToImageFilter.h"
-
 #include "otbSarImageMetadataInterfaceFactory.h"
+#include "otbSarCalibrationLookupData.h"
 
 namespace otb
 {
@@ -34,7 +34,33 @@ namespace otb
 template<class TInputImage, class TOutputImage>
 SarRadiometricCalibrationToImageFilter<TInputImage, TOutputImage>
 ::SarRadiometricCalibrationToImageFilter()
+: m_LookupSelected(0)
 {
+
+}
+
+template<class TInputImage, class TOutputImage>
+void
+SarRadiometricCalibrationToImageFilter<TInputImage, TOutputImage>
+::GenerateOutputInformation( )
+{
+  Superclass::GenerateOutputInformation();
+
+  // Retrieving input/output pointers
+  InputImagePointer      inputPtr = this->GetInput();
+
+  if (inputPtr.IsNull())
+    {
+    itkExceptionMacro(<< "At least one input is missing."
+                      << " Input is missing :" << inputPtr.GetPointer() )
+      }
+
+  OutputImagePointer outputPtr = this->GetOutput();
+  if (outputPtr.IsNull())
+    {
+    itkExceptionMacro(<< "At least one output is missing."
+                      << " Output is missing :" << outputPtr.GetPointer() )
+      }
 }
 
 template<class TInputImage, class TOutputImage>
@@ -45,60 +71,104 @@ SarRadiometricCalibrationToImageFilter<TInputImage, TOutputImage>
   // will SetInputImage on the function
   Superclass::BeforeThreadedGenerateData();
 
+  /** cretate a SarImageMetadataInterface instance from
+   * GetMetaDataDictionary(). This will return the appropriate IMI depending on
+   * the Sensor information & co available in GetMetaDataDictionary()  */
   SarImageMetadataInterface::Pointer imageMetadataInterface = SarImageMetadataInterfaceFactory::CreateIMI(
       this->GetInput()->GetMetaDataDictionary());
 
+  /** Get the SarRadiometricCalibrationFunction function instance.  */
   FunctionPointer function = this->GetFunction();
 
-  function->SetScale(imageMetadataInterface->GetRadiometricCalibrationScale());
+  /** check if there is a calibration lookupdata is available with the
+    * product. eg. Sentinel1. This means
+    * A. The computation of the backscatter is based on this lookup value which
+    * depends on the given product.*
+    * B. The other value such as antenna pattern gain, rangespread loss, incidence
+    * angle has no effect in calibration  */
+
+  bool apply = imageMetadataInterface->HasCalibrationLookupDataFlag();
+  /* Below lines will toggle the necessary flags which can help skip some
+   * computation. For example, if there is lookup value and ofcourse antenna
+   * pattern gain is not required. Even if we try to compute the value with
+   * SarParametricFuntion we  get 1. This is the safe side. But as we are so sure
+   * we skip all those calls to EvaluateParametricCoefficient and also the
+   * Evalute(). For the function the value is 1 by default.
+   */
+  function->SetApplyAntennaPatternGain(!apply);
+  function->SetApplyIncidenceAngleCorrection(!apply);
+  function->SetApplyRangeSpreadLossCorrection(!apply);
+  function->SetApplyRescalingFactor(!apply);
+  function->SetApplyLookupDataCorrection(apply);
 
-  ParametricFunctionPointer   noise;
-  ParametricFunctionPointer   antennaPatternNewGain;
-  ParametricFunctionPointer   antennaPatternOldGain;
-  ParametricFunctionPointer   incidenceAngle;
-  ParametricFunctionPointer   rangeSpreadLoss;
-
-  noise = function->GetNoise();
-  noise->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationNoise());
-  noise->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationNoisePolynomialDegree());
-  noise->EvaluateParametricCoefficient();
-
-  antennaPatternNewGain = function->GetAntennaPatternNewGain();
-  antennaPatternNewGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGain());
-  antennaPatternNewGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree());
-  antennaPatternNewGain->EvaluateParametricCoefficient();
-
-  antennaPatternOldGain = function->GetAntennaPatternOldGain();
-  antennaPatternOldGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGain());
-  antennaPatternOldGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree());
-  antennaPatternOldGain->EvaluateParametricCoefficient();
-
-  incidenceAngle = function->GetIncidenceAngle();
-  incidenceAngle->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationIncidenceAngle());
-
-  typename ParametricFunctionType::PointType point;
-  point.Fill(0);
-  typename ParametricFunctionType::PointSetType::PixelType pointValue;
-  pointValue = itk::NumericTraits<typename ParametricFunctionType::PointSetType::PixelType>::Zero;
-  unsigned int nbRecords = imageMetadataInterface->GetRadiometricCalibrationIncidenceAngle()->GetNumberOfPoints();
-
-  // Fill the linear system
-  for (unsigned int i = 0; i < nbRecords; ++i)
-  {
-      imageMetadataInterface->GetRadiometricCalibrationIncidenceAngle()->GetPoint(i, &point);
-      imageMetadataInterface->GetRadiometricCalibrationIncidenceAngle()->GetPointData(i, &pointValue);
-  }
-  incidenceAngle->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationIncidenceAnglePolynomialDegree());
-
-  incidenceAngle->EvaluateParametricCoefficient();
-  rangeSpreadLoss = function->GetRangeSpreadLoss();
-  rangeSpreadLoss->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLoss());
-  rangeSpreadLoss->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLossPolynomialDegree());
-  rangeSpreadLoss->EvaluateParametricCoefficient();
+  function->SetScale(imageMetadataInterface->GetRadiometricCalibrationScale());
 
+  /* Compute noise if enabled */
+  if( function->GetEnableNoise())
+    {
+    ParametricFunctionPointer   noise;
+    noise = function->GetNoise();
+    noise->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationNoise());
+    noise->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationNoisePolynomialDegree());
+    noise->EvaluateParametricCoefficient();
+    }
+
+  /* Compute old and new antenna pattern gain */
+  if(function->GetApplyAntennaPatternGain())
+    {
+    ParametricFunctionPointer   antennaPatternNewGain;
+    antennaPatternNewGain = function->GetAntennaPatternNewGain();
+    antennaPatternNewGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGain());
+    antennaPatternNewGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree());
+    antennaPatternNewGain->EvaluateParametricCoefficient();
+
+    ParametricFunctionPointer   antennaPatternOldGain;
+    antennaPatternOldGain = function->GetAntennaPatternOldGain();
+    antennaPatternOldGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGain());
+    antennaPatternOldGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree());
+    antennaPatternOldGain->EvaluateParametricCoefficient();
+    }
+
+  /* Compute incidence angle */
+  if (function->GetApplyIncidenceAngleCorrection())
+    {
+    ParametricFunctionPointer   incidenceAngle;
+    incidenceAngle = function->GetIncidenceAngle();
+    incidenceAngle->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationIncidenceAngle());
+    incidenceAngle->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationIncidenceAnglePolynomialDegree());
+    incidenceAngle->EvaluateParametricCoefficient();
+    }
+
+    /* Compute Range spread Loss */
+  if (function->GetApplyRangeSpreadLossCorrection())
+    {
+    ParametricFunctionPointer   rangeSpreadLoss;
+    rangeSpreadLoss = function->GetRangeSpreadLoss();
+    rangeSpreadLoss->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLoss());
+    rangeSpreadLoss->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLossPolynomialDegree());
+    rangeSpreadLoss->EvaluateParametricCoefficient();
+    }
+
+  /** Get the lookupdata instance. unlike the all the above this is not a
+* parametricFunction instance. But rather an internal class in IMI called
+* SarCalibrationLookupData.
+*
+*NOTE: As the computation of lookup data for sensors is not universal. One must
+*provide a sub-class.
+See Also: otbSentinel1ImageMetadataInterface, otbTerraSarImageMetadataInterface,
+*otbRadarsat2ImageMetadataInterface  */
+  if (function->GetApplyLookupDataCorrection())
+    {
+    function->SetCalibrationLookupData(imageMetadataInterface->GetCalibrationLookupData(this->GetLookupSelected()));
+    }
+
+  /** This was introduced for cosmoskymed which required a rescaling factor */
+  if (function->GetApplyRescalingFactor())
+    {
+    function->SetRescalingFactor(imageMetadataInterface->GetRescalingFactor());
+    }
 }
 
-
 } // end namespace otb
 
 #endif
diff --git a/Modules/Radiometry/SARCalibration/test/CMakeLists.txt b/Modules/Radiometry/SARCalibration/test/CMakeLists.txt
index 0e3ddd5..09dde97 100644
--- a/Modules/Radiometry/SARCalibration/test/CMakeLists.txt
+++ b/Modules/Radiometry/SARCalibration/test/CMakeLists.txt
@@ -18,8 +18,6 @@ otbSarRadiometricCalibrationToImageFilterCompareTest.cxx
 otbSarBrightnessFunctor.cxx
 otbSarBrightnessFunctionWithoutNoise.cxx
 otbSarRadiometricCalibrationFunction.cxx
-otbSarRadiometricCalibrationFunctor.cxx
-otbSarRadiometricCalibrationFunctorWithoutNoise.cxx
 otbSarRadiometricCalibrationFunctionWithoutNoise.cxx
 otbTerraSarBrightnessImageComplexFilterTest.cxx
 otbSarRadiometricCalibrationToImageFilterWithComplexPixelTest.cxx
@@ -127,6 +125,28 @@ otb_add_test(NAME raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWith
   1000 1000 250 250 # Extract
   )
 
+#Sentinel-1 L1, SLC
+otb_add_test(NAME raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_SENTINEL1 COMMAND  otbSARCalibrationTestDriver
+  --compare-image ${EPSILON_12}
+  ${BASELINE}/raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_SENTINEL1_VV.tif
+  ${TEMP}/raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_SENTINEL1_VV.tif
+  otbSarRadiometricCalibrationToImageFilterWithComplexPixelTestWithoutNoise
+  LARGEINPUT{SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff}
+  ${TEMP}/raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_SENTINEL1_VV.tif
+  1100 1900 450 450 # Extract
+  )
+
+#Radarsat2
+otb_add_test(NAME raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_RADARSAT2 COMMAND  otbSARCalibrationTestDriver
+  --compare-image ${EPSILON_12}
+  ${BASELINE}/raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_RADARSAT2_HV.tif
+  ${TEMP}/raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_RADARSAT2_HV.tif
+  otbSarRadiometricCalibrationToImageFilterWithComplexPixelTestWithoutNoise
+  LARGEINPUT{RADARSAT2/ALTONA/Fine_Quad-Pol_Dataset/PK6621_DK406_FQ9_20080405_124900_HH_VV_HV_VH_SLC_Altona/imagery_HV.tif}
+  ${TEMP}/raTvSarRadiometricCalibrationToImageWithComplexPixelFilterWithoutNoise_RADARSAT2_HV.tif
+  11 11 650 750 # Extract
+  )
+
 otb_add_test(NAME raTuSarBrightnessFunctorWithoutNoise COMMAND otbSARCalibrationTestDriver
   otbSarBrightnessFunctorWithoutNoise
   )
@@ -190,13 +210,6 @@ otb_add_test(NAME raTvSarRadiometricCalibrationFunction COMMAND otbSARCalibratio
   ${TEMP}/raTvSarRadiometricCalibrationFunctionOutputAsciiWithNoise.txt
   )
 
-otb_add_test(NAME raTuSarRadiometricCalibrationFunctor COMMAND otbSARCalibrationTestDriver
-  otbSarRadiometricCalibrationFunctor
-  )
-
-otb_add_test(NAME raTuSarRadiometricCalibrationFunctorWithoutNoise COMMAND otbSARCalibrationTestDriver
-  otbSarRadiometricCalibrationFunctorWithoutNoise
-  )
 
 otb_add_test(NAME raTvSarRadiometricCalibrationFunctionWithoutNoise COMMAND otbSARCalibrationTestDriver
   --compare-ascii ${NOTOL}
@@ -259,4 +272,3 @@ otb_add_test(NAME raTvSarBrightnessToImageFilter COMMAND  otbSARCalibrationTestD
   ${TEMP}/raTvSarBrightnessToImageFilter_TSX_PANGKALANBUUN_HH.tif
   1000 1000 250 250 # Extract
   )
-
diff --git a/Modules/Radiometry/SARCalibration/test/otbSARCalibrationTestDriver.cxx b/Modules/Radiometry/SARCalibration/test/otbSARCalibrationTestDriver.cxx
index 19236b9..873a912 100644
--- a/Modules/Radiometry/SARCalibration/test/otbSARCalibrationTestDriver.cxx
+++ b/Modules/Radiometry/SARCalibration/test/otbSARCalibrationTestDriver.cxx
@@ -17,8 +17,6 @@ void RegisterTests()
   REGISTER_TEST(otbSarBrightnessFunctor);
   REGISTER_TEST(otbSarBrightnessFunctionWithoutNoise);
   REGISTER_TEST(otbSarRadiometricCalibrationFunction);
-  REGISTER_TEST(otbSarRadiometricCalibrationFunctor);
-  REGISTER_TEST(otbSarRadiometricCalibrationFunctorWithoutNoise);
   REGISTER_TEST(otbSarRadiometricCalibrationFunctionWithoutNoise);
   REGISTER_TEST(otbTerraSarBrightnessImageComplexFilterTest);
   REGISTER_TEST(otbSarRadiometricCalibrationToImageFilterWithComplexPixelTest);
diff --git a/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctionWithoutNoise.cxx b/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctionWithoutNoise.cxx
index 8b0f967..6e6fe8d 100644
--- a/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctionWithoutNoise.cxx
+++ b/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctionWithoutNoise.cxx
@@ -20,6 +20,7 @@
 #include "otbImage.h"
 #include "otbImageFileReader.h"
 #include <iostream>
+#include "otbMath.h"
 
 int otbSarBrightnessFunctionWithoutNoise(int itkNotUsed(argc), char* argv[])
 {
diff --git a/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctor.cxx b/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctor.cxx
index a407fd5..f991127 100644
--- a/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctor.cxx
+++ b/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctor.cxx
@@ -16,8 +16,8 @@
 
 =========================================================================*/
 #include "itkMacro.h"
-
 #include "otbSarBrightnessFunctor.h"
+#include "otbMath.h"
 
 int otbSarBrightnessFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
 {
@@ -28,28 +28,28 @@ int otbSarBrightnessFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[])
   FunctorType funct;
 
   funct.SetNoise( 10.0);
-  if( abs(funct.GetNoise() -10.0) > 0.0)
+  if( vcl_abs(funct.GetNoise() -10.0) > 0.0)
   {
     return false;
   }
   funct.SetScale( 10.0);
-  if( abs(funct.GetScale() -10.0) > 0.0)
+  if( vcl_abs(funct.GetScale() -10.0) > 0.0)
   {
     return false;
   }
   funct.SetAntennaPatternNewGain( 10.0);
-  if( abs(funct.GetAntennaPatternNewGain() -10.0) > 0.0)
+  if( vcl_abs(funct.GetAntennaPatternNewGain() -10.0) > 0.0)
   {
     return false;
   }
   funct.SetAntennaPatternOldGain( 10.0);
-  if( abs(funct.GetAntennaPatternOldGain() -10.0) > 0.0)
+  if( vcl_abs(funct.GetAntennaPatternOldGain() -10.0) > 0.0)
   {
     return false;
   }
 
   funct.SetRangeSpreadLoss( 10.0);
-  if( abs(funct.GetRangeSpreadLoss() -10.0) > 0.0)
+  if( vcl_abs(funct.GetRangeSpreadLoss() -10.0) > 0.0)
   {
     return false;
   }
diff --git a/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctorWithoutNoise.cxx b/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctorWithoutNoise.cxx
index 60f6445..6f435d0 100644
--- a/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctorWithoutNoise.cxx
+++ b/Modules/Radiometry/SARCalibration/test/otbSarBrightnessFunctorWithoutNoise.cxx
@@ -16,8 +16,8 @@
 
 =========================================================================*/
 #include "itkMacro.h"
-
 #include "otbSarBrightnessFunctor.h"
+#include "otbMath.h"
 
 int otbSarBrightnessFunctorWithoutNoise(int itkNotUsed(argc), char * itkNotUsed(argv)[])
 {
@@ -30,51 +30,51 @@ int otbSarBrightnessFunctorWithoutNoise(int itkNotUsed(argc), char * itkNotUsed(
 
   // With Noise
   functWithNoise.SetNoise( 0.0);
-  if( abs(functWithNoise.GetNoise() -0.0) > 0.0)
+  if( vcl_abs(functWithNoise.GetNoise() -0.0) > 0.0)
   {
     return false;
   }
   functWithNoise.SetScale( 10.0);
-  if( abs(functWithNoise.GetScale() -10.0) > 0.0)
+  if( vcl_abs(functWithNoise.GetScale() -10.0) > 0.0)
   {
     return false;
   }
   functWithNoise.SetAntennaPatternNewGain( 10.0);
-  if( abs(functWithNoise.GetAntennaPatternNewGain() -10.0) > 0.0)
+  if( vcl_abs(functWithNoise.GetAntennaPatternNewGain() -10.0) > 0.0)
   {
     return false;
   }
   functWithNoise.SetAntennaPatternOldGain( 10.0);
-  if( abs(functWithNoise.GetAntennaPatternOldGain() -10.0) > 0.0)
+  if( vcl_abs(functWithNoise.GetAntennaPatternOldGain() -10.0) > 0.0)
   {
     return false;
   }
 
   functWithNoise.SetRangeSpreadLoss( 10.0);
-  if( abs(functWithNoise.GetRangeSpreadLoss() -10.0) > 0.0)
+  if( vcl_abs(functWithNoise.GetRangeSpreadLoss() -10.0) > 0.0)
   {
     return false;
   }
 
   // Without Noise
   functWithoutNoise.SetScale(10.0);
-  if (abs(functWithoutNoise.GetScale() - 10.0) > 0.0)
+  if (vcl_abs(functWithoutNoise.GetScale() - 10.0) > 0.0)
     {
     return false;
     }
   functWithoutNoise.SetAntennaPatternNewGain(10.0);
-  if (abs(functWithoutNoise.GetAntennaPatternNewGain() - 10.0) > 0.0)
+  if (vcl_abs(functWithoutNoise.GetAntennaPatternNewGain() - 10.0) > 0.0)
     {
     return false;
     }
   functWithoutNoise.SetAntennaPatternOldGain(10.0);
-  if (abs(functWithoutNoise.GetAntennaPatternOldGain() - 10.0) > 0.0)
+  if (vcl_abs(functWithoutNoise.GetAntennaPatternOldGain() - 10.0) > 0.0)
     {
     return false;
     }
 
   functWithoutNoise.SetRangeSpreadLoss(10.0);
-  if (abs(functWithoutNoise.GetRangeSpreadLoss() - 10.0) > 0.0)
+  if (vcl_abs(functWithoutNoise.GetRangeSpreadLoss() - 10.0) > 0.0)
     {
     return false;
     }
diff --git a/Modules/Radiometry/Simulation/otb-module.cmake b/Modules/Radiometry/Simulation/otb-module.cmake
index e198396..0c5d1cc 100644
--- a/Modules/Radiometry/Simulation/otb-module.cmake
+++ b/Modules/Radiometry/Simulation/otb-module.cmake
@@ -15,7 +15,7 @@ otb_module(OTBSimulation
     OTBIndices
     OTBCommon
     OTBInterpolation
-    OTBBoost
+    OTBBoostAdapters
     OTBOpticalCalibration
     OTBObjectList
 
diff --git a/Modules/Radiometry/Simulation/src/otbProspectModel.cxx b/Modules/Radiometry/Simulation/src/otbProspectModel.cxx
index 3aa5549..71edbf4 100644
--- a/Modules/Radiometry/Simulation/src/otbProspectModel.cxx
+++ b/Modules/Radiometry/Simulation/src/otbProspectModel.cxx
@@ -19,7 +19,7 @@
 #include "itkNumericTraits.h"
 
 #include "otbProspectModel.h"
-#include <boost/math/special_functions/expint.hpp>
+#include "otb_boost_expint_header.h"
 #include <boost/shared_ptr.hpp>
 #include "otbMath.h"
 
@@ -256,4 +256,3 @@ ProspectModel
 
 }
 } // end namespace otb
-
diff --git a/Modules/Radiometry/Simulation/src/otbSailModel.cxx b/Modules/Radiometry/Simulation/src/otbSailModel.cxx
index 230637d..76dfd3c 100644
--- a/Modules/Radiometry/Simulation/src/otbSailModel.cxx
+++ b/Modules/Radiometry/Simulation/src/otbSailModel.cxx
@@ -18,7 +18,7 @@
 #include "itkNumericTraits.h"
 
 #include "otbSailModel.h"
-#include <boost/math/special_functions/expint.hpp>
+#include "otb_boost_expint_header.h"
 #include <boost/shared_ptr.hpp>
 #include "otbMath.h"
 
@@ -457,7 +457,7 @@ SailModel
 
       absh = (1-rddt-(1-rsoil0)*(tdd+(tdd*rdd*rsoil0)/dn));
       absv = (1-rsdt-(1-rsoil0)*(tss+(tss*rsoil0*rdd+tsd)/dn));
-      
+
       SpectralResponseType::PairType response;
       response.first=lambda/1000.0;
       response.second=resh;
@@ -508,7 +508,7 @@ SailModel
       x2 = excent/sqrt(1.+excent*excent*vcl_tan(tl2)*vcl_tan(tl2));
       if(excent==1)
       {
-         v = abs(cos(tl1)-cos(tl2));
+         v = vcl_abs(cos(tl1)-cos(tl2));
          temp.push_back( v );
          sum = sum + v;
       }
@@ -709,4 +709,3 @@ SailModel
 
 }
 } // end namespace otb
-
diff --git a/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.txx b/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.txx
index 2a0932c..afd59f1 100644
--- a/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.txx
+++ b/Modules/Registration/DisparityMap/include/otbDisparityTranslateFilter.txx
@@ -205,6 +205,18 @@ DisparityTranslateFilter<TDisparityImage,TGridImage,TSensorImage,TMaskImage>
 
   horizOut->CopyInformation(leftIn);
   vertiOut->CopyInformation(leftIn);
+
+  // Set the NoData value
+  std::vector<bool> noDataValueAvailable;
+  noDataValueAvailable.push_back(true);
+  std::vector<double> noDataValue;
+  noDataValue.push_back(m_NoDataValue);
+  itk::MetaDataDictionary& dict = horizOut->GetMetaDataDictionary();
+  itk::EncapsulateMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+  itk::EncapsulateMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValue);
+  dict = vertiOut->GetMetaDataDictionary();
+  itk::EncapsulateMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+  itk::EncapsulateMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValue);
 }
 
 template <class TDisparityImage, class TGridImage, class TSensorImage, class TMaskImage>
diff --git a/Modules/Registration/DisplacementField/test/otbBSplinesInterpolateDisplacementFieldGeneratorNew.cxx b/Modules/Registration/DisplacementField/test/otbBSplinesInterpolateDisplacementFieldGeneratorNew.cxx
index 880ff3d..823122f 100644
--- a/Modules/Registration/DisplacementField/test/otbBSplinesInterpolateDisplacementFieldGeneratorNew.cxx
+++ b/Modules/Registration/DisplacementField/test/otbBSplinesInterpolateDisplacementFieldGeneratorNew.cxx
@@ -22,11 +22,12 @@
 
 int otbBSplinesInterpolateDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) [])
 {
-  const unsigned int Dimension = 2;
+  const unsigned int Dimension = 3;
   typedef double                                                                     PixelType;
-  typedef otb::VectorImage<PixelType, Dimension>                                     ImageType;
-  typedef ImageType::PointType                                                       PointType;
+  typedef otb::VectorImage<PixelType, 2>                                             ImageType;
+  typedef itk::FixedArray<double, Dimension>                                         PointType;
   typedef itk::PointSet<PointType, Dimension>                                        PointSetType;
+
   typedef otb::BSplinesInterpolateDisplacementFieldGenerator<PointSetType, ImageType> FilterType;
 
   // Instantiating object
diff --git a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx
index 8fd8030..7f9cd03 100644
--- a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx
+++ b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx
@@ -632,7 +632,7 @@ AdhesionCorrectionFilter<TImage, TMask>
               int l=-2-win;
               index2[0] = index_pos[0] + i;
               index2[1] = index_pos[1] + l;
-              while (old_maskPtr->GetPixel(index2) == 0)
+              while (old_maskPtr->GetBufferedRegion().IsInside(index2) && old_maskPtr->GetPixel(index2) == 0)
                 {
                 l++;
                 index2[1] = index_pos[1] + l;
diff --git a/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.txx b/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.txx
index 1723af8..c4f6307 100644
--- a/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.txx
+++ b/Modules/Registration/Stereo/include/otbBijectionCoherencyFilter.txx
@@ -265,12 +265,18 @@ BijectionCoherencyFilter<TDisparityImage,TOutputImage>
       ul[1] = (buffered.GetIndex()[1]+buffered.GetSize()[1]-1);
 
     ur = ul;
-    ur[0] += 1;
     ll = ul;
-    ll[1] += 1;
     lr = ul;
-    lr[0] += 1;
-    lr[1] += 1;
+    if (ul[0] < static_cast<IndexValueType>(buffered.GetIndex()[0] + buffered.GetSize()[0]-1))
+      {
+      ur[0] += 1;
+      lr[0] += 1;
+      }
+    if (ul[1] < static_cast<IndexValueType>(buffered.GetIndex()[1] + buffered.GetSize()[1]-1))
+      {
+      ll[1] += 1;
+      lr[1] += 1;
+      }
 
     double rx = tmpIndex[0] - static_cast<double>(ul[0]);
     double ry = tmpIndex[1] - static_cast<double>(ul[1]);
diff --git a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx
index 2c7a851..28c605b 100644
--- a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx
+++ b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx
@@ -337,7 +337,14 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::GenerateOutpu
     m_IsGeographic = oSRS.IsGeographic(); // TODO check if this test is valid for all projection systems
     }
 
-
+  // Set the NoData value
+  std::vector<bool> noDataValueAvailable;
+  noDataValueAvailable.push_back(true);
+  std::vector<double> noDataValue;
+  noDataValue.push_back(m_NoDataValue);
+  itk::MetaDataDictionary& dict = outputPtr->GetMetaDataDictionary();
+  itk::EncapsulateMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+  itk::EncapsulateMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValue);
 }
 
 template<class T3DImage, class TMaskImage, class TOutputDEMImage>
@@ -541,22 +548,24 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::ThreadedGener
   typename OutputImageType::PointType pointRefStep;
   typename OutputImageType::RegionType requestedRegion = outputPtr->GetRequestedRegion();
 
-  typename TOutputDEMImage::SpacingType step = outputPtr->GetSpacing();
+//  typename TOutputDEMImage::SpacingType step = outputPtr->GetSpacing();
 
   //convert requested region to Long/Lat
 
-  typename TOutputDEMImage::SizeType size = requestedRegion.GetSize();
+//  typename TOutputDEMImage::SizeType size = requestedRegion.GetSize();
 
   typename TOutputDEMImage::IndexType index = requestedRegion.GetIndex();
   outputPtr->TransformIndexToPhysicalPoint(index, pointRef);
+  /*
   InputInternalPixelType regionLong1 = pointRef[0];
   InputInternalPixelType regionLat1 = pointRef[1];
   InputInternalPixelType regionLong2 = pointRef[0] + size[0] * step[0];
   InputInternalPixelType regionLat2 = pointRef[1] + size[1] * step[1];
   InputInternalPixelType minLong = std::min(regionLong1, regionLong2);
-  // InputInternalPixelType minLat = std::min(regionLat1, regionLat2);
-  // InputInternalPixelType maxLong = std::max(regionLong1, regionLong2);
-  // InputInternalPixelType maxLat = std::max(regionLat1, regionLat2);
+  InputInternalPixelType minLat = std::min(regionLat1, regionLat2);
+  InputInternalPixelType maxLong = std::max(regionLong1, regionLong2);
+  InputInternalPixelType maxLat = std::max(regionLat1, regionLat2);
+  */
 
   TOutputDEMImage * tmpDEM = NULL;
   AccumulatorImageType *tmpAcc = NULL;
diff --git a/Modules/Remote/Mosaic.remote.cmake b/Modules/Remote/Mosaic.remote.cmake
new file mode 100644
index 0000000..fa38ba4
--- /dev/null
+++ b/Modules/Remote/Mosaic.remote.cmake
@@ -0,0 +1,9 @@
+#Contact: Rémi Cresson <remi.cresson at teledetection.fr>
+otb_fetch_module(Mosaic
+  "This module provides one application dedicated to images mosaicking
+A more detailed description can be found on the project website:
+https://github.com/remicres/otb-mosaic
+"
+  GIT_REPOSITORY https://github.com/remicres/otb-mosaic.git
+  GIT_TAG 1406369c1ec9accffc0b3f40d0411e78bed2d893
+)
diff --git a/Modules/Remote/SertitObject.remote.cmake b/Modules/Remote/SertitObject.remote.cmake
new file mode 100644
index 0000000..8bb9d48
--- /dev/null
+++ b/Modules/Remote/SertitObject.remote.cmake
@@ -0,0 +1,27 @@
+#Contact: Rémi Cresson <remi.cresson at teledetection.fr>
+otb_fetch_module(SertitObject
+  "This module provides 2 applications dedicated to object-oriented image analysis.
+   
+   Aggregate application:
+
+The aim of this application is to merge the result of a segmentation with a
+pixel-based image classification in order to produce an object-oriented image
+classification. The input segmentation is a labeled image, typically the result
+provided by the OTB application LSMSSegmentation. The output is a vector dataset
+containing objects and the corresponding class in the attribute table. Connected
+regions belonging to the same class are merged. This application could be used
+at the last step of the LSMS pipeline in replacement of the application
+LSMSVectorization.  
+
+   ObjectsRadiometricStatistics application:
+
+This application computes radiometric and shape attributes on a vector dataset,
+using an image. The results are stored in the attribute table. Shape attributes
+are : number of pixels, flatness, roundness, elongation, perimeter. Radiometric
+attributes are for each band of the input image : mean, standard-deviation,
+median, variance, kurtosis, skewness. The result could be use to perform futher
+object-oriented image analysis.
+"
+  GIT_REPOSITORY https://github.com/sertit/SertitObject.git
+  GIT_TAG 90c369e9a197b3f83cb18e1d7bc594313fef63d5
+)
diff --git a/Modules/Remote/otbGRM.remote.cmake b/Modules/Remote/otbGRM.remote.cmake
new file mode 100644
index 0000000..5b04011
--- /dev/null
+++ b/Modules/Remote/otbGRM.remote.cmake
@@ -0,0 +1,16 @@
+#Contact: Pierre Lassalle <lassallepierre34 at gmail.com> 
+otb_fetch_module(otbGRM
+  "This module provides the GRM OTB application to perform multiscale
+region-merging segmentation on satellite images. Three local homogeneity
+criteria are available: the Baatz & Schäpe criterion, the Full Lambda Schedule
+criterion and the simple Euclidean Distance criterion.  This application uses
+the GRM (Generic Region Merging) library which allows to add quickly a new local
+homogeneity criterion. Look at the template header file: GRMSegmenterTemplate.h
+to see which format you must respect to add a new criterion.
+
+A more detailed description can be found on the project website:
+http://tully.ups-tlse.fr/lassallep/grm
+"
+  GIT_REPOSITORY http://tully.ups-tlse.fr/lassallep/grm.git
+  GIT_TAG 7762ef1f84154fcbaecba476ab9e0aba1bcd736c
+)
diff --git a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx
index 997c4cb..69b8e32 100644
--- a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx
+++ b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx
@@ -20,6 +20,8 @@
 #include "otbOGRIOHelper.h"
 #include "otbGdalDataTypeBridge.h"
 #include "otbImageMetadataInterfaceFactory.h"
+#include "itkMetaDataObject.h"
+#include "otbMetaDataKey.h"
 
 #include "gdal_alg.h"
 #include "stdint.h" //needed for uintptr_t
@@ -164,6 +166,15 @@ OGRDataSourceToLabelImageFilter<TOutputImage>
          m_SrcDataSetLayers.push_back( &(ogrDS->GetLayer(layer).ogr()) );
       }
     }
+
+  // Set the NoData value using the background
+  const unsigned int & nbBands =  outputPtr->GetNumberOfComponentsPerPixel();
+  std::vector<bool> noDataValueAvailable;
+  noDataValueAvailable.resize(nbBands,true);
+  std::vector<double> noDataValue;
+  noDataValue.resize(nbBands,static_cast<double>(m_BackgroundValue));
+  itk::EncapsulateMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable);
+  itk::EncapsulateMetaData<std::vector<double> >(dict,MetaDataKey::NoDataValue,noDataValue);
 }
 
 template< class TOutputImage>
diff --git a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h
index 32e8d62..ce68b0f 100644
--- a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h
+++ b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.h
@@ -27,10 +27,8 @@
 
 #include "gdal.h"
 #include "gdal_alg.h"
-
-#include <ogrsf_frmts.h>
-#include "ogr_api.h"
 #include "ogr_srs_api.h"
+#include "otbOGRVersionProxy.h"
 
 namespace otb {
 
@@ -142,7 +140,7 @@ protected:
   {
     if (m_OGRDataSourcePointer != NULL)
       {
-      OGRDataSource::DestroyDataSource(m_OGRDataSourcePointer);
+      ogr::version_proxy::Close(m_OGRDataSourcePointer);
       }
   }
 
@@ -154,7 +152,7 @@ private:
   RasterizeVectorDataFilter(const Self&); //purposely not implemented
   void operator=(const Self&); //purposely not implemented
 
-  OGRDataSource*              m_OGRDataSourcePointer;
+  ogr::version_proxy::GDALDatasetType * m_OGRDataSourcePointer;
 
   // Vector Of LayersH
   std::vector< OGRLayerH >    m_SrcDataSetLayers;
diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h
index 0e51efb..24aa6e7 100644
--- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h
+++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h
@@ -26,7 +26,7 @@
 
 #include "gdal.h"
 #include "ogr_api.h"
-#include <ogrsf_frmts.h>
+#include "otbOGRVersionProxy.h"
 
 namespace otb {
 
@@ -134,7 +134,7 @@ protected:
 
     if (m_OGRDataSourcePointer != NULL)
       {
-      OGRDataSource::DestroyDataSource(m_OGRDataSourcePointer);
+      ogr::version_proxy::Close(m_OGRDataSourcePointer);
       }
   }
 
@@ -146,7 +146,7 @@ private:
   VectorDataToLabelImageFilter(const Self&); //purposely not implemented
   void operator=(const Self&); //purposely not implemented
 
-  OGRDataSource*                m_OGRDataSourcePointer;
+  ogr::version_proxy::GDALDatasetType * m_OGRDataSourcePointer;
 
   // Vector Of OGRGeometyH
   std::vector< OGRGeometryH >   m_SrcDataSetGeometries;
diff --git a/Modules/Segmentation/Conversion/test/otbOGRDataSourceToLabelImageFilter.cxx b/Modules/Segmentation/Conversion/test/otbOGRDataSourceToLabelImageFilter.cxx
index 681dbc6..745f1b0 100644
--- a/Modules/Segmentation/Conversion/test/otbOGRDataSourceToLabelImageFilter.cxx
+++ b/Modules/Segmentation/Conversion/test/otbOGRDataSourceToLabelImageFilter.cxx
@@ -9,8 +9,6 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Segmentation/Conversion/test/otbPolygonizationRasterizationTest.cxx b/Modules/Segmentation/Conversion/test/otbPolygonizationRasterizationTest.cxx
index df69214..abb2562 100644
--- a/Modules/Segmentation/Conversion/test/otbPolygonizationRasterizationTest.cxx
+++ b/Modules/Segmentation/Conversion/test/otbPolygonizationRasterizationTest.cxx
@@ -9,8 +9,6 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Segmentation/Conversion/test/otbVectorDataRasterizeFilter.cxx b/Modules/Segmentation/Conversion/test/otbVectorDataRasterizeFilter.cxx
index 2e073dd..e9032ae 100644
--- a/Modules/Segmentation/Conversion/test/otbVectorDataRasterizeFilter.cxx
+++ b/Modules/Segmentation/Conversion/test/otbVectorDataRasterizeFilter.cxx
@@ -9,8 +9,6 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Segmentation/Conversion/test/otbVectorDataToLabelImageFilter.cxx b/Modules/Segmentation/Conversion/test/otbVectorDataToLabelImageFilter.cxx
index 04619bd..229b5b6 100644
--- a/Modules/Segmentation/Conversion/test/otbVectorDataToLabelImageFilter.cxx
+++ b/Modules/Segmentation/Conversion/test/otbVectorDataToLabelImageFilter.cxx
@@ -9,8 +9,6 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Segmentation/Conversion/test/otbVectorDataToLabelImageFilterWithoutReader.cxx b/Modules/Segmentation/Conversion/test/otbVectorDataToLabelImageFilterWithoutReader.cxx
index 4b00e88..8dd0bc3 100644
--- a/Modules/Segmentation/Conversion/test/otbVectorDataToLabelImageFilterWithoutReader.cxx
+++ b/Modules/Segmentation/Conversion/test/otbVectorDataToLabelImageFilterWithoutReader.cxx
@@ -9,8 +9,6 @@
   Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
   See OTBCopyright.txt for details.
 
-  Copyright (c) Institut Telecom; Telecom Bretagne. All rights reserved.
-  See ITCopyright.txt for details.
 
      This software is distributed WITHOUT ANY WARRANTY; without even
      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
diff --git a/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h b/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h
index 03c8a2b..200ceed 100644
--- a/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h
+++ b/Modules/Segmentation/Metrics/include/otbHooverInstanceFilter.h
@@ -129,16 +129,18 @@ public:
   itkGetMacro(MeanRM, AttributesValueType);
   itkGetMacro(MeanRN, AttributesValueType);
 
-  itkStaticConstMacro(ATTRIBUTE_CD, AttributeType, 100);
-  itkStaticConstMacro(ATTRIBUTE_OS, AttributeType, 101);
-  itkStaticConstMacro(ATTRIBUTE_US, AttributeType, 102);
-  itkStaticConstMacro(ATTRIBUTE_M,  AttributeType, 103);
-  itkStaticConstMacro(ATTRIBUTE_N,  AttributeType, 104);
-  itkStaticConstMacro(ATTRIBUTE_RC, AttributeType, 105);
-  itkStaticConstMacro(ATTRIBUTE_RF, AttributeType, 106);
-  itkStaticConstMacro(ATTRIBUTE_RA, AttributeType, 107);
-  itkStaticConstMacro(ATTRIBUTE_RM, AttributeType, 108);
-  itkStaticConstMacro(ATTRIBUTE_RN, AttributeType, 109);
+  enum AttributeTypes {
+    ATTRIBUTE_CD=100,
+    ATTRIBUTE_OS,
+    ATTRIBUTE_US,
+    ATTRIBUTE_M,
+    ATTRIBUTE_N,
+    ATTRIBUTE_RC,
+    ATTRIBUTE_RF,
+    ATTRIBUTE_RA,
+    ATTRIBUTE_RM,
+    ATTRIBUTE_RN
+  };
 
   static std::string GetNameFromAttribute( const AttributeType & a )
     {
diff --git a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx
index b9ff295..b1a88bf 100644
--- a/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx
+++ b/Modules/Segmentation/OGRProcessing/include/otbOGRLayerStreamStitchingFilter.txx
@@ -317,7 +317,25 @@ OGRLayerStreamStitchingFilter<TInputImage>
                ogr::Field field = upper.feat[0];
                try
                  {
+                 #ifdef OTB_USE_GDAL_20
+                 // In this case, the feature id can be either
+                 // OFTInteger64 or OFTInteger
+                 switch(field.GetType())
+                   {
+                   case OFTInteger64:
+                   {
+                   fusionFeature[0].SetValue(field.GetValue<GIntBig>());
+                   break;
+                   }
+                   default:
+                   {
+                   fusionFeature[0].SetValue(field.GetValue<int>());
+                   }
+                   }
+                 #else
+                 // Only OFTInteger supported in this case
                  fusionFeature[0].SetValue(field.GetValue<int>());
+                 #endif
                  m_OGRLayer.CreateFeature(fusionFeature);
                  m_OGRLayer.DeleteFeature(lower.feat.GetFID());
                  m_OGRLayer.DeleteFeature(upper.feat.GetFID());
diff --git a/Modules/ThirdParty/GDAL/CMakeLists.txt b/Modules/ThirdParty/GDAL/CMakeLists.txt
index 0df9914..cd42ac6 100644
--- a/Modules/ThirdParty/GDAL/CMakeLists.txt
+++ b/Modules/ThirdParty/GDAL/CMakeLists.txt
@@ -3,6 +3,4 @@ project(OTBGDAL)
 set(OTBGDAL_SYSTEM_INCLUDE_DIRS ${GDAL_INCLUDE_DIRS})
 set(OTBGDAL_LIBRARIES "${GDAL_LIBRARIES}")
 
-set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE)
-
 otb_module_impl()
diff --git a/Modules/ThirdParty/GDAL/gdalVersionTest.cxx b/Modules/ThirdParty/GDAL/gdalVersionTest.cxx
index 981cf8f..076a144 100644
--- a/Modules/ThirdParty/GDAL/gdalVersionTest.cxx
+++ b/Modules/ThirdParty/GDAL/gdalVersionTest.cxx
@@ -55,7 +55,7 @@ int main(int argc, char * argv[])
 	}
 
   
-  if ( (UIntVect[0]<MAJOR) || (UIntVect[1]<MINOR) )
+  if ( (UIntVect[0]==MAJOR && UIntVect[1]<MINOR) || (UIntVect[0]<MAJOR) )
 	{
 		cout << "WARNING : Version of GDAL must be >= " << MAJOR << "." << MINOR << " : " << UIntVect[0] << "." << UIntVect[1] << " detected)." << endl;
 		return 1;
diff --git a/Modules/ThirdParty/GDAL/otb-module-init.cmake b/Modules/ThirdParty/GDAL/otb-module-init.cmake
index 60c16c4..47380a1 100644
--- a/Modules/ThirdParty/GDAL/otb-module-init.cmake
+++ b/Modules/ThirdParty/GDAL/otb-module-init.cmake
@@ -2,12 +2,16 @@ find_package ( GDAL REQUIRED )
 
 mark_as_advanced(GDAL_INCLUDE_DIR)
 mark_as_advanced(GDAL_LIBRARY)
-
+mark_as_advanced(GDAL_CONFIG)
 
 if(NOT GDAL_FOUND)
  message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY")
 endif()
 
+#Allow to deactivate GDAL checking (done by default)
+set(GDAL_CONFIG_CHECKING ON CACHE BOOL "Tests to check gdal config." FORCE)
+mark_as_advanced(GDAL_CONFIG_CHECKING)
+
 if(GDAL_CONFIG_CHECKING)
 	set(MIN_MAJOR_VERSION 1)
 	set(MIN_MINOR_VERSION 10)
@@ -23,7 +27,7 @@ if(GDAL_CONFIG_CHECKING)
 	#------------------- TESTS ---------------------
 	# Version of GDAL  
 	try_run(RUN_RESULT_VERSION COMPILE_RESULT_VERSION ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalVersionTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}" ARGS ${TEMP}/gdalVersion.txt ${MIN_MAJOR_VERSION} ${MIN_MINOR_VERSION})
-
+  
 	# Has OGR
 	try_compile(GDAL_HAS_OGR ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/GDAL/gdalOGRTest.cxx CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${GDAL_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${GDAL_LIBRARY}")
 
@@ -85,6 +89,15 @@ if(GDAL_CONFIG_CHECKING)
 		file(READ "${TEMP}/gdalVersion.txt" DETECTED_VERSION)
 		message(WARNING "Version of GDAL must be >= " ${MIN_MAJOR_VERSION} "." ${MIN_MINOR_VERSION} " : " ${DETECTED_VERSION} " detected.")
 		set(GDAL_QUALIFIES FALSE)
+  else((${RUN_RESULT_VERSION} EQUAL 1))
+    file(READ "${TEMP}/gdalVersion.txt" DETECTED_VERSION)
+    string(SUBSTRING ${DETECTED_VERSION} 0 2 VER2)
+    if(${VER2} EQUAL "2.")
+      message(STATUS "Gdal >= 2.0.0 detected")
+      set(OTB_USE_GDAL_20 true CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE )
+    else(${VER2} EQUAL "2.")
+      set(OTB_USE_GDAL_20 false CACHE INTERNAL "True if GDAL >= 2.0.0 has been detected" FORCE )
+    endif()
 	endif()
 		
 	if (NOT GDAL_HAS_OGR)
@@ -98,8 +111,8 @@ if(GDAL_CONFIG_CHECKING)
 	else()
 
 		if (NOT GDAL_HAS_J2K_JG2000 AND NOT GDAL_HAS_J2K_OPJG AND NOT GDAL_HAS_J2K_KAK AND NOT GDAL_HAS_J2K_ECW)
-		message(WARNING "No Jpeg2000 driver found (compatible drivers are : OpenJpeg, Kakadu, ECW).")
-		set(GDAL_QUALIFIES FALSE)
+		message(STATUS "No Jpeg2000 driver found (compatible drivers are : OpenJpeg, Kakadu, ECW).")
+		#set(GDAL_QUALIFIES FALSE)
 		endif()
 			
 		if (NOT GDAL_HAS_JPEG)
@@ -190,5 +203,24 @@ if(GDAL_CONFIG_CHECKING)
           message(STATUS "Check if Gdal qualifies for Orfeo ToolBox -- no.")
 	endif()
 
+  if(NOT GDAL_VERSION)
+    if(EXISTS "${TEMP}/gdalVersion.txt")
+      file(READ "${TEMP}/gdalVersion.txt" GDAL_VERSION)
+    endif()
+  endif()
+  message(STATUS "  Version : ${GDAL_VERSION}")
+  message(STATUS "  Drivers for JPEG 2000 : ")
+  if(GDAL_HAS_J2K_JG2000)
+    message(STATUS "    Jasper (will not be used)")
+  endif()
+  if(GDAL_HAS_J2K_OPJG)
+    message(STATUS "    OpenJPEG")
+  endif()
+  if(GDAL_HAS_J2K_KAK)
+    message(STATUS "    Kakadu")
+  endif()
+  if(GDAL_HAS_J2K_ECW)
+    message(STATUS "    ECW")
+  endif()
 
 endif() #GDAL_CONFIG_CHECKING
diff --git a/Modules/ThirdParty/ITK/include/otbWarpImageFilter.h b/Modules/ThirdParty/ITK/include/otbWarpImageFilter.h
index 0a2041d..19f46d9 100644
--- a/Modules/ThirdParty/ITK/include/otbWarpImageFilter.h
+++ b/Modules/ThirdParty/ITK/include/otbWarpImageFilter.h
@@ -257,7 +257,7 @@ private:
   /** This function should be in an interpolator but none of the ITK
    * interpolators at this point handle edge conditions properly
    */
-  DisplacementType EvaluateDisplacementAtPhysicalPoint(const PointType &p);
+  DisplacementType EvaluateDisplacementAtPhysicalPoint(const PointType &p, const DisplacementFieldType *fieldPtr);
 
   PixelType                  m_EdgePaddingValue;
   SpacingType                m_OutputSpacing;
diff --git a/Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx b/Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx
index a57a72f..7f0719b 100644
--- a/Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx
+++ b/Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx
@@ -214,9 +214,8 @@ typename WarpImageFilter<TInputImage,
                          TOutputImage,
                          TDisplacementField>::DisplacementType
 WarpImageFilter<TInputImage,TOutputImage,TDisplacementField>
-::EvaluateDisplacementAtPhysicalPoint(const PointType &point)
+::EvaluateDisplacementAtPhysicalPoint(const PointType &point, const DisplacementFieldType *fieldPtr)
 {
-  DisplacementFieldPointer fieldPtr = this->GetDisplacementField();
   itk::ContinuousIndex<double,ImageDimension> index;
   fieldPtr->TransformPhysicalPointToContinuousIndex(point,index);
   unsigned int dim;  // index over dimension
@@ -377,7 +376,7 @@ WarpImageFilter<TInputImage,TOutputImage,TDisplacementField>
       index = outputIt.GetIndex();
       outputPtr->TransformIndexToPhysicalPoint( index, point );
 
-      displacement = this->EvaluateDisplacementAtPhysicalPoint(point);
+      displacement = this->EvaluateDisplacementAtPhysicalPoint( point, fieldPtr );
       // compute the required input image point
       for(unsigned int j = 0; j < ImageDimension; j++ )
         {
diff --git a/Modules/ThirdParty/ITK/otb-module-init.cmake b/Modules/ThirdParty/ITK/otb-module-init.cmake
index 0cf743e..9cfbdab 100644
--- a/Modules/ThirdParty/ITK/otb-module-init.cmake
+++ b/Modules/ThirdParty/ITK/otb-module-init.cmake
@@ -80,7 +80,8 @@ set(OTBITK_ITK_REQUIRED_MODULE_LIST
     ITKVoronoi
     ITKWatersheds)
 
-find_package ( ITK COMPONENTS ${OTBITK_ITK_REQUIRED_MODULE_LIST})
+find_package(ITK COMPONENTS ${OTBITK_ITK_REQUIRED_MODULE_LIST})
+mark_as_advanced(ITK_DIR)
 
 # set ( ITK_NO_IO_FACTORY_REGISTER_MANAGER TRUE )
 # include (${ITK_USE_FILE})
diff --git a/Modules/ThirdParty/MuParser/CMakeLists.txt b/Modules/ThirdParty/MuParser/CMakeLists.txt
index adcee13..e4ece5e 100644
--- a/Modules/ThirdParty/MuParser/CMakeLists.txt
+++ b/Modules/ThirdParty/MuParser/CMakeLists.txt
@@ -4,31 +4,36 @@ set(OTBMuParser_SYSTEM_INCLUDE_DIRS ${MUPARSER_INCLUDE_DIRS})
 set(OTBMuParser_LIBRARIES "${MUPARSER_LIBRARIES}")
 set(OTBMuParser_INCLUDE_DIRS ${OTBMuParser_BINARY_DIR}/src)
 
+set(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS 0)
+if(NOT MUPARSER_VERSION_NUMBER LESS 20000)
+set(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS 1)
+endif()
+
 # Starting with muparser 2.0.0,
 # intrinsic operators "and", "or", "xor" have been removed
 #  and intrinsic operators "&&" and "||" have been introduced as replacements
-include(CheckCXXSourceRuns)
-set(CMAKE_REQUIRED_INCLUDES ${OTBMuParser_SYSTEM_INCLUDE_DIRS})
-set(CMAKE_REQUIRED_LIBRARIES ${OTBMuParser_LIBRARIES})
-unset(CMAKE_REQUIRED_FLAGS)
-unset(CMAKE_REQUIRED_DEFINES)
-file(READ ${OTBMuParser_SOURCE_DIR}/CMake/otbTestMuParserHasCxxLogicalOperators.cxx
-  OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE)
-check_cxx_source_runs(
-  "${OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE}"
-  OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS
-  )
-unset(CMAKE_REQUIRED_INCLUDES)
-unset(CMAKE_REQUIRED_LIBRARIES)
-unset(CMAKE_REQUIRED_FLAGS)
-unset(CMAKE_REQUIRED_DEFINES)
+# include(CheckCXXSourceRuns)
+# set(CMAKE_REQUIRED_INCLUDES ${OTBMuParser_SYSTEM_INCLUDE_DIRS})
+# set(CMAKE_REQUIRED_LIBRARIES ${OTBMuParser_LIBRARIES})
+# unset(CMAKE_REQUIRED_FLAGS)
+# unset(CMAKE_REQUIRED_DEFINES)
+# file(READ ${OTBMuParser_SOURCE_DIR}/CMake/otbTestMuParserHasCxxLogicalOperators.cxx
+  # OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE)
+# check_cxx_source_runs(
+  # "${OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE}"
+  # OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS
+  # )
+# unset(CMAKE_REQUIRED_INCLUDES)
+# unset(CMAKE_REQUIRED_LIBRARIES)
+# unset(CMAKE_REQUIRED_FLAGS)
+# unset(CMAKE_REQUIRED_DEFINES)
 
 if(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS)
-  message(STATUS "MuParser version is >= 2.0.0 : "
+  message(STATUS "MuParser version is  ${MUPARSER_VERSION} >= 2.0.0 : "
     "uses '&&' and '||' logical operators, and C++ like "
     "ternary if-then-else operator")
 else()
-  message(STATUS "MuParser version is < 2.0.0  : "
+  message(STATUS "MuParser version is ${MUPARSER_VERSION} < 2.0.0  : "
     "uses 'and' and 'or' logical operators, and ternary "
     "operator 'if( ; ; )'")
 endif()
diff --git a/Modules/ThirdParty/OpenCV/otb-module-init.cmake b/Modules/ThirdParty/OpenCV/otb-module-init.cmake
index c6e8461..ef0305c 100644
--- a/Modules/ThirdParty/OpenCV/otb-module-init.cmake
+++ b/Modules/ThirdParty/OpenCV/otb-module-init.cmake
@@ -1 +1,2 @@
 find_package ( OpenCV REQUIRED )
+mark_as_advanced( OpenCV_DIR )
diff --git a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
index 6510100..7dd8fd8 100644
--- a/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
+++ b/Modules/ThirdParty/OpenJPEG/CMakeLists.txt
@@ -16,7 +16,7 @@ endif()")
   endif()
 
   message(STATUS "Found OpenJPEG : ${OPENJPEG_LIBRARIES} (version ${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION})")
-  message(WARNING "There could be a version conflict if ITK also contains an OpenJPEG version. "
+  message(STATUS  "Caution : there could be a version conflict if ITK also contains an OpenJPEG version. "
                   "Depending on ITK version and enabled modules, the OpenJPEG headers can be "
                   "present in ITK include folder. Since the include order between modules is "
                   "deterministic, the OpenJPEG header from ITK may be included first. To avoid "
diff --git a/Modules/ThirdParty/OpenJPEG/otb-module-init.cmake b/Modules/ThirdParty/OpenJPEG/otb-module-init.cmake
index beb9f1f..07abcc5 100644
--- a/Modules/ThirdParty/OpenJPEG/otb-module-init.cmake
+++ b/Modules/ThirdParty/OpenJPEG/otb-module-init.cmake
@@ -1 +1,2 @@
-find_package(OpenJPEG)
+find_package( OpenJPEG REQUIRED )
+mark_as_advanced( OpenJPEG_DIR )
diff --git a/Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt b/Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt
index d0a91e3..9ae9700 100644
--- a/Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt
+++ b/Modules/ThirdParty/OssimPlugins/src/CMakeLists.txt
@@ -52,7 +52,7 @@ set(ossimplugins_SOURCES
 add_library(otbossimplugins ${ossimplugins_LIBTYPE} ${ossimplugins_SOURCES})
 target_link_libraries(otbossimplugins 
   ${OTBGDAL_LIBRARIES}
-  ${OSSIM_LIBRARIES}
+  ${OTBOssim_LIBRARIES}
   ${OTBGeoTIFF_LIBRARIES}
   )
 
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.h
index a5fe8b4..23c3f81 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.h
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimGeometricSarSensorModel.h
@@ -12,9 +12,20 @@
 #ifndef ossimGeometricSarSensorModel_H
 #define ossimGeometricSarSensorModel_H 1
 
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Woverloaded-virtual"
+#pragma GCC diagnostic ignored "-Wshadow"
 #include <ossimPluginConstants.h>
 #include <ossim/projection/ossimSensorModel.h>
 #include <ossim/projection/ossimCoarseGridModel.h>
+#pragma GCC diagnostic pop
+#else
+#include <ossimPluginConstants.h>
+#include <ossim/projection/ossimSensorModel.h>
+#include <ossim/projection/ossimCoarseGridModel.h>
+#endif
 
 #include <list>
 #include <vector>
@@ -23,7 +34,9 @@ namespace ossimplugins
 {
 
 class PlatformPosition;
+
 class SensorParams;
+
 class RefPoint;
 class SarSensor;
 class JSDDateTime;
@@ -38,6 +51,8 @@ class OSSIM_PLUGINS_DLL ossimGeometricSarSensorModel : public ossimSensorModel
 public:
    static const char* CREATE_OCG_PREF_KW;
 
+   using ossimOptimizableProjection::operator=;
+
    /** @brief default constructor */
    ossimGeometricSarSensorModel();
 
@@ -47,6 +62,24 @@ public:
    /** @brief Destructor */
    virtual ~ossimGeometricSarSensorModel();
 
+//   ossimRefPtr <PlatformPosition2> thePlatformPosition;
+//   SensorParams* theSensorParams;
+//   SensorParams2 theSensorParams;
+
+   void finalize(const ossimKeywordlist& /*kwl*/)
+   {
+//       ossimKeywordlist ppKwl;
+//       kwl.extractKeysThatMatch(ppKwl, "orbitList.*");
+//       size_t ppcount = atoi(ppKwl.find("orbitList.count"));
+//       thePlatformPosition = new PlatformPosition2(ppcount);
+//       thePlatformPosition->loadState(ppKwl, "orbitList.");
+//
+//       ossimKeywordlist sensorKwl;
+//       kwl.extractKeysThatMatch(sensorKwl, "sensor_params.*");
+//       theSensorParams = new SensorParams();
+//       theSensorParams->loadState(sensorKwl, "sensor_params.");
+   }
+
    /**
     * @brief This function associates an image column number to a slant range when the image is georeferenced (ground projected)
     * @param col Column coordinate of the image point
@@ -64,7 +97,7 @@ public:
     * @param line Line coordinate of the image point
     */
    virtual JSDDateTime getTime(double line) const;
- 
+
    /**
     * @brief This function associates an image line number to a platform position and speed
     * @param line Line coordinate of the image point
@@ -178,7 +211,7 @@ public:
 
 protected:
    /**
-    * @brief Creates replacement coarse grid model if user requested via ossim preferences 
+    * @brief Creates replacement coarse grid model if user requested via ossim preferences
     * keyword "geometric_sar_sensor_model.create_ocg: <bool>"
     * @return true if load OK, false on error
     */
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp
index 0da1b33..dd59bd2 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.cpp
@@ -30,7 +30,7 @@
 #include <ossim/base/ossimNotifyContext.h>
 #include "ossimTileMapModel.h"
 #include "ossimSpot6Model.h"
-
+#include "ossimSentinel1Model.h"
 //***
 // Define Trace flags for use within this file:
 //***
@@ -45,15 +45,16 @@ static ossimTrace traceDebug = ossimTrace("ossimPluginProjectionFactory:debug");
 namespace ossimplugins
 {
 
+   bool ossimPluginProjectionFactory::initalized_;
 
-ossimPluginProjectionFactory* ossimPluginProjectionFactory::instance()
-{
-   static ossimPluginProjectionFactory* factoryInstance =
-      new ossimPluginProjectionFactory();
+   ossimPluginProjectionFactory ossimPluginProjectionFactory::factoryInstance;
+
+   ossimPluginProjectionFactory* ossimPluginProjectionFactory::instance()
+   {
+      return initalized_ ? &factoryInstance : 0;
+
+   }
 
-   return factoryInstance;
-}
-   
 ossimProjection* ossimPluginProjectionFactory::createProjection(
    const ossimFilename& filename, ossim_uint32 /*entryIdx*/)const
 {
@@ -61,14 +62,35 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
    ossimRefPtr<ossimProjection> projection = 0;
    //traceDebug.setTraceFlag(true);
 
-   if(traceDebug())
+   // Sentinel1
+   if ( !projection )
    {
-    	ossimNotify(ossimNotifyLevel_DEBUG)
-        	   << MODULE << " DEBUG: testing ossimRadarSat2Model" << std::endl;
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimSentinel1Model" << std::endl;
+      }
+
+      ossimRefPtr<ossimSentinel1Model> model = new ossimSentinel1Model();
+      if ( model->open(filename) )
+      {
+         projection = model.get();
+      }
+      else
+      {
+         model = 0;
+      }
    }
 
    if ( !projection )
    {
+
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimRadarSat2Model" << std::endl;
+      }
+
       ossimRefPtr<ossimRadarSat2Model> model = new ossimRadarSat2Model();
       if ( model->open(filename) )
       {
@@ -84,16 +106,16 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
          model = 0;
       }
    }
-   
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-             << MODULE << " DEBUG: testing ossimPleiadesModel" << std::endl;
-   }
 
    // Pleiades
    if ( !projection )
    {
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimPleiadesModel" << std::endl;
+      }
+
       ossimRefPtr<ossimPleiadesModel> model = new ossimPleiadesModel();
       if ( model->open(filename) )
       {
@@ -105,14 +127,14 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
       }
    }
 
-   if(traceDebug())
-   	{
-    	ossimNotify(ossimNotifyLevel_DEBUG)
-        	   << MODULE << " DEBUG: testing ossimTerraSarModel" << std::endl;
-    }
-
    if ( !projection )
    {
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimTerraSarModel" << std::endl;
+      }
+
       ossimRefPtr<ossimTerraSarModel> model = new ossimTerraSarModel();
 
      if ( model->open(filename) )
@@ -130,14 +152,15 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
       }
    }
 
-   if(traceDebug())
-   {
-    	ossimNotify(ossimNotifyLevel_DEBUG)
-        	   << MODULE << " DEBUG: testing ossimErsSarModel" << std::endl;
-   }
 
+   // ErsSar
    if ( !projection )
    {
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimErsSarModel" << std::endl;
+      }
       ossimRefPtr<ossimErsSarModel> model = new ossimErsSarModel();
       if ( model->open(filename) )
       {
@@ -149,14 +172,14 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
       }
    }
 
-   if(traceDebug())
-   {
-    	ossimNotify(ossimNotifyLevel_DEBUG)
-        	   << MODULE << " DEBUG: testing ossimEnvisatSarModel" << std::endl;
-   }
-
    if (!projection)
    {
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimEnvisatSarModel" << std::endl;
+      }
+
      ossimRefPtr<ossimEnvisatAsarModel> model = new ossimEnvisatAsarModel();
      if (model->open(filename))
      {
@@ -168,14 +191,14 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
      }
    }
 
-   if(traceDebug())
+   if (!projection)
    {
-    	ossimNotify(ossimNotifyLevel_DEBUG)
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
         	   << MODULE << " DEBUG: testing ossimRadarSatModel" << std::endl;
-   }
+      }
 
-   if (!projection)
-   {
      ossimRefPtr<ossimRadarSatModel> model = new ossimRadarSatModel();
      if (model->open(filename))
      {
@@ -187,14 +210,14 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
      }
    }
 
-   if(traceDebug())
-   {
-    	ossimNotify(ossimNotifyLevel_DEBUG)
-        	   << MODULE << " DEBUG: testing ossimAlosPalsarModel" << std::endl;
-   }
-
    if (!projection)
    {
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimAlosPalsarModel" << std::endl;
+      }
+
      ossimRefPtr<ossimAlosPalsarModel> model = new ossimAlosPalsarModel();
      if (model->open(filename))
      {
@@ -206,47 +229,52 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
      }
    }
 
-   if(traceDebug())
-   	{
-    	ossimNotify(ossimNotifyLevel_DEBUG)
-        	   << MODULE << " DEBUG: testing ossimFormosatModel" << std::endl;
-    }
-
-   ossimFilename formosatTest = filename;
-   formosatTest = formosatTest.setExtension("geom");
-   if(!formosatTest.exists())
+   if (!projection)
    {
-      formosatTest = filename.path();
-      formosatTest = formosatTest.dirCat(ossimFilename("METADATA.DIM"));
-      if (formosatTest.exists() == false)
+
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimFormosatModel" << std::endl;
+      }
+
+      ossimFilename formosatTest = filename;
+      formosatTest = formosatTest.setExtension("geom");
+      if(!formosatTest.exists())
       {
          formosatTest = filename.path();
-         formosatTest = formosatTest.dirCat(ossimFilename("metadata.dim"));
+         formosatTest = formosatTest.dirCat(ossimFilename("METADATA.DIM"));
+         if (formosatTest.exists() == false)
+         {
+            formosatTest = filename.path();
+            formosatTest = formosatTest.dirCat(ossimFilename("metadata.dim"));
+         }
       }
-   }
-   if(formosatTest.exists())
-   {
-      ossimRefPtr<ossimFormosatDimapSupportData> meta =
-         new ossimFormosatDimapSupportData;
-      if(meta->loadXmlFile(formosatTest))
+      if(formosatTest.exists())
       {
-   		 ossimRefPtr<ossimFormosatModel> model = new ossimFormosatModel(meta.get());
-         if(!model->getErrorStatus())
+         ossimRefPtr<ossimFormosatDimapSupportData> meta =
+            new ossimFormosatDimapSupportData;
+         if(meta->loadXmlFile(formosatTest))
          {
-            projection = model.get();
+            ossimRefPtr<ossimFormosatModel> model = new ossimFormosatModel(meta.get());
+            if(!model->getErrorStatus())
+            {
+               projection = model.get();
+            }
+            model = 0;
          }
-         model = 0;
       }
    }
 
-   if(traceDebug())
-   {
-    	ossimNotify(ossimNotifyLevel_DEBUG)
-        	   << MODULE << " DEBUG: testing ossimTileMapModel" << std::endl;
-   }
 
    if (!projection)
    {
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimTileMapModel" << std::endl;
+      }
+
      ossimRefPtr<ossimTileMapModel> model = new ossimTileMapModel();
      if (model->open(filename))
      {
@@ -258,19 +286,20 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
      }
    }
 
-   if(traceDebug())
-   {
-      ossimNotify(ossimNotifyLevel_DEBUG)
-             << MODULE << " DEBUG: testing ossimSpot6Model" << std::endl;
-   }
 
    // Spot6
    if ( !projection )
    {
+      if(traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG)
+            << MODULE << " DEBUG: testing ossimSpot6Model" << std::endl;
+      }
+
       ossimRefPtr<ossimSpot6Model> model = new ossimSpot6Model();
       if ( model->open(filename) )
       {
-         projection = model.get(); 
+         projection = model.get();
       }
       else
       {
@@ -278,6 +307,7 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
       }
    }
 
+
    //***
    // ADD_MODEL: (Please leave this comment for the next programmer)
    //***
@@ -315,10 +345,10 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
         	   << MODULE << " DEBUG: Entering ...." << std::endl;
    }
 
-   //   else if (name == STATIC_TYPE_NAME(ossimCosmoSkymedModel))
-   //    {
-   //      return new ossimCosmoSkymedModel;
-   //   }
+   // else if (name == STATIC_TYPE_NAME(ossimCosmoSkymedModel))
+   // {
+   //    return new ossimCosmoSkymedModel;
+   // }
    if (name == STATIC_TYPE_NAME(ossimRadarSat2Model))
    {
       return new ossimRadarSat2Model();
@@ -359,6 +389,11 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
    {
      return new ossimSpot6Model;
    }
+   else if (name == STATIC_TYPE_NAME(ossimSentinel1Model))
+   {
+     return new ossimSentinel1Model;
+   }
+
 
    //***
    // ADD_MODEL: (Please leave this comment for the next programmer)
@@ -474,6 +509,15 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
          }
       }
 
+      else if (type == "ossimSentinel1Model")
+      {
+         result = new ossimSentinel1Model();
+         if ( !result->loadState(kwl, prefix) )
+         {
+            result = 0;
+         }
+      }
+
    //***
    // ADD_MODEL: (Please leave this comment for the next programmer)
    //***
@@ -493,7 +537,7 @@ ossimProjection* ossimPluginProjectionFactory::createProjection(
     	ossimNotify(ossimNotifyLevel_DEBUG)
         	   << MODULE << " DEBUG: End ...." << std::endl;
    }
-   
+
    return result.release();
 }
 
@@ -515,13 +559,14 @@ void ossimPluginProjectionFactory::getTypeNameList(std::vector<ossimString>& typ
    typeList.push_back(STATIC_TYPE_NAME(ossimRadarSatModel));
    typeList.push_back(STATIC_TYPE_NAME(ossimRadarSat2Model));
    typeList.push_back(STATIC_TYPE_NAME(ossimTerraSarModel));
-   //   result.push_back(STATIC_TYPE_NAME(ossimCosmoSkymedModel));
+//   typeList.push_back(STATIC_TYPE_NAME(ossimCosmoSkymedModel));
    typeList.push_back(STATIC_TYPE_NAME(ossimEnvisatAsarModel));
    typeList.push_back(STATIC_TYPE_NAME(ossimErsSarModel));
    typeList.push_back(STATIC_TYPE_NAME(ossimAlosPalsarModel));
    typeList.push_back(STATIC_TYPE_NAME(ossimFormosatModel));
    typeList.push_back(STATIC_TYPE_NAME(ossimTileMapModel));
    typeList.push_back(STATIC_TYPE_NAME(ossimPleiadesModel));
+   typeList.push_back(STATIC_TYPE_NAME(ossimSentinel1Model));
    typeList.push_back(STATIC_TYPE_NAME(ossimSpot6Model));
 
    //***
@@ -534,9 +579,9 @@ bool ossimPluginProjectionFactory::isTileMap(const ossimFilename& filename)const
 {
   ossimFilename temp(filename);
   temp.downcase();
-  
+
   ossimString os = temp.beforePos(4);
-  
+
   if(temp.ext()=="otb")
   {
     return true;
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h
index 5205d76..f245079 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginProjectionFactory.h
@@ -52,8 +52,29 @@ public:
 
    virtual void getTypeNameList(std::vector<ossimString>& typeList)const;
 protected:
-   ossimPluginProjectionFactory(){}
+
    bool isTileMap(const ossimFilename& filename) const;
+
+private:
+   ossimPluginProjectionFactory()
+   {
+      initalized_ = true;
+   }
+
+   ~ossimPluginProjectionFactory()
+   {
+      initalized_ = false;
+   }
+
+   static bool initalized_;
+
+   static ossimPluginProjectionFactory factoryInstance;
+
+   ossimPluginProjectionFactory(ossimPluginProjectionFactory const&);              // Don't
+                                                                                   // Implement
+
+   void operator=(ossimPluginProjectionFactory const&); // Don't implement
+
 };
 }
 
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.cpp
index c7e78de..5671993 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.cpp
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.cpp
@@ -47,21 +47,24 @@ RTTI_DEF1(ossimRadarSat2Model, "ossimRadarSat2Model", ossimGeometricSarSensorMod
 
 
 ossimRadarSat2Model::ossimRadarSat2Model()
-   :
-   ossimGeometricSarSensorModel(),
-   _n_srgr(0),
-   _srgr_update(),
-   _SrGr_R0()
+   :  ossimGeometricSarSensorModel()
+   , _n_srgr(0)
+   , _srgr_update()
+   , _SrGr_R0()
+   , theAcquisitionDateUTCString("")
+   , theProductionDateUTCString("")
 {
 }
 
 ossimRadarSat2Model::ossimRadarSat2Model(const ossimRadarSat2Model& rhs)
-   :
-   ossimGeometricSarSensorModel(rhs),
-   _n_srgr(rhs._n_srgr),
-   _srgr_update(rhs._srgr_update),
-   _SrGr_R0(rhs._SrGr_R0)
+   : ossimGeometricSarSensorModel(rhs)
+   , _n_srgr(rhs._n_srgr)
+   , _srgr_update(rhs._srgr_update)
+   , _SrGr_R0(rhs._SrGr_R0)
+   , theProductionDateUTCString(rhs.theProductionDateUTCString)
+   , theAcquisitionDateUTCString(rhs.theAcquisitionDateUTCString)
 {
+
 }
 
 ossimRadarSat2Model::~ossimRadarSat2Model()
@@ -81,15 +84,15 @@ ossimObject* ossimRadarSat2Model::dup() const
 double ossimRadarSat2Model::getSlantRangeFromGeoreferenced(double col) const
 {
    if (_n_srgr==0) return(-1) ;
-   
+
    double relativeGroundRange, slantRange = 0.0 ;
-   
+
    // in the case of Georeferenced images, _refPoint->get_distance()
    // contains the ground range
    relativeGroundRange = _refPoint->get_distance() + _sensor->get_col_direction() * (col-_refPoint->get_pix_col())* theGSD.x;
    //relativeGroundRange = 1 + _sensor->get_col_direction() * (col-_refPoint->get_pix_col())* theGSD.x;
    //relativeGroundRange = (8.78400000e+03)*theGSD.x;
-   
+
    if ( traceDebug() )
    {
       ossimNotify(ossimNotifyLevel_DEBUG)
@@ -100,15 +103,15 @@ double ossimRadarSat2Model::getSlantRangeFromGeoreferenced(double col) const
          << "\n_refPoint->get_pix_col() : " << _refPoint->get_pix_col()
          << "\n relativeGroundRange : " << relativeGroundRange << endl;
    }
-   
+
    int numSet = FindSRGRSetNumber((_refPoint->get_ephemeris())->get_date()) ;
    /**
     * @todo : could be improved (date choice)
     */
-   
+
    for (int i=0 ; i < static_cast<int>(_SrGr_coeffs[numSet].size()); i++)
    {
-      
+
       slantRange += _SrGr_coeffs[numSet][i]*pow(relativeGroundRange,i) ;
    }
 
@@ -160,6 +163,8 @@ bool ossimRadarSat2Model::open(const ossimFilename& file)
 
          if (result)
          {
+            _productXmlFile = xmlFile;
+
             if (traceDebug())
             {
                ossimNotify(ossimNotifyLevel_DEBUG)
@@ -204,8 +209,12 @@ bool ossimRadarSat2Model::open(const ossimFilename& file)
                result = rsDoc.getSatellite(xdoc, theSensorID);
             }
 
+            if (result)
+            {
             // Set the base class gsd:
             result = rsDoc.initGsd(xdoc, theGSD);
+            }
+
             if (result)
             {
                theMeanGSD = (theGSD.x + theGSD.y)/2.0;
@@ -213,6 +222,16 @@ bool ossimRadarSat2Model::open(const ossimFilename& file)
 
             if (result)
             {
+               result = rsDoc.getAcquistionDate(xdoc, theAcquisitionDateUTCString);
+            }
+
+            if (result)
+            {
+               result = rsDoc.getProductionDate(xdoc, theProductionDateUTCString);
+            }
+
+            if (result)
+            {
                result = initSRGR(xdoc, rsDoc);
 
                if (result)
@@ -226,7 +245,7 @@ bool ossimRadarSat2Model::open(const ossimFilename& file)
                      if (result)
                      {
                         result = initRefPoint(xdoc, rsDoc);
-                     
+
                      	  if (result)
                         {
                         result = InitRefNoiseLevel(xdoc);
@@ -246,7 +265,6 @@ bool ossimRadarSat2Model::open(const ossimFilename& file)
 
    if (result)
    {
-      _productXmlFile = xmlFile;
       ossimSupportFilesList::instance()->add(_productXmlFile);
    }
    else
@@ -273,7 +291,7 @@ bool ossimRadarSat2Model::open(const ossimFilename& file)
             << "ul, ur, lr, ll " << ul << ", " << ur
             << ", " << lr << " , " << ll << endl;
       }
-      
+
       setGroundRect(ul, ur, lr, ll);  // ossimSensorModel method.
 
       // OSSIM preferences specifies whether a coarse grid needs to be generated:
@@ -336,7 +354,7 @@ std::ostream& ossimRadarSat2Model::print(std::ostream& out) const
    }
 
    ossimGeometricSarSensorModel::print(out);
-   
+
 
    // Reset flags.
    out.setf(f);
@@ -523,7 +541,7 @@ bool ossimRadarSat2Model::InitRefPoint(const ossimKeywordlist &kwl,
       date->set_decimal(time - floor(time)) ;
    }
    delete date;//FIXME to confirm
-  
+
    if(_platformPosition != 0)
    {
       Ephemeris * ephemeris = _platformPosition->Interpolate((JSDDateTime)*date);
@@ -928,7 +946,7 @@ bool ossimRadarSat2Model::initRefPoint(const ossimXmlDocument* xdoc,
 
    double distance = 1;
 
-   // Only set distance to 
+   // Only set distance to
    if (!_isProductGeoreferenced)
    {
 	   if ( !rsDoc.getSlantRangeNearEdge(xdoc, s) )
@@ -936,9 +954,9 @@ bool ossimRadarSat2Model::initRefPoint(const ossimXmlDocument* xdoc,
 		   if (traceDebug())
 		   {
 			   ossimNotify(ossimNotifyLevel_DEBUG)
-    
+
 				   << MODULE << "getSlantRangeNearEdge error! exiting\n";
-		   }      
+		   }
 		   return false;
 	   }
 	   distance = s.toDouble();
@@ -981,7 +999,8 @@ bool ossimRadarSat2Model::initRefPoint(const ossimXmlDocument* xdoc,
 bool ossimRadarSat2Model::InitLut( const ossimXmlDocument* xmlDocument,
    			RadarSat2NoiseLevel& noise)
 {
-   static const char MODULE[] = "ossimRadarSat2Model::initLut";
+   static const char MODULE[] = "ossimRadarSat2Model::InitLut";
+
    if (traceDebug())
    {
       ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " entered...\n";
@@ -992,8 +1011,8 @@ bool ossimRadarSat2Model::InitLut( const ossimXmlDocument* xmlDocument,
    std::vector<ossimRefPtr<ossimXmlNode> > xml_nodes;
    std::vector<ossimRefPtr<ossimXmlNode> >::iterator node;
    ossimFilename  lutXmlFile;
-      
-   incidenceAngleCorrectionName = noise.get_incidenceAngleCorrectionName();     
+
+   incidenceAngleCorrectionName = noise.get_incidenceAngleCorrectionName();
 
    xpath = "/product/imageAttributes/lookupTable";
    xml_nodes.clear();
@@ -1009,8 +1028,8 @@ bool ossimRadarSat2Model::InitLut( const ossimXmlDocument* xmlDocument,
                		<< std::endl;
       }
       return false;
-   }  
-        
+   }
+
    node = xml_nodes.begin();
    while (node != xml_nodes.end())
    {
@@ -1024,56 +1043,67 @@ bool ossimRadarSat2Model::InitLut( const ossimXmlDocument* xmlDocument,
       			//---
       			// Instantiate the XML parser:
       			//---
-      			ossimXmlDocument* xmlLutDocument = new ossimXmlDocument();
-      			if ( xmlLutDocument->openFile(lutXmlFile) )
+           ossimRefPtr<ossimXmlDocument> xmlLutDocument;
+           xmlLutDocument = new ossimXmlDocument();
+           if ( xmlLutDocument.get()->openFile(lutXmlFile) )
       			{
-   					std::vector<ossimRefPtr<ossimXmlNode> > xml_lutNodes;
-   					ossimString s;
-   					
-   					xpath = "/lut/offset";
-   					xml_lutNodes.clear();
-   					xmlLutDocument->findNodes(xpath, xml_lutNodes);   					
-   					if(xml_lutNodes.size() == 0)
-   					{
-     					setErrorStatus();
-     					if(traceDebug())
-     					{
-  	    					ossimNotify(ossimNotifyLevel_DEBUG)
+               const ossimRefPtr<ossimXmlNode> lutRoot = xmlLutDocument.get()->getRoot(); //->findFirstNode("lut");
+
+               if(! lutRoot.get())
+               {
+                  setErrorStatus();
+                  if(traceDebug())
+                  {
+                     ossimNotify(ossimNotifyLevel_DEBUG)
+    		      					<< MODULE << " DEBUG:"
+                        << "\nCould not find: lut"  << std::endl;
+                  }
+                  return false;
+               }
+
+               ossimString offsetVal = lutRoot->getChildTextValue("offset");
+               if( !offsetVal.empty())
+               {
+                  noise.set_offset(offsetVal.toFloat64());
+               }
+               else
+               {
+                  setErrorStatus();
+                  if(traceDebug())
+                  {
+                     ossimNotify(ossimNotifyLevel_DEBUG)
     		      					<< MODULE << " DEBUG:"
-            	  					<< "\nCould not find: " << xpath
-               						<< std::endl;
-      					}
-      					return false;
-   					}
-   					ossim_float64 offset = xml_lutNodes[0]->getText().toFloat64();  
-					noise.set_offset(offset);				
-								
-   					xpath = "/lut/gains";
-   					xml_lutNodes.clear();
-   					xmlLutDocument->findNodes(xpath, xml_lutNodes);   					
-   					if(xml_lutNodes.size() == 0)
-   					{
-     					setErrorStatus();
-     					if(traceDebug())
-     					{
-  	    					ossimNotify(ossimNotifyLevel_DEBUG)
+                        << "\nCould not find: offset"  << std::endl;
+                  }
+                  return false;
+               }
+
+               ossimString gainVal = lutRoot->getChildTextValue("gains");
+               if( !gainVal.empty())
+               {
+                  noise.set_gain(gainVal);
+               }
+               else
+               {
+                  setErrorStatus();
+                  if(traceDebug())
+                  {
+                     ossimNotify(ossimNotifyLevel_DEBUG)
     		      					<< MODULE << " DEBUG:"
-            	  					<< "\nCould not find: " << xpath
-               						<< std::endl;
-      					}
-      					return false;
-   					}  
-					noise.set_gain(xml_lutNodes[0]->getText());	
-				}
+                        << "\nCould not find: gains"  << std::endl;
+                  }
+                  return false;
+               }
+            }
    			}
 		}
-    	++node;	
+    	++node;
    }
 
    if (traceDebug())
    {
       ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " leaving...\n";
-   }   
+   }
 
    return true;
 }
@@ -1095,8 +1125,8 @@ bool ossimRadarSat2Model::InitRefNoiseLevel(
    }
 
    _noiseLevel.clear();
-   
-   
+
+
    xpath = "/product/sourceAttributes/radarParameters/referenceNoiseLevel";
    xml_nodes.clear();
    xmlDocument->findNodes(xpath, xml_nodes);
@@ -1111,14 +1141,14 @@ bool ossimRadarSat2Model::InitRefNoiseLevel(
                		<< std::endl;
       }
       return false;
-   }  
-        
+   }
+
    node = xml_nodes.begin();
    while (node != xml_nodes.end())
    {
-   	
-   	ev.set_incidenceAngleCorrectionName( (*node)->getAttributeValue("incidenceAngleCorrection") ); 
-   	
+
+   	ev.set_incidenceAngleCorrectionName( (*node)->getAttributeValue("incidenceAngleCorrection") );
+
     sub_nodes.clear();
     xpath = "pixelFirstNoiseValue";
     (*node)->findChildNodes(xpath, sub_nodes);
@@ -1185,10 +1215,10 @@ bool ossimRadarSat2Model::InitRefNoiseLevel(
          }
       	return false;
     }
-   	ev.set_units( sub_nodes[0]->getAttributeValue("units") ); 
+   	ev.set_units( sub_nodes[0]->getAttributeValue("units") );
 
 
-    std::vector<ossimString> s2;      
+    std::vector<ossimString> s2;
     std::vector<ossim_float64> noiseLevelValues;
     s2.clear();
     noiseLevelValues.clear();
@@ -1197,7 +1227,7 @@ bool ossimRadarSat2Model::InitRefNoiseLevel(
 	{
 		noiseLevelValues.push_back( s2[i].toFloat64() );
 	}
-   	ev.set_noiseLevelValues( noiseLevelValues ); 
+   	ev.set_noiseLevelValues( noiseLevelValues );
 
 	InitLut(xmlDocument, ev);
 
@@ -1206,11 +1236,11 @@ bool ossimRadarSat2Model::InitRefNoiseLevel(
 
     ++node;
    }
- 
+
    if (traceDebug())
    {
       ossimNotify(ossimNotifyLevel_DEBUG)<< MODULE << " leaving...\n";
-   }   
+   }
 
    return true;
 }
@@ -1234,6 +1264,33 @@ bool ossimRadarSat2Model::saveState(ossimKeywordlist& kwl,
    kwl.add(prefix, PRODUCT_XML_FILE_KW, _productXmlFile.c_str());
    kwl.add(prefix, NUMBER_SRGR_COEFFICIENTS_KW, _n_srgr);
 
+   kwl.add("support_data.",
+           "calibration_lookup_flag",
+           "true",
+           true);
+
+
+   if(! theProductionDateUTCString.empty())
+      kwl.add("support_data.",
+              ossimKeywordNames::DATE_KW,
+              theProductionDateUTCString.c_str(),
+              true);
+
+   if(! theAcquisitionDateUTCString.empty())
+      kwl.add("support_data.",
+              ossimKeywordNames::IMAGE_DATE_KW,
+              theAcquisitionDateUTCString.c_str(),
+              true);
+
+   //RK ...fix this part as part of refractoring
+   //if(theSLC)// numBands*=2; // real and imaginary
+
+
+   kwl.add("support_data.",
+           ossimKeywordNames::NUMBER_BANDS_KW,
+           2,
+           true);
+
    // Make sure all the arrays are equal in size.
    const ossim_uint32 COUNT = static_cast<ossim_uint32>(_n_srgr);
 
@@ -1282,10 +1339,10 @@ bool ossimRadarSat2Model::saveState(ossimKeywordlist& kwl,
    if (result)
    {
       	for(ossim_uint32 i = 0; i < _noiseLevel.size(); ++i)
-   		{	
+   		{
    				_noiseLevel[i].saveState(kwl, prefix);
    		}
-       
+
    }
 
    //---
@@ -1485,9 +1542,9 @@ bool ossimRadarSat2Model::loadState (const ossimKeywordlist &kwl,
 	if(result)
 	{
       	for(ossim_uint32 i = 0; i < _noiseLevel.size(); ++i)
-   		{	
+   		{
    				_noiseLevel[i].loadState(kwl, prefix);
-   		}		
+   		}
 	}
 
    if (traceDebug())
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.h
index 2269a02..606e41a 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.h
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2Model.h
@@ -169,6 +169,11 @@ private:
     */
    int   _n_srgr;
 
+   //RK remove this part soon and use kwl directly.
+   ossimString theAcquisitionDateUTCString;
+
+   ossimString theProductionDateUTCString;
+
    /**
     * @brief Slant Range FOR EACH Ground Range coefficient sets update times
     */
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.cpp
index 65a03be..569f21e 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.cpp
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.cpp
@@ -465,7 +465,7 @@ bool ossimRadarSat2ProductDoc::initGsd(const ossimXmlDocument* xdoc,
       ossimString s;
       if ( getSampledPixelSpacing(xdoc, s) )
       {
-         gsd.x = s.toFloat64();
+         gsd.x = ossimString::toFloat64(s);
       }
       else
       {
@@ -473,7 +473,7 @@ bool ossimRadarSat2ProductDoc::initGsd(const ossimXmlDocument* xdoc,
       }
       if ( getSampledLineSpacing(xdoc, s) )
       {
-         gsd.y = s.toFloat64(s);
+         gsd.y = ossimString::toFloat64(s);
       }
       else
       {
@@ -496,6 +496,20 @@ bool ossimRadarSat2ProductDoc::initGsd(const ossimXmlDocument* xdoc,
    return result;
 }
 
+
+
+bool ossimRadarSat2ProductDoc::getAcquistionDate(const ossimXmlDocument* xdoc, ossimString& adate)
+{
+   ossimString path = "/product/sourceAttributes/rawDataStartTime";
+   return ossim::getPath(path, xdoc, adate);
+}
+
+bool ossimRadarSat2ProductDoc::getProductionDate(const ossimXmlDocument* xdoc, ossimString& pdate)
+{
+   ossimString path = "/product/imageGenerationParameters/generalProcessingInformation/processingTime";
+   return ossim::getPath(path, xdoc, pdate);
+}
+
 bool ossimRadarSat2ProductDoc::initTiePoints(const ossimXmlDocument* xdoc,
                                              std::list<ossimGpt>& gcp,
                                              std::list<ossimDpt>& icp) const
@@ -889,15 +903,15 @@ bool ossimRadarSat2ProductDoc::getImageFile(const ossimXmlDocument* xdoc,
 {
    bool result = false;
    ossimString fileName;
-   
+
    ossimString path = "/product/imageAttributes/fullResolutionImageData";
-   
+
    if ( ossim::getPath(path, xdoc, fileName) )
    {
       result = true;
       s = fileName;
    }
-   
+
    return result;
 }
 
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.h
index 56bf0a7..ae376b0 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.h
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2ProductDoc.h
@@ -51,7 +51,7 @@ typedef struct
    vector<double> lineDenominatorCoefficients;
    vector<double> pixelNumeratorCoefficients;
    vector<double> pixelDenominatorCoefficients;
-   
+
 }RPCModel;
 
 namespace ossimplugins
@@ -59,17 +59,17 @@ namespace ossimplugins
 class PlatformPosition;
 class RefPoint;
 class SensorParams;
-   
+
 /** @brief Class to encapsulate parsing RadarSat2 product.xml file. */
 class OSSIM_PLUGINS_DLL ossimRadarSat2ProductDoc
 {
 public:
    /** @brief default constructor */
    ossimRadarSat2ProductDoc();
-      
+
    /** @brief destructor */
    ~ossimRadarSat2ProductDoc();
-      
+
    /**
     * @brief Checks for node /product/sourceAttributes/satellite containing
     * RADARSAT-2.
@@ -77,9 +77,9 @@ public:
     * @return true if present, false if not.
     */
    bool isRadarSat2(const ossimXmlDocument* xdoc) const;
-      
+
    RPCModel getRpcData(const ossimXmlDocument* xdoc) const;
-      
+
    /**
     * @brief Method to initialize PlatformPosition object from
     * RadarSat "product.xml" file.
@@ -89,7 +89,7 @@ public:
     */
    bool initPlatformPosition(const ossimXmlDocument* xdoc,
                              PlatformPosition* pos) const;
-      
+
    /**
     * @brief Method to initialize SensorParams object from
     * RadarSat "product.xml" file.
@@ -99,7 +99,7 @@ public:
     */
    bool initSensorParams(const ossimXmlDocument* xdoc,
                          SensorParams* sp) const;
-      
+
    /**
     * @brief Method to initialize image size from
     * RadarSat "product.xml" file.
@@ -109,7 +109,7 @@ public:
     */
    bool initImageSize(const ossimXmlDocument* xdoc,
                       ossimIpt& imageSize) const;
-      
+
    /**
     * @brief Method to initialize gsd from
     * RadarSat "product.xml" file.
@@ -119,7 +119,11 @@ public:
     */
    bool initGsd(const ossimXmlDocument* xdoc,
                 ossimDpt& gsd) const;
-      
+
+   bool getAcquistionDate(const ossimXmlDocument* xdoc, ossimString& adate);
+
+   bool getProductionDate(const ossimXmlDocument* xdoc, ossimString& pdate);
+
    /**
     * @brief Method to initialize image tie points from
     * RadarSat "product.xml" file.
@@ -132,7 +136,7 @@ public:
                       std::list<ossimDpt>& icp) const;
    bool getSatellite(const ossimXmlDocument* xdoc,
                      ossimString& s) const;
-      
+
    bool getSensor(const ossimXmlDocument* xdoc,
                   ossimString& s) const;
 
@@ -222,7 +226,7 @@ public:
 
    bool getIncidenceAngleFarRange(const ossimXmlDocument* xdoc,
                                   ossimString& s) const;
-   
+
    bool getSatelliteHeight(const ossimXmlDocument* xdoc,
                            ossimString& s) const;
 };
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2TiffReader.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2TiffReader.cpp
index 1db14de..8b99f5d 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2TiffReader.cpp
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2TiffReader.cpp
@@ -30,9 +30,7 @@ static const char PRODUCT_XML_FILE_KW[] = "product_xml_filename";
 
 namespace ossimplugins
 {
-RTTI_DEF1(ossimRadarSat2TiffReader,
-          "ossimRadarSat2TiffReader",
-          ossimTiffTileSource)
+RTTI_DEF1(ossimRadarSat2TiffReader, "ossimRadarSat2TiffReader", ossimTiffTileSource)
 }
 
 #ifdef OSSIM_ID_ENABLED
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp
new file mode 100644
index 0000000..f0bd0d5
--- /dev/null
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.cpp
@@ -0,0 +1,546 @@
+#include "ossimSentinel1Model.h"
+
+namespace ossimplugins
+{
+
+// Define Trace flags for use within this file:
+   static ossimTrace traceExec  ("ossimSentinel1Model:exec");
+   static ossimTrace traceDebug ("ossimSentinel1Model:debug");
+
+   RTTI_DEF1(ossimSentinel1Model, "ossimSentinel1Model", ossimSarModel);
+
+//*************************************************************************************************
+// Constructor
+//*************************************************************************************************
+   ossimSentinel1Model::ossimSentinel1Model()
+      : ossimSarModel()
+      , theOCN(false)
+      , theSLC(false)
+   {
+      theManifestDoc = new ossimXmlDocument();
+      theProduct = new ossimSentinel1ProductDoc();
+      this->clearFields();
+
+   }
+
+    void ossimSentinel1Model::clearFields()
+    {
+       theOCN = false;
+       theSLC = false;
+       theManifestKwl.clear();
+       theManifestFile = ossimFilename::NIL;
+       theProductXmlFile = ossimFilename::NIL;
+       theProduct->clearFields();
+
+    }
+
+
+//*************************************************************************************************
+// Constructor
+//*************************************************************************************************
+   ossimSentinel1Model::ossimSentinel1Model(const ossimSentinel1Model& rhs)
+      :ossimSarModel(rhs)
+      , theOCN(rhs.theOCN)
+      , theSLC(rhs.theSLC)
+   {
+
+   }
+
+//*************************************************************************************************
+// Destructor
+//*************************************************************************************************
+   ossimSentinel1Model::~ossimSentinel1Model()
+   {
+      theProduct = 0;
+      if (traceExec())  ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG DESTRUCTOR: ~ossimSentinel1Model(): entering..." << std::endl;
+   }
+
+//*************************************************************************************************
+// Infamous DUP
+//*************************************************************************************************
+   ossimObject* ossimSentinel1Model::dup() const
+   {
+      return new ossimSentinel1Model(*this);
+   }
+
+//*************************************************************************************************
+// Print
+//*************************************************************************************************
+   std::ostream& ossimSentinel1Model::print(std::ostream& out) const
+   {
+      // Capture stream flags since we are going to mess with them.
+      std::ios_base::fmtflags f = out.flags();
+
+      out << "\nDump of ossimSentinel1Model at address " << (hex) << this
+          << (dec)
+          << "\n------------------------------------------------"
+          << "\n  theImageID            = " << theImageID
+          << "\n  theImageSize          = " << theImageSize
+
+          << "\n------------------------------------------------"
+          << "\n  " << endl;
+
+      // Set the flags back.
+      out.flags(f);
+      return ossimSarModel::print(out);
+
+   }
+
+//*************************************************************************************************
+// Save State
+//*************************************************************************************************
+   bool ossimSentinel1Model::saveState(ossimKeywordlist& kwl,
+                                      const char* prefix) const
+   {
+
+      kwl.add(prefix,
+              ossimKeywordNames::TYPE_KW,
+              "ossimSentinel1Model",
+              true);
+
+      kwl.add("support_data.",
+              "calibration_lookup_flag",
+              "true",
+              true);
+
+      kwl.addList(theManifestKwl, true);
+
+         if(theProduct.get())
+         {
+            kwl.addList(theProduct->getProductKwl(), true);
+            //   theProduct->saveState(kwl, prefix);
+         }
+         ossimSarModel::saveState(kwl, prefix);
+         return true;
+   }
+
+
+//*************************************************************************************************
+// Load State
+//*************************************************************************************************
+   bool ossimSentinel1Model::loadState(const ossimKeywordlist& kwl,
+                                      const char* prefix)
+   {
+      //theManifestKwl.addList(kwl, true);
+
+      ossimSarModel::loadState(kwl, prefix);
+      return true;
+   }
+
+   bool ossimSentinel1Model::findSafeManifest(const ossimFilename& file, ossimFilename& manifestFile)
+   {
+      manifestFile = ossimFilename(file.path().path() + "/manifest.safe");
+
+      if(!manifestFile.exists())
+      {
+         if (traceDebug())
+         {
+            ossimNotify(ossimNotifyLevel_DEBUG) << "manifest.safe " << manifestFile << " doesn't exist ...\n";
+         }
+         return false;
+      }
+      return true;
+   }
+
+   bool ossimSentinel1Model::open(const ossimFilename& file)
+   {
+
+      static const char MODULE[] = "ossimplugins::ossimSentinel1Model::open";
+      //traceDebug.setTraceFlag(true);
+
+      if (traceDebug())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
+      }
+
+      bool result = false;
+
+      if ( !file.exists() || (file.ext().downcase() != "tiff") )
+      {
+         return false;
+      }
+      else
+      {
+         theGSD.makeNan();
+
+         ossimFilename safeFile;
+         bool foundManifestFile = findSafeManifest(file, safeFile);
+         while (foundManifestFile)
+         {
+            if(theManifestDoc.get())
+            {
+               if( !theManifestDoc->openFile(safeFile))
+               {
+                  std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+                  break;
+               }
+            }
+            else
+            {
+               ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " theManifestDoc..\n";
+               break;
+            }
+
+            if ( !this->isSentinel1(safeFile))
+            {
+               std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+               break;
+            }
+
+            ossimString productFile;
+            if ( !this->getAnnotationFileLocation(safeFile, "^product"))
+            {
+               std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+               break;
+            }
+
+            // Set the image ID to the scene ID.
+            if ( !this->getImageId( theImageID ) )
+            {
+               std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+               break;
+            }
+
+            if ( !this->standAloneProductInformation( ) )
+            {
+               std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+               break;
+            }
+
+            // Set the sensor ID to the mission ID.
+            if ( !this->initSensorID( theSensorID ) )
+            {
+               std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+               break;
+            }
+
+            if ( !this->readProduct( safeFile ) )
+            {
+               std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+               break;
+            }
+
+            if ( !this->initImageSize( theImageSize ) )
+             {
+                std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+                break;
+             }
+
+            theImageClipRect = ossimDrect( 0, 0, theImageSize.x-1, theImageSize.y-1 );
+            theSubImageOffset.x = 0.0;
+            theSubImageOffset.y = 0.0;
+
+            if ( !this->initGsd( theGSD ) )
+             {
+                std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+                break;
+             }
+
+            theMeanGSD = (theGSD.x + theGSD.y)/2.0;
+
+            if ( !this->initSRGR( ) )
+            {
+               std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+               break;
+            }
+
+            // if ( !theSafeManifest->initPlatformPosition( ) )
+            // {
+            //    break;
+            // }
+            // else
+            // {
+            //    std::cerr << MODULE << "error at line:" << __LINE__ << std::endl;
+            // }
+
+
+            return true;
+         }
+
+//    // If we broke out of the while, something happened...
+         return false;
+      }
+
+   }
+
+
+   bool ossimSentinel1Model::getImageId( ossimString& s) const
+   {
+      ossimString xpath;
+      xpath = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/s1sarl1:standAloneProductInformation/s1sarl1:missionDataTakeID";
+      return ossim::getPath(xpath, theManifestDoc.get(), s);
+   }
+
+   bool ossimSentinel1Model::initSensorID(ossimString& s)
+   {
+      const ossimRefPtr<ossimXmlNode> safePlatform = theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:platform");
+      ossimString familyName, instrumentId;
+      bool ret1 = safePlatform->getChildTextValue(familyName, "safe:familyName");
+      bool ret2 = safePlatform->getChildTextValue(instrumentId, "safe:number");
+
+      theManifestKwl.add("support_data.",
+                     "instrument",
+                      "S1" + instrumentId,
+                      true);
+
+      s = familyName + instrumentId;
+      return (ret1 && ret2);
+   }
+
+   bool ossimSentinel1Model::getAnnotationFileLocation(const ossimFilename &manifestFile, const char* pattern)
+   {
+
+      static const char MODULE[] = "ossimSentinel1SafeManifest::getAnnotationFileLocation";
+      //traceDebug.setTraceFlag(true);
+      const ossimString prefix = "support_data.";
+      const ossimString xpath =  "/xfdu:XFDU/dataObjectSection/dataObject";
+
+      vector<ossimRefPtr<ossimXmlNode> > xml_nodes;
+
+      theManifestDoc->findNodes(xpath, xml_nodes);
+
+      ossimRefPtr<ossimXmlNode> dataObjectNode = xml_nodes[0];
+      ossimString dataObjectId;
+      dataObjectNode->getAttributeValue(dataObjectId , "ID");
+
+      if ( dataObjectId.match(pattern) )
+      {
+         ossim::getPath(xpath +  "/byteStream/fileLocation", theManifestDoc.get(), theProductXmlFile);
+         xml_nodes.clear();
+         theManifestDoc->findNodes(xpath +  "/byteStream/fileLocation", xml_nodes);
+         if(xml_nodes.size() < 1 )
+         {
+            std::cerr << "error :" << __LINE__ << std::endl;
+            return  false;
+         }
+         xml_nodes[0]->getAttributeValue(theProductXmlFile , "href");
+         theProductXmlFile.setPath(manifestFile.path() + "/annotation");
+
+      }
+      return true;
+   }
+
+
+   bool ossimSentinel1Model::standAloneProductInformation()
+   {
+      static const char MODULE[] = "ossimSentinel1ProductDoc::parseSafe";
+
+      const ossimString prefix = "support_data.";
+
+      const ossimRefPtr<ossimXmlNode> safeProcessing = theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:processing");
+      const ossimRefPtr<ossimXmlNode> facility = safeProcessing->findFirstNode("safe:facility");
+      const ossimRefPtr<ossimXmlNode> software = facility->findFirstNode("safe:software");
+      const ossimString org = facility->getAttributeValue("organisation");
+      const ossimString name = software->getAttributeValue("name");
+      const ossimString version = software->getAttributeValue("version");
+
+      theManifestKwl.add(prefix,
+                      "Processing_system_identifier",
+                      org + " " + name + " " + version,
+                      true);
+
+      theManifestKwl.add(prefix,
+                      ossimKeywordNames::DATE_KW,
+                      safeProcessing->getAttributeValue("start"),
+                      true);
+
+      const ossimRefPtr<ossimXmlNode> acquisitionPeriod = theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:acquisitionPeriod");
+      ossimString acqStartTime = acquisitionPeriod->getChildTextValue("safe:startTime");
+
+      theManifestKwl.add(prefix,
+                      "first_line_time",
+                      acqStartTime,
+                      true);
+
+      theManifestKwl.add(prefix,
+                      "last_line_time",
+                      acquisitionPeriod->getChildTextValue("safe:stopTime"),
+                      true);
+      //RK
+      theManifestKwl.add(prefix,
+                      ossimKeywordNames::IMAGE_DATE_KW,
+                      acqStartTime,
+                      true);
+
+      const ossimRefPtr<ossimXmlNode> instrumentNode =
+         theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:platform/safe:instrument");
+      ossimString swath =  instrumentNode->getChildTextValue("s1sarl1:swath");
+      ossimString acquisition_mode =  instrumentNode->getChildTextValue("s1sarl1:mode");
+
+      if( acquisition_mode.empty())
+      {
+         ossimRefPtr<ossimXmlNode>  instrumentModeNode =  instrumentNode->findFirstNode("safe:extension/s1sarl1:instrumentMode");
+         if(instrumentModeNode.get())
+         {
+            acquisition_mode = instrumentModeNode->getChildTextValue("s1sarl1:mode");
+            swath = instrumentModeNode->getChildTextValue("s1sarl1:swath");
+         }
+      }
+
+      theManifestKwl.add(prefix,
+                      "acquisition_mode",
+                      acquisition_mode,
+                      true);
+
+      theManifestKwl.add(prefix,
+                      "swath",
+                      swath,
+                      true);
+
+      if (acquisition_mode == "IW" || acquisition_mode == "EW")
+         theProduct->setTOPSAR(true);
+
+      const ossimRefPtr<ossimXmlNode> orbitReference =
+         theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/safe:orbitReference");
+
+      std::vector<ossimRefPtr<ossimXmlNode> > orbitNumberNodes;
+      const ossimString orbitReference_xpath = "/xfdu:XFDU/metadataSection/metadataObject/metadataWrap/xmlData/safe:orbitReference";
+         theManifestDoc->findNodes(orbitReference_xpath + "/safe:orbitNumber", orbitNumberNodes);
+
+      std::vector<ossimRefPtr<ossimXmlNode> >::const_iterator it = orbitNumberNodes.begin();
+      while( it != orbitNumberNodes.end())
+      {
+         const ossimRefPtr<ossimXmlAttribute> attribute =    (*it)->findAttribute("type");
+         if( attribute.get() )
+         {
+            if( attribute->getValue() == "start" )
+            {
+            theManifestKwl.add(prefix, "abs_orbit", (*it)->getText(), true);
+            break;
+            }
+         }
+         ++it;
+      }
+
+      orbitNumberNodes.clear();
+      theManifestDoc->findNodes(orbitReference_xpath + "/safe:relativeOrbitNumber", orbitNumberNodes);
+
+      std::vector<ossimRefPtr<ossimXmlNode> >::const_iterator it2 = orbitNumberNodes.begin();
+      while( it2 != orbitNumberNodes.end())
+      {
+         const ossimRefPtr<ossimXmlAttribute> attribute =    (*it2)->findAttribute("start");
+         if( attribute.get() )
+         {
+            if( attribute->getValue() == "start" )
+            {
+               theManifestKwl.add(prefix, "rel_orbit", (*it2)->getText(), true);
+               break;
+            }
+         }
+         ++it2;
+      }
+
+      theManifestKwl.add(prefix, "orbit_cycle", orbitReference->getChildTextValue("safe:cycleNumber"), true);
+
+      ossimString orbit_pass = "";
+      orbit_pass = orbitReference->getChildTextValue("s1:pass");
+
+      if( orbit_pass.empty() )
+      {
+         orbit_pass = orbitReference->getChildTextValue("safe:extension/s1:orbitProperties/s1:pass");
+      }
+
+      theManifestKwl.add(prefix,
+                         "orbit_pass",
+                         orbit_pass,
+                         true);
+
+      ossimString productType = "unknown";
+      const ossimRefPtr<ossimXmlNode> standAloneProductInformation =
+         theManifestDoc->getRoot()->findFirstNode("metadataSection/metadataObject/metadataWrap/xmlData/s1sarl1:standAloneProductInformation");
+
+      if (theOCN)
+      {
+         productType = "OCN";
+      }
+      else
+      {
+         if (standAloneProductInformation.get())
+            productType  = standAloneProductInformation->getChildTextValue("s1sarl1:productType");
+      }
+
+      theManifestKwl.add(prefix,
+                      "product_type",
+                      productType,
+                      true);
+
+      if( productType.contains("SLC" ) )
+      {
+         //ossimKeywordNames::PIXEL_TYPE_KW;  RK
+         theManifestKwl.add("sample_type", "COMPLEX",  true);
+         theProduct->setSLC(true);
+
+      }
+      else
+      {
+         theManifestKwl.add("sample_type", "DETECTED",  true);
+         theManifestKwl.add(prefix, "srgr_flag", "true",  true);
+      }
+
+      return true;
+   }
+
+   bool ossimSentinel1Model::isSentinel1(const ossimFilename &manifestFile )
+   {
+      theOCN = isLevel2(manifestFile);
+      if( isLevel1(manifestFile) || theOCN  || isLevel0(manifestFile))
+         return true;
+      else
+         return false;
+   }
+
+   bool ossimSentinel1Model::isLevel1(const ossimFilename& file)
+   {
+      bool productXmlCheck = checkDirectory(file, "annotation", ".xml");
+
+      return productXmlCheck && checkDirectory(file, "measurement", ".tiff");
+   }
+
+   bool ossimSentinel1Model::isLevel2(const ossimFilename& file)
+   {
+
+      return checkDirectory(file, "measurement",".nc");
+   }
+
+   bool ossimSentinel1Model::isLevel0(const ossimFilename& file)
+   {
+      return checkDirectory(file, "measurement",".dat");
+   }
+
+   bool ossimSentinel1Model::checkDirectory(const ossimFilename& file, const char* d, const char* ext)
+   {
+      //check dir is valid first
+      ossimDirectory dir = ossimDirectory(file.path() + "/" + d + "/");
+      std::vector<ossimFilename> result;
+      dir.findAllFilesThatMatch(result, ext);
+      if ( result.size() < 1 )
+      {
+         if (traceExec())
+         {
+            ossimNotify(ossimNotifyLevel_FATAL)
+               << " DEBUG:" << " checkDirectory failed for: " << file.path()   << "/" << d << " with ext ="<< ext << std::endl;
+         }
+         return false;
+      }
+
+      return true;
+   }
+
+   bool ossimSentinel1Model::readProduct(const ossimFilename &manifestFile )
+   {
+      theProduct->setMetadataDirectory( manifestFile.path() );
+      bool ret = theProduct->readProductMetadata( );
+      if ( ret )
+      {
+         theProduct->readCalibrationMetadata();
+         theProduct->readNoiseMetadata();
+      }
+      else
+      {
+         ossimNotify(ossimNotifyLevel_FATAL) << " theProduct->readProductMetadata() failed" << std::endl;
+      }
+
+      return true;
+   }
+
+} //end namespace
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h
new file mode 100644
index 0000000..65b1fdc
--- /dev/null
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h
@@ -0,0 +1,160 @@
+//----------------------------------------------------------------------------
+//
+// "Copyright Centre National d'Etudes Spatiales"
+//
+// License:  LGPL-2
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#ifndef ossimSentinel1Model_HEADER
+#define ossimSentinel1Model_HEADER
+
+#include <ossim/base/ossimCommon.h>
+#include <ossim/base/ossimFilename.h>
+#include <ossim/base/ossimDirectory.h>
+#include <ossim/base/ossimKeywordNames.h>
+#include <ossim/base/ossimNotify.h>
+#include <ossim/base/ossimRefPtr.h>
+#include <ossim/base/ossimString.h>
+#include <ossim/base/ossimTrace.h>
+#include <ossim/base/ossimXmlDocument.h>
+#include <ossim/base/ossimXmlNode.h>
+
+//#include <ossim/projection/ossimSensorModel.h>
+//#include <ossim/projection/ossimCoarseGridModel.h>
+#include <ossim/projection/ossimSarModel.h>
+
+#include <ossim/support_data/ossimSupportFilesList.h>
+
+#include "ossimPluginConstants.h"
+#include "ossimPluginCommon.h"
+#include <iostream>
+#include <cmath>
+#include <cstdio>
+
+//#include "ossimGeometricSarSensorModel.h"
+
+#include "ossimSentinel1ProductDoc.h"
+
+//ossimGeometricSarSensorModel
+
+namespace ossimplugins
+{
+
+   class OSSIM_PLUGINS_DLL ossimSentinel1Model : public ossimSarModel
+   {
+   public:
+      /*!
+       * CONSTRUCTORS:
+       */
+      /** @brief default constructor */
+      ossimSentinel1Model();
+
+      /** @brief copy constructor */
+      ossimSentinel1Model(const ossimSentinel1Model& rhs);
+
+      /** @brief Destructor */
+      virtual ~ossimSentinel1Model();
+
+
+      bool open(const ossimFilename& file);
+
+      /*!
+       * Returns pointer to a new instance, copy of this.
+       * Not implemented yet!  Returns NULL...
+       */
+      virtual ossimObject* dup() const;
+
+      /*!
+       * Extends base-class implementation. Dumps contents of object to ostream.
+       */
+      virtual std::ostream& print(std::ostream& out) const;
+
+      /*!
+       * Fulfills ossimObject base-class pure virtuals. Loads and saves geometry
+       * KWL files. Returns true if successful.
+       */
+      virtual bool saveState(ossimKeywordlist& kwl,
+                             const char* prefix=NULL) const;
+
+      virtual bool loadState(const ossimKeywordlist& kwl,
+                             const char* prefix=NULL);
+
+    bool checkDirectory(const ossimFilename& file, const char* d, const char *ext);
+
+    bool isLevel0(const ossimFilename& file);
+
+    bool isLevel2(const ossimFilename& file);
+
+    bool isLevel1(const ossimFilename& file);
+
+    bool isSentinel1(const ossimFilename &manifestFile);
+
+    bool readProduct(const ossimFilename &manifestFile);
+
+    bool getImageId(ossimString& s) const;
+
+    bool initSensorID(ossimString& s);
+
+    bool standAloneProductInformation();
+
+    bool getAnnotationFileLocation(const ossimFilename &manifestFile, const char* pattern);
+
+
+    bool initImageSize(ossimIpt& imageSize) const
+    {
+       // theImageClipRect = ossimDrect(0, 0, theImageSize.x-1, theImageSize.y-1);
+       // theSubImageOffset.x = 0.0;
+       // theSubImageOffset.y = 0.0;
+
+       return theProduct->initImageSize(imageSize );
+    }
+
+    bool initGsd(ossimDpt& gsd) const
+    {
+       return theProduct->initGsd( gsd );
+    }
+
+    const ossimKeywordlist getManifestKwl() const
+    {
+       return theManifestKwl;
+    }
+
+    bool isSLC() { return  theSLC; }
+    bool isOCN() { return  theOCN; }
+
+    bool initSRGR()
+    {
+       //   theProduct->initSRGR( );
+       return true;
+    }
+
+    bool findSafeManifest(const ossimFilename& file, ossimFilename& safeFile);
+
+    void clearFields();
+
+
+   protected:
+
+    TYPE_DATA
+
+  private:
+
+    ossimFilename                          theProductXmlFile;
+    ossimFilename                          theManifestFile;
+    ossimKeywordlist                       theManifestKwl;
+    ossimRefPtr<ossimXmlDocument>          theManifestDoc;
+    ossimRefPtr<ossimSentinel1ProductDoc>  theProduct;
+    bool                                   theOCN;
+    bool                                   theSLC;
+
+
+    }; //end class ossimSentinel1Model
+
+}  //end namespace ossimplugins
+
+
+#endif /* #ifndef ossimSentinel1Model_HEADER */
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.cpp
new file mode 100644
index 0000000..64840e2
--- /dev/null
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.cpp
@@ -0,0 +1,722 @@
+#include "ossimSentinel1ProductDoc.h"
+#include <ossim/base/ossimDirectory.h>
+#include <ossim/base/ossimDate.h>
+
+// Define Trace flags for use within this file:
+static ossimTrace traceExec  ("ossimSentinel1SupportData:exec");
+static ossimTrace traceDebug ("ossimSentinel1SupportData:debug");
+
+namespace ossimplugins
+{
+
+   static const char LOAD_FROM_PRODUCT_FILE_KW[] = "load_from_product_file_flag";
+   static const char PRODUCT_XML_FILE_KW[] = "product_xml_filename";
+   static const char SUPPORT_DATA_PREFIX[] = "support_data.";
+
+   ossimSentinel1ProductDoc::ossimSentinel1ProductDoc ()
+      : ossimErrorStatusInterface ()
+      , theRangeSpacingTotal (0.0)
+      , theAzimuthSpacingTotal (0.0)
+      , theSLC (false)
+      , theTOPSAR (false)
+   {
+
+   }
+
+   ossimSentinel1ProductDoc::~ossimSentinel1ProductDoc ()
+   {
+
+   }
+
+   bool ossimSentinel1ProductDoc::openMetadataFile(ossimRefPtr<ossimXmlDocument>& doc, const ossimString file) const
+   {
+      if ( !doc->openFile( file ) )
+      {
+         std::cerr << "ossimSentinel1ProductDoc::openMetadataFile() failed." << std::endl;
+         return false;
+      }
+
+      return true;
+   }
+
+
+   double
+   ossimSentinel1ProductDoc
+   ::getModifiedJulianDate(const ossimString utcTimeString)
+   {
+
+      std::vector<ossimString> date_time;
+      std::vector<ossimString> output;
+
+      utcTimeString.split(date_time, "T");
+
+      date_time[0].split(output, "-");
+
+      if (output.size () != 3)
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "invalid date\n";
+      }
+
+      char* stop;
+      int year = std::strtol( output[0].c_str(), &stop, 10);
+      if ( *stop != 0 )
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "invalid year\n";
+      }
+
+      stop  = 0;
+      int month = std::strtol( output[1].c_str(), &stop, 10);
+      if ( *stop != 0 )
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "invalid month\n";
+      }
+      stop  = 0;
+      int day = std::strtol( output[2].c_str(), &stop, 10);
+      if ( *stop != 0 )
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "invalid day\n";
+      }
+      /* Parse time */
+      output.clear();
+      date_time[1].split(output, ":");
+      if (output.size () != 3)
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "invalid time\n";
+      }
+
+      stop  = 0;
+      int hours = std::strtol( output[0].c_str(), &stop, 10);
+      if ( *stop != 0 )
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "invalid hours\n";
+      }
+
+      stop  = 0;
+      int minutes = std::strtol( output[1].c_str(), &stop, 10);
+      if ( *stop != 0 )
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "invalid minutes\n";
+      }
+
+      stop  = 0;
+      int seconds = std::strtod( output[2].c_str(), &stop);
+      if ( *stop != 0 )
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "invalid seconds in float\n";
+      }
+
+/* Below method could replace all above split and convert. But there is a lot of
+   checks done in  ossimLocalTm::setIso8601( ) which slows us down. And I dont
+   want that. */
+/*
+  ossimLocalTm otm;
+  if ( !otm.setIso8601(utcString) )
+  {
+  }
+  ossimDate ossimdate(otm);
+*/
+
+      ossimDate ossimdate(month, day, year);
+      ossimdate.setHour(hours);
+      ossimdate.setMin(minutes);
+      ossimdate.setFloatSec(seconds);
+      return ossimdate.getModifiedJulian();
+
+   }
+
+   bool ossimSentinel1ProductDoc::readProductMetadata()
+   {
+      bool commonMetadataRetrieved = false;
+      double heightSum = 0.0;
+      int numBands = 0;
+
+      ossimDirectory annotationDir( theManifestDirectory.dirCat( "annotation") );
+      std::vector<ossimFilename> files;
+      annotationDir.findAllFilesThatMatch(files, ".xml");
+      std::vector<ossimFilename>::const_iterator it = files.begin();
+
+      /* avoid zero value for numBands. This will result in division by zero below */
+      if( files.size() < 1 ) numBands = 1;
+
+      for (int count=0; it != files.end(); ++it,  ++count)
+      {
+         ossimRefPtr<ossimXmlDocument> theProductXmlDocument = new ossimXmlDocument();
+         openMetadataFile(theProductXmlDocument, (*it) );
+
+         const ossimRefPtr<ossimXmlNode> adsHeader = theProductXmlDocument->getRoot()->findFirstNode("adsHeader");
+
+         const ossimString swath = adsHeader->getChildTextValue("swath");
+         const ossimString polarisation = adsHeader->getChildTextValue("polarisation");
+
+         std::stringstream _tempstrm;
+         _tempstrm << "Band[" << count << "].";
+         const ossimString bandPrefix = _tempstrm.str();
+
+         theProductKwl.add(bandPrefix,
+                         "swath",
+                         swath,
+                         true);
+
+         theProductKwl.add(bandPrefix,
+                         "polarisation",
+                         polarisation,
+                         true);
+
+         theProductKwl.add(bandPrefix,
+                         "annotation",
+                         (*it).file(),
+                         true);
+
+         theProductKwl.add(bandPrefix,
+                         "first_line_time",
+                         adsHeader->getChildTextValue("startTime"),
+                         true);
+
+         theProductKwl.add(bandPrefix,
+                         "last_line_time",
+                         adsHeader->getChildTextValue("stopTime"),
+                         true);
+         //RK maybe use this->getManifestPrefix()
+         theProductKwl.add(SUPPORT_DATA_PREFIX,
+                      "mds1_tx_rx_polar",
+                      polarisation,
+                      true);
+
+         const ossimRefPtr<ossimXmlNode> imageInformation = theProductXmlDocument->getRoot()->findFirstNode("imageAnnotation/imageInformation");
+
+         const ossimRefPtr<ossimXmlNode> productInformation = theProductXmlDocument->getRoot()->findFirstNode("generalAnnotation/productInformation");
+
+         theProductKwl.add(SUPPORT_DATA_PREFIX,
+                         "data_take_id",
+                         adsHeader->getChildTextValue("missionDataTakeId"),
+                         true);
+
+         theProductKwl.add(SUPPORT_DATA_PREFIX,
+                         "slice_num",
+                         imageInformation->getChildTextValue("sliceNumber"),
+                         true);
+
+         theProductKwl.add(SUPPORT_DATA_PREFIX,
+                         "line_time_interval",
+                         imageInformation->getChildTextValue("azimuthTimeInterval"),
+                         true);
+
+         theRangeSpacingTotal += imageInformation->getChildTextValue("rangePixelSpacing").toFloat64();
+
+         theAzimuthSpacingTotal += imageInformation->getChildTextValue("azimuthPixelSpacing").toFloat64();
+
+         theProductKwl.add(bandPrefix,
+                         ossimKeywordNames::NUMBER_SAMPLES_KW,
+                         imageInformation->getChildTextValue("numberOfSamples"),
+                         true);
+
+         theProductKwl.add(bandPrefix,
+                         ossimKeywordNames::NUMBER_LINES_KW,
+                         imageInformation->getChildTextValue("numberOfLines"),
+                         true);
+
+         theProductKwl.add(bandPrefix,
+                         "sample_type", //ossimKeywordNames::PIXEL_TYPE_KW,
+                         imageInformation->getChildTextValue("pixelValue").upcase(),
+                         true);
+
+         heightSum += getBandTerrainHeight(theProductXmlDocument);
+
+
+         if (!commonMetadataRetrieved)
+         {
+            // these should be the same for all swaths
+            //RK div by oneMillion taken from S1tlbx
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                              "range_sampling_rate",
+                              productInformation->getChildTextValue("rangeSamplingRate"),
+                              true);
+
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                              "radar_frequency",
+                              productInformation->getChildTextValue("radarFrequency"),
+                              true);
+
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                            "line_time_interval",
+                            imageInformation->getChildTextValue("azimuthTimeInterval"),
+                            true);
+
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                              "slant_range_to_first_pixel",
+                              imageInformation->getChildTextValue("slantRangeTime"),
+                              true);
+
+            const ossimRefPtr<ossimXmlNode> downlinkInformation =
+               theProductXmlDocument->getRoot()->findFirstNode("generalAnnotation/downlinkInformationList/downlinkInformation");
+
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                            "pulse_repetition_frequency",
+                            downlinkInformation->getChildTextValue("prf"),
+                            true);
+
+            const ossimRefPtr<ossimXmlNode> swathProcParams =
+               theProductXmlDocument->getRoot()->findFirstNode("imageAnnotation/processingInformation/swathProcParamsList/swathProcParams");
+            const ossimRefPtr<ossimXmlNode> rangeProcessingNode = swathProcParams->findFirstNode("rangeProcessing");
+            const ossimRefPtr<ossimXmlNode> azimuthProcessingNode = swathProcParams->findFirstNode("azimuthProcessing");
+
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                            "azimuth_bandwidth",
+                              azimuthProcessingNode->getChildTextValue("processingBandwidth"),
+                            true);
+
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                            "range_bandwidth",
+                              rangeProcessingNode->getChildTextValue("processingBandwidth"),
+                            true);
+
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                            "range_looks",
+                            rangeProcessingNode->getChildTextValue("numberOfLooks"),
+                            true);
+
+            theProductKwl.add(SUPPORT_DATA_PREFIX,
+                            "azimuth_looks",
+                            azimuthProcessingNode->getChildTextValue("numberOfLooks"),
+                            true);
+
+            if(!theTOPSAR || !theSLC)
+            {
+               theProductKwl.add(SUPPORT_DATA_PREFIX,
+                               ossimKeywordNames::NUMBER_SAMPLES_KW,
+                               imageInformation->getChildTextValue("numberOfSamples"),
+                               true);
+
+               theProductKwl.add(SUPPORT_DATA_PREFIX,
+                               ossimKeywordNames::NUMBER_LINES_KW,
+                               imageInformation->getChildTextValue("numberOfLines"),
+                            true);
+            }
+
+            const ossimRefPtr<ossimXmlNode> orbitList = theProductXmlDocument->getRoot()->findFirstNode("generalAnnotation/orbitList");
+            addOrbitStateVectors(orbitList);
+
+            const ossimRefPtr<ossimXmlNode> coordinateConversionList = theProductXmlDocument->getRoot()->findFirstNode("coordinateConversion/coordinateConversionList");
+            addSRGRCoefficients(SUPPORT_DATA_PREFIX, coordinateConversionList);
+
+            const ossimRefPtr<ossimXmlNode> dcEstimateList = theProductXmlDocument->getRoot()->findFirstNode("dopplerCentroid/dcEstimateList");
+            addDopplerCentroidCoefficients(dcEstimateList);
+
+            commonMetadataRetrieved = true;
+         }
+
+         ++numBands;
+      }
+
+      if(theSLC)
+      {
+         numBands = numBands * 2; // real and imaginary
+      }
+
+
+      theProductKwl.add(SUPPORT_DATA_PREFIX,
+                      "range_spacing",
+                      theRangeSpacingTotal / (double)numBands,
+                      true);
+
+      theProductKwl.add(SUPPORT_DATA_PREFIX,
+                      "azimuth_spacing",
+                      theAzimuthSpacingTotal / (double)numBands,
+                      true);
+
+      theProductKwl.add(SUPPORT_DATA_PREFIX,
+                      "avg_scene_height",
+                      heightSum / (double)files.size(),
+                      true);
+
+      theProductKwl.add(SUPPORT_DATA_PREFIX,
+                      ossimKeywordNames::NUMBER_BANDS_KW,
+                      numBands,
+                      true);
+      return true;
+   }
+
+   void ossimSentinel1ProductDoc::addDopplerCentroidCoefficients(const ossimRefPtr<ossimXmlNode>& dcEstimateList)
+   {
+      if (!dcEstimateList.get())
+         return;
+
+      ossimString count_str;
+      dcEstimateList->getAttributeValue(count_str, "count");
+      const int count  = count_str.toInt();
+      if( count < 1)
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "No doppler centroid coefficients available in metadata!!\n";
+         return;
+      }
+      else
+      {
+         ossimXmlNode::ChildListType dcEstimates;
+         dcEstimateList->findChildNodes("dcEstimate", dcEstimates);
+
+         ossimXmlNode::ChildListType::const_iterator it = dcEstimates.begin();
+
+         int index = 1;
+
+         while( it != dcEstimates.end())
+         {
+            //Doppler_Centroid_Coefficients.dop_coef_list;
+            const ossimString prefix = "dopplerCentroid.dop_coef_list" + ossimString::toString(index) + ".";
+
+            ++index;
+
+            const ossimRefPtr<ossimXmlNode> dcEstimate = (*it);
+            theProductKwl.add(prefix,
+                            "dop_coef_time",
+                            dcEstimate->getChildTextValue("azimuthTime"),
+                            true);
+            //RK
+            const double ref_time = dcEstimate->getChildTextValue("t0").toFloat64() * 1e9; // s to ns
+
+            theProductKwl.add(prefix,
+                            "slant_range_time",
+                            ref_time,
+                            true);
+
+            const ossimString ns = dcEstimate->getChildTextValue("ns");
+
+            if( !ns.empty() )
+               theProductKwl.add(prefix,
+                               "slant_range_time",
+                               ns,
+                               true);
+
+            const ossimString coeffStr = dcEstimate->getChildTextValue("geometryDcPolynomial");
+
+            if (!coeffStr.empty())
+            {
+               const ossimString separatorList = " ";
+               std::vector<ossimString> result;
+
+               coeffStr.split(result, separatorList, true);
+
+               std::vector<ossimString>::const_iterator coeff = result.begin();
+
+               int count = 1;
+
+               while (coeff != result.end())
+               {
+                  const ossimString coeff_prefix =  prefix + ossimString::toString(count) + ".";
+
+                  theProductKwl.add(coeff_prefix,
+                                  "dop_coef",
+                                  (*coeff),
+                                  true);
+
+                  ++coeff;
+
+                  ++count;
+               }
+
+            } //if (!coeffStr.empty())
+
+            ++it;
+
+         } // while( it != dcEstimates.end())
+
+      } // else count < 1
+    }
+
+
+   double ossimSentinel1ProductDoc::getBandTerrainHeight( const ossimRefPtr<ossimXmlDocument>& theProductXmlDocument )
+   {
+      double heightSum = 0.0;
+      vector< ossimRefPtr<ossimXmlNode> > heightList;
+      theProductXmlDocument->findNodes("/product/generalAnnotation/terrainHeightList/terrainHeight", heightList);
+      vector<ossimRefPtr<ossimXmlNode> >::const_iterator it = heightList.begin();
+      while(it != heightList.end())
+      {
+         heightSum += (*it)->getChildTextValue("value").toFloat64();
+         ++it;
+      }
+      return heightSum / heightList.size();
+   }
+
+   bool ossimSentinel1ProductDoc::initImageSize(ossimIpt& imageSize) const
+   {
+      const ossimString samples_str = theProductKwl.find(SUPPORT_DATA_PREFIX, ossimKeywordNames::NUMBER_SAMPLES_KW);
+      const ossimString lines_str = theProductKwl.find(SUPPORT_DATA_PREFIX, ossimKeywordNames::NUMBER_LINES_KW);
+
+      imageSize.samp =  samples_str.toInt();
+      imageSize.line =  lines_str.toInt();
+
+      return true;
+   }
+
+   bool ossimSentinel1ProductDoc::initGsd( ossimDpt& gsd) const
+   {
+      gsd.x =  theRangeSpacingTotal;
+      gsd.y =  theAzimuthSpacingTotal;
+      return true;
+   }
+
+   void ossimSentinel1ProductDoc::addOrbitStateVectors(const ossimRefPtr<ossimXmlNode>& orbitList)
+   {
+
+      if (!orbitList.get())
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "No orbitVectorList info available in metadata!!\n";
+         return;
+      }
+
+      ossimXmlNode::ChildListType stateVectorList;
+      orbitList->findChildNodes("orbit", stateVectorList);
+
+      if(stateVectorList.size() < 1)
+      {
+         ossimNotify(ossimNotifyLevel_DEBUG) << "No orbitVectorList info available in metadata!!\n";
+         return;
+      }
+
+      for (int i = 0; i < stateVectorList.size(); ++i)
+      {
+         //orbit_state_vectors
+         const ossimString orbit_prefix = "orbitList.orbit[" + ossimString::toString(i)  + "].";
+
+         theProductKwl.add(orbit_prefix,
+                         "time",
+                         stateVectorList[i]->getChildTextValue("time"),
+                         true);
+
+         theProductKwl.add(orbit_prefix,
+                         "x_pos",
+                         stateVectorList[i]->getChildTextValue("position/x").toFloat64(),
+                         true);
+
+         theProductKwl.add(orbit_prefix,
+                         "y_pos",
+                         stateVectorList[i]->getChildTextValue("position/y").toFloat64(),
+                         true);
+
+         theProductKwl.add(orbit_prefix,
+                         "z_pos",
+                         stateVectorList[i]->getChildTextValue("position/z").toFloat64(),
+                         true);
+
+         theProductKwl.add(orbit_prefix,
+                         "x_vel",
+                         stateVectorList[i]->getChildTextValue("velocity/x").toFloat64(),
+                         true);
+
+         theProductKwl.add(orbit_prefix,
+                         "y_vel",
+                         stateVectorList[i]->getChildTextValue("velocity/y").toFloat64(),
+                         true);
+
+         theProductKwl.add(orbit_prefix,
+                         "z_vel",
+                         stateVectorList[i]->getChildTextValue("velocity/z").toFloat64(),
+                         true);
+      }
+   }
+
+   void ossimSentinel1ProductDoc::addSRGRCoefficients(const char* prefix, const ossimRefPtr<ossimXmlNode>& coordinateConversionList)
+   {
+      if (!coordinateConversionList.get())
+         return;
+
+      ossimString count_str;
+      coordinateConversionList->getAttributeValue(count_str, "count");
+      const int count  = count_str.toInt();
+      if( count < 1)
+      {
+         if(traceDebug())
+            ossimNotify(ossimNotifyLevel_DEBUG) << "No coordinate conversion info available in metadata!!\n";
+         return;
+      }
+      else
+      {
+         ossimNotify(ossimNotifyLevel_FATAL) << "shouldn't reach here!!\n";
+         return;
+      }
+
+    }
+
+   void ossimSentinel1ProductDoc::readCalibrationMetadata()
+   {
+      ossimDirectory calibrationDir( theManifestDirectory.dirCat( "annotation/calibration") );
+      std::vector<ossimFilename> files;
+      calibrationDir.findAllFilesThatMatch(files, "calibration*");
+      std::vector<ossimFilename>::const_iterator it = files.begin();
+
+      std::stringstream strm;
+      for (; it != files.end(); ++it)
+      {
+         ossimRefPtr<ossimXmlDocument> calibrationDoc = new ossimXmlDocument();
+         openMetadataFile(calibrationDoc, (*it) );
+
+         ossimRefPtr<ossimXmlNode> adsHeader = calibrationDoc->getRoot()->findFirstNode("adsHeader");
+         ossimRefPtr<ossimXmlNode> calibrationInformation = calibrationDoc->getRoot()->findFirstNode("calibrationInformation");
+         ossimRefPtr<ossimXmlNode> calibrationVectorList = calibrationDoc->getRoot()->findFirstNode("calibrationVectorList");
+
+         const ossimString calibrationPrefix = "calibration.";
+
+         theProductKwl.add(calibrationPrefix,
+                         "swath",
+                         adsHeader->getChildTextValue("swath"),
+                         true);
+
+         theProductKwl.add(calibrationPrefix,
+                         "polarisation",
+                         adsHeader->getChildTextValue("polarisation"),
+                         true);
+
+         theProductKwl.add(calibrationPrefix,
+                         "startTime",
+                         getModifiedJulianDate(adsHeader->getChildTextValue("startTime")),
+                         true);
+
+         theProductKwl.add(calibrationPrefix,
+                         "stopTime",
+                         getModifiedJulianDate(adsHeader->getChildTextValue("stopTime")),
+                         true);
+
+         theProductKwl.add(calibrationPrefix,
+                         "absoluteCalibrationConstant",
+                         calibrationInformation->getChildTextValue("absoluteCalibrationConstant"),
+                         true);
+
+         theProductKwl.add(calibrationPrefix,
+                         "count",
+                         calibrationVectorList->getAttributeValue("count"),
+                         true);
+
+         const ossimRefPtr<ossimXmlNode> calibrationRoot = calibrationDoc->getRoot();
+         std::vector< ossimRefPtr<ossimXmlNode> > calibrationVectors;
+         calibrationRoot->findChildNodes("calibrationVectorList/calibrationVector", calibrationVectors);
+         for( unsigned int idx = 0; idx < calibrationVectors.size(); ++idx)
+         {
+
+         const ossimString calibrationVectorPrefix = calibrationPrefix + "calibrationVector[" + ossimString::toString(idx) + "].";
+
+         const ossimRefPtr<ossimXmlNode> node = calibrationVectors[idx]->findFirstNode("pixel");
+
+         theProductKwl.add(calibrationVectorPrefix,
+                         "pixel_count",
+                         node->getAttributeValue("count"),
+                         false);
+
+         theProductKwl.add(calibrationVectorPrefix,
+                         "azimuthTime",
+                         getModifiedJulianDate(calibrationVectors[idx]->getChildTextValue("azimuthTime")),
+                         true);
+
+         theProductKwl.add(calibrationVectorPrefix,
+                         "line",
+                         calibrationVectors[idx]->getChildTextValue("line"),
+                         true);
+
+         theProductKwl.add(calibrationVectorPrefix,
+                         "pixel",
+                         calibrationVectors[idx]->getChildTextValue("pixel"),
+                         true);
+
+         theProductKwl.add(calibrationVectorPrefix,
+                         "sigmaNought",
+                         calibrationVectors[idx]->getChildTextValue("sigmaNought"),
+                         true);
+
+         theProductKwl.add(calibrationVectorPrefix,
+                         "betaNought",
+                         calibrationVectors[idx]->getChildTextValue("betaNought"),
+                         true);
+
+         theProductKwl.add(calibrationVectorPrefix,
+                         "gamma",
+                         calibrationVectors[idx]->getChildTextValue("gamma"),
+                         true);
+
+         theProductKwl.add(calibrationVectorPrefix,
+                         "dn",
+                         calibrationVectors[idx]->getChildTextValue("dn"),
+                         true);
+
+            //  calibrationVectors[idx]->toKwl(theProductKwl, "calibrationVectorList_" + ossimString::toString(idx+1) + ".");
+         }
+       }
+   }
+
+   void ossimSentinel1ProductDoc::readNoiseMetadata()
+   {
+      ossimDirectory calibrationDir( theManifestDirectory.dirCat( "annotation/calibration") );
+      std::vector<ossimFilename> files;
+      calibrationDir.findAllFilesThatMatch(files, "noise*");
+      std::vector<ossimFilename>::const_iterator it = files.begin();
+      const ossimString noisePrefix = "noise.";
+
+      for (; it != files.end(); ++it)
+      {
+         ossimRefPtr<ossimXmlDocument> noiseDoc = new ossimXmlDocument();
+         openMetadataFile(noiseDoc, (*it) );
+
+         const ossimRefPtr<ossimXmlNode> noiseRoot = noiseDoc->getRoot();
+         std::vector< ossimRefPtr<ossimXmlNode> > noiseVectors;
+         noiseRoot->findChildNodes("noiseVectorList/noiseVector", noiseVectors);
+         for( unsigned int idx = 0; idx < noiseVectors.size(); ++idx)
+         {
+            const ossimString noiseVectorPrefix = noisePrefix + "noiseVector[" + ossimString::toString(idx) + "].";
+
+            const ossimRefPtr<ossimXmlNode> node = noiseVectors[idx]->findFirstNode("pixel");
+
+            theProductKwl.add(noiseVectorPrefix,
+                              "pixel_count",
+                              node->getAttributeValue("count"),
+                              false);
+
+            theProductKwl.add(noiseVectorPrefix,
+                              "azimuthTime",
+                              getModifiedJulianDate(noiseVectors[idx]->getChildTextValue("azimuthTime")),
+                              true);
+
+            theProductKwl.add(noiseVectorPrefix,
+                              "line",
+                              noiseVectors[idx]->getChildTextValue("line"),
+                              true);
+
+            theProductKwl.add(noiseVectorPrefix,
+                              "pixel",
+                              noiseVectors[idx]->getChildTextValue("pixel"),
+                              true);
+
+            theProductKwl.add(noiseVectorPrefix,
+                              "noiseLut",
+                              noiseVectors[idx]->getChildTextValue("noiseLut"),
+                              true);
+
+            //noiseVectorList[idx]->toKwl(theProductKwl, "noiseVectorList_" + ossimString::toString(idx+1) + ".");
+         }
+      }
+   }
+
+
+   void ossimSentinel1ProductDoc::clearFields( )
+   {
+      theProductKwl.clear();
+   }
+   //RK
+   // bool ossimSentinel1ProductDoc::saveState(ossimKeywordlist& kwl,
+   //                                               const char* prefix)const
+   // {
+   //    kwl.addList(theProductKwl);
+
+   //    kwl.add(prefix,
+   //            "sample_type",
+   //            theSampleType,
+   //            true);
+
+   //    return true;
+   // }
+
+   // bool ossimSentinel1ProductDoc::loadState(const ossimKeywordlist& kwl,
+   //                                               const char* prefix)
+   // {
+
+   //    return true;
+
+   // }
+}
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.h
new file mode 100644
index 0000000..50b0f51
--- /dev/null
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1ProductDoc.h
@@ -0,0 +1,112 @@
+//----------------------------------------------------------------------------
+//
+// "Copyright Centre National d'Etudes Spatiales"
+//
+// License:  LGPL-2
+//
+// See LICENSE.txt file in the top level directory for more details.
+//
+//----------------------------------------------------------------------------
+// $Id$
+
+#ifndef ossimSentinel1ProductDoc_HEADER
+#define ossimSentinel1ProductDoc_HEADER
+
+#include <ossim/base/ossimConstants.h>
+#include <ossim/base/ossimIpt.h>
+#include <ossim/base/ossimObject.h>
+#include <ossim/base/ossimString.h>
+#include <ossim/base/ossimErrorStatusInterface.h>
+#include <ossim/base/ossimFilename.h>
+#include <ossim/base/ossimDpt.h>
+#include <ossim/base/ossimDrect.h>
+#include <ossim/base/ossimGpt.h>
+#include <ossim/base/ossimXmlDocument.h>
+#include <ossim/base/ossimXmlNode.h>
+#include <ossim/base/ossimKeywordlist.h>
+#include <ossim/base/ossimNotify.h>
+#include <ossim/base/ossimNotifyContext.h>
+#include <ossim/base/ossimKeywordNames.h>
+#include <ossim/base/ossimTrace.h>
+#include <ossim/base/ossimCommon.h>
+#include "ossimPluginCommon.h"
+#include "ossimPluginConstants.h"
+
+#include <cstdio>
+#include <vector>
+#include <sstream>
+#include <iostream>
+#include <iterator>
+
+namespace ossimplugins
+{
+
+   class OSSIM_PLUGINS_DLL ossimSentinel1ProductDoc : public ossimObject,
+                                                   public ossimErrorStatusInterface
+   {
+   public:
+
+      ossimSentinel1ProductDoc();
+
+      virtual ~ossimSentinel1ProductDoc();
+
+      void clearFields();
+
+      bool openMetadataFile(ossimRefPtr<ossimXmlDocument>& doc, const ossimString file) const;
+
+      bool initImageSize(ossimIpt& imageSize) const;
+
+      bool initGsd( ossimDpt& gsd) const;
+
+      void addSRGRCoefficients(const char* prefix, const ossimRefPtr<ossimXmlNode>& coordinateConversion);
+
+      void addDopplerCentroidCoefficients(const ossimRefPtr<ossimXmlNode>& dcEstimateList);
+
+      void addOrbitStateVectors(const ossimRefPtr<ossimXmlNode>& dcEstimateList);
+
+      void readCalibrationMetadata();
+
+      void readNoiseMetadata();
+
+      double getModifiedJulianDate(const ossimString utc_time);
+
+      bool readProductMetadata( );
+
+      double getBandTerrainHeight( const ossimRefPtr<ossimXmlDocument>& theProductXmlDocument );
+
+      inline const ossimKeywordlist getProductKwl() const
+      {
+         return theProductKwl;
+      }
+
+      inline void setMetadataDirectory(const ossimFilename d)
+      {
+         theManifestDirectory = d;
+      }
+
+
+      inline void setSLC(bool b)
+      {
+         theSLC = true;
+      }
+
+      inline void setTOPSAR(bool b)
+      {
+         theTOPSAR = true;
+      }
+
+   private:
+      ossimFilename theManifestDirectory;
+      double theRangeSpacingTotal;
+      double theAzimuthSpacingTotal;
+      bool theTOPSAR;
+      bool theSLC;
+      ossimFilename theProductXmlFile;
+      ossimString theSampleType;
+      ossimKeywordlist theProductKwl;
+
+      };
+
+}
+
+#endif /* #ifndef ossimSentinel1ProductDoc_HEADER */
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarTiffReader.cpp b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarTiffReader.cpp
index 86093a8..6838827 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarTiffReader.cpp
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarTiffReader.cpp
@@ -29,16 +29,14 @@ static const char PRODUCT_XML_FILE_KW[] = "product_xml_filename";
 
 namespace ossimplugins
 {
-RTTI_DEF1(ossimTerraSarTiffReader,
-          "ossimTerraSarTiffReader",
-          ossimTiffTileSource)
+RTTI_DEF1(ossimTerraSarTiffReader, "ossimTerraSarTiffReader", ossimTiffTileSource)
 }
 
 #ifdef OSSIM_ID_ENABLED
    static const char OSSIM_ID[] = "$Id$";
 #endif
-   
-static ossimTrace traceDebug("ossimTerraSarTiffReader:degug");  
+
+static ossimTrace traceDebug("ossimTerraSarTiffReader:degug");
 
 ossimplugins::ossimTerraSarTiffReader::ossimTerraSarTiffReader()
    :
diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.h
index 019049f..7f92e49 100644
--- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.h
+++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTileMapModel.h
@@ -37,10 +37,13 @@ public:
   /*!
    * CONSTRUCTORS:
    */
+
+  using ossimOptimizableProjection::operator=;
+
   ossimTileMapModel();
   ossimTileMapModel(const ossimKeywordlist& geom_kwl);
   ossimTileMapModel(const ossimTileMapModel& rhs);
-  
+
   virtual ~ossimTileMapModel(){};
 
   enum ProjectionType
@@ -51,17 +54,18 @@ public:
     SOM_MAP,
     SOM_ORBIT
   };
-  
+
+
+
   /*!
    * Returns pointer to a new instance, copy of this.
    */
   virtual ossimObject* dup() const { return 0; } // TBR
-  
+
   /*!
    * Extends base-class implementation. Dumps contents of object to ostream.
    */
   virtual std::ostream& print(std::ostream& out) const;
-  
 
 
   bool open(const ossimFilename& file);
@@ -72,16 +76,16 @@ public:
    */
   virtual bool saveState(ossimKeywordlist& kwl,
                          const char* prefix=0) const;
-  
+
   virtual bool loadState(const ossimKeywordlist& kwl,
                          const char* prefix=0);
-  
+
   /*!
    * Writes a template of geom keywords processed by loadState and saveState
    * to output stream.
    */
   static void writeGeomTemplate(ostream& os);
-  
+
   //***
   // Overrides base class pure virtual.
   //***
@@ -92,7 +96,7 @@ public:
                                        ossimGpt&       worldPoint) const;
   virtual void lineSampleToWorld(const ossimDpt& image_point,
                                  ossimGpt&       worldPoint) const;
-  
+
   /*!
    * Set/Get the depth of the quadtree decomposition
    *
@@ -104,18 +108,18 @@ public:
   {
     return qDepth;
   }
-  
-  
+
+
   /*!
    * ossimOptimizableProjection
    */
   inline virtual bool useForward()const {return true;} //!image to ground faster
 
-  
+
 protected:
-  
 
-  
+
+
   //***
   // Image constant parameters:
   //***
@@ -129,17 +133,17 @@ protected:
   int              theWrsRowNumber;
   double           theMeridianalAngle;
   double           thePositionError;
- 
+
   ProjectionType       theProjectionType;
   ossimRefPtr<ossimMapProjection>  theMapProjection;
- 
+
   double           theMapAzimAngle;
   double           theMapAzimCos;
   double           theMapAzimSin;
   double           theMap2IcRotAngle;
   double           theMap2IcRotCos;
   double           theMap2IcRotSin;
- // 
+ //
  // //***
  // // Adjustable parameters:
  // //***
@@ -151,15 +155,15 @@ protected:
   double           theYawOffset;
   double           theYawRate;
   double           theMapRotation;
- // 
+ //
  // //***
  // // Quantities derived from the adjustable parameters:
  // //***
   NEWMAT::Matrix   theRollRotMat;
 
-  unsigned int qDepth;  
+  unsigned int qDepth;
   TYPE_DATA
-  
+
 
 };
 } // End: namespace ossimplugins
diff --git a/Modules/ThirdParty/SiftFast/src/CMakeLists.txt b/Modules/ThirdParty/SiftFast/src/CMakeLists.txt
index c475fff..56c63b1 100644
--- a/Modules/ThirdParty/SiftFast/src/CMakeLists.txt
+++ b/Modules/ThirdParty/SiftFast/src/CMakeLists.txt
@@ -122,23 +122,28 @@ if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX )
 
   add_definitions(${SSE_FLAGS})
 elseif(MSVC)
-  check_cxx_source_runs("
-    #include <emmintrin.h>
-
-    int main()
-    {
-        __m128d a, b;
-        double vals[2] = {0};
-        a = _mm_loadu_pd(vals);
-        b = _mm_add_pd(a,a);
-        _mm_storeu_pd(vals,b);
-        return 0;
-     }"
-     HAS_SSE2_EXTENSIONS)
-  if( HAS_SSE2_EXTENSIONS )
-    message(STATUS "Using SSE2 extensions")
-    add_definitions( "/arch:SSE2 /fp:fast -D__SSE__ -D__SSE2__" )
-  endif()
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+      message(STATUS "Not using SSE2 extensions on x64")
+    else()
+      check_cxx_source_runs("
+       #include <emmintrin.h>
+       
+        int main()
+        {
+          __m128d a, b;
+          double vals[2] = {0};
+          a = _mm_loadu_pd(vals);
+          b = _mm_add_pd(a,a);
+          _mm_storeu_pd(vals,b);
+          return 0;
+        }"
+      HAS_SSE2_EXTENSIONS)
+     
+      if( HAS_SSE2_EXTENSIONS )
+        message(STATUS "Using SSE2 extensions")
+        add_definitions( "/arch:SSE2 /fp:fast -D__SSE__ -D__SSE2__" )
+      endif()
+    endif()
 endif()
 
 #set(Boost_ADDITIONAL_VERSIONS "1.40" "1.39" "1.38" "1.37.0" "1.37" "1.35.0" "1.34.1" "1.34.0" "1.34" "1.33.1" "1.33.0" "1.33")
diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
index 9c83a78..955a76b 100644
--- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
+++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h
@@ -247,6 +247,20 @@ public:
    */
   void SetDefaultParameterFloat(std::string parameter, float value);
 
+  /** Set a default pixel type for an output image parameter
+   *
+   * \param[in] parameter Name of the output image parameter
+   * \param[in] type Default pixel type
+   */
+  void SetDefaultOutputPixelType(std::string parameter, ImagePixelType type);
+
+  /** Set a default complex pixel type for an output complex image parameter
+   *
+   * \param[in] parameter Name of the output complex image parameter
+   * \param[in] type Default complex pixel type
+   */
+  void SetDefaultOutputComplexPixelType(std::string parameter, ComplexImagePixelType type);
+
  /* Set a minimum int value, must used in the
    * DoInit when setting a value by default
    * for the parameter
diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h
index 318b97e..755cb26 100644
--- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h
+++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactory.h
@@ -18,6 +18,7 @@
 #ifndef __otbWrapperApplicationFactory_h
 #define __otbWrapperApplicationFactory_h
 
+#include "otbWrapperApplicationFactoryBase.h"
 #include "itkVersion.h"
 
 namespace otb
@@ -26,12 +27,12 @@ namespace Wrapper
 {
 
 template < class TApplication >
-class ITK_ABI_EXPORT ApplicationFactory : public itk::ObjectFactoryBase
+class ITK_ABI_EXPORT ApplicationFactory : public ApplicationFactoryBase
 {
 public:
   /** Standard class typedefs. */
   typedef ApplicationFactory            Self;
-  typedef itk::ObjectFactoryBase        Superclass;
+  typedef ApplicationFactoryBase        Superclass;
   typedef itk::SmartPointer<Self>       Pointer;
   typedef itk::SmartPointer<const Self> ConstPointer;
 
@@ -50,7 +51,19 @@ public:
   itkFactorylessNewMacro(Self);
 
   /** Run-time type information (and related methods). */
-  itkTypeMacro(ApplicationFactory, itk::ObjectFactoryBase);
+  itkTypeMacro(ApplicationFactory, ApplicationFactoryBase);
+  
+  void SetClassName(const char* name)
+  {
+    // remove namespace, only keep class name
+    std::string tmpName(name);
+    std::string::size_type pos = tmpName.rfind("::");
+    if (pos != std::string::npos)
+      {
+      tmpName = tmpName.substr(pos+2);
+      }
+    m_ClassName.assign(tmpName);
+  }
 
 protected:
   ApplicationFactory()
@@ -68,9 +81,8 @@ protected:
    * is not supported by the factory implementation. */
   virtual LightObject::Pointer CreateObject(const char* itkclassname )
   {
-    const std::string classname("otbWrapperApplication");
     LightObject::Pointer ret;
-    if ( classname == itkclassname )
+    if ( m_ClassName == itkclassname)
       ret = TApplication::New().GetPointer();
 
     return ret;
@@ -82,9 +94,10 @@ protected:
   virtual std::list<LightObject::Pointer>
   CreateAllObject(const char* itkclassname)
   {
-    const std::string classname("otbWrapperApplication");
+    const std::string applicationClass("otbWrapperApplication");
     std::list<LightObject::Pointer> list;
-    if ( classname == itkclassname )
+    if ( m_ClassName == itkclassname ||
+         applicationClass == itkclassname )
       list.push_back(TApplication::New().GetPointer());
 
     return list;
@@ -93,6 +106,8 @@ protected:
 private:
   ApplicationFactory(const Self &); //purposely not implemented
   void operator =(const Self&); //purposely not implemented
+  
+  std::string m_ClassName;
 };
 
 } // end namespace Wrapper
@@ -112,6 +127,7 @@ private:
     OTB_APP_EXPORT itk::ObjectFactoryBase* itkLoad()                                   \
     {                                                                                  \
       staticFactory = ApplicationFactoryType::New();                                   \
+      staticFactory->SetClassName(#ApplicationType);                                   \
       return staticFactory;                                                            \
     }                                                                                  \
   }
diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h
new file mode 100644
index 0000000..095cc88
--- /dev/null
+++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationFactoryBase.h
@@ -0,0 +1,58 @@
+/*=========================================================================
+
+ 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 __otbWrapperApplicationFactoryBase_h
+#define __otbWrapperApplicationFactoryBase_h
+
+#include "itkObjectFactoryBase.h"
+#include "otbWrapperApplication.h"
+
+namespace otb
+{
+namespace Wrapper
+{
+
+class ITK_ABI_EXPORT ApplicationFactoryBase : public itk::ObjectFactoryBase
+{
+public:
+  /** Standard class typedefs. */
+  typedef ApplicationFactoryBase        Self;
+  typedef itk::ObjectFactoryBase        Superclass;
+  typedef itk::SmartPointer<Self>       Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+  
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(ApplicationFactoryBase, itk::ObjectFactoryBase);
+  
+  /** Create an application using the CreateObject() method of the current factory */
+  Application::Pointer CreateApplication(const char* name);
+
+protected:
+  ApplicationFactoryBase(){}
+
+  virtual ~ApplicationFactoryBase(){}
+
+private:
+  ApplicationFactoryBase(const Self &); //purposely not implemented
+  void operator =(const Self&); //purposely not implemented
+
+};
+
+} // end namespace Wrapper
+} //end namespace otb
+
+#endif
diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h
index ed1699d..ba6a467 100644
--- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h
+++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplicationRegistry.h
@@ -39,7 +39,7 @@ class ITK_ABI_EXPORT ApplicationRegistry : public itk::Object
 {
 public:
   /** Standard class typedefs. */
-  typedef ApplicationRegistry            Self;
+  typedef ApplicationRegistry           Self;
   typedef itk::Object                   Superclass;
   typedef itk::SmartPointer<Self>       Pointer;
   typedef itk::SmartPointer<const Self> ConstPointer;
@@ -58,12 +58,21 @@ public:
   /** Add the specified path to the list of application search path */
   static void AddApplicationPath(std::string path);
 
+  /** Return the application search path */
+  static std::string GetApplicationPath();
+
   /** Return the list of available applications */
-  static std::vector<std::string> GetAvailableApplications();
+  static std::vector<std::string> GetAvailableApplications(bool useFactory=true);
 
   /** Create the specified Application */
-  static Application::Pointer CreateApplication(const std::string& applicationName);
+  static Application::Pointer CreateApplication(const std::string& applicationName, bool useFactory=true);
+
+  /** Create the specified Application (faster)
+   *  method using dynamic library name to load the right module */
+  static Application::Pointer CreateApplicationFaster(const std::string& applicationName);
 
+  /** Clean registry by releasing unused modules */
+  static void CleanRegistry();
 
 protected:
   ApplicationRegistry();
@@ -73,6 +82,9 @@ private:
   ApplicationRegistry(const Self&); //purposely not implemented
   void operator=(const Self&); //purposely not implemented
 
+  /** Load an application from a shared library */
+  static Application::Pointer LoadApplicationFromPath(std::string path,std::string name);
+
 };
 
 } // end namespace Wrapper
diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h
index 6500d54..5edf833 100644
--- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h
+++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperComplexOutputImageParameter.h
@@ -61,14 +61,27 @@ public:
   /** Return any value */
   ImageBaseType* GetValue( void );
 
-  /** Set/Get PixelType to be used when saving */
+  /** Set/Get m_ComplexPixelType to be used when saving */
   itkSetMacro(ComplexPixelType, ComplexImagePixelType);
   itkGetMacro(ComplexPixelType, ComplexImagePixelType);
 
+  /** Set/Get m_DefaultComplexPixelType*/
+  itkSetMacro(DefaultComplexPixelType, ComplexImagePixelType);
+  itkGetMacro(DefaultComplexPixelType, ComplexImagePixelType);
+
   /** Set/Get available RAM value */
   itkSetMacro(RAMValue, unsigned int);
   itkGetMacro(RAMValue, unsigned int);
 
+  /** Implement the reset method (replace pixel type by default type) */
+  virtual void Reset()
+  {
+    m_ComplexPixelType = m_DefaultComplexPixelType;
+  }
+
+  /** Static method to convert pixel type into string */
+  static std::string ConvertPixelTypeToString(ComplexImagePixelType type);
+
   /** Return true if a filename is set */
   bool HasValue() const;
 
@@ -106,7 +119,7 @@ protected:
   ImageBaseType::Pointer m_Image;
   std::string            m_FileName;
   ComplexImagePixelType         m_ComplexPixelType;
-
+  ComplexImagePixelType         m_DefaultComplexPixelType;
 
   typedef otb::ImageFileWriter<ComplexFloatImageType>  ComplexFloatWriterType;
   typedef otb::ImageFileWriter<ComplexDoubleImageType> ComplexDoubleWriterType;
diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h
index be5f9dc..1db4f6e 100644
--- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h
+++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputProcessXMLParameter.h
@@ -43,19 +43,10 @@ public:
   // Get Value
   //TODO otbGetObjectMemberMacro(StringParam, Value , std::string);
 
-  void SetFileName(std::string value)
-  {
-    this->SetValue(value);
-  }
+  bool SetFileName(std::string value);
 
   // Set Value
-  virtual void SetValue(const std::string value)
-    {
-    itkDebugMacro("setting member m_FileName to " << value);
-    this->m_FileName = value;
-    SetActive(true);
-    this->Modified();
-    }
+  virtual void SetValue(const std::string value);
 
   ImagePixelType GetPixelTypeFromString(std::string pixTypeAsString);
 
diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h
index a8dc212..3313e5a 100644
--- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h
+++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h
@@ -66,10 +66,23 @@ public:
   itkSetMacro(PixelType, ImagePixelType);
   itkGetMacro(PixelType, ImagePixelType);
 
+  /** Set/Get DefaultPixelType  */
+  itkSetMacro(DefaultPixelType, ImagePixelType);
+  itkGetMacro(DefaultPixelType, ImagePixelType);
+
   /** Set/Get available RAM value */
   itkSetMacro(RAMValue, unsigned int);
   itkGetMacro(RAMValue, unsigned int);
 
+  /** Implement the reset method (replace pixel type by default type) */
+  virtual void Reset()
+  {
+    m_PixelType = m_DefaultPixelType;
+  }
+
+  /** Static method to convert pixel type into string */
+  static std::string ConvertPixelTypeToString(ImagePixelType type);
+
   /** Return true if a filename is set */
   bool HasValue() const;
 
@@ -113,6 +126,7 @@ protected:
   ImageBaseType::Pointer m_Image;
   std::string            m_FileName;
   ImagePixelType         m_PixelType;
+  ImagePixelType         m_DefaultPixelType;
 
   typedef otb::ImageFileWriter<UInt8ImageType>  UInt8WriterType;
   typedef otb::ImageFileWriter<Int16ImageType>  Int16WriterType;
diff --git a/Modules/Wrappers/ApplicationEngine/otb-module.cmake b/Modules/Wrappers/ApplicationEngine/otb-module.cmake
index e2c2e57..d7421d1 100644
--- a/Modules/Wrappers/ApplicationEngine/otb-module.cmake
+++ b/Modules/Wrappers/ApplicationEngine/otb-module.cmake
@@ -13,7 +13,7 @@ otb_module(OTBApplicationEngine
     OTBImageBase
     OTBCommon
     OTBObjectList
-    OTBBoost
+    OTBBoostAdapters
     OTBOSSIMAdapters
     OTBITK
 
diff --git a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt
index 055cfea..29a4a46 100644
--- a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt
+++ b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt
@@ -26,6 +26,7 @@ set(OTBApplicationEngine_SRC
   otbWrapperApplication.cxx
   otbWrapperChoiceParameter.cxx
   otbWrapperApplicationRegistry.cxx
+  otbWrapperApplicationFactoryBase.cxx
   )
 
 add_library(OTBApplicationEngine ${OTBApplicationEngine_SRC})
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx
index 8176e2f..3df1c19 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx
@@ -657,6 +657,29 @@ void Application::SetDefaultParameterFloat(std::string parameter, float value)
     }
 }
 
+void Application::SetDefaultOutputPixelType(std::string parameter, ImagePixelType type)
+{
+  Parameter* param = GetParameterByKey(parameter);
+  OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param);
+  if (paramDown)
+    {
+    paramDown->SetDefaultPixelType(type);
+    paramDown->SetPixelType(type);
+    }
+}
+
+void
+Application::SetDefaultOutputComplexPixelType(std::string parameter, ComplexImagePixelType type)
+{
+  Parameter* param = GetParameterByKey(parameter);
+  ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param);
+  if (paramDown)
+    {
+    paramDown->SetDefaultComplexPixelType(type);
+    paramDown->SetComplexPixelType(type);
+    }
+}
+
 void Application::SetMinimumParameterIntValue(std::string parameter, int value)
 {
   Parameter* param = GetParameterByKey(parameter);
@@ -807,7 +830,8 @@ void Application::SetParameterString(std::string parameter, std::string value)
   else if (dynamic_cast<InputProcessXMLParameter*>(param))
     {
     InputProcessXMLParameter* paramDown = dynamic_cast<InputProcessXMLParameter*>(param);
-    paramDown->SetValue(value);
+    if ( !paramDown->SetFileName(value) )
+      otbAppLogCRITICAL( <<"Invalid XML parameter filename " << value <<".");
     }
 }
 
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationFactoryBase.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationFactoryBase.cxx
new file mode 100644
index 0000000..3102d00
--- /dev/null
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationFactoryBase.cxx
@@ -0,0 +1,43 @@
+/*=========================================================================
+
+ 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 "otbWrapperApplicationFactoryBase.h"
+
+namespace otb
+{
+namespace Wrapper
+{
+
+Application::Pointer
+ApplicationFactoryBase::CreateApplication(const char* name)
+{
+  Application::Pointer appli;
+  
+  LightObject::Pointer obj = this->CreateObject(name);
+  if (obj.IsNotNull())
+    {
+    Application* app = dynamic_cast<Application*> (obj.GetPointer());
+    if (app)
+      {
+      appli = app;
+      }
+    }
+  return appli;
+}
+
+}
+}
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx
index 9580861..ea66893 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx
@@ -16,8 +16,14 @@
 
  =========================================================================*/
 #include "otbWrapperApplicationRegistry.h"
+#include "otbWrapperApplicationFactoryBase.h"
 #include "otbMacro.h"
 #include "itksys/SystemTools.hxx"
+#include "itkDynamicLoader.h"
+#include "itkDirectory.h"
+#include "itkMutexLock.h"
+#include "itkMutexLockHolder.h"
+
 #include <iterator>
 
 namespace otb
@@ -25,6 +31,101 @@ namespace otb
 namespace Wrapper
 {
 
+// Constant : environment variable for application path
+static const char OTB_APPLICATION_VAR[] = "OTB_APPLICATION_PATH";
+
+class ApplicationPrivateRegistry
+{
+public:
+  typedef std::pair<Application*, void* > AppHandlePairType;
+  typedef std::list<AppHandlePairType>    AppHandleContainerType;
+
+  /** Add a pair (application, library handle) in the private registry */
+  bool AddPair(Application *app, void *handle)
+    {
+    AppHandlePairType pair;
+    if (app && handle)
+      {
+      // mutex lock to ensure thread safety
+      itk::MutexLockHolder<itk::SimpleMutexLock> mutexHolder(m_Mutex);
+      pair.first = app;
+      pair.second = handle;
+      m_Container.push_back(pair);
+      return true;
+      }
+    return false;
+    }
+
+  /** When an application is deleted, unregister its pointer from private registry */
+  void UnregisterApp(const Application *app)
+    {
+    if (app)
+      {
+      // mutex lock to ensure thread safety
+      itk::MutexLockHolder<itk::SimpleMutexLock> mutexHolder(m_Mutex);
+      AppHandleContainerType::iterator it = m_Container.begin();
+      while (it != m_Container.end())
+        {
+        if ((*it).first == app)
+          {
+          (*it).first = NULL;
+          }
+        ++it;
+        }
+      }
+    }
+
+  /** Release the library handles from applications already deleted */
+  void ReleaseUnusedHandle()
+    {
+    itk::MutexLockHolder<itk::SimpleMutexLock> mutexHolder(m_Mutex);
+    AppHandleContainerType::iterator it;
+    for (it = m_Container.begin() ; it != m_Container.end() ; ++it)
+      {
+      if ((*it).first == NULL)
+        {
+        itk::DynamicLoader::CloseLibrary( static_cast<itk::LibHandle>((*it).second));
+        (*it).second = NULL;
+        }
+      }
+    m_Container.remove(AppHandlePairType((Application*) NULL, (void*) NULL));
+    }
+
+  /** close all handles at program exit */
+  ~ApplicationPrivateRegistry()
+  {
+  // unregister all ITK factories, because some of them could have been
+  // registered by the shared libs we are about to close.
+  itk::ObjectFactoryBase::UnRegisterAllFactories();
+  // Close all opened shared libs
+  AppHandleContainerType::iterator it;
+  for (it = m_Container.begin() ; it != m_Container.end() ; ++it)
+    {
+    itk::DynamicLoader::CloseLibrary( static_cast<itk::LibHandle>((*it).second));
+    }
+  m_Container.clear();
+  }
+
+private:
+  AppHandleContainerType m_Container;
+
+  itk::SimpleMutexLock m_Mutex;
+};
+// static finalizer to close opened libraries
+static ApplicationPrivateRegistry m_ApplicationPrivateRegistryGlobal;
+
+// Define callbacks to unregister applications in ApplicationPrivateRegistry
+void DeleteAppCallback(itk::Object *obj,const itk::EventObject &, void *)
+  {
+  Application *appPtr = dynamic_cast<Application*>(obj);
+  m_ApplicationPrivateRegistryGlobal.UnregisterApp(appPtr);
+  }
+void DeleteAppConstCallback(const itk::Object *obj,const itk::EventObject &, void *)
+  {
+  const Application *appPtr = dynamic_cast<const Application*>(obj);
+  m_ApplicationPrivateRegistryGlobal.UnregisterApp(appPtr);
+  }
+
 ApplicationRegistry::ApplicationRegistry()
 {
 }
@@ -37,23 +138,20 @@ void
 ApplicationRegistry::SetApplicationPath(std::string newpath)
 {
   std::ostringstream putEnvPath;
-  putEnvPath << "ITK_AUTOLOAD_PATH=" << newpath;
+  putEnvPath << OTB_APPLICATION_VAR << "=" << newpath;
 
   // do NOT use putenv() directly, since the string memory must be managed carefully
   itksys::SystemTools::PutEnv(putEnvPath.str().c_str());
-
-  // Reload factories to take into account new path
-  itk::ObjectFactoryBase::ReHash();
 }
 
 void
 ApplicationRegistry::AddApplicationPath(std::string newpath)
 {
   std::ostringstream putEnvPath;
-  putEnvPath << "ITK_AUTOLOAD_PATH=";
+  putEnvPath << OTB_APPLICATION_VAR <<"=";
 
   // Can be NULL if the env var is not set
-  const char* currentEnv = itksys::SystemTools::GetEnv("ITK_AUTOLOAD_PATH");
+  const char* currentEnv = itksys::SystemTools::GetEnv(OTB_APPLICATION_VAR);
 
 #if defined(WIN32)
   const char pathSeparator = ';';
@@ -70,50 +168,101 @@ ApplicationRegistry::AddApplicationPath(std::string newpath)
 
   // do NOT use putenv() directly, since the string memory must be managed carefully
   itksys::SystemTools::PutEnv(putEnvPath.str().c_str());
+}
 
-  // Reload factories to take into account new path
-  itk::ObjectFactoryBase::ReHash();
-
+std::string
+ApplicationRegistry::GetApplicationPath()
+{
+  std::string ret;
+  // Can be NULL if the env var is not set
+  const char* currentEnv = itksys::SystemTools::GetEnv(OTB_APPLICATION_VAR);
+  if (currentEnv)
+    {
+    ret = std::string(currentEnv);
+    }
+  return ret;
 }
 
 Application::Pointer
-ApplicationRegistry::CreateApplication(const std::string& name)
+ApplicationRegistry::CreateApplication(const std::string& name, bool useFactory)
 {
   ApplicationPointer appli;
 
-  std::list<ApplicationPointer> possibleApp;
-  std::list<LightObject::Pointer> allobjects = itk::ObjectFactoryBase::CreateAllInstance("otbWrapperApplication");
+  // Fast search : uses OTB_APPLICATION_PATH
+  appli = ApplicationRegistry::CreateApplicationFaster(name);
+  if (appli.IsNotNull())
+    {
+    return appli;
+    }
 
-  // Downcast and Sanity check
-  for (std::list<LightObject::Pointer>::iterator i = allobjects.begin(); i != allobjects.end(); ++i)
+  // Classic search : uses factories registered by ITK ( see ITK_AUTOLOAD_PATH )
+  if (useFactory)
     {
-    Application* app = dynamic_cast<Application*> (i->GetPointer());
-    if (app)
-      {
-      possibleApp.push_back(app);
-      }
-    else
+    LightObject::Pointer possibleApp = itk::ObjectFactoryBase::CreateInstance(name.c_str());
+    if (possibleApp.IsNotNull())
       {
-      otbMsgDevMacro( << "Error ApplicationRegistry factory did not return an Application: " << (*i)->GetNameOfClass() << std::endl );
+      // Downcast
+      Application* app = dynamic_cast<Application*> (possibleApp.GetPointer());
+      if (app)
+        {
+          appli = app;
+          appli->Init();
+        }
+      else
+        {
+        otbMsgDevMacro( << "Error ApplicationRegistry factory did not return an Application: " << possibleApp->GetNameOfClass() << std::endl );
+        }
       }
     }
+  
+  return appli;
+}
+
+typedef itk::ObjectFactoryBase * ( *ITK_LOAD_FUNCTION )();
+
+Application::Pointer
+ApplicationRegistry::CreateApplicationFaster(const std::string& name)
+{
+  ApplicationPointer appli = NULL;
+
+  std::string appExtension = itksys::DynamicLoader::LibExtension();
+#ifdef __APPLE__
+  appExtension = ".dylib";
+#endif
+  std::ostringstream appLibName;
+  appLibName << "otbapp_" << name << appExtension;
 
-  // Return the app with the desired name
-  for(std::list<ApplicationPointer>::iterator k = possibleApp.begin();
-      k != possibleApp.end(); ++k)
+#if defined(WIN32)
+  const char pathSeparator = ';';
+#else
+  const char pathSeparator = ':';
+#endif
+
+#ifdef _WIN32
+  const char sep = '\\';
+#else
+  const char sep = '/';
+#endif
+
+  std::string otbAppPath = GetApplicationPath();
+  std::vector<itksys::String> pathList;
+  if (!otbAppPath.empty())
+    {
+    pathList = itksys::SystemTools::SplitString(otbAppPath.c_str(),pathSeparator,false);
+    }
+  for (unsigned int i=0 ; i<pathList.size() ; ++i)
     {
-    try
+    std::string possiblePath = pathList[i];
+    if ( !possiblePath.empty() && possiblePath[possiblePath.size() - 1] != sep )
       {
-      (*k)->Init();
-      if ( (*k)->GetName() == name )
-        {
-        appli = *k;
-        break;
-        }
+      possiblePath += sep;
       }
-    catch(...)
+    possiblePath += appLibName.str();
+
+    appli = LoadApplicationFromPath(possiblePath,name);
+    if (appli.IsNotNull())
       {
-      otbMsgDevMacro( << "Error a faulty Application has been detected: "<<(*k)->GetNameOfClass() << std::endl );
+      break;
       }
     }
 
@@ -121,36 +270,88 @@ ApplicationRegistry::CreateApplication(const std::string& name)
 }
 
 std::vector<std::string>
-ApplicationRegistry::GetAvailableApplications()
+ApplicationRegistry::GetAvailableApplications(bool useFactory)
 {
   ApplicationPointer appli;
+  std::set<std::string> appSet;
 
-  std::list<ApplicationPointer> possibleApp;
-  std::list<LightObject::Pointer> allobjects = itk::ObjectFactoryBase::CreateAllInstance("otbWrapperApplication");
+  std::string appPrefix("otbapp_");
+  std::string appExtension = itksys::DynamicLoader::LibExtension();
+#ifdef __APPLE__
+  appExtension = ".dylib";
+#endif
 
-  // Downcast and Sanity check
-  for (std::list<LightObject::Pointer>::iterator i = allobjects.begin(); i != allobjects.end(); ++i)
+#if defined(WIN32)
+  const char pathSeparator = ';';
+#else
+  const char pathSeparator = ':';
+#endif
+
+#ifdef _WIN32
+  const char sep = '\\';
+#else
+  const char sep = '/';
+#endif
+
+  std::string otbAppPath = GetApplicationPath();
+  std::vector<itksys::String> pathList;
+  if (!otbAppPath.empty())
+    {
+    pathList = itksys::SystemTools::SplitString(otbAppPath.c_str(),pathSeparator,false);
+    }
+  for (unsigned int k=0 ; k<pathList.size() ; ++k)
     {
-    Application* io = dynamic_cast<Application*> (i->GetPointer());
-    if (io)
+    itk::Directory::Pointer dir = itk::Directory::New();
+    if (!dir->Load(pathList[k].c_str()))
       {
-      possibleApp.push_back(io);
+      continue;
       }
-    else
+    for (unsigned int i = 0; i < dir->GetNumberOfFiles(); i++)
       {
-      otbMsgDevMacro( "Error ApplicationRegistry factory did not return an Application: " << (*i)->GetNameOfClass() << std::endl );
+      const char *filename = dir->GetFile(i);
+      std::string sfilename(filename);
+      std::string::size_type extPos = sfilename.rfind(appExtension);
+      std::string::size_type prefixPos = sfilename.find(appPrefix);
+
+      // Check if current file is a shared lib with the right pattern
+      if (extPos + appExtension.size() == sfilename.size() &&
+          prefixPos == 0)
+        {
+        std::string name = sfilename.substr(appPrefix.size(),extPos-appPrefix.size());
+        std::string fullpath = pathList[k];
+        if (!fullpath.empty() && fullpath[fullpath.size() - 1] != sep)
+          {
+          fullpath.push_back(sep);
+          }
+        fullpath.append(sfilename);
+        appli = LoadApplicationFromPath(fullpath,name);
+        if (appli.IsNotNull())
+          {
+          appSet.insert(name);
+          }
+        appli = NULL;
+        }
       }
     }
 
-  // Get all the app names
-  // If ITK_AUTOLOAD_PATH contains several times the same path, then the same app appear several times
-  // Use a temporary std::set to fix this
-  std::set<std::string> appSet;
-  for(std::list<ApplicationPointer>::iterator k = possibleApp.begin();
-      k != possibleApp.end(); ++k)
+  if (useFactory)
     {
-    (*k)->Init();
-    appSet.insert((*k)->GetName());
+    std::list<LightObject::Pointer> allobjects = itk::ObjectFactoryBase::CreateAllInstance("otbWrapperApplication");
+    // Downcast and Sanity check
+    for (std::list<LightObject::Pointer>::iterator i = allobjects.begin(); i != allobjects.end(); ++i)
+      {
+      Application* app = dynamic_cast<Application*> (i->GetPointer());
+      if (app)
+        {
+        app->Init();
+        std::string curName(app->GetName());
+        appSet.insert(curName);
+        }
+      else
+        {
+        otbMsgDevMacro( << "Error ApplicationRegistry factory did not return an Application: " << (*i)->GetNameOfClass() << std::endl );
+        }
+      }
     }
 
   std::vector<std::string> appVec;
@@ -158,6 +359,60 @@ ApplicationRegistry::GetAvailableApplications()
   return appVec;
 }
 
+void
+ApplicationRegistry::CleanRegistry()
+{
+  m_ApplicationPrivateRegistryGlobal.ReleaseUnusedHandle();
+}
+
+Application::Pointer
+ApplicationRegistry::LoadApplicationFromPath(std::string path,std::string name)
+{
+  Application::Pointer appli;
+
+  if (itksys::SystemTools::FileExists(path.c_str(),true))
+    {
+    itk::LibHandle lib = itk::DynamicLoader::OpenLibrary(path.c_str());
+    if (lib)
+      {
+      /**
+       * Look for the symbol itkLoad in the library
+       */
+      ITK_LOAD_FUNCTION loadfunction =
+        ( ITK_LOAD_FUNCTION ) itk::DynamicLoader::GetSymbolAddress(lib, "itkLoad");
+      /**
+       * if the symbol is found call it to create the factory
+       * from the library
+       */
+      if ( loadfunction )
+        {
+        itk::ObjectFactoryBase *newfactory = ( *loadfunction )( );
+        // Downcast
+        ApplicationFactoryBase* appFactory = dynamic_cast<ApplicationFactoryBase*>(newfactory);
+
+        if (appFactory)
+          {
+          appli = appFactory->CreateApplication(name.c_str());
+          if (appli.IsNotNull())
+            {
+            appli->Init();
+            // register library handle
+            m_ApplicationPrivateRegistryGlobal.AddPair(appli.GetPointer(), (void*) lib);
+            // set a callback on DeleteEvent
+            itk::CStyleCommand::Pointer command = itk::CStyleCommand::New();
+            command->SetCallback(&DeleteAppCallback);
+            command->SetConstCallback(&DeleteAppConstCallback);
+            appli->AddObserver(itk::DeleteEvent(),command);
+            return appli;
+            }
+          }
+        }
+      itk::DynamicLoader::CloseLibrary(lib);
+      }
+    }
+  return appli;
+}
+
 
 } // end namespace Wrapper
 } //end namespace otb
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx
index e87df13..2421c4f 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperComplexOutputImageParameter.cxx
@@ -26,7 +26,9 @@ namespace Wrapper
 {
 
 ComplexOutputImageParameter::ComplexOutputImageParameter()
-  : m_ComplexPixelType(ComplexImagePixelType_float), m_RAMValue(0)
+  : m_ComplexPixelType(ComplexImagePixelType_float),
+    m_DefaultComplexPixelType(ComplexImagePixelType_float),
+    m_RAMValue(0)
 {
   this->SetName("Complex Output Image");
   this->SetKey("cout");
@@ -36,6 +38,26 @@ ComplexOutputImageParameter::~ComplexOutputImageParameter()
 {
 }
 
+std::string
+ComplexOutputImageParameter::ConvertPixelTypeToString(ComplexImagePixelType type)
+{
+  std::string ret;
+  switch(type)
+    {
+    case ComplexImagePixelType_float:
+      {
+      ret = "cfloat";
+      break;
+      }
+    case ComplexImagePixelType_double:
+      {
+      ret = "cdouble";
+      break;
+      }
+    }
+  return ret;
+}
+
 void ComplexOutputImageParameter::InitializeWriters()
 {
   m_ComplexFloatWriter = ComplexFloatWriterType::New();
@@ -111,7 +133,7 @@ ComplexOutputImageParameter::Write()
     }
   else if (dynamic_cast<ComplexDoubleImageType*>(m_Image.GetPointer()))
     {
-    SwitchImageWrite<DoubleImageType>();
+    SwitchImageWrite<ComplexDoubleImageType>();
     }
   else if (dynamic_cast<ComplexFloatVectorImageType*>(m_Image.GetPointer()))
     {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx
index 796bf38..15382be 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx
@@ -19,7 +19,7 @@
 #include "itksys/SystemTools.hxx"
 #include "otbWrapperTypes.h"
 #include "otbWrapperInputImageParameterMacros.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
@@ -114,4 +114,3 @@ InputImageParameter::ClearValue()
 
 }
 }
-
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx
index 242ce97..090e250 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx
@@ -19,7 +19,7 @@
 #include "itksys/SystemTools.hxx"
 #include "otbWrapperTypes.h"
 #include "otbWrapperInputImageParameterMacros.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx
index 7de7bf9..0d0ad12 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx
@@ -19,7 +19,7 @@
 #include "otbWrapperInputImageParameterMacros.h"
 #include "itksys/SystemTools.hxx"
 #include "otbWrapperTypes.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx
index 5034d65..4bba9c7 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx
@@ -19,7 +19,7 @@
 #include "itksys/SystemTools.hxx"
 #include "otbWrapperTypes.h"
 #include "otbWrapperInputImageParameterMacros.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx
index e486218..71fe018 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx
@@ -19,7 +19,7 @@
 #include "itksys/SystemTools.hxx"
 #include "otbWrapperTypes.h"
 #include "otbWrapperInputImageParameterMacros.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx
index cba0992..feb5fb0 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx
@@ -19,7 +19,7 @@
 #include "itksys/SystemTools.hxx"
 #include "otbWrapperTypes.h"
 #include "otbWrapperInputImageParameterMacros.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx
index 49284dd..dac4d0f 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx
@@ -19,7 +19,7 @@
 #include "itksys/SystemTools.hxx"
 #include "otbWrapperTypes.h"
 #include "otbWrapperInputImageParameterMacros.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx
index 743b0b5..04d7b58 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx
@@ -19,7 +19,7 @@
 #include "itksys/SystemTools.hxx"
 #include "otbWrapperTypes.h"
 #include "otbWrapperInputImageParameterMacros.h"
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx
index 87b94e8..be17bb9 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputProcessXMLParameter.cxx
@@ -41,6 +41,34 @@ InputProcessXMLParameter::~InputProcessXMLParameter()
 
 }
 
+bool
+InputProcessXMLParameter::SetFileName(std::string value)
+{
+  // Check if the filename is not empty
+  if(!value.empty())
+    {
+    // Check that the right extension is given : expected .xml
+    if (itksys::SystemTools::GetFilenameLastExtension(value) == ".xml")
+      {
+      if (itksys::SystemTools::FileExists(value.c_str(),true))
+        {
+        this->SetValue(value);
+        return true;
+        }
+      }
+    }
+  return false;
+}
+
+void
+InputProcessXMLParameter::SetValue(const std::string value)
+{
+  itkDebugMacro("setting member m_FileName to " << value);
+  this->m_FileName = value;
+  SetActive(true);
+  this->Modified();
+}
+
 ImagePixelType
 InputProcessXMLParameter::GetPixelTypeFromString(std::string strType)
 {
@@ -134,18 +162,6 @@ InputProcessXMLParameter::GetChildNodeTextOf(TiXmlElement *parentElement, std::s
 int
 InputProcessXMLParameter::Read(Application::Pointer this_)
 {
-
-  // Check if the filename is not empty
-  if(m_FileName.empty())
-    itkExceptionMacro(<<"The XML input FileName is empty, please set the filename via the method SetFileName");
-
-  // Check that the right extension is given : expected .xml
-  if (itksys::SystemTools::GetFilenameLastExtension(m_FileName) != ".xml")
-    {
-    itkExceptionMacro(<<itksys::SystemTools::GetFilenameLastExtension(m_FileName) << " " << m_FileName << " "
-                      <<" is a wrong Extension FileName : Expected .xml");
-    }
-
   // Open the xml file
   TiXmlDocument doc;
 
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx
index 47498fa..ec02594 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx
@@ -25,7 +25,9 @@ namespace Wrapper
 {
 
 OutputImageParameter::OutputImageParameter()
-  : m_PixelType(ImagePixelType_float), m_RAMValue(0)
+  : m_PixelType(ImagePixelType_float),
+    m_DefaultPixelType(ImagePixelType_float),
+    m_RAMValue(0)
 {
   this->SetName("Output Image");
   this->SetKey("out");
@@ -36,6 +38,50 @@ OutputImageParameter::~OutputImageParameter()
 {
 }
 
+std::string OutputImageParameter::ConvertPixelTypeToString(ImagePixelType type)
+{
+  std::string ret;
+  switch(type)
+    {
+    case ImagePixelType_uint8:
+      {
+      ret = "uint8";
+      break;
+      }
+    case ImagePixelType_int16:
+      {
+      ret = "int16";
+      break;
+      }
+    case ImagePixelType_uint16:
+      {
+      ret = "uint16";
+      break;
+      }
+    case ImagePixelType_int32:
+      {
+      ret = "int32";
+      break;
+      }
+    case ImagePixelType_uint32:
+      {
+      ret = "uint32";
+      break;
+      }
+    case ImagePixelType_float:
+      {
+      ret = "float";
+      break;
+      }
+    case ImagePixelType_double:
+      {
+      ret = "double";
+      break;
+      }
+    }
+  return ret;
+}
+
 void OutputImageParameter::InitializeWriters()
 {
   m_UInt8Writer = UInt8WriterType::New();
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx
index b3da84f..e172ad3 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterGroup.cxx
@@ -37,7 +37,7 @@
 #include "otbWrapperParameterKey.h"
 #include "otbWrapperRAMParameter.h"
 
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterKey.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterKey.cxx
index 9b9b984..13de1d0 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterKey.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperParameterKey.cxx
@@ -17,7 +17,7 @@
  =========================================================================*/
 #include "otbWrapperParameterKey.h"
 
-#include <boost/algorithm/string.hpp>
+#include "otb_boost_string_header.h"
 
 namespace otb
 {
diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx
index 9dae631..84a9112 100644
--- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx
+++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx
@@ -321,9 +321,8 @@ void CommandLineLauncher::LoadApplication()
   if (m_Application.IsNull())
     {
     std::cerr << "ERROR: Could not find application \"" << moduleName << "\"" << std::endl;
-
-    const char * ITK_AUTOLOAD_PATH = itksys::SystemTools::GetEnv("ITK_AUTOLOAD_PATH");
-    std::cerr << "ERROR: Module search path: " << (ITK_AUTOLOAD_PATH ? ITK_AUTOLOAD_PATH : "none (check ITK_AUTOLOAD_PATH)") << std::endl;
+    std::string modulePath = ApplicationRegistry::GetApplicationPath();
+    std::cerr << "ERROR: Module search path: " << (modulePath.empty() ? "none (check OTB_APPLICATION_PATH)" : modulePath) << std::endl;
 
     std::vector<std::string> list = ApplicationRegistry::GetAvailableApplications();
     if (list.size() == 0)
@@ -467,6 +466,31 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters()
                         return INVALIDNUMBEROFVALUE;
                         }
                     }
+                  else if (type == ParameterType_ComplexOutputImage)
+                    {
+                    m_Application->SetParameterString(paramKey, values[0]);
+                    // Check if pixel type is given
+                    if (values.size() == 2)
+                      {
+                      ComplexImagePixelType outPixType = ComplexImagePixelType_float;
+                      if (values[1] == "cfloat")
+                        outPixType = ComplexImagePixelType_float;
+                      else if (values[1] == "cdouble")
+                        outPixType = ComplexImagePixelType_double;
+                      else
+                        {
+                        return WRONGPARAMETERVALUE;
+                        }
+                      dynamic_cast<ComplexOutputImageParameter *> (param.GetPointer())->SetComplexPixelType(outPixType);
+                      }
+                    else
+                      if (values.size() != 1 && values.size() != 2)
+                        {
+                        std::cerr << "ERROR: Invalid number of value for: \"" << paramKey
+                                  << "\", invalid number of values " << values.size() << std::endl;
+                        return INVALIDNUMBEROFVALUE;
+                        }
+                    }
                   else
                     if (type == ParameterType_ListView)
                       {
@@ -478,7 +502,8 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters()
                         // Handle space in filename. Only for input
                         // files or directories
                         if (type == ParameterType_Directory         || type == ParameterType_InputFilename ||
-                            type == ParameterType_ComplexInputImage || type == ParameterType_InputImage ||
+                            type == ParameterType_ComplexInputImage ||
+                            type == ParameterType_InputImage ||
                             type == ParameterType_InputVectorData   || type == ParameterType_OutputVectorData )
                           {
                           for(unsigned int j=1; j<values.size(); j++)
@@ -497,9 +522,10 @@ CommandLineLauncher::ParamResultType CommandLineLauncher::LoadParameters()
         // Single value parameter
         if (type == ParameterType_Choice || type == ParameterType_Float || type == ParameterType_Int ||
             type == ParameterType_Radius || type == ParameterType_Directory || type == ParameterType_InputFilename ||
-            type == ParameterType_InputFilenameList || type == ParameterType_OutputFilename ||
+            type == ParameterType_OutputFilename ||
             type == ParameterType_ComplexInputImage || type == ParameterType_InputImage ||
-            type == ParameterType_InputVectorData || type == ParameterType_InputVectorDataList ||
+            type == ParameterType_ComplexOutputImage ||
+            type == ParameterType_InputVectorData ||
             type == ParameterType_OutputVectorData || type == ParameterType_RAM ||
             type == ParameterType_OutputProcessXML) // || type == ParameterType_InputProcessXML)
           {
@@ -800,7 +826,7 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer &
     {
     oss << "<string>        ";
     }
-  else if (type == ParameterType_OutputImage)
+  else if (type == ParameterType_OutputImage || type == ParameterType_ComplexOutputImage)
     {
     oss << "<string> [pixel]";
     }
@@ -818,8 +844,26 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer &
 
   if (type == ParameterType_OutputImage)
     {
+    OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param.GetPointer());
+    std::string defPixType("float");
+    if (paramDown)
+      {
+      defPixType = OutputImageParameter::ConvertPixelTypeToString(paramDown->GetDefaultPixelType());
+      }
     oss << " [pixel=uint8/uint16/int16/uint32/int32/float/double]";
-    oss << " (default value is float)";
+    oss << " (default value is " << defPixType <<")";
+    }
+
+  if (type == ParameterType_ComplexOutputImage)
+    {
+    ComplexOutputImageParameter* paramDown = dynamic_cast<ComplexOutputImageParameter*>(param.GetPointer());
+    std::string defPixType("cfloat");
+    if (paramDown)
+      {
+      defPixType = ComplexOutputImageParameter::ConvertPixelTypeToString(paramDown->GetDefaultComplexPixelType());
+      }
+    oss << " [pixel=cfloat/cdouble]";
+    oss << " (default value is "<< defPixType <<")";
     }
 
 
diff --git a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h
index 1ed151e..f372525 100644
--- a/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h
+++ b/Modules/Wrappers/QtWidget/include/otbQtFileSelectionWidget.h
@@ -55,7 +55,7 @@ public:
 
   std::string GetFilename()
   {
-    return m_Input->text().toAscii().constData();
+    return QFile::encodeName( m_Input->text() ).constData();
   }
 
   void ClearFilename()
diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h
index 5067ee0..952b1de 100644
--- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h
+++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetInputProcessXMLParameter.h
@@ -42,6 +42,9 @@ public:
   QtWidgetInputProcessXMLParameter(InputProcessXMLParameter*, QtWidgetModel*);
   virtual ~QtWidgetInputProcessXMLParameter();
 
+  inline const QLineEdit* GetInput() const;
+  inline QLineEdit* GetInput();
+
 protected slots:
   void SetFileName( const QString& value );
   void SelectFile();
@@ -63,6 +66,22 @@ private:
 };
 
 
+inline
+const QLineEdit*
+QtWidgetInputProcessXMLParameter
+::GetInput() const
+{
+  return m_Input;
+}
+
+inline
+QLineEdit*
+QtWidgetInputProcessXMLParameter
+::GetInput()
+{
+  return m_Input;
+}
+
 }
 }
 
diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h
index 3164189..e045993 100644
--- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h
+++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputFilenameParameter.h
@@ -42,8 +42,13 @@ public:
   QtWidgetOutputFilenameParameter(OutputFilenameParameter*, QtWidgetModel*);
   virtual ~QtWidgetOutputFilenameParameter();
 
-protected slots:
+  inline const QLineEdit* GetInput() const;
+  inline QLineEdit* GetInput();
+
+public slots:
   void SetFileName( const QString& value );
+
+protected slots:
   void SelectFile();
 
 private:
@@ -63,6 +68,23 @@ private:
 };
 
 
+inline
+const QLineEdit*
+QtWidgetOutputFilenameParameter
+::GetInput() const
+{
+  return m_Input;
+}
+
+inline
+QLineEdit*
+QtWidgetOutputFilenameParameter
+::GetInput()
+{
+  return m_Input;
+}
+
+
 }
 }
 
diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h
index 4d9e2b5..d090604 100644
--- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h
+++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputImageParameter.h
@@ -42,6 +42,9 @@ public:
   QtWidgetOutputImageParameter(OutputImageParameter*, QtWidgetModel*);
   virtual ~QtWidgetOutputImageParameter();
 
+  inline const QLineEdit* GetInput() const;
+  inline QLineEdit* GetInput();
+
   /** Get the PixelType*/
   //itkGetMacro(PixelType, int);
 
@@ -72,6 +75,22 @@ private:
 };
 
 
+inline
+const QLineEdit*
+QtWidgetOutputImageParameter
+::GetInput() const
+{
+  return m_Input;
+}
+
+inline
+QLineEdit*
+QtWidgetOutputImageParameter
+::GetInput()
+{
+  return m_Input;
+}
+
 }
 }
 
diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h
index 282164d..20c6bf5 100644
--- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h
+++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputProcessXMLParameter.h
@@ -42,8 +42,13 @@ public:
   QtWidgetOutputProcessXMLParameter(OutputProcessXMLParameter*, QtWidgetModel*);
   virtual ~QtWidgetOutputProcessXMLParameter();
 
-protected slots:
+  inline const QLineEdit* GetInput() const;
+  inline QLineEdit* GetInput();
+
+public slots:
   void SetFileName( const QString& value );
+
+protected slots:
   void SelectFile();
 
 private:
@@ -63,6 +68,22 @@ private:
 };
 
 
+inline
+const QLineEdit*
+QtWidgetOutputProcessXMLParameter
+::GetInput() const
+{
+  return m_Input;
+}
+
+inline
+QLineEdit*
+QtWidgetOutputProcessXMLParameter
+::GetInput()
+{
+  return m_Input;
+}
+
 }
 }
 
diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h
index 140d766..c569710 100644
--- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h
+++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetOutputVectorDataParameter.h
@@ -42,11 +42,16 @@ public:
   QtWidgetOutputVectorDataParameter(OutputVectorDataParameter*, QtWidgetModel*);
   virtual ~QtWidgetOutputVectorDataParameter();
 
+  inline const QLineEdit* GetInput() const;
+  inline QLineEdit* GetInput();
+
   /** Get the PixelType*/
   //itkGetMacro(PixelType, int);
 
-protected slots:
+public slots:
   void SetFileName( const QString& value );
+
+protected slots:
   void SelectFile();
 
 private:
@@ -69,6 +74,23 @@ private:
 };
 
 
+
+inline
+const QLineEdit*
+QtWidgetOutputVectorDataParameter
+::GetInput() const
+{
+  return m_Input;
+}
+
+inline
+QLineEdit*
+QtWidgetOutputVectorDataParameter
+::GetInput()
+{
+  return m_Input;
+}
+
 }
 }
 
diff --git a/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx b/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx
index 24036ac..99e0779 100644
--- a/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbApplicationLauncherQt.cxx
@@ -53,7 +53,6 @@ int main(int argc, char* argv[])
     std::copy(argv + 2, argv + argc, std::back_inserter(modulePathList));
 
     // Load the path in the environment
-    std::string specificEnv("ITK_AUTOLOAD_PATH=");
     std::list<std::string>::const_iterator it = modulePathList.begin();
     while( it != modulePathList.end() )
       {
@@ -68,9 +67,8 @@ int main(int argc, char* argv[])
 
     {
     std::cerr << "Could not find application " << moduleName << std::endl;
-
-    const char* modulePath = itksys::SystemTools::GetEnv("ITK_AUTOLOAD_PATH");
-    std::cout << "Module search path : " << (modulePath ? modulePath : "") << std::endl;
+    std::string modulePath = ApplicationRegistry::GetApplicationPath();
+    std::cout << "Module search path : " << modulePath << std::endl;
     std::vector<std::string> list = ApplicationRegistry::GetAvailableApplications();
 
     std::cout << "Available applications : " << (list.empty() ? "None" : "") << std::endl;
diff --git a/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx b/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx
index a612d69..a3fb761 100644
--- a/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbQtFileSelectionWidget.cxx
@@ -70,6 +70,14 @@ void QtFileSelectionWidget::SelectFile()
   fileDialog.setFileMode(QFileDialog::ExistingFile);
   fileDialog.setNameFilter("All files (*)");
 
+  QFileInfo finfo( QString::fromStdString( GetFilename() ) );
+
+  fileDialog.setDirectory(
+    finfo.isDir()
+    ? finfo.absoluteFilePath()
+    : finfo.absoluteDir()
+  );
+
   if (fileDialog.exec())
     {
     QString filemane(fileDialog.selectedFiles().at(0));
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexInputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexInputImageParameter.cxx
index 52a3ee0..563cb91 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexInputImageParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexInputImageParameter.cxx
@@ -34,7 +34,12 @@ QtWidgetComplexInputImageParameter::~QtWidgetComplexInputImageParameter()
 
 void QtWidgetComplexInputImageParameter::DoUpdateGUI()
 {
-  QString text( m_ComplexInputImageParam->GetFileName().c_str() );
+  QString text(
+    QFile::decodeName(
+      m_ComplexInputImageParam->GetFileName().c_str()
+    )
+  );
+
   if (text != m_Input->text())
     m_Input->setText(text);
 }
@@ -72,7 +77,8 @@ void QtWidgetComplexInputImageParameter::SelectFile()
 
   if (fileDialog.exec())
     {
-    this->SetFileName(fileDialog.selectedFiles().at(0));
+    this->SetFileName( fileDialog.selectedFiles().at(0) );
+
     m_Input->setText(fileDialog.selectedFiles().at(0));
     }
 }
@@ -80,7 +86,9 @@ void QtWidgetComplexInputImageParameter::SelectFile()
 void QtWidgetComplexInputImageParameter::SetFileName(const QString& value)
 {
   // save value
-  m_ComplexInputImageParam->SetFromFileName(value.toAscii().constData());
+  m_ComplexInputImageParam->SetFromFileName(
+    QFile::encodeName( value ).constData()
+  );
 
   // notify of value change
   QString key( m_ComplexInputImageParam->GetKey() );
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx
index 3fe32b7..79063bf 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetComplexOutputImageParameter.cxx
@@ -36,7 +36,10 @@ QtWidgetComplexOutputImageParameter::~QtWidgetComplexOutputImageParameter()
 void QtWidgetComplexOutputImageParameter::DoUpdateGUI()
 {
   // Update the lineEdit
-  QString text( m_OutputImageParam->GetFileName() );
+  QString text(
+    QFile::decodeName( m_OutputImageParam->GetFileName() )
+  );
+
   if (text != m_Input->text())
     m_Input->setText(text);
 }
@@ -91,7 +94,7 @@ void QtWidgetComplexOutputImageParameter::SelectFile()
 void QtWidgetComplexOutputImageParameter::SetFileName(const QString& value)
 {
   // save value
-  m_FileName = value.toAscii().constData();
+  m_FileName = QFile::encodeName( value ).constData();
 
   m_OutputImageParam->SetFileName(m_FileName);
 
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetDirectoryParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetDirectoryParameter.cxx
index ed8bea8..cdf6b8f 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetDirectoryParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetDirectoryParameter.cxx
@@ -35,7 +35,12 @@ QtWidgetDirectoryParameter::~QtWidgetDirectoryParameter()
 void QtWidgetDirectoryParameter::DoUpdateGUI()
 {
   // Update the lineEdit
-  QString text( m_DirectoryParam->GetValue().c_str() );
+  QString text(
+    QFile::decodeName(
+      m_DirectoryParam->GetValue().c_str()
+    )
+  );
+
   m_Input->setText(text);
 }
 
@@ -72,7 +77,8 @@ void QtWidgetDirectoryParameter::SelectFile()
 
   if (fileDialog.exec())
     {
-    this->SetFileName(fileDialog.selectedFiles().at(0));
+    this->SetFileName( fileDialog.selectedFiles().at(0) );
+
     m_Input->setText(fileDialog.selectedFiles().at(0));
     }
 }
@@ -80,7 +86,9 @@ void QtWidgetDirectoryParameter::SelectFile()
 void QtWidgetDirectoryParameter::SetFileName(const QString& value)
 {
   // save value
-  m_DirectoryParam->SetValue(value.toAscii().constData());
+  m_DirectoryParam->SetValue(
+    QFile::encodeName( value ).constData()
+  );
 
   // notify of value change
   QString key( m_DirectoryParam->GetKey() );
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameListParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameListParameter.cxx
index a6dfd0c..be107c3 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameListParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameListParameter.cxx
@@ -47,7 +47,11 @@ void QtWidgetInputFilenameListParameter::DoUpdateGUI()
   std::vector<std::string>::iterator it;
   for (it = fileList.begin(); it != fileList.end(); ++it)
     {
-      m_FileSelectionList[i++]->GetInput()->setText(QString( (*it).c_str() ));
+      m_FileSelectionList[i++]->GetInput()->setText(
+	QFile::decodeName(
+	  it->c_str()
+	)
+      );
     }
 }
 
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx
index 31cef3a..d7d486b 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputFilenameParameter.cxx
@@ -39,7 +39,12 @@ QtWidgetInputFilenameParameter::~QtWidgetInputFilenameParameter()
 void QtWidgetInputFilenameParameter::DoUpdateGUI()
 {
   // Update the lineEdit
-  QString text( m_FilenameParam->GetValue().c_str() );
+  QString text(
+    QFile::decodeName(
+      m_FilenameParam->GetValue().c_str()
+    )
+  );
+
   if (text != m_Input->text())
     m_Input->setText(text);
 }
@@ -71,7 +76,9 @@ void QtWidgetInputFilenameParameter::DoCreateWidget()
 void QtWidgetInputFilenameParameter::SelectFile()
 {
   QFileDialog fileDialog;
+
   fileDialog.setConfirmOverwrite(true);
+
   switch(m_FilenameParam->GetRole())
     {
     case Role_Input:
@@ -90,9 +97,25 @@ void QtWidgetInputFilenameParameter::SelectFile()
 
   fileDialog.setNameFilter("File (*)");
 
+
+  assert( m_Input!=NULL );
+
+  if( !m_Input->text().isEmpty() )
+    {
+    QFileInfo finfo( m_Input->text() );
+
+    fileDialog.setDirectory(
+      finfo.isDir()
+      ? finfo.absoluteFilePath()
+      : finfo.absoluteDir()
+    );
+    }
+
+
   if (fileDialog.exec())
     {
-    this->SetFileName(fileDialog.selectedFiles().at(0));
+    this->SetFileName( fileDialog.selectedFiles().at(0) );
+
     m_Input->setText(fileDialog.selectedFiles().at(0));
     }
 }
@@ -100,7 +123,9 @@ void QtWidgetInputFilenameParameter::SelectFile()
 void QtWidgetInputFilenameParameter::SetFileName(const QString& value)
 {
   // save value
-  m_FilenameParam->SetValue(value.toAscii().constData());
+  m_FilenameParam->SetValue(
+    QFile::encodeName( value ).constData()
+  );
 
   // notify of value change
   QString key( m_FilenameParam->GetKey() );
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageListParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageListParameter.cxx
index 7e34d77..e040b65 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageListParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageListParameter.cxx
@@ -51,7 +51,9 @@ void QtWidgetInputImageListParameter::DoUpdateGUI()
     std::vector<std::string>::iterator it;
     for (it = fileList.begin(); it != fileList.end(); ++it)
       {
-      m_FileSelectionList[i++]->GetInput()->setText( QString::fromAscii(it->c_str()) );
+      m_FileSelectionList[i++]->GetInput()->setText(
+	QFile::decodeName( it->c_str() )
+      );
       }
     }
 }
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx
index 29583da..f3d52f9 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputImageParameter.cxx
@@ -41,7 +41,12 @@ void QtWidgetInputImageParameter::DoUpdateGUI()
   //update lineedit if HasUserValue flag is set(from xml)
   if(m_InputImageParam->HasUserValue())
     {
-    QString text( m_InputImageParam->GetFileName().c_str() );
+    QString text(
+      QFile::decodeName(
+	m_InputImageParam->GetFileName().c_str()
+      )
+    );
+
     if (text != m_Input->text())
       m_Input->setText(text);
     }
@@ -78,15 +83,28 @@ void QtWidgetInputImageParameter::SelectFile()
   fileDialog.setFileMode(QFileDialog::ExistingFile);
   fileDialog.setNameFilter("Raster files (*)");
 
+  assert( m_Input!=NULL );
+
+  if( !m_Input->text().isEmpty() )
+    {
+    QFileInfo finfo( m_Input->text() );
+
+    fileDialog.setDirectory(
+      finfo.isDir()
+      ? finfo.absoluteFilePath()
+      : finfo.absoluteDir()
+    );
+    }
+
   if (fileDialog.exec())
     {
-    if ( this->SetFileName(fileDialog.selectedFiles().at(0)) == true )
+    if ( this->SetFileName( fileDialog.selectedFiles().at(0) ) == true )
       m_Input->setText(fileDialog.selectedFiles().at(0));
     else
       {
       std::ostringstream oss;
       oss << "The given file "
-          << fileDialog.selectedFiles().at(0).toAscii().constData()
+          << QFile::encodeName(	fileDialog.selectedFiles().at( 0 ) ).constData()
           << " is not valid.";
       this->GetModel()->SendLogWARNING( oss.str() );
       }
@@ -97,7 +115,8 @@ bool QtWidgetInputImageParameter::SetFileName(const QString& value)
 {
   bool res = true;
   // save value
-  if(m_InputImageParam->SetFromFileName(value.toAscii().constData()) == true)
+  if( m_InputImageParam->SetFromFileName(
+	QFile::encodeName( value ).constData() ) == true )
     {
     // notify of value change
     QString key( m_InputImageParam->GetKey() );
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputProcessXMLParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputProcessXMLParameter.cxx
index fbd32e3..acf27f5 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputProcessXMLParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputProcessXMLParameter.cxx
@@ -34,10 +34,16 @@ QtWidgetInputProcessXMLParameter::~QtWidgetInputProcessXMLParameter()
 
 void QtWidgetInputProcessXMLParameter::DoUpdateGUI()
 {
-  // Update the lineEdit
-  QString text( m_XMLParam->GetFileName() );
-  if (text != m_Input->text())
-    m_Input->setText(text);
+  if (m_XMLParam->HasUserValue())
+    {
+    // Update the lineEdit
+    QString text(
+      QFile::decodeName( m_XMLParam->GetFileName() )
+    );
+
+    if (text != m_Input->text())
+      m_Input->setText(text);
+    }
 }
 
 void QtWidgetInputProcessXMLParameter::DoCreateWidget()
@@ -71,12 +77,27 @@ void QtWidgetInputProcessXMLParameter::SelectFile()
   fileDialog.setFileMode(QFileDialog::AnyFile);
   fileDialog.setNameFilter("XML File (*.xml)");
 
+  assert( m_Input!=NULL );
+
+  if( !m_Input->text().isEmpty() )
+    {
+    QFileInfo finfo( m_Input->text() );
+
+    fileDialog.setDirectory(
+      finfo.isDir()
+      ? finfo.absoluteFilePath()
+      : finfo.absoluteDir()
+    );
+    }
+
   if (fileDialog.exec())
     {
     QString name = fileDialog.selectedFiles().at(0);
+
     if( !name.isEmpty() )
       {
-      this->SetFileName(name);
+      this->SetFileName( name );
+
       m_Input->setText(name);
       }
     }
@@ -85,15 +106,14 @@ void QtWidgetInputProcessXMLParameter::SelectFile()
 void QtWidgetInputProcessXMLParameter::SetFileName(const QString& value)
 {
   // load xml file name
-  m_XMLParam->SetValue(value.toAscii().constData());
-
-  // notify of value change
-  QString key( m_XMLParam->GetKey() );
-
-  emit ParameterChanged(key);
-
-  GetModel()->UpdateAllWidgets();
-
+  if( m_XMLParam->SetFileName(
+	QFile::encodeName( value ).constData() ) )
+    {
+    // notify of value change
+    QString key( m_XMLParam->GetKey() );
+    emit ParameterChanged(key);
+    GetModel()->UpdateAllWidgets();
+    }
 }
 
 }
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataListParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataListParameter.cxx
index 9a19303..21527cb 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataListParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataListParameter.cxx
@@ -48,7 +48,9 @@ void QtWidgetInputVectorDataListParameter::DoUpdateGUI()
   std::vector<std::string>::iterator it;
   for (it = fileList.begin(); it != fileList.end(); ++it)
     {
-      m_FileSelectionList[i++]->GetInput()->setText(QString( (*it).c_str() ));
+      m_FileSelectionList[i++]->GetInput()->setText(
+	QFile::decodeName( it->c_str() )
+      );
     }
 }
 
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx
index e631044..1fb3033 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetInputVectorDataParameter.cxx
@@ -38,9 +38,15 @@ QtWidgetInputVectorDataParameter::~QtWidgetInputVectorDataParameter()
 void QtWidgetInputVectorDataParameter::DoUpdateGUI()
 {
   //update lineedit
-  QString text( m_InputVectorDataParam->GetFileName().c_str() );
-  if (text != m_Input->text())
-    m_Input->setText(text);
+  if(m_InputVectorDataParam->HasUserValue())
+    {
+    QString text(
+      QFile::decodeName( m_InputVectorDataParam->GetFileName().c_str() )
+    );
+
+    if (text != m_Input->text())
+      m_Input->setText(text);
+    }
 }
 
 void QtWidgetInputVectorDataParameter::DoCreateWidget()
@@ -74,9 +80,22 @@ void QtWidgetInputVectorDataParameter::SelectFile()
   fileDialog.setFileMode(QFileDialog::ExistingFile);
   fileDialog.setNameFilter("Vector data files (*)");
 
+  assert( m_Input!=NULL );
+
+  if( !m_Input->text().isEmpty() )
+    {
+    QFileInfo finfo( m_Input->text() );
+
+    fileDialog.setDirectory(
+      finfo.isDir()
+      ? finfo.absoluteFilePath()
+      : finfo.absoluteDir()
+    );
+    }
+
   if (fileDialog.exec())
     {
-    if ( this->SetFileName(fileDialog.selectedFiles().at(0)) == true )
+    if ( this->SetFileName( fileDialog.selectedFiles().at(0) )  == true )
     {
       m_Input->setText(fileDialog.selectedFiles().at(0));
     }
@@ -84,7 +103,7 @@ void QtWidgetInputVectorDataParameter::SelectFile()
       {
       std::ostringstream oss;
       oss << "The given file "
-          << fileDialog.selectedFiles().at(0).toAscii().constData()
+          << QFile::encodeName( fileDialog.selectedFiles().at( 0 ) ).constData()
           << " is not valid.";
       this->GetModel()->SendLogWARNING( oss.str() );
       }
@@ -95,7 +114,8 @@ bool QtWidgetInputVectorDataParameter::SetFileName(const QString& value)
 {
   bool res = true;
   // save value
-  if(m_InputVectorDataParam->SetFromFileName(value.toAscii().constData()) == true)
+  if( m_InputVectorDataParam->SetFromFileName(
+	QFile::encodeName( value ).constData() ) == true )
     {
     // notify of value change
     QString key( m_InputVectorDataParam->GetKey() );
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputFilenameParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputFilenameParameter.cxx
index 6565865..33c356d 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputFilenameParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputFilenameParameter.cxx
@@ -35,7 +35,12 @@ QtWidgetOutputFilenameParameter::~QtWidgetOutputFilenameParameter()
 void QtWidgetOutputFilenameParameter::DoUpdateGUI()
 {
   // Update the lineEdit
-  QString text( m_FilenameParam->GetValue().c_str() );
+  QString text(
+    QFile::decodeName(
+      m_FilenameParam->GetValue().c_str()
+    )
+  );
+
   if (text != m_Input->text())
     m_Input->setText(text);
 }
@@ -86,9 +91,24 @@ void QtWidgetOutputFilenameParameter::SelectFile()
 
   fileDialog.setNameFilter("File (*)");
 
+
+  assert( m_Input!=NULL );
+
+  if( !m_Input->text().isEmpty() )
+    {
+    QFileInfo finfo( m_Input->text() );
+
+    fileDialog.setDirectory(
+      finfo.isDir()
+      ? finfo.absoluteFilePath()
+      : finfo.absoluteDir()
+    );
+    }
+
   if (fileDialog.exec())
     {
-    this->SetFileName(fileDialog.selectedFiles().at(0));
+    this->SetFileName( fileDialog.selectedFiles().at( 0 ) );
+
     m_Input->setText(fileDialog.selectedFiles().at(0));
     }
 }
@@ -96,7 +116,9 @@ void QtWidgetOutputFilenameParameter::SelectFile()
 void QtWidgetOutputFilenameParameter::SetFileName(const QString& value)
 {
   // save value
-  m_FilenameParam->SetValue(value.toAscii().constData());
+  m_FilenameParam->SetValue(
+    QFile::encodeName( value ).constData()
+  );
 
   // notify of value change
   QString key( m_FilenameParam->GetKey() );
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx
index 7c748be..be265da 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputImageParameter.cxx
@@ -38,7 +38,10 @@ void QtWidgetOutputImageParameter::DoUpdateGUI()
   // Update the lineEdit
   if (m_Input->text() != m_OutputImageParam->GetFileName())
     {
-    m_Input->setText(m_OutputImageParam->GetFileName());
+    m_Input->setText(
+      QFile::decodeName( m_OutputImageParam->GetFileName() )
+    );
+
     m_ComboBox->setCurrentIndex(m_OutputImageParam->GetPixelType());
     }
 }
@@ -84,10 +87,25 @@ void QtWidgetOutputImageParameter::DoCreateWidget()
 void QtWidgetOutputImageParameter::SelectFile()
 {
   QFileDialog fileDialog;
+
   fileDialog.setConfirmOverwrite(true);
   fileDialog.setFileMode(QFileDialog::AnyFile);
   fileDialog.setNameFilter("Raster files (*)");
 
+
+  assert( m_Input!=NULL );
+
+  if( !m_Input->text().isEmpty() )
+    {
+    QFileInfo finfo( m_Input->text() );
+
+    fileDialog.setDirectory(
+      finfo.isDir()
+      ? finfo.absoluteFilePath()
+      : finfo.absoluteDir()
+    );
+    }
+
   if (fileDialog.exec())
     {
     //this->SetFileName(fileDialog.selectedFiles().at(0));
@@ -98,7 +116,7 @@ void QtWidgetOutputImageParameter::SelectFile()
 void QtWidgetOutputImageParameter::SetFileName(const QString& value)
 {
   // save value
-  m_FileName = value.toAscii().constData();
+  m_FileName = QFile::encodeName( value ).constData();
 
   m_OutputImageParam->SetFileName(m_FileName);
 
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputProcessXMLParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputProcessXMLParameter.cxx
index 475e58e..059d94a 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputProcessXMLParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputProcessXMLParameter.cxx
@@ -35,7 +35,10 @@ QtWidgetOutputProcessXMLParameter::~QtWidgetOutputProcessXMLParameter()
 void QtWidgetOutputProcessXMLParameter::DoUpdateGUI()
 {
   // Update the lineEdit
-  QString text( m_XMLParam->GetFileName() );
+  QString text(
+    QFile::decodeName( m_XMLParam->GetFileName() )
+  );
+;
   if (text != m_Input->text())
     m_Input->setText(text);
 }
@@ -72,9 +75,23 @@ void QtWidgetOutputProcessXMLParameter::SelectFile()
 
   fileDialog.setNameFilter("XML File (*.xml)");
 
+  assert( m_Input!=NULL );
+
+  if( !m_Input->text().isEmpty() )
+    {
+    QFileInfo finfo( m_Input->text() );
+
+    fileDialog.setDirectory(
+      finfo.isDir()
+      ? finfo.absoluteFilePath()
+      : finfo.absoluteDir()
+    );
+    }
+
   if (fileDialog.exec())
     {
-    this->SetFileName(fileDialog.selectedFiles().at(0));
+    this->SetFileName( fileDialog.selectedFiles().at(0) );
+
     m_Input->setText(fileDialog.selectedFiles().at(0));
     }
 }
@@ -82,7 +99,9 @@ void QtWidgetOutputProcessXMLParameter::SelectFile()
 void QtWidgetOutputProcessXMLParameter::SetFileName(const QString& value)
 {
   // save xml file name
-  m_XMLParam->SetValue(value.toAscii().constData());
+  m_XMLParam->SetValue(
+    QFile::encodeName( value ).constData()
+  );
 
   // notify of value change
   QString key( m_XMLParam->GetKey() );
diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputVectorDataParameter.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputVectorDataParameter.cxx
index ecae920..1cf7024 100644
--- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputVectorDataParameter.cxx
+++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetOutputVectorDataParameter.cxx
@@ -66,10 +66,24 @@ void QtWidgetOutputVectorDataParameter::DoCreateWidget()
 void QtWidgetOutputVectorDataParameter::SelectFile()
 {
   QFileDialog fileDialog;
+
   fileDialog.setConfirmOverwrite(true);
   fileDialog.setFileMode(QFileDialog::AnyFile);
   fileDialog.setNameFilter("Vector data files (*)");
 
+  assert( m_Input!=NULL );
+
+  if( !m_Input->text().isEmpty() )
+    {
+    QFileInfo finfo( m_Input->text() );
+
+    fileDialog.setDirectory(
+      finfo.isDir()
+      ? finfo.absoluteFilePath()
+      : finfo.absoluteDir()
+    );
+    }
+
   if (fileDialog.exec())
     {
     //this->SetFileName(fileDialog.selectedFiles().at(0));
@@ -80,7 +94,7 @@ void QtWidgetOutputVectorDataParameter::SelectFile()
 void QtWidgetOutputVectorDataParameter::SetFileName(const QString& value)
 {
   // save value
-  m_FileName = value.toAscii().constData();
+  m_FileName = QFile::encodeName( value ).constData();
 
   m_OutputVectorDataParam->SetFileName(m_FileName);
 
diff --git a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetShowWidget.cxx b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetShowWidget.cxx
index c3e3086..3dae376 100644
--- a/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetShowWidget.cxx
+++ b/Modules/Wrappers/QtWidget/test/otbWrapperQtWidgetShowWidget.cxx
@@ -41,7 +41,6 @@ int otbWrapperQtWidgetShowWidget(int argc, char* argv[])
     std::copy(argv + 1, argv + argc, std::back_inserter(modulePathList));
 
     // Load the path in the environment
-    std::string specificEnv("ITK_AUTOLOAD_PATH=");
     std::list<std::string>::const_iterator it = modulePathList.begin();
     while( it != modulePathList.end() )
       {
diff --git a/Modules/Wrappers/SWIG/otb-module-init.cmake b/Modules/Wrappers/SWIG/otb-module-init.cmake
index bd32dc1..819a60d 100644
--- a/Modules/Wrappers/SWIG/otb-module-init.cmake
+++ b/Modules/Wrappers/SWIG/otb-module-init.cmake
@@ -25,6 +25,7 @@ if ( OTB_WRAP_PYTHON )
   check_PIC_flag ( Python )
   find_package ( PythonLibs REQUIRED )
   find_package ( PythonInterp REQUIRED )
+  find_package ( Numpy )
 endif()
 
 #
@@ -34,4 +35,5 @@ if ( OTB_WRAP_JAVA )
   check_PIC_flag ( Java )
   find_package ( Java REQUIRED )
   find_package ( JNI REQUIRED )
-endif()
\ No newline at end of file
+  mark_as_advanced( JAVA_HOME )
+endif()
diff --git a/Modules/Wrappers/SWIG/src/CMakeLists.txt b/Modules/Wrappers/SWIG/src/CMakeLists.txt
index 786f3a6..af42462 100644
--- a/Modules/Wrappers/SWIG/src/CMakeLists.txt
+++ b/Modules/Wrappers/SWIG/src/CMakeLists.txt
@@ -24,6 +24,10 @@ if ( OTB_WRAP_PYTHON )
 
   # Run swig
   set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_GLOBAL_FLAGS})
+  if(NUMPY_FOUND)
+    include_directories(${NUMPY_INCLUDE_DIRS})
+    list(APPEND CMAKE_SWIG_FLAGS  "-DOTB_SWIGNUMPY=1")
+  endif()
   set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR})
   set(SWIG_MODULE_otbApplication_EXTRA_DEPS
        ${CMAKE_CURRENT_SOURCE_DIR}/Python.i
@@ -32,7 +36,11 @@ if ( OTB_WRAP_PYTHON )
        OTBApplicationEngine)
   SWIG_add_module( otbApplication python otbApplication.i otbApplicationPYTHON_wrap.cxx itkPyCommand.cxx )
   SWIG_link_libraries( otbApplication ${PYTHON_LIBRARIES} OTBApplicationEngine )
-  set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/otbApplicationPYTHON_wrap.cxx COMPILE_FLAGS "-w" )
+  if(MSVC)
+    set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/otbApplicationPYTHON_wrap.cxx COMPILE_FLAGS "/wd4005" )
+  else()
+    set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/otbApplicationPYTHON_wrap.cxx COMPILE_FLAGS "-w" )
+  endif()
 
   # byte-compile the resulting python file
   add_custom_command(
@@ -42,7 +50,7 @@ if ( OTB_WRAP_PYTHON )
       COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/CMake/PythonCompile.py otbApplication.py
       DEPENDS _otbApplication
     )
-    
+
   otb_module_target_label( _otbApplication )
 
   install( TARGETS _otbApplication
@@ -76,11 +84,16 @@ if ( OTB_WRAP_JAVA )
        OTBApplicationEngine)
   SWIG_add_module ( otbApplicationJava java otbApplication.i otbApplicationJAVA_wrap.cxx)
   SWIG_link_libraries(otbApplicationJava OTBApplicationEngine )
-  set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/otbApplicationJAVA_wrap.cxx COMPILE_FLAGS "-w")
+  
+  if(MSVC)
+    set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/otbApplicationJAVA_wrap.cxx COMPILE_FLAGS "/wd4005" )
+  else()
+    set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/otbApplicationJAVA_wrap.cxx COMPILE_FLAGS "-w")
+  endif()
 
   # Add target for org.otb.Application.jar
   add_custom_target(org_otb_Application_jar ALL DEPENDS org.otb.application.jar)
-  
+
   otb_module_target_label( org_otb_Application_jar )
 
   # Add custom command and target to compile the generated files and put them in a jar file
@@ -106,4 +119,3 @@ if ( OTB_WRAP_JAVA )
           COMPONENT RuntimeLibraries )
 
 endif()
-
diff --git a/Modules/Wrappers/SWIG/src/numpy.i b/Modules/Wrappers/SWIG/src/numpy.i
new file mode 100644
index 0000000..b9a7ce7
--- /dev/null
+++ b/Modules/Wrappers/SWIG/src/numpy.i
@@ -0,0 +1,3117 @@
+/* -*- C -*-  (not really, but good for syntax highlighting) */
+
+/*
+ * Copyright (c) 2005-2015, NumPy Developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *        notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials provided
+ *        with the distribution.
+ *
+ *     * Neither the name of the NumPy Developers nor the names of any
+ *        contributors may be used to endorse or promote products derived
+ *        from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef SWIGPYTHON
+
+%{
+#ifndef SWIG_FILE_WITH_INIT
+#define NO_IMPORT_ARRAY
+#endif
+#include "stdio.h"
+#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
+#include <numpy/arrayobject.h>
+%}
+
+/**********************************************************************/
+
+%fragment("NumPy_Backward_Compatibility", "header")
+{
+%#if NPY_API_VERSION < 0x00000007
+%#define NPY_ARRAY_DEFAULT NPY_DEFAULT
+%#define NPY_ARRAY_FARRAY  NPY_FARRAY
+%#define NPY_FORTRANORDER  NPY_FORTRAN
+%#endif
+}
+
+/**********************************************************************/
+
+/* The following code originally appeared in
+ * enthought/kiva/agg/src/numeric.i written by Eric Jones.  It was
+ * translated from C++ to C by John Hunter.  Bill Spotz has modified
+ * it to fix some minor bugs, upgrade from Numeric to numpy (all
+ * versions), add some comments and functionality, and convert from
+ * direct code insertion to SWIG fragments.
+ */
+
+%fragment("NumPy_Macros", "header")
+{
+/* Macros to extract array attributes.
+ */
+%#if NPY_API_VERSION < 0x00000007
+%#define is_array(a)            ((a) && PyArray_Check((PyArrayObject*)a))
+%#define array_type(a)          (int)(PyArray_TYPE((PyArrayObject*)a))
+%#define array_numdims(a)       (((PyArrayObject*)a)->nd)
+%#define array_dimensions(a)    (((PyArrayObject*)a)->dimensions)
+%#define array_size(a,i)        (((PyArrayObject*)a)->dimensions[i])
+%#define array_strides(a)       (((PyArrayObject*)a)->strides)
+%#define array_stride(a,i)      (((PyArrayObject*)a)->strides[i])
+%#define array_data(a)          (((PyArrayObject*)a)->data)
+%#define array_descr(a)         (((PyArrayObject*)a)->descr)
+%#define array_flags(a)         (((PyArrayObject*)a)->flags)
+%#define array_enableflags(a,f) (((PyArrayObject*)a)->flags) = f
+%#else
+%#define is_array(a)            ((a) && PyArray_Check(a))
+%#define array_type(a)          PyArray_TYPE((PyArrayObject*)a)
+%#define array_numdims(a)       PyArray_NDIM((PyArrayObject*)a)
+%#define array_dimensions(a)    PyArray_DIMS((PyArrayObject*)a)
+%#define array_strides(a)       PyArray_STRIDES((PyArrayObject*)a)
+%#define array_stride(a,i)      PyArray_STRIDE((PyArrayObject*)a,i)
+%#define array_size(a,i)        PyArray_DIM((PyArrayObject*)a,i)
+%#define array_data(a)          PyArray_DATA((PyArrayObject*)a)
+%#define array_descr(a)         PyArray_DESCR((PyArrayObject*)a)
+%#define array_flags(a)         PyArray_FLAGS((PyArrayObject*)a)
+%#define array_enableflags(a,f) PyArray_ENABLEFLAGS((PyArrayObject*)a,f)
+%#endif
+%#define array_is_contiguous(a) (PyArray_ISCONTIGUOUS((PyArrayObject*)a))
+%#define array_is_native(a)     (PyArray_ISNOTSWAPPED((PyArrayObject*)a))
+%#define array_is_fortran(a)    (PyArray_ISFORTRAN((PyArrayObject*)a))
+}
+
+/**********************************************************************/
+
+%fragment("NumPy_Utilities",
+          "header")
+{
+  /* Given a PyObject, return a string describing its type.
+   */
+  const char* pytype_string(PyObject* py_obj)
+  {
+    if (py_obj == NULL          ) return "C NULL value";
+    if (py_obj == Py_None       ) return "Python None" ;
+    if (PyCallable_Check(py_obj)) return "callable"    ;
+    if (PyString_Check(  py_obj)) return "string"      ;
+    if (PyInt_Check(     py_obj)) return "int"         ;
+    if (PyFloat_Check(   py_obj)) return "float"       ;
+    if (PyDict_Check(    py_obj)) return "dict"        ;
+    if (PyList_Check(    py_obj)) return "list"        ;
+    if (PyTuple_Check(   py_obj)) return "tuple"       ;
+%#if PY_MAJOR_VERSION < 3
+    if (PyFile_Check(    py_obj)) return "file"        ;
+    if (PyModule_Check(  py_obj)) return "module"      ;
+    if (PyInstance_Check(py_obj)) return "instance"    ;
+%#endif
+
+    return "unkown type";
+  }
+
+  /* Given a NumPy typecode, return a string describing the type.
+   */
+  const char* typecode_string(int typecode)
+  {
+    static const char* type_names[25] = {"bool",
+                                         "byte",
+                                         "unsigned byte",
+                                         "short",
+                                         "unsigned short",
+                                         "int",
+                                         "unsigned int",
+                                         "long",
+                                         "unsigned long",
+                                         "long long",
+                                         "unsigned long long",
+                                         "float",
+                                         "double",
+                                         "long double",
+                                         "complex float",
+                                         "complex double",
+                                         "complex long double",
+                                         "object",
+                                         "string",
+                                         "unicode",
+                                         "void",
+                                         "ntypes",
+                                         "notype",
+                                         "char",
+                                         "unknown"};
+    return typecode < 24 ? type_names[typecode] : type_names[24];
+  }
+
+  /* Make sure input has correct numpy type.  This now just calls
+     PyArray_EquivTypenums().
+   */
+  int type_match(int actual_type,
+                 int desired_type)
+  {
+    return PyArray_EquivTypenums(actual_type, desired_type);
+  }
+
+%#ifdef SWIGPY_USE_CAPSULE
+  void free_cap(PyObject * cap)
+  {
+    void* array = (void*) PyCapsule_GetPointer(cap,SWIGPY_CAPSULE_NAME);
+    if (array != NULL) free(array);
+  }
+%#endif
+
+
+}
+
+/**********************************************************************/
+
+%fragment("NumPy_Object_to_Array",
+          "header",
+          fragment="NumPy_Backward_Compatibility",
+          fragment="NumPy_Macros",
+          fragment="NumPy_Utilities")
+{
+  /* Given a PyObject pointer, cast it to a PyArrayObject pointer if
+   * legal.  If not, set the python error string appropriately and
+   * return NULL.
+   */
+  PyArrayObject* obj_to_array_no_conversion(PyObject* input,
+                                            int        typecode)
+  {
+    PyArrayObject* ary = NULL;
+    if (is_array(input) && (typecode == NPY_NOTYPE ||
+                            PyArray_EquivTypenums(array_type(input), typecode)))
+    {
+      ary = (PyArrayObject*) input;
+    }
+    else if is_array(input)
+    {
+      const char* desired_type = typecode_string(typecode);
+      const char* actual_type  = typecode_string(array_type(input));
+      PyErr_Format(PyExc_TypeError,
+                   "Array of type '%s' required.  Array of type '%s' given",
+                   desired_type, actual_type);
+      ary = NULL;
+    }
+    else
+    {
+      const char* desired_type = typecode_string(typecode);
+      const char* actual_type  = pytype_string(input);
+      PyErr_Format(PyExc_TypeError,
+                   "Array of type '%s' required.  A '%s' was given",
+                   desired_type,
+                   actual_type);
+      ary = NULL;
+    }
+    return ary;
+  }
+
+  /* Convert the given PyObject to a NumPy array with the given
+   * typecode.  On success, return a valid PyArrayObject* with the
+   * correct type.  On failure, the python error string will be set and
+   * the routine returns NULL.
+   */
+  PyArrayObject* obj_to_array_allow_conversion(PyObject* input,
+                                               int       typecode,
+                                               int*      is_new_object)
+  {
+    PyArrayObject* ary = NULL;
+    PyObject*      py_obj;
+    if (is_array(input) && (typecode == NPY_NOTYPE ||
+                            PyArray_EquivTypenums(array_type(input),typecode)))
+    {
+      ary = (PyArrayObject*) input;
+      *is_new_object = 0;
+    }
+    else
+    {
+      py_obj = PyArray_FROMANY(input, typecode, 0, 0, NPY_ARRAY_DEFAULT);
+      /* If NULL, PyArray_FromObject will have set python error value.*/
+      ary = (PyArrayObject*) py_obj;
+      *is_new_object = 1;
+    }
+    return ary;
+  }
+
+  /* Given a PyArrayObject, check to see if it is contiguous.  If so,
+   * return the input pointer and flag it as not a new object.  If it is
+   * not contiguous, create a new PyArrayObject using the original data,
+   * flag it as a new object and return the pointer.
+   */
+  PyArrayObject* make_contiguous(PyArrayObject* ary,
+                                 int*           is_new_object,
+                                 int            min_dims,
+                                 int            max_dims)
+  {
+    PyArrayObject* result;
+    if (array_is_contiguous(ary))
+    {
+      result = ary;
+      *is_new_object = 0;
+    }
+    else
+    {
+      result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)ary,
+                                                              array_type(ary),
+                                                              min_dims,
+                                                              max_dims);
+      *is_new_object = 1;
+    }
+    return result;
+  }
+
+  /* Given a PyArrayObject, check to see if it is Fortran-contiguous.
+   * If so, return the input pointer, but do not flag it as not a new
+   * object.  If it is not Fortran-contiguous, create a new
+   * PyArrayObject using the original data, flag it as a new object
+   * and return the pointer.
+   */
+  PyArrayObject* make_fortran(PyArrayObject* ary,
+                              int*           is_new_object)
+  {
+    PyArrayObject* result;
+    if (array_is_fortran(ary))
+    {
+      result = ary;
+      *is_new_object = 0;
+    }
+    else
+    {
+      Py_INCREF(array_descr(ary));
+      result = (PyArrayObject*) PyArray_FromArray(ary,
+                                                  array_descr(ary),
+                                                  NPY_FORTRANORDER);
+      *is_new_object = 1;
+    }
+    return result;
+  }
+
+  /* Convert a given PyObject to a contiguous PyArrayObject of the
+   * specified type.  If the input object is not a contiguous
+   * PyArrayObject, a new one will be created and the new object flag
+   * will be set.
+   */
+  PyArrayObject* obj_to_array_contiguous_allow_conversion(PyObject* input,
+                                                          int       typecode,
+                                                          int*      is_new_object)
+  {
+    int is_new1 = 0;
+    int is_new2 = 0;
+    PyArrayObject* ary2;
+    PyArrayObject* ary1 = obj_to_array_allow_conversion(input,
+                                                        typecode,
+                                                        &is_new1);
+    if (ary1)
+    {
+      ary2 = make_contiguous(ary1, &is_new2, 0, 0);
+      if ( is_new1 && is_new2)
+      {
+        Py_DECREF(ary1);
+      }
+      ary1 = ary2;
+    }
+    *is_new_object = is_new1 || is_new2;
+    return ary1;
+  }
+
+  /* Convert a given PyObject to a Fortran-ordered PyArrayObject of the
+   * specified type.  If the input object is not a Fortran-ordered
+   * PyArrayObject, a new one will be created and the new object flag
+   * will be set.
+   */
+  PyArrayObject* obj_to_array_fortran_allow_conversion(PyObject* input,
+                                                       int       typecode,
+                                                       int*      is_new_object)
+  {
+    int is_new1 = 0;
+    int is_new2 = 0;
+    PyArrayObject* ary2;
+    PyArrayObject* ary1 = obj_to_array_allow_conversion(input,
+                                                        typecode,
+                                                        &is_new1);
+    if (ary1)
+    {
+      ary2 = make_fortran(ary1, &is_new2);
+      if (is_new1 && is_new2)
+      {
+        Py_DECREF(ary1);
+      }
+      ary1 = ary2;
+    }
+    *is_new_object = is_new1 || is_new2;
+    return ary1;
+  }
+} /* end fragment */
+
+/**********************************************************************/
+
+%fragment("NumPy_Array_Requirements",
+          "header",
+          fragment="NumPy_Backward_Compatibility",
+          fragment="NumPy_Macros")
+{
+  /* Test whether a python object is contiguous.  If array is
+   * contiguous, return 1.  Otherwise, set the python error string and
+   * return 0.
+   */
+  int require_contiguous(PyArrayObject* ary)
+  {
+    int contiguous = 1;
+    if (!array_is_contiguous(ary))
+    {
+      PyErr_SetString(PyExc_TypeError,
+                      "Array must be contiguous.  A non-contiguous array was given");
+      contiguous = 0;
+    }
+    return contiguous;
+  }
+
+  /* Require that a numpy array is not byte-swapped.  If the array is
+   * not byte-swapped, return 1.  Otherwise, set the python error string
+   * and return 0.
+   */
+  int require_native(PyArrayObject* ary)
+  {
+    int native = 1;
+    if (!array_is_native(ary))
+    {
+      PyErr_SetString(PyExc_TypeError,
+                      "Array must have native byteorder.  "
+                      "A byte-swapped array was given");
+      native = 0;
+    }
+    return native;
+  }
+
+  /* Require the given PyArrayObject to have a specified number of
+   * dimensions.  If the array has the specified number of dimensions,
+   * return 1.  Otherwise, set the python error string and return 0.
+   */
+  int require_dimensions(PyArrayObject* ary,
+                         int            exact_dimensions)
+  {
+    int success = 1;
+    if (array_numdims(ary) != exact_dimensions)
+    {
+      PyErr_Format(PyExc_TypeError,
+                   "Array must have %d dimensions.  Given array has %d dimensions",
+                   exact_dimensions,
+                   array_numdims(ary));
+      success = 0;
+    }
+    return success;
+  }
+
+  /* Require the given PyArrayObject to have one of a list of specified
+   * number of dimensions.  If the array has one of the specified number
+   * of dimensions, return 1.  Otherwise, set the python error string
+   * and return 0.
+   */
+  int require_dimensions_n(PyArrayObject* ary,
+                           int*           exact_dimensions,
+                           int            n)
+  {
+    int success = 0;
+    int i;
+    char dims_str[255] = "";
+    char s[255];
+    for (i = 0; i < n && !success; i++)
+    {
+      if (array_numdims(ary) == exact_dimensions[i])
+      {
+        success = 1;
+      }
+    }
+    if (!success)
+    {
+      for (i = 0; i < n-1; i++)
+      {
+        sprintf(s, "%d, ", exact_dimensions[i]);
+        strcat(dims_str,s);
+      }
+      sprintf(s, " or %d", exact_dimensions[n-1]);
+      strcat(dims_str,s);
+      PyErr_Format(PyExc_TypeError,
+                   "Array must have %s dimensions.  Given array has %d dimensions",
+                   dims_str,
+                   array_numdims(ary));
+    }
+    return success;
+  }
+
+  /* Require the given PyArrayObject to have a specified shape.  If the
+   * array has the specified shape, return 1.  Otherwise, set the python
+   * error string and return 0.
+   */
+  int require_size(PyArrayObject* ary,
+                   npy_intp*      size,
+                   int            n)
+  {
+    int i;
+    int success = 1;
+    int len;
+    char desired_dims[255] = "[";
+    char s[255];
+    char actual_dims[255] = "[";
+    for(i=0; i < n;i++)
+    {
+      if (size[i] != -1 &&  size[i] != array_size(ary,i))
+      {
+        success = 0;
+      }
+    }
+    if (!success)
+    {
+      for (i = 0; i < n; i++)
+      {
+        if (size[i] == -1)
+        {
+          sprintf(s, "*,");
+        }
+        else
+        {
+          sprintf(s, "%ld,", (long int)size[i]);
+        }
+        strcat(desired_dims,s);
+      }
+      len = strlen(desired_dims);
+      desired_dims[len-1] = ']';
+      for (i = 0; i < n; i++)
+      {
+        sprintf(s, "%ld,", (long int)array_size(ary,i));
+        strcat(actual_dims,s);
+      }
+      len = strlen(actual_dims);
+      actual_dims[len-1] = ']';
+      PyErr_Format(PyExc_TypeError,
+                   "Array must have shape of %s.  Given array has shape of %s",
+                   desired_dims,
+                   actual_dims);
+    }
+    return success;
+  }
+
+  /* Require the given PyArrayObject to to be Fortran ordered.  If the
+   * the PyArrayObject is already Fortran ordered, do nothing.  Else,
+   * set the Fortran ordering flag and recompute the strides.
+   */
+  int require_fortran(PyArrayObject* ary)
+  {
+    int success = 1;
+    int nd = array_numdims(ary);
+    int i;
+    npy_intp * strides = array_strides(ary);
+    if (array_is_fortran(ary)) return success;
+    /* Set the Fortran ordered flag */
+    array_enableflags(ary,NPY_ARRAY_FARRAY);
+    /* Recompute the strides */
+    strides[0] = strides[nd-1];
+    for (i=1; i < nd; ++i)
+      strides[i] = strides[i-1] * array_size(ary,i-1);
+    return success;
+  }
+}
+
+/* Combine all NumPy fragments into one for convenience */
+%fragment("NumPy_Fragments",
+          "header",
+          fragment="NumPy_Backward_Compatibility",
+          fragment="NumPy_Macros",
+          fragment="NumPy_Utilities",
+          fragment="NumPy_Object_to_Array",
+          fragment="NumPy_Array_Requirements")
+{
+}
+
+/* End John Hunter translation (with modifications by Bill Spotz)
+ */
+
+/* %numpy_typemaps() macro
+ *
+ * This macro defines a family of 74 typemaps that allow C arguments
+ * of the form
+ *
+ *    1. (DATA_TYPE IN_ARRAY1[ANY])
+ *    2. (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+ *    3. (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+ *
+ *    4. (DATA_TYPE IN_ARRAY2[ANY][ANY])
+ *    5. (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ *    6. (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+ *    7. (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ *    8. (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
+ *
+ *    9. (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+ *   10. (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+ *   11. (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+ *   12. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
+ *   13. (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+ *   14. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3)
+ *
+ *   15. (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
+ *   16. (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+ *   17. (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+ *   18. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, , DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)
+ *   19. (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+ *   20. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)
+ *
+ *   21. (DATA_TYPE INPLACE_ARRAY1[ANY])
+ *   22. (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
+ *   23. (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
+ *
+ *   24. (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
+ *   25. (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ *   26. (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
+ *   27. (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ *   28. (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2)
+ *
+ *   29. (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
+ *   30. (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+ *   31. (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+ *   32. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3)
+ *   33. (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+ *   34. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3)
+ *
+ *   35. (DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])
+ *   36. (DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+ *   37. (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+ *   38. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_ARRAY4)
+ *   39. (DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+ *   40. (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_FARRAY4)
+ *
+ *   41. (DATA_TYPE ARGOUT_ARRAY1[ANY])
+ *   42. (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
+ *   43. (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
+ *
+ *   44. (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
+ *
+ *   45. (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
+ *
+ *   46. (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY])
+ *
+ *   47. (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1)
+ *   48. (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1)
+ *
+ *   49. (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+ *   50. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2)
+ *   51. (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+ *   52. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2)
+ *
+ *   53. (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+ *   54. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3)
+ *   55. (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+ *   56. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3)
+ *
+ *   57. (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ *   58. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_ARRAY4)
+ *   59. (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ *   60. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_FARRAY4)
+ *
+ *   61. (DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1)
+ *   62. (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1)
+ *
+ *   63. (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+ *   64. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2)
+ *   65. (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+ *   66. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2)
+ *
+ *   67. (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+ *   68. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_ARRAY3)
+ *   69. (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+ *   70. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_FARRAY3)
+ *
+ *   71. (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ *   72. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
+ *   73. (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ *   74. (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
+ *
+ * where "DATA_TYPE" is any type supported by the NumPy module, and
+ * "DIM_TYPE" is any int-like type suitable for specifying dimensions.
+ * The difference between "ARRAY" typemaps and "FARRAY" typemaps is
+ * that the "FARRAY" typemaps expect Fortran ordering of
+ * multidimensional arrays.  In python, the dimensions will not need
+ * to be specified (except for the "DATA_TYPE* ARGOUT_ARRAY1"
+ * typemaps).  The IN_ARRAYs can be a numpy array or any sequence that
+ * can be converted to a numpy array of the specified type.  The
+ * INPLACE_ARRAYs must be numpy arrays of the appropriate type.  The
+ * ARGOUT_ARRAYs will be returned as new numpy arrays of the
+ * appropriate type.
+ *
+ * These typemaps can be applied to existing functions using the
+ * %apply directive.  For example:
+ *
+ *     %apply (double* IN_ARRAY1, int DIM1) {(double* series, int length)};
+ *     double prod(double* series, int length);
+ *
+ *     %apply (int DIM1, int DIM2, double* INPLACE_ARRAY2)
+ *           {(int rows, int cols, double* matrix        )};
+ *     void floor(int rows, int cols, double* matrix, double f);
+ *
+ *     %apply (double IN_ARRAY3[ANY][ANY][ANY])
+ *           {(double tensor[2][2][2]         )};
+ *     %apply (double ARGOUT_ARRAY3[ANY][ANY][ANY])
+ *           {(double low[2][2][2]                )};
+ *     %apply (double ARGOUT_ARRAY3[ANY][ANY][ANY])
+ *           {(double upp[2][2][2]                )};
+ *     void luSplit(double tensor[2][2][2],
+ *                  double low[2][2][2],
+ *                  double upp[2][2][2]    );
+ *
+ * or directly with
+ *
+ *     double prod(double* IN_ARRAY1, int DIM1);
+ *
+ *     void floor(int DIM1, int DIM2, double* INPLACE_ARRAY2, double f);
+ *
+ *     void luSplit(double IN_ARRAY3[ANY][ANY][ANY],
+ *                  double ARGOUT_ARRAY3[ANY][ANY][ANY],
+ *                  double ARGOUT_ARRAY3[ANY][ANY][ANY]);
+ */
+
+%define %numpy_typemaps(DATA_TYPE, DATA_TYPECODE, DIM_TYPE)
+
+/************************/
+/* Input Array Typemaps */
+/************************/
+
+/* Typemap suite for (DATA_TYPE IN_ARRAY1[ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE IN_ARRAY1[ANY])
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE IN_ARRAY1[ANY])
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[1] = { $1_dim0 };
+  array = obj_to_array_contiguous_allow_conversion($input,
+                                                   DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 1) ||
+      !require_size(array, size, 1)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(freearg)
+  (DATA_TYPE IN_ARRAY1[ANY])
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[1] = { -1 };
+  array = obj_to_array_contiguous_allow_conversion($input,
+                                                   DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 1) ||
+      !require_size(array, size, 1)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[1] = {-1};
+  array = obj_to_array_contiguous_allow_conversion($input,
+                                                   DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 1) ||
+      !require_size(array, size, 1)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DATA_TYPE* IN_ARRAY1)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE IN_ARRAY2[ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE IN_ARRAY2[ANY][ANY])
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE IN_ARRAY2[ANY][ANY])
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[2] = { $1_dim0, $1_dim1 };
+  array = obj_to_array_contiguous_allow_conversion($input,
+                                                   DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 2) ||
+      !require_size(array, size, 2)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(freearg)
+  (DATA_TYPE IN_ARRAY2[ANY][ANY])
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[2] = { -1, -1 };
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 2) ||
+      !require_size(array, size, 2)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[2] = { -1, -1 };
+  array = obj_to_array_contiguous_allow_conversion($input,
+                                                   DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 2) ||
+      !require_size(array, size, 2)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[2] = { -1, -1 };
+  array = obj_to_array_fortran_allow_conversion($input,
+                                                DATA_TYPECODE,
+                                                &is_new_object);
+  if (!array || !require_dimensions(array, 2) ||
+      !require_size(array, size, 2) || !require_fortran(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[2] = { -1, -1 };
+  array = obj_to_array_fortran_allow_conversion($input,
+                                                   DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 2) ||
+      !require_size(array, size, 2) || !require_fortran(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_FARRAY2)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
+  array = obj_to_array_contiguous_allow_conversion($input,
+                                                   DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 3) ||
+      !require_size(array, size, 3)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(freearg)
+  (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY])
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[3] = { -1, -1, -1 };
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 3) ||
+      !require_size(array, size, 3)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  /* for now, only concerned with lists */
+  $1 = PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+  (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL, int* is_new_object_array=NULL)
+{
+  npy_intp size[2] = { -1, -1 };
+  PyArrayObject* temp_array;
+  Py_ssize_t i;
+  int is_new_object;
+
+  /* length of the list */
+  $2 = PyList_Size($input);
+
+  /* the arrays */
+  array = (DATA_TYPE **)malloc($2*sizeof(DATA_TYPE *));
+  object_array = (PyArrayObject **)calloc($2,sizeof(PyArrayObject *));
+  is_new_object_array = (int *)calloc($2,sizeof(int));
+
+  if (array == NULL || object_array == NULL || is_new_object_array == NULL)
+  {
+    SWIG_fail;
+  }
+
+  for (i=0; i<$2; i++)
+  {
+    temp_array = obj_to_array_contiguous_allow_conversion(PySequence_GetItem($input,i), DATA_TYPECODE, &is_new_object);
+
+    /* the new array must be stored so that it can be destroyed in freearg */
+    object_array[i] = temp_array;
+    is_new_object_array[i] = is_new_object;
+
+    if (!temp_array || !require_dimensions(temp_array, 2)) SWIG_fail;
+
+    /* store the size of the first array in the list, then use that for comparison. */
+    if (i == 0)
+    {
+      size[0] = array_size(temp_array,0);
+      size[1] = array_size(temp_array,1);
+    }
+
+    if (!require_size(temp_array, size, 2)) SWIG_fail;
+
+    array[i] = (DATA_TYPE*) array_data(temp_array);
+  }
+
+  $1 = (DATA_TYPE**) array;
+  $3 = (DIM_TYPE) size[0];
+  $4 = (DIM_TYPE) size[1];
+}
+%typemap(freearg)
+  (DATA_TYPE** IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  Py_ssize_t i;
+
+  if (array$argnum!=NULL) free(array$argnum);
+
+  /*freeing the individual arrays if needed */
+  if (object_array$argnum!=NULL)
+  {
+    if (is_new_object_array$argnum!=NULL)
+    {
+      for (i=0; i<$2; i++)
+      {
+        if (object_array$argnum[i] != NULL && is_new_object_array$argnum[i])
+        { Py_DECREF(object_array$argnum[i]); }
+      }
+      free(is_new_object_array$argnum);
+    }
+    free(object_array$argnum);
+  }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
+ *                    DATA_TYPE* IN_ARRAY3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[3] = { -1, -1, -1 };
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 3) ||
+      !require_size(array, size, 3)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[3] = { -1, -1, -1 };
+  array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE,
+                                                &is_new_object);
+  if (!array || !require_dimensions(array, 3) ||
+      !require_size(array, size, 3) | !require_fortran(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
+ *                    DATA_TYPE* IN_FARRAY3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[3] = { -1, -1, -1 };
+  array = obj_to_array_fortran_allow_conversion($input,
+                                                   DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 3) ||
+      !require_size(array, size, 3) || !require_fortran(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_FARRAY3)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[4] = { $1_dim0, $1_dim1, $1_dim2 , $1_dim3};
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 4) ||
+      !require_size(array, size, 4)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(freearg)
+  (DATA_TYPE IN_ARRAY4[ANY][ANY][ANY][ANY])
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3, DIM_TYPE DIM4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[4] = { -1, -1, -1, -1 };
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 4) ||
+      !require_size(array, size, 4)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+  $5 = (DIM_TYPE) array_size(array,3);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3, DIM_TYPE DIM4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  /* for now, only concerned with lists */
+  $1 = PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+  (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL, int* is_new_object_array=NULL)
+{
+  npy_intp size[3] = { -1, -1, -1 };
+  PyArrayObject* temp_array;
+  Py_ssize_t i;
+  int is_new_object;
+
+  /* length of the list */
+  $2 = PyList_Size($input);
+
+  /* the arrays */
+  array = (DATA_TYPE **)malloc($2*sizeof(DATA_TYPE *));
+  object_array = (PyArrayObject **)calloc($2,sizeof(PyArrayObject *));
+  is_new_object_array = (int *)calloc($2,sizeof(int));
+
+  if (array == NULL || object_array == NULL || is_new_object_array == NULL)
+  {
+    SWIG_fail;
+  }
+
+  for (i=0; i<$2; i++)
+  {
+    temp_array = obj_to_array_contiguous_allow_conversion(PySequence_GetItem($input,i), DATA_TYPECODE, &is_new_object);
+
+    /* the new array must be stored so that it can be destroyed in freearg */
+    object_array[i] = temp_array;
+    is_new_object_array[i] = is_new_object;
+
+    if (!temp_array || !require_dimensions(temp_array, 3)) SWIG_fail;
+
+    /* store the size of the first array in the list, then use that for comparison. */
+    if (i == 0)
+    {
+      size[0] = array_size(temp_array,0);
+      size[1] = array_size(temp_array,1);
+      size[2] = array_size(temp_array,2);
+    }
+
+    if (!require_size(temp_array, size, 3)) SWIG_fail;
+
+    array[i] = (DATA_TYPE*) array_data(temp_array);
+  }
+
+  $1 = (DATA_TYPE**) array;
+  $3 = (DIM_TYPE) size[0];
+  $4 = (DIM_TYPE) size[1];
+  $5 = (DIM_TYPE) size[2];
+}
+%typemap(freearg)
+  (DATA_TYPE** IN_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  Py_ssize_t i;
+
+  if (array$argnum!=NULL) free(array$argnum);
+
+  /*freeing the individual arrays if needed */
+  if (object_array$argnum!=NULL)
+  {
+    if (is_new_object_array$argnum!=NULL)
+    {
+      for (i=0; i<$2; i++)
+      {
+        if (object_array$argnum[i] != NULL && is_new_object_array$argnum[i])
+        { Py_DECREF(object_array$argnum[i]); }
+      }
+      free(is_new_object_array$argnum);
+    }
+    free(object_array$argnum);
+  }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4,
+ *                    DATA_TYPE* IN_ARRAY4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[4] = { -1, -1, -1 , -1};
+  array = obj_to_array_contiguous_allow_conversion($input, DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 4) ||
+      !require_size(array, size, 4)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DIM_TYPE) array_size(array,3);
+  $5 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_ARRAY4)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3, DIM_TYPE DIM4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[4] = { -1, -1, -1, -1 };
+  array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE,
+                                                &is_new_object);
+  if (!array || !require_dimensions(array, 4) ||
+      !require_size(array, size, 4) | !require_fortran(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+  $5 = (DIM_TYPE) array_size(array,3);
+}
+%typemap(freearg)
+  (DATA_TYPE* IN_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4,
+ *                    DATA_TYPE* IN_FARRAY4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)
+{
+  $1 = is_array($input) || PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)
+  (PyArrayObject* array=NULL, int is_new_object=0)
+{
+  npy_intp size[4] = { -1, -1, -1 , -1 };
+  array = obj_to_array_fortran_allow_conversion($input, DATA_TYPECODE,
+                                                   &is_new_object);
+  if (!array || !require_dimensions(array, 4) ||
+      !require_size(array, size, 4) || !require_fortran(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DIM_TYPE) array_size(array,3);
+  $5 = (DATA_TYPE*) array_data(array);
+}
+%typemap(freearg)
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* IN_FARRAY4)
+{
+  if (is_new_object$argnum && array$argnum)
+    { Py_DECREF(array$argnum); }
+}
+
+/***************************/
+/* In-Place Array Typemaps */
+/***************************/
+
+/* Typemap suite for (DATA_TYPE INPLACE_ARRAY1[ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE INPLACE_ARRAY1[ANY])
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE INPLACE_ARRAY1[ANY])
+  (PyArrayObject* array=NULL)
+{
+  npy_intp size[1] = { $1_dim0 };
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,1) || !require_size(array, size, 1) ||
+      !require_contiguous(array) || !require_native(array)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1)
+  (PyArrayObject* array=NULL, int i=1)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,1) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = 1;
+  for (i=0; i < array_numdims(array); ++i) $2 *= array_size(array,i);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1)
+  (PyArrayObject* array=NULL, int i=0)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,1) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = 1;
+  for (i=0; i < array_numdims(array); ++i) $1 *= array_size(array,i);
+  $2 = (DATA_TYPE*) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE INPLACE_ARRAY2[ANY][ANY])
+  (PyArrayObject* array=NULL)
+{
+  npy_intp size[2] = { $1_dim0, $1_dim1 };
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,2) || !require_size(array, size, 2) ||
+      !require_contiguous(array) || !require_native(array)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,2) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,2) || !require_contiguous(array) ||
+      !require_native(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DATA_TYPE*) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* INPLACE_FARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,2) || !require_contiguous(array)
+      || !require_native(array) || !require_fortran(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_FARRAY2)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,2) || !require_contiguous(array) ||
+      !require_native(array) || !require_fortran(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DATA_TYPE*) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY])
+  (PyArrayObject* array=NULL)
+{
+  npy_intp size[3] = { $1_dim0, $1_dim1, $1_dim2 };
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,3) || !require_size(array, size, 3) ||
+      !require_contiguous(array) || !require_native(array)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,3) || !require_contiguous(array) ||
+      !require_native(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+}
+
+/* Typemap suite for (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  $1 = PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+  (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL)
+{
+  npy_intp size[2] = { -1, -1 };
+  PyArrayObject* temp_array;
+  Py_ssize_t i;
+
+  /* length of the list */
+  $2 = PyList_Size($input);
+
+  /* the arrays */
+  array = (DATA_TYPE **)malloc($2*sizeof(DATA_TYPE *));
+  object_array = (PyArrayObject **)calloc($2,sizeof(PyArrayObject *));
+
+  if (array == NULL || object_array == NULL)
+  {
+    SWIG_fail;
+  }
+
+  for (i=0; i<$2; i++)
+  {
+    temp_array = obj_to_array_no_conversion(PySequence_GetItem($input,i), DATA_TYPECODE);
+
+    /* the new array must be stored so that it can be destroyed in freearg */
+    object_array[i] = temp_array;
+
+    if ( !temp_array || !require_dimensions(temp_array, 2) ||
+      !require_contiguous(temp_array) ||
+      !require_native(temp_array) ||
+      !PyArray_EquivTypenums(array_type(temp_array), DATA_TYPECODE)
+    ) SWIG_fail;
+
+    /* store the size of the first array in the list, then use that for comparison. */
+    if (i == 0)
+    {
+      size[0] = array_size(temp_array,0);
+      size[1] = array_size(temp_array,1);
+    }
+
+    if (!require_size(temp_array, size, 2)) SWIG_fail;
+
+    array[i] = (DATA_TYPE*) array_data(temp_array);
+  }
+
+  $1 = (DATA_TYPE**) array;
+  $3 = (DIM_TYPE) size[0];
+  $4 = (DIM_TYPE) size[1];
+}
+%typemap(freearg)
+  (DATA_TYPE** INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  if (array$argnum!=NULL) free(array$argnum);
+  if (object_array$argnum!=NULL) free(object_array$argnum);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
+ *                    DATA_TYPE* INPLACE_ARRAY3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,3) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DATA_TYPE*) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* INPLACE_FARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,3) || !require_contiguous(array) ||
+      !require_native(array) || !require_fortran(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
+ *                    DATA_TYPE* INPLACE_FARRAY3)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_FARRAY3)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,3) || !require_contiguous(array)
+      || !require_native(array) || !require_fortran(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DATA_TYPE*) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE INPLACE_ARRAY4[ANY][ANY][ANY][ANY])
+  (PyArrayObject* array=NULL)
+{
+  npy_intp size[4] = { $1_dim0, $1_dim1, $1_dim2 , $1_dim3 };
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,4) || !require_size(array, size, 4) ||
+      !require_contiguous(array) || !require_native(array)) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3, DIM_TYPE DIM4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,4) || !require_contiguous(array) ||
+      !require_native(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+  $5 = (DIM_TYPE) array_size(array,3);
+}
+
+/* Typemap suite for (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3, DIM_TYPE DIM4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  $1 = PySequence_Check($input);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+  (DATA_TYPE** array=NULL, PyArrayObject** object_array=NULL)
+{
+  npy_intp size[3] = { -1, -1, -1 };
+  PyArrayObject* temp_array;
+  Py_ssize_t i;
+
+  /* length of the list */
+  $2 = PyList_Size($input);
+
+  /* the arrays */
+  array = (DATA_TYPE **)malloc($2*sizeof(DATA_TYPE *));
+  object_array = (PyArrayObject **)calloc($2,sizeof(PyArrayObject *));
+
+  if (array == NULL || object_array == NULL)
+  {
+    SWIG_fail;
+  }
+
+  for (i=0; i<$2; i++)
+  {
+    temp_array = obj_to_array_no_conversion(PySequence_GetItem($input,i), DATA_TYPECODE);
+
+    /* the new array must be stored so that it can be destroyed in freearg */
+    object_array[i] = temp_array;
+
+    if ( !temp_array || !require_dimensions(temp_array, 3) ||
+      !require_contiguous(temp_array) ||
+      !require_native(temp_array) ||
+      !PyArray_EquivTypenums(array_type(temp_array), DATA_TYPECODE)
+    ) SWIG_fail;
+
+    /* store the size of the first array in the list, then use that for comparison. */
+    if (i == 0)
+    {
+      size[0] = array_size(temp_array,0);
+      size[1] = array_size(temp_array,1);
+      size[2] = array_size(temp_array,2);
+    }
+
+    if (!require_size(temp_array, size, 3)) SWIG_fail;
+
+    array[i] = (DATA_TYPE*) array_data(temp_array);
+  }
+
+  $1 = (DATA_TYPE**) array;
+  $3 = (DIM_TYPE) size[0];
+  $4 = (DIM_TYPE) size[1];
+  $5 = (DIM_TYPE) size[2];
+}
+%typemap(freearg)
+  (DATA_TYPE** INPLACE_ARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  if (array$argnum!=NULL) free(array$argnum);
+  if (object_array$argnum!=NULL) free(object_array$argnum);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4,
+ *                    DATA_TYPE* INPLACE_ARRAY4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_ARRAY4)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_ARRAY4)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,4) || !require_contiguous(array)
+      || !require_native(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DIM_TYPE) array_size(array,3);
+  $5 = (DATA_TYPE*) array_data(array);
+}
+
+/* Typemap suite for (DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2,
+ *                    DIM_TYPE DIM3, DIM_TYPE DIM4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* INPLACE_FARRAY4, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,4) || !require_contiguous(array) ||
+      !require_native(array) || !require_fortran(array)) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+  $2 = (DIM_TYPE) array_size(array,0);
+  $3 = (DIM_TYPE) array_size(array,1);
+  $4 = (DIM_TYPE) array_size(array,2);
+  $5 = (DIM_TYPE) array_size(array,3);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3,
+ *                    DATA_TYPE* INPLACE_FARRAY4)
+ */
+%typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY,
+           fragment="NumPy_Macros")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_FARRAY4)
+{
+  $1 = is_array($input) && PyArray_EquivTypenums(array_type($input),
+                                                 DATA_TYPECODE);
+}
+%typemap(in,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DIM_TYPE DIM4, DATA_TYPE* INPLACE_FARRAY4)
+  (PyArrayObject* array=NULL)
+{
+  array = obj_to_array_no_conversion($input, DATA_TYPECODE);
+  if (!array || !require_dimensions(array,4) || !require_contiguous(array)
+      || !require_native(array) || !require_fortran(array)) SWIG_fail;
+  $1 = (DIM_TYPE) array_size(array,0);
+  $2 = (DIM_TYPE) array_size(array,1);
+  $3 = (DIM_TYPE) array_size(array,2);
+  $4 = (DIM_TYPE) array_size(array,3);
+  $5 = (DATA_TYPE*) array_data(array);
+}
+
+/*************************/
+/* Argout Array Typemaps */
+/*************************/
+
+/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY1[ANY])
+ */
+%typemap(in,numinputs=0,
+         fragment="NumPy_Backward_Compatibility,NumPy_Macros")
+  (DATA_TYPE ARGOUT_ARRAY1[ANY])
+  (PyObject* array = NULL)
+{
+  npy_intp dims[1] = { $1_dim0 };
+  array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
+  if (!array) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE ARGOUT_ARRAY1[ANY])
+{
+  $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
+}
+
+/* Typemap suite for (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
+ */
+%typemap(in,numinputs=1,
+         fragment="NumPy_Fragments")
+  (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
+  (PyObject* array = NULL)
+{
+  npy_intp dims[1];
+  if (!PyInt_Check($input))
+  {
+    const char* typestring = pytype_string($input);
+    PyErr_Format(PyExc_TypeError,
+                 "Int dimension expected.  '%s' given.",
+                 typestring);
+    SWIG_fail;
+  }
+  $2 = (DIM_TYPE) PyInt_AsLong($input);
+  dims[0] = (npy_intp) $2;
+  array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
+  if (!array) SWIG_fail;
+  $1 = (DATA_TYPE*) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1)
+{
+  $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
+}
+
+/* Typemap suite for (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
+ */
+%typemap(in,numinputs=1,
+         fragment="NumPy_Fragments")
+  (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
+  (PyObject* array = NULL)
+{
+  npy_intp dims[1];
+  if (!PyInt_Check($input))
+  {
+    const char* typestring = pytype_string($input);
+    PyErr_Format(PyExc_TypeError,
+                 "Int dimension expected.  '%s' given.",
+                 typestring);
+    SWIG_fail;
+  }
+  $1 = (DIM_TYPE) PyInt_AsLong($input);
+  dims[0] = (npy_intp) $1;
+  array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
+  if (!array) SWIG_fail;
+  $2 = (DATA_TYPE*) array_data(array);
+}
+%typemap(argout)
+  (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1)
+{
+  $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
+}
+
+/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
+ */
+%typemap(in,numinputs=0,
+         fragment="NumPy_Backward_Compatibility,NumPy_Macros")
+  (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
+  (PyObject* array = NULL)
+{
+  npy_intp dims[2] = { $1_dim0, $1_dim1 };
+  array = PyArray_SimpleNew(2, dims, DATA_TYPECODE);
+  if (!array) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY])
+{
+  $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
+}
+
+/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
+ */
+%typemap(in,numinputs=0,
+         fragment="NumPy_Backward_Compatibility,NumPy_Macros")
+  (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
+  (PyObject* array = NULL)
+{
+  npy_intp dims[3] = { $1_dim0, $1_dim1, $1_dim2 };
+  array = PyArray_SimpleNew(3, dims, DATA_TYPECODE);
+  if (!array) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY])
+{
+  $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
+}
+
+/* Typemap suite for (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY])
+ */
+%typemap(in,numinputs=0,
+         fragment="NumPy_Backward_Compatibility,NumPy_Macros")
+  (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY])
+  (PyObject* array = NULL)
+{
+  npy_intp dims[4] = { $1_dim0, $1_dim1, $1_dim2, $1_dim3 };
+  array = PyArray_SimpleNew(4, dims, DATA_TYPECODE);
+  if (!array) SWIG_fail;
+  $1 = ($1_ltype) array_data(array);
+}
+%typemap(argout)
+  (DATA_TYPE ARGOUT_ARRAY4[ANY][ANY][ANY][ANY])
+{
+  $result = SWIG_Python_AppendOutput($result,(PyObject*)array$argnum);
+}
+
+/*****************************/
+/* Argoutview Array Typemaps */
+/*****************************/
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1    )
+  (DATA_TYPE*  data_temp = NULL , DIM_TYPE  dim_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility")
+  (DATA_TYPE** ARGOUTVIEW_ARRAY1, DIM_TYPE* DIM1)
+{
+  npy_intp dims[1] = { *$2 };
+  PyObject* obj = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DATA_TYPE** ARGOUTVIEW_ARRAY1)
+  (DIM_TYPE  dim_temp, DATA_TYPE*  data_temp = NULL )
+{
+  $1 = &dim_temp;
+  $2 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility")
+  (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEW_ARRAY1)
+{
+  npy_intp dims[1] = { *$1 };
+  PyObject* obj = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$2));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1     , DIM_TYPE* DIM2     )
+  (DATA_TYPE*  data_temp = NULL , DIM_TYPE  dim1_temp, DIM_TYPE  dim2_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility")
+  (DATA_TYPE** ARGOUTVIEW_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+{
+  npy_intp dims[2] = { *$2, *$3 };
+  PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1     , DIM_TYPE* DIM2     , DATA_TYPE** ARGOUTVIEW_ARRAY2)
+  (DIM_TYPE  dim1_temp, DIM_TYPE  dim2_temp, DATA_TYPE*  data_temp = NULL )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_ARRAY2)
+{
+  npy_intp dims[2] = { *$1, *$2 };
+  PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1     , DIM_TYPE* DIM2     )
+  (DATA_TYPE*  data_temp = NULL  , DIM_TYPE  dim1_temp, DIM_TYPE  dim2_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
+  (DATA_TYPE** ARGOUTVIEW_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+{
+  npy_intp dims[2] = { *$2, *$3 };
+  PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1     , DIM_TYPE* DIM2     , DATA_TYPE** ARGOUTVIEW_FARRAY2)
+  (DIM_TYPE  dim1_temp, DIM_TYPE  dim2_temp, DATA_TYPE*  data_temp = NULL  )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEW_FARRAY2)
+{
+  npy_intp dims[2] = { *$1, *$2 };
+  PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    )
+  (DATA_TYPE* data_temp = NULL  , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility")
+  (DATA_TYPE** ARGOUTVIEW_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+{
+  npy_intp dims[3] = { *$2, *$3, *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3,
+                      DATA_TYPE** ARGOUTVIEW_ARRAY3)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp = NULL)
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_ARRAY3)
+{
+  npy_intp dims[3] = { *$1, *$2, *$3 };
+  PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$4));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    )
+  (DATA_TYPE* data_temp = NULL   , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
+  (DATA_TYPE** ARGOUTVIEW_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+{
+  npy_intp dims[3] = { *$2, *$3, *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3,
+                      DATA_TYPE** ARGOUTVIEW_FARRAY3)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DATA_TYPE** ARGOUTVIEW_FARRAY3)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp = NULL   )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEW_FARRAY3)
+{
+  npy_intp dims[3] = { *$1, *$2, *$3 };
+  PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$4));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    )
+  (DATA_TYPE* data_temp = NULL  , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+  $5 = &dim4_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility")
+  (DATA_TYPE** ARGOUTVIEW_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+{
+  npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
+                      DATA_TYPE** ARGOUTVIEW_ARRAY4)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    , DATA_TYPE** ARGOUTVIEW_ARRAY4)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL  )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &dim4_temp;
+  $5 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_ARRAY4)
+{
+  npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    )
+  (DATA_TYPE* data_temp = NULL   , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+  $5 = &dim4_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
+  (DATA_TYPE** ARGOUTVIEW_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+{
+  npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
+                      DATA_TYPE** ARGOUTVIEW_FARRAY4)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    , DATA_TYPE** ARGOUTVIEW_FARRAY4)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL   )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &dim4_temp;
+  $5 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEW_FARRAY4)
+{
+  npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/*************************************/
+/* Managed Argoutview Array Typemaps */
+/*************************************/
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1    )
+  (DATA_TYPE*  data_temp = NULL  , DIM_TYPE  dim_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY1, DIM_TYPE* DIM1)
+{
+  npy_intp dims[1] = { *$2 };
+  PyObject* obj = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DATA_TYPE** ARGOUTVIEWM_ARRAY1)
+  (DIM_TYPE  dim_temp, DATA_TYPE*  data_temp = NULL  )
+{
+  $1 = &dim_temp;
+  $2 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DATA_TYPE** ARGOUTVIEWM_ARRAY1)
+{
+  npy_intp dims[1] = { *$1 };
+  PyObject* obj = PyArray_SimpleNewFromData(1, dims, DATA_TYPECODE, (void*)(*$2));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1     , DIM_TYPE* DIM2     )
+  (DATA_TYPE*  data_temp = NULL  , DIM_TYPE  dim1_temp, DIM_TYPE  dim2_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+{
+  npy_intp dims[2] = { *$2, *$3 };
+  PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1     , DIM_TYPE* DIM2     , DATA_TYPE** ARGOUTVIEWM_ARRAY2)
+  (DIM_TYPE  dim1_temp, DIM_TYPE  dim2_temp, DATA_TYPE*  data_temp = NULL  )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_ARRAY2)
+{
+  npy_intp dims[2] = { *$1, *$2 };
+  PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1     , DIM_TYPE* DIM2     )
+  (DATA_TYPE*  data_temp = NULL   , DIM_TYPE  dim1_temp, DIM_TYPE  dim2_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_FARRAY2, DIM_TYPE* DIM1, DIM_TYPE* DIM2)
+{
+  npy_intp dims[2] = { *$2, *$3 };
+  PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1     , DIM_TYPE* DIM2     , DATA_TYPE** ARGOUTVIEWM_FARRAY2)
+  (DIM_TYPE  dim1_temp, DIM_TYPE  dim2_temp, DATA_TYPE*  data_temp = NULL   )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DATA_TYPE** ARGOUTVIEWM_FARRAY2)
+{
+  npy_intp dims[2] = { *$1, *$2 };
+  PyObject* obj = PyArray_SimpleNewFromData(2, dims, DATA_TYPECODE, (void*)(*$3));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    )
+  (DATA_TYPE* data_temp = NULL   , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+{
+  npy_intp dims[3] = { *$2, *$3, *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3,
+                      DATA_TYPE** ARGOUTVIEWM_ARRAY3)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DATA_TYPE** ARGOUTVIEWM_ARRAY3)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp = NULL   )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_ARRAY3)
+{
+  npy_intp dims[3] = { *$1, *$2, *$3 };
+  PyObject* obj= PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$4));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    )
+  (DATA_TYPE* data_temp = NULL    , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_FARRAY3, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+{
+  npy_intp dims[3] = { *$2, *$3, *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3,
+                      DATA_TYPE** ARGOUTVIEWM_FARRAY3)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DATA_TYPE** ARGOUTVIEWM_FARRAY3)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DATA_TYPE* data_temp = NULL    )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DATA_TYPE** ARGOUTVIEWM_FARRAY3)
+{
+  npy_intp dims[3] = { *$1, *$2, *$3 };
+  PyObject* obj = PyArray_SimpleNewFromData(3, dims, DATA_TYPECODE, (void*)(*$4));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    )
+  (DATA_TYPE* data_temp = NULL   , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+  $5 = &dim4_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+{
+  npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
+                      DATA_TYPE** ARGOUTVIEWM_ARRAY4)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    , DATA_TYPE** ARGOUTVIEWM_ARRAY4)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL   )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &dim4_temp;
+  $5 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
+{
+  npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    )
+  (DATA_TYPE* data_temp = NULL    , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+  $5 = &dim4_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
+{
+  npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
+                      DATA_TYPE** ARGOUTVIEWM_FARRAY4)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    , DATA_TYPE** ARGOUTVIEWM_FARRAY4)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL    )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &dim4_temp;
+  $5 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
+{
+  npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    )
+  (DATA_TYPE* data_temp = NULL   , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+  $5 = &dim4_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+{
+  npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
+                      DATA_TYPE** ARGOUTVIEWM_ARRAY4)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    , DATA_TYPE** ARGOUTVIEWM_ARRAY4)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL   )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &dim4_temp;
+  $5 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
+{
+  npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
+                      DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+ */
+%typemap(in,numinputs=0)
+  (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    )
+  (DATA_TYPE* data_temp = NULL    , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
+{
+  $1 = &data_temp;
+  $2 = &dim1_temp;
+  $3 = &dim2_temp;
+  $4 = &dim3_temp;
+  $5 = &dim4_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
+  (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
+{
+  npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
+                      DATA_TYPE** ARGOUTVIEWM_FARRAY4)
+ */
+%typemap(in,numinputs=0)
+  (DIM_TYPE* DIM1    , DIM_TYPE* DIM2    , DIM_TYPE* DIM3    , DIM_TYPE* DIM4    , DATA_TYPE** ARGOUTVIEWM_FARRAY4)
+  (DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL    )
+{
+  $1 = &dim1_temp;
+  $2 = &dim2_temp;
+  $3 = &dim3_temp;
+  $4 = &dim4_temp;
+  $5 = &data_temp;
+}
+%typemap(argout,
+         fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
+  (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
+{
+  npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
+  PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
+  PyArrayObject* array = (PyArrayObject*) obj;
+
+  if (!array || !require_fortran(array)) SWIG_fail;
+
+%#ifdef SWIGPY_USE_CAPSULE
+    PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
+%#else
+    PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
+%#endif
+
+%#if NPY_API_VERSION < 0x00000007
+  PyArray_BASE(array) = cap;
+%#else
+  PyArray_SetBaseObject(array,cap);
+%#endif
+
+  $result = SWIG_Python_AppendOutput($result,obj);
+}
+
+%enddef    /* %numpy_typemaps() macro */
+/* *************************************************************** */
+
+/* Concrete instances of the %numpy_typemaps() macro: Each invocation
+ * below applies all of the typemaps above to the specified data type.
+ */
+%numpy_typemaps(signed char       , NPY_BYTE     , int)
+%numpy_typemaps(unsigned char     , NPY_UBYTE    , int)
+%numpy_typemaps(short             , NPY_SHORT    , int)
+%numpy_typemaps(unsigned short    , NPY_USHORT   , int)
+%numpy_typemaps(int               , NPY_INT      , int)
+%numpy_typemaps(unsigned int      , NPY_UINT     , int)
+%numpy_typemaps(long              , NPY_LONG     , int)
+%numpy_typemaps(unsigned long     , NPY_ULONG    , int)
+%numpy_typemaps(long long         , NPY_LONGLONG , int)
+%numpy_typemaps(unsigned long long, NPY_ULONGLONG, int)
+%numpy_typemaps(float             , NPY_FLOAT    , int)
+%numpy_typemaps(double            , NPY_DOUBLE   , int)
+
+/* ***************************************************************
+ * The follow macro expansion does not work, because C++ bool is 4
+ * bytes and NPY_BOOL is 1 byte
+ *
+ *    %numpy_typemaps(bool, NPY_BOOL, int)
+ */
+
+/* ***************************************************************
+ * On my Mac, I get the following warning for this macro expansion:
+ * 'swig/python detected a memory leak of type 'long double *', no destructor found.'
+ *
+ *    %numpy_typemaps(long double, NPY_LONGDOUBLE, int)
+ */
+
+#ifdef __cplusplus
+
+%include <std_complex.i>
+
+%numpy_typemaps(std::complex<float>,  NPY_CFLOAT , int)
+%numpy_typemaps(std::complex<double>, NPY_CDOUBLE, int)
+
+#endif
+
+#endif /* SWIGPYTHON */
diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i
index 39768ed..9b41b7a 100644
--- a/Modules/Wrappers/SWIG/src/otbApplication.i
+++ b/Modules/Wrappers/SWIG/src/otbApplication.i
@@ -6,38 +6,74 @@
   Version:   $Revision$
 
 
-  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
-  See OTBCopyright.txt for details.
+  Copyright:
+    Centre National d'Etudes Spatiales,
+    CS Systemes d'information.
 
+ See OTBCopyright.txt, CSCopyright.txt for details.
+ All rights reserved.
 
-     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 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.
 
 =========================================================================*/
 
 %module otbApplication
 
-
  %{
 #include "itkBase.includes"
 #include "otbWrapperSWIGIncludes.h"
- %}
+#include <string>         // std::string
+#include <locale>
+#define SWIG_FILE_WITH_INIT
+%}
 
 // Langage specific extension
 %include "Python.i"
 %include "Java.i"
 %include "Ruby.i"
 %include "Lua.i"
-
 %include "itkMacro.i"
 %include "itkBase.i"
 
+#if OTB_SWIGNUMPY
+%include "numpy.i"
+
+%init
+%{
+import_array();
+%}
+
+/*leave the mess to SWIG and let us not worry.*/
+%apply (signed char* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(signed char* buffer, int dim1, int dim2, int dim3)};
+%apply (signed short* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(signed short* buffer, int dim1, int dim2, int dim3)};
+%apply (signed int* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(signed int* buffer, int dim1, int dim2, int dim3)};
+%apply (signed long* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(signed long* buffer, int dim1, int dim2, int dim3)};
+%apply (float* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(float* buffer, int dim1, int dim2, int dim3)};
+%apply (unsigned char* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(unsigned char* buffer, int dim1, int dim2, int dim3)};
+%apply (unsigned short* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(unsigned short* buffer, int dim1, int dim2, int dim3)};
+%apply (unsigned int* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(unsigned int* buffer, int dim1, int dim2, int dim3)};
+%apply (unsigned long* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(unsigned long* buffer, int dim1, int dim2, int dim3)};
+%apply (double* INPLACE_ARRAY3, int DIM1, int DIM2, int DIM3) {(double* buffer, int dim1, int dim2, int dim3)};
+
+%apply (signed char** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(signed char** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (signed short** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(signed short** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (signed int** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(signed int** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (signed long** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(signed long** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (float** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(float** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (unsigned char** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(unsigned char** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (unsigned short** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(unsigned short** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (unsigned int** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(unsigned int** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (unsigned long** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(unsigned long** buffer, int *dim1, int *dim2, int *dim3)};
+%apply (double** ARGOUTVIEW_ARRAY3, int *DIM1, int *DIM2, int *DIM3) {(double** buffer, int *dim1, int *dim2, int *dim3)};
+
+#endif /* OTB_SWIGNUMPY */
+
 namespace otb
 {
 namespace Wrapper
 {
-
   enum DefaultValueMode
   {
     DefaultValueMode_UNKNOWN,
@@ -90,19 +126,20 @@ namespace Wrapper
     ImagePixelType_double,
   } ImagePixelType;
 
- typedef enum
- {
-   Role_Input,
-   Role_Output
- } Role;
+  typedef enum
+  {
+    Role_Input,
+    Role_Output
+  } Role;
 
- typedef enum
- {
-   ComplexImagePixelType_float,
-   ComplexImagePixelType_double,
- } ComplexImagePixelType;
+  typedef enum
+  {
+    ComplexImagePixelType_float,
+    ComplexImagePixelType_double,
+  } ComplexImagePixelType;
 
 }
+
 }
 
 class Application: public itkObject
@@ -120,11 +157,13 @@ public:
   int ExecuteAndWriteOutput();
 
   std::vector<std::string> GetParametersKeys(bool recursive = true);
+  Parameter* Application::GetParameterByKey(std::string name);
   std::string GetParameterName(std::string);
   std::string GetParameterDescription(std::string);
   void SetParameterDescription(std::string paramKey, std::string dec);
   void SetParameterUserValue(std::string paramKey, bool value);
 
+
   void EnableParameter(std::string paramKey);
   void DisableParameter(std::string paramKey);
   bool IsParameterEnabled(std::string paramKey) const;
@@ -153,7 +192,6 @@ public:
   void SetParameterStringList(std::string parameter, std::vector<std::string> values, bool hasUserValueFlag);
   void SetParameterEmpty(std::string parameter, bool value, bool hasUserValueFlag);
 
-
   void SetParameterOutputImagePixelType(std::string parameter, otb::Wrapper::ImagePixelType pixelType);
   void SetParameterComplexOutputImagePixelType(std::string parameter, otb::Wrapper::ComplexImagePixelType cpixelType);
 
@@ -184,6 +222,7 @@ public:
   void AddDocTag( const std::string & tag );
   std::vector<std::string> GetDocTags();
 
+  otb::Wrapper::ParameterGroup* GetParameterList();
 
   unsigned int GetNumberOfExamples();
   std::string GetExampleComment(unsigned int id);
@@ -199,6 +238,161 @@ public:
   std::string GetHtmlExample();
   std::vector< std::pair<std::string, std::string> > GetOutputParametersSumUp();
 
+#if OTB_SWIGNUMPY
+  %extend {
+
+#define SetFromNumpyArrayMacro(prefix, PixelDataType, ImageClass)       \
+      void Set##ImageClass##From##prefix##NumpyArray_(std::string pkey, ##PixelDataType##* buffer, int dim1, int dim2, int dim3) \
+      {                                                                 \
+        otb::Wrapper::Parameter *parameter = $self->GetParameterList()->GetParameterByKey(pkey); \
+        InputImageParameter* inputImageParam = dynamic_cast<InputImageParameter*>(parameter); \
+        typedef otb::##ImageClass##<##PixelDataType##>   ImageType;     \
+        ImageType::Pointer output = ImageType::New();          \
+        typedef ImageType::SizeType        SizeType;           \
+        typedef ImageType::IndexType       IndexType;          \
+        typedef ImageType::RegionType      RegionType;         \
+        typedef ImageType::PointType       PointType;          \
+        typedef ImageType::SpacingType     SpacingType;        \
+        typedef ImageType::DirectionType   DirectionType;      \
+        IndexType start;                                                \
+        DirectionType direction;                                        \
+        start.Fill( 0 );                                                \
+        SizeType size;                                                  \
+        size[0] = dim2; size[1] = dim1;                                 \
+        SetVectorLengthMacro                                            \
+        output->Allocate();                                             \
+        unsigned int numberOfPixels = dim1 * dim2 * dim3;               \
+        RegionType region;                                              \
+        region.SetIndex( start );                                       \
+        region.SetSize( size );                                         \
+        PointType origin;                                               \
+        origin.Fill( 0.0 );                                             \
+        SpacingType spacing;                                            \
+        spacing.Fill( 1.0 );                                            \
+        direction.SetIdentity();                                        \
+        output->SetOrigin( origin );                                    \
+        output->SetSpacing( spacing );                                  \
+        output->SetDirection(direction);                                \
+        output->SetLargestPossibleRegion(region);                       \
+        output->SetRequestedRegion(output->GetLargestPossibleRegion()); \
+        output->SetBufferedRegion(output->GetLargestPossibleRegion());  \
+        output->GetPixelContainer()->SetImportPointer(buffer, numberOfPixels, false); \
+        inputImageParam->SetImage<ImageType>(output);                   \
+  }
+
+#define SetVectorLengthMacro output->SetVectorLength(dim3);
+       SetFromNumpyArrayMacro(Float, float, VectorImage)
+       SetFromNumpyArrayMacro(Int8, signed char, VectorImage)
+       SetFromNumpyArrayMacro(Int16, signed short, VectorImage)
+       SetFromNumpyArrayMacro(Int32, signed int, VectorImage)
+       SetFromNumpyArrayMacro(Int64, signed long, VectorImage)
+       SetFromNumpyArrayMacro(UInt8, unsigned char, VectorImage)
+       SetFromNumpyArrayMacro(UInt16, unsigned short, VectorImage)
+       SetFromNumpyArrayMacro(UInt32, unsigned int, VectorImage)
+       SetFromNumpyArrayMacro(UInt64, unsigned long, VectorImage)
+       SetFromNumpyArrayMacro(Double, double, VectorImage)
+#undef SetVectorLengthMacro
+
+#define SetVectorLengthMacro dim3=1;
+       SetFromNumpyArrayMacro(Float, float, Image)
+       SetFromNumpyArrayMacro(Int8, signed char, Image)
+       SetFromNumpyArrayMacro(Int16, signed short, Image)
+       SetFromNumpyArrayMacro(Int32, signed int, Image)
+       SetFromNumpyArrayMacro(Int64, signed long, Image)
+       SetFromNumpyArrayMacro(UInt8, unsigned char, Image)
+       SetFromNumpyArrayMacro(UInt16, unsigned short, Image)
+       SetFromNumpyArrayMacro(UInt32, unsigned int, Image)
+       SetFromNumpyArrayMacro(UInt64, unsigned long, Image)
+       SetFromNumpyArrayMacro(Double, double, Image)
+#undef SetVectorLengthMacro
+#undef SetFromNumpyArrayMacro
+
+#define GetVectorImageAsNumpyArrayMacro(prefix, PixelType)                    \
+      void GetVectorImageAs##prefix##NumpyArray_(std::string pkey, ##PixelType##** buffer, int *dim1, int *dim2, int *dim3) \
+        {                                                               \
+        otb::Wrapper::Parameter *parameter = $self->GetParameterList()->GetParameterByKey(pkey); \
+        OutputImageParameter* outputImageParam = dynamic_cast<OutputImageParameter*>(parameter); \
+        typedef itk::ImageBase<2> ImageBaseType;                        \
+        typedef ImageBaseType::RegionType RegionType;          \
+        ImageBaseType::Pointer imageBase;                               \
+        imageBase = outputImageParam->GetValue();                       \
+        imageBase->Update();                                            \
+        typedef ImageBaseType::SizeType        SizeType;       \
+        typedef ImageBaseType::IndexType       IndexType;      \
+        typedef ImageBaseType::PointType       PointType;      \
+        typedef ImageBaseType::SpacingType     SpacingType;    \
+        RegionType region = imageBase->GetBufferedRegion();             \
+        SizeType size =  region.GetSize();                              \
+        *dim1 = size[1];                                                \
+        *dim2 = size[0];                                                \
+        typedef otb::VectorImage<signed char> Int8ImageType;            \
+        typedef otb::VectorImage<signed short> Int16ImageType;          \
+        typedef otb::VectorImage<signed int> Int32ImageType;            \
+        typedef otb::VectorImage<unsigned char> UInt8ImageType;         \
+        typedef otb::VectorImage<unsigned short> UInt16ImageType;       \
+        typedef otb::VectorImage<unsigned int> UInt32ImageType;         \
+        typedef otb::VectorImage<float> FloatImageType;                 \
+        typedef otb::VectorImage<double> DoubleImageType;               \
+        if (dynamic_cast<UInt8ImageType*>(imageBase.GetPointer()))      \
+          {                                                             \
+            UInt8ImageType* output = dynamic_cast<UInt8ImageType*>(imageBase.GetPointer()); \
+            *buffer  =  reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \
+              *dim3 = output->GetNumberOfComponentsPerPixel();          \
+          }                                                             \
+        else if (dynamic_cast<Int16ImageType*>(imageBase.GetPointer())) \
+          {                                                             \
+            Int16ImageType* output = dynamic_cast<Int16ImageType*>(imageBase.GetPointer()); \
+            *buffer  =  reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \
+              *dim3 = output->GetNumberOfComponentsPerPixel();          \
+          }                                                             \
+        else if (dynamic_cast<UInt16ImageType*>(imageBase.GetPointer())) \
+          {                                                             \
+            UInt16ImageType* output = dynamic_cast<UInt16ImageType*>(imageBase.GetPointer()); \
+            *buffer  =  reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \
+              *dim3 = output->GetNumberOfComponentsPerPixel();          \
+          }                                                             \
+        else if (dynamic_cast<Int32ImageType*>(imageBase.GetPointer())) \
+          {                                                             \
+            Int32ImageType* output = dynamic_cast<Int32ImageType*>(imageBase.GetPointer()); \
+            *buffer  =  reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \
+              *dim3 = output->GetNumberOfComponentsPerPixel();          \
+          }                                                             \
+        else if (dynamic_cast<UInt32ImageType*>(imageBase.GetPointer())) \
+          {                                                             \
+            UInt32ImageType* output = dynamic_cast<UInt32ImageType*>(imageBase.GetPointer()); \
+            *buffer = reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \
+              *dim3 = output->GetNumberOfComponentsPerPixel();          \
+          }                                                             \
+        else if (dynamic_cast<FloatImageType*>(imageBase.GetPointer())) \
+          {                                                             \
+            FloatImageType* output = dynamic_cast<FloatImageType*>(imageBase.GetPointer()); \
+            *buffer  =  reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \
+              *dim3 = output->GetNumberOfComponentsPerPixel();          \
+          }                                                             \
+        else if (dynamic_cast<DoubleImageType*>(imageBase.GetPointer())) \
+          {                                                             \
+            DoubleImageType* output = dynamic_cast<DoubleImageType*>(imageBase.GetPointer()); \
+            *buffer  =  reinterpret_cast<##PixelType##*>(output->GetBufferPointer()); \
+              *dim3 = output->GetNumberOfComponentsPerPixel();          \
+          }                                                             \
+        else                                                            \
+          {                                                             \
+            std::cerr << "unknown image type. cannot make a numpy array" << std::endl; \
+          }                                                             \
+      }
+
+       GetVectorImageAsNumpyArrayMacro(Float, float)
+       GetVectorImageAsNumpyArrayMacro(Int16, signed short)
+       GetVectorImageAsNumpyArrayMacro(Int32, signed int)
+       GetVectorImageAsNumpyArrayMacro(UInt8, unsigned char)
+       GetVectorImageAsNumpyArrayMacro(UInt16, unsigned short)
+       GetVectorImageAsNumpyArrayMacro(UInt32, unsigned int)
+       GetVectorImageAsNumpyArrayMacro(Double, double)
+#undef GetVectorImageAsNumpyArrayMacro
+
+} /* end of %extend */
+#endif /* OTB_SWIGNUMPY */
+
 protected:
   Application();
 #if SWIGJAVA
@@ -208,57 +402,357 @@ private:
   Application(const Application &);
   void operator =(const Application&);
 };
+
 DECLARE_REF_COUNT_CLASS( Application )
 
+
+    /* Int8 Int16 Int32 Int64 */
+    /* UInt8 UInt16 UInt32 UInt64 */
+    /* Float32 Double64 */
+    /* Complex32 Complex64 */
+
+    /* typedef signed char       Int8; */
+    /* typedef signed short      Int16; */
+    /* typedef signed int        Int32; */
+    /* typedef signed long      Int64; */
+    /* typedef unsigned char     UInt8; */
+    /* typedef unsigned short    UInt16; */
+    /* typedef unsigned int      UInt32; */
+    /* typedef unsigned long     UInt64; */
+    /* typedef float Float32; */
+    /* typedef double Float64; */
+
 #if SWIGPYTHON
-%extend Application {
-  %pythoncode {
-    def GetParameterValue(self, paramKey):
-       paramType = self.GetParameterType(paramKey)
-       if paramType in [ParameterType_InputProcessXML, ParameterType_Choice,
-                        ParameterType_String, ParameterType_InputFilename,
-                        ParameterType_OutputImage, ParameterType_OutputVectorData,
-                        ParameterType_OutputProcessXML, ParameterType_OutputFilename,
-                        ParameterType_Directory, ParameterType_InputImage,
-                        ParameterType_ComplexInputImage, ParameterType_InputVectorData]:
-          return self.GetParameterString(paramKey)
-
-       elif paramType in [ ParameterType_InputImageList, ParameterType_InputVectorDataList,
-                        ParameterType_InputFilenameList, ParameterType_StringList,
-                        ParameterType_ListView]:
-          return self.GetParameterStringList(paramKey)
-
-       elif paramType in [ParameterType_Int, ParameterType_Radius, ParameterType_RAM]:
-          return self.GetParameterInt(paramKey)
-
-       elif paramType in [ParameterType_Float]:
-          return self.GetParameterFloat(paramKey)
-
-       elif paramType in [ParameterType_Empty]:
-          return self.IsParameterEnabled(paramKey)
-
-       else:
-          print "Unsupported parameter type for '" + paramKey  + "'"
-          return None
-      }
+%pythoncode {
+import sys
+
+class ApplicationProxy(object):
+  def __init__(self, application, groupkey, value = None):
+    self.__dict__["application"] = application
+    self.__dict__["groupkey"] = groupkey
+    if value is not None:
+      self.__dict__["application"].SetParameterString(groupkey, value)
+
+  def __str__(self):
+      return self.__dict__["application"].GetParameterAsString(self.groupkey)
+
+  def __eq__(self, other):
+    if not type(other) == type(self):
+			return (self.__str__() == other)
+    else:
+			return (isinstance(other, self.__class__) and self.__dict__ == other.__dict__)
+
+  def __ne__(self, other):
+    return not self.__eq__(other)
+
+  def __getattr__(self,attr):
+    return self.__dict__["application"].GetParameterValue( self.groupkey + "." + attr.lower() )
+
+  def __setattr__(self,attr,value):
+    if attr not in self.__dict__:
+        return self.__dict__["application"].SetParameterValue( self.groupkey + "." + attr.lower(), value )
+    else:
+        return dict.__setattr__(self, attr, value)
+
+
+}
+#endif
+
+#if SWIGPYTHON
+/*Maybe TODO: change use a dict to  GetParameterTypeAsString */
+
+%extend Application
+{
+  %pythoncode
+    {
+
+		def __str__(self):
+			s  = self.GetDocName()
+
+		def GetParameterTypeAsString(self, parameter_type):
+			return {
+				ParameterType_InputProcessXML : 'ParameterType_InputProcessXML',
+				ParameterType_String : 'ParameterType_String',
+				ParameterType_InputFilename : 'ParameterType_InputFilename',
+				ParameterType_OutputImage : 'ParameterType_OutputImage',
+				ParameterType_OutputVectorData : 'ParameterType_OutputVectorData',
+				ParameterType_OutputProcessXML : 'ParameterType_OutputProcessXML',
+				ParameterType_OutputFilename : 'ParameterType_OutputFilename',
+				ParameterType_Directory : 'ParameterType_Directory',
+				ParameterType_InputImage : 'ParameterType_InputImage',
+				ParameterType_ComplexInputImage : 'ParameterType_ComplexInputImage',
+				ParameterType_InputVectorData : 'ParameterType_InputVectorData',
+				ParameterType_InputImageList : 'ParameterType_InputImageList',
+				ParameterType_InputVectorDataList : 'ParameterType_InputImageList',
+				ParameterType_InputFilenameList : 'ParameterType_InputFilenameList',
+				ParameterType_StringList : 'ParameterType_StringList',
+				ParameterType_ListView : 'ParameterType_ListView',
+				ParameterType_Int : 'ParameterType_Int',
+				ParameterType_Radius : 'ParameterType_Radius',
+				ParameterType_RAM : 'ParameterType_RAM',
+				ParameterType_Float : 'ParameterType_Float',
+				ParameterType_Empty : 'ParameterType_Empty',
+				ParameterType_Choice : 'ParameterType_Choice',
+				ParameterType_Group : 'ParameterType_Group',
+			}.get(parameter_type, 'ParameterType_UNKNOWN')
+
+		def __str__(self):
+			s  = self.GetDocName()
+			s += '\n'
+			s += self.GetDocLongDescription()
+			return s
+
+		def SetParameterValue(self, paramKey, value):
+			paramType = self.GetParameterType(paramKey)
+			if paramType in [ParameterType_InputProcessXML, ParameterType_RAM,
+											 ParameterType_String, ParameterType_InputFilename,
+											 ParameterType_OutputImage, ParameterType_OutputVectorData,
+											 ParameterType_OutputProcessXML, ParameterType_OutputFilename,
+											 ParameterType_Directory, ParameterType_InputImage,
+											 ParameterType_ComplexInputImage, ParameterType_InputVectorData]:
+			  return self.SetParameterString(paramKey, value)
+			elif paramType in [ParameterType_InputImageList, ParameterType_InputVectorDataList,
+												 ParameterType_InputFilenameList, ParameterType_StringList,
+												 ParameterType_ListView]:
+			  return self.setParameterStringList(paramKey, value)
+			elif paramType in [ParameterType_Int, ParameterType_Radius]:
+			  return self.SetParameterInt(paramKey, value)
+			elif paramType in [ParameterType_Float]:
+			  return self.SetParameterFloat(paramKey, value)
+			elif paramType in [ParameterType_Empty]:
+			  return self.EnableParameter(paramKey)
+			elif paramType in [ParameterType_Group]:
+			  return ApplicationProxy(self, paramKey)
+			elif paramType in [ParameterType_Choice]:
+			  return ApplicationProxy(self, paramKey, value)
+			else:
+			  print "Unsupported parameter type '%s' with key '%s'" %(self.GetParameterTypeAsString(paramType) ,paramKey)
+			return
+
+		def GetParameterValue(self, paramKey):
+			paramType = self.GetParameterType(paramKey)
+			if paramType in [ParameterType_InputProcessXML,
+											 ParameterType_String, ParameterType_InputFilename,
+											 ParameterType_OutputImage, ParameterType_OutputVectorData,
+											 ParameterType_OutputProcessXML, ParameterType_OutputFilename,
+											 ParameterType_Directory, ParameterType_InputImage,
+											 ParameterType_ComplexInputImage, ParameterType_InputVectorData]:
+			  return self.GetParameterString(paramKey)
+			elif paramType in [ParameterType_InputImageList, ParameterType_InputVectorDataList,
+												 ParameterType_InputFilenameList, ParameterType_StringList,
+												 ParameterType_ListView]:
+			  return self.GetParameterStringList(paramKey)
+			elif paramType in [ParameterType_Int, ParameterType_Radius, ParameterType_RAM]:
+			  return self.GetParameterInt(paramKey)
+			elif paramType in [ParameterType_Float]:
+			  return self.GetParameterFloat(paramKey)
+			elif paramType in [ParameterType_Empty]:
+			  return self.IsParameterEnabled(paramKey)
+			elif paramType in [ParameterType_Group, ParameterType_Choice]:
+			  return ApplicationProxy(self, paramKey)
+			else:
+			  print "Unsupported parameter type '%s' with key '%s'" %(self.GetParameterTypeAsString(paramType) ,paramKey)
+			return None
+
+		def __getattr__(self,attr):
+		  """
+		  __get_attribute__ is called whenever an instance request an attribute.
+		  eg: App.SetParameterString(), App.GetName() ..
+		  __getattr__ is only called if the attribute is not found by __get_attribute__ call
+		  So we keep hide the GetParameter** calls within this method so that it seems like
+		  an obivous call for users. App.IN , App.OUT , where 'in' and 'out' are
+		  parameters in the 'otb application' with instance App
+		  """
+		  if attr is not None:
+		    key_list = [k.upper() for k in self.GetParametersKeys(True)]
+		    if attr in key_list:
+		      return self.GetParameterValue(attr.lower())
+		    else:
+		      raise AttributeError
+
+		def __setattr__(self, attr, value):
+		  """
+		  __setattr__ is called if the attribute requested is not found in the attribute list.
+		  So these attributes are supposed to be 'key' of parameters used. Here we
+		  keep hide the SetParameter** calls within this method so that it seems like
+		  an obivous call for users. App.IN='my-input-file-name' , App.OUT='my-output-file-name'w
+		  here 'in' and 'out' are    parameters in the 'otb application' with instance App
+		  Ofcourse, we dont blindly accept any attributes as python, we check them against
+		  list of existing parameters for application with 'self.GetParametersKeys(True)'
+		  """
+		  if attr is not None:
+		    key_list = [k.upper() for k in self.GetParametersKeys(True)]
+		    if attr in key_list:
+		      self.SetParameterValue(attr.lower(), value)
+		    else:
+		      raise AttributeError
+
+    }
 }
+
 #endif
 
+
+#if OTB_SWIGNUMPY
+
+%extend Application
+{
+  %pythoncode
+    {
+    def SetImageFromNumpyArray(self, paramKey, npArray):
+      """
+      This method takes a numpy array and set ImageIOBase of
+      InputImageParameter by creating an otbImage with
+      same pixel type as numpyarray.dtype
+      """
+      if len(npArray.shape) == 3:
+         raise ValueError( "(len(npArray.shape) == 3)\n"
+                           "Input array given is of 3 dimension.\n"
+                           "SetImageFromNumpyArray create ImageIO from otbImage and thus demands a 2d array.\n"
+                           "you can either provide an 2d numpy array or use SetVectorImageFromNumpyArray depending on your application.\n")
+
+      dt = npArray.dtype.name
+      if dt == 'int8':
+        self.SetImageFromInt8NumpyArray_(paramKey, npArray)
+      elif dt == 'int16':
+        self.SetImageFromInt16NumpyArray_(paramKey, npArray)
+      elif dt == 'int32':
+        self.SetImageFromInt32NumpyArray_(paramKey, npArray)
+      elif dt == 'uint8':
+        self.SetImageFromUInt8NumpyArray_(paramKey, npArray)
+      elif dt == 'uint16':
+        self.SetImageFromUInt16NumpyArray_(paramKey, npArray)
+      elif dt == 'uint32':
+        self.SetImageFromUInt32NumpyArray_(paramKey, npArray)
+      elif dt == 'float':
+        self.SetImageFromFloatNumpyArray_(paramKey, npArray)
+      elif dt == 'double':
+        self.SetImageFromDoubleNumpyArray_(paramKey, npArray)
+      else:
+        self.SetImageFromFloatNumpyArray_(paramKey, npArray)
+      return
+
+    def SetVectorImageFromNumpyArray(self, paramKey, npArray):
+      """
+      This method takes a numpy array and set ImageIOBase of
+      InputImageParameter by creating an otbVectorImage with
+      same pixel type as numpyarray.dtype.
+      NOTE: Input (npArray) must be an ndarray with 3 dimension,
+      len(npArray.shape) must be > 2
+      """
+      if len(npArray.shape) < 3:
+        raise ValueError( "(len(npArray.shape) < 3)\n"
+                        "Input array given is not of 3 dimension.\n"
+                        "SetVectorImageFromNumpyArray create ImageIO from otbVectorImage and thus demands an array of shape 3.\n"
+                        "you can either provide an 3d numpy array or use SetImageFromNumpyArray depending on your application.\n")
+
+      dt = npArray.dtype.name
+      if dt == 'int8':
+        self.SetVectorImageFromInt8NumpyArray_(paramKey, npArray)
+      elif dt == 'int16':
+        self.SetVectorImageFromInt16NumpyArray_(paramKey, npArray)
+      elif dt == 'int32':
+        self.SetVectorImageFromInt32NumpyArray_(paramKey, npArray)
+      elif dt == 'uint8':
+        self.SetVectorImageFromUInt8NumpyArray_(paramKey, npArray)
+      elif dt == 'uint16':
+        self.SetVectorImageFromUInt16NumpyArray_(paramKey, npArray)
+      elif dt == 'uint32':
+        self.SetVectorImageFromUInt32NumpyArray_(paramKey, npArray)
+      elif dt == 'float':
+        self.SetVectorImageFromFloatNumpyArray_(paramKey, npArray)
+      elif dt == 'double':
+        self.SetVectorImageFromDoubleNumpyArray_(paramKey, npArray)
+      else:
+        self.SetVectorImageFromFloatNumpyArray_(paramKey, npArray)
+      return
+
+    def GetVectorImageAsNumpyArray(self, paramKey, dt='float'):
+      """
+      If datatype is unknown this method assumes to numpy.float32
+      Valid datatypes are:
+      int8, int16, int32, uint8, uint16, uint32, float, double.
+      NOTE: This method always return an numpy array with dimension 3
+      """
+      if dt == 'int8':
+        return self.GetVectorImageAsInt8NumpyArray_(paramKey)
+      elif dt == 'int16':
+        return self.GetVectorImageAsInt16NumpyArray_(paramKey)
+      elif dt == 'int32':
+        return self.GetVectorImageAsInt32NumpyArray_(paramKey)
+      elif dt == 'uint8':
+        return self.GetVectorImageAsUInt8NumpyArray_(paramKey)
+      elif dt == 'uint16':
+        return self.GetVectorImageAsUInt16NumpyArray_(paramKey)
+      elif dt == 'uint32':
+        return self.GetVectorImageAsUInt32NumpyArray_(paramKey)
+      elif dt == 'float':
+        return self.GetVectorImageAsFloatNumpyArray_(paramKey)
+      elif dt == 'double':
+        return self.GetVectorImageAsDoubleNumpyArray_(paramKey)
+      else:
+        print "Unknown datatype '" + dt + "'. Using float instead. Available types are:"
+        print "int8, int16, int32, uint8, uint16, uint32, float, double"
+        return self.GetVectorImageAsFloatNumpyArray_(paramKey)
+
+    def GetImageAsNumpyArray(self, paramKey, dt='float'):
+      """
+      If datatype is unknown this method assumes to numpy.float32
+      Valid datatypes are:
+      int8, int16, int32, uint8, uint16, uint32, float, double.
+      NOTE: This method always return an numpy array with dimension 3
+      """
+      if dt == 'int8':
+        numpy_vector_image = self.GetVectorImageAsInt8NumpyArray_(paramKey)
+      elif dt == 'int16':
+        numpy_vector_image = self.GetVectorImageAsInt16NumpyArray_(paramKey)
+      elif dt == 'int32':
+        numpy_vector_image = self.GetVectorImageAsInt32NumpyArray_(paramKey)
+      elif dt == 'uint8':
+        numpy_vector_image = self.GetVectorImageAsUInt8NumpyArray_(paramKey)
+      elif dt == 'uint16':
+        numpy_vector_image = self.GetVectorImageAsUInt16NumpyArray_(paramKey)
+      elif dt == 'uint32':
+        numpy_vector_image = self.GetVectorImageAsUInt32NumpyArray_(paramKey)
+      elif dt == 'float':
+        numpy_vector_image = self.GetVectorImageAsFloatNumpyArray_(paramKey)
+      elif dt == 'double':
+        numpy_vector_image = self.GetVectorImageAsDoubleNumpyArray_(paramKey)
+
+      else:
+        print "Unknown datatype '" + dt + "'. Using float instead. Available types are:"
+        print "int8, int16, int32, uint8, uint16, uint32, float, double"
+        numpy_vector_image = self.GetVectorImageAsFloatNumpyArray_(paramKey)
+
+      if len(numpy_vector_image.shape) > 2:
+        raise ValueError("len(numpy_vector_image.shape) > 2\n"
+                         "Output image from application is of 3 dimension (len(nparray.shape) > 2). \n"
+                         "GetImageFromNumpyArray returns an numpy array of dimension 2 that will result is loss of data.\n"
+                         "In this case you must use GetVectorImageFromNumpyArray which is capable of return a 3 dimension image.\n")
+
+      numpy_vector_image = numpy_vector_image[:,:,1]
+      return numpy_vector_image
+
+
+    }
+}
+
+#endif /* OTB_SWIGNUMPY */
+
 class Registry : public itkObject
 {
 public:
+
   static std::vector<std::string> GetAvailableApplications();
   static Application_Pointer CreateApplication(const std::string& name);
   static void AddApplicationPath(std::string newpath);
   static void SetApplicationPath(std::string newpath);
 
-
 protected:
   Registry();
   virtual ~Registry();
 };
 
-
 class AddProcessToWatchEvent : public itkEventObject
 {
 public:
diff --git a/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h b/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h
index 3bf3074..80459d3 100644
--- a/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h
+++ b/Modules/Wrappers/SWIG/src/otbWrapperSWIGIncludes.h
@@ -6,13 +6,16 @@
   Version:   $Revision$
 
 
-  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
-  See OTBCopyright.txt for details.
+  Copyright:
+    Centre National d'Etudes Spatiales,
+    CS Systemes d'information.
 
+ See OTBCopyright.txt, CSCopyright.txt for details.
+ All rights reserved.
 
-     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 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 __otbWrapperSWIGIncludes_h
@@ -27,5 +30,7 @@ typedef otb::Wrapper::Application::Pointer               Application_Pointer;
 typedef otb::Wrapper::ApplicationRegistry                Registry;
 typedef otb::Wrapper::AddProcessToWatchEvent             AddProcessToWatchEvent;
 typedef otb::Wrapper::DocExampleStructure                DocExampleStructure;
-
+typedef otb::Wrapper::Parameter                          Parameter;
+typedef otb::Wrapper::OutputImageParameter               OutputImageParameter;
+typedef otb::Wrapper::InputImageParameter                InputImageParameter;
 #endif
diff --git a/Modules/Wrappers/SWIG/test/java/CMakeLists.txt b/Modules/Wrappers/SWIG/test/java/CMakeLists.txt
index 993160e..3b0917f 100644
--- a/Modules/Wrappers/SWIG/test/java/CMakeLists.txt
+++ b/Modules/Wrappers/SWIG/test/java/CMakeLists.txt
@@ -1,7 +1,7 @@
 include( UseJava )
 
 set(TEST_DRIVER otbTestDriver
-    --add-before-env ITK_AUTOLOAD_PATH $<TARGET_FILE_DIR:otbapp_Smoothing>
+    --add-before-env OTB_APPLICATION_PATH $<TARGET_FILE_DIR:otbapp_Smoothing>
 )
 
 set( PATH_SEPARATOR ":")
diff --git a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt
index e51c82f..b3dbcfd 100644
--- a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt
+++ b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt
@@ -1,7 +1,7 @@
 set(TEST_DRIVER otbTestDriver
     --add-before-env PYTHONPATH        "${OTBSWIGWrapper_BINARY_DIR}/src"
     --add-before-env PYTHONPATH        $<TARGET_FILE_DIR:_otbApplication>
-    --add-before-env ITK_AUTOLOAD_PATH $<TARGET_FILE_DIR:otbapp_Smoothing> )
+    --add-before-env OTB_APPLICATION_PATH $<TARGET_FILE_DIR:otbapp_Smoothing> )
 
 add_test( NAME pyTvSmoothing
           COMMAND ${TEST_DRIVER} Execute
@@ -72,3 +72,20 @@ add_test( NAME pyTvBandMathInXML
                   ${TEMP}/pyTvBandMathInXML.tif
                   )
 
+add_test( NAME pyTvNumpyIO
+          COMMAND ${TEST_DRIVER} Execute
+                  ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonNumpyTest.py
+                  ${OTB_DATA_ROOT}/Examples/ROI_QB_MUL_1_SVN_CLASS_MULTI.png
+                  ${TEMP}/pyTvNumpyIO_SmoothingOut.png )
+
+add_test( NAME pyTvNewStyleParameters
+          COMMAND ${TEST_DRIVER} Execute
+          ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonNewStyleParametersTest.py
+          ${OTB_DATA_ROOT}/Input/poupees.tif
+          ${TEMP}/pyTvNewStyleParametersTest.tif
+          ${OTB_DATA_ROOT}/Input/apTvUtSmoothingTest_OutXML.xml)
+
+add_test( NAME pyTvNewStyleParametersInstanciateAll
+          COMMAND ${TEST_DRIVER} Execute
+          ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonNewStyleParametersInstanciateAllTest.py
+          )
diff --git a/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersInstanciateAllTest.py b/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersInstanciateAllTest.py
new file mode 100644
index 0000000..7151dc0
--- /dev/null
+++ b/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersInstanciateAllTest.py
@@ -0,0 +1,14 @@
+import otbApplication as otb
+import operator
+import inspect
+# List applications
+appNames = [app for app in otb.Registry.GetAvailableApplications()]
+for appName in appNames:
+	app = otb.Registry.CreateApplication(appName)
+	# Generate parameters
+	parameters = app.GetParametersKeys()
+	for param in parameters:
+		upParam = param.upper()
+		if app.HasValue(param):
+			operator.attrgetter(upParam)(app)
+
diff --git a/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py b/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py
new file mode 100644
index 0000000..9e05ab4
--- /dev/null
+++ b/Modules/Wrappers/SWIG/test/python/PythonNewStyleParametersTest.py
@@ -0,0 +1,130 @@
+# -*- coding: utf-8 -*-
+# Authors: Rashad Kanavath <rashad.kanavath at c-s.fr>
+#          Julien Malik <julien.malik at c-s.fr>
+#
+# Copyright: (c) CS Systemes d'information. All rights reserved
+#
+#  Example on the use of otb "pythonization"
+#
+from sys import argv
+import otbApplication as otb
+
+def cm_assert(a,b):
+	print "debug print before assert check: '%s'== '%s'" %(a, b)
+	assert a == b
+
+app = otb.Registry.CreateApplication('OrthoRectification')
+
+#test GetParameterTypeAsString() method in python.
+print app.GetParameterTypeAsString(otb.ParameterType_InputImage)
+print app.GetParameterTypeAsString(otb.ParameterType_String)
+print app.GetParameterTypeAsString(otb.ParameterType_Empty)
+
+# one test for each parameter type (string, float, int, ...)
+
+# # parameter group io.in
+# 1 - input image parameter set
+app.IO.IN = argv[1]
+cm_assert(app.GetParameterString('io.in'), argv[1])
+
+# 2 - input image parameter get
+cm_assert(app.IO.IN, argv[1])
+
+# # parameter group io.in
+# 3 - output image parameter set
+app.IO.OUT = argv[2]
+cm_assert(app.GetParameterString('io.out'), argv[2])
+
+# 4 - output image parameter get
+cm_assert(app.IO.OUT, argv[2])
+
+# 5 - choice with sub parameters set
+app.MAP = 'lambert2'
+cm_assert(app.GetParameterString('map'), 'lambert2')
+
+# 5.1 - choice with sub parameters get
+app.SetParameterString('map', 'wgs')
+cm_assert('wgs', app.MAP)
+
+# 5.2 - choice with sub parameters set
+app.MAP = 'lambert93'
+cm_assert('lambert93', app.GetParameterString('map'))
+
+# 5.3 - choice with sub parameters set
+app.SetParameterString('map', 'epsg')
+cm_assert(app.MAP, 'epsg')
+
+# 6 - int type 2nd level sub parameters of choice parameter set
+app.MAP.EPSG.CODE = 32768
+cm_assert(32768, app.GetParameterInt('map.epsg.code'))
+
+# 7 - another choice with sub parameters set
+app.MAP = 'utm'
+cm_assert('utm', app.GetParameterString('map'))
+
+# 8 - int type sub parameters of choice parameter set
+app.MAP.UTM.ZONE = 47
+cm_assert(47,app.GetParameterInt('map.utm.zone'))
+
+# 9 - int type sub parameters of choice parameter get
+app.SetParameterInt('map.utm.zone', 31)
+cm_assert(app.MAP.UTM.ZONE, 31)
+
+# 10 - bool type sub parameters of choice parameter get
+app.DisableParameter('map.utm.northhem')
+cm_assert(app.MAP.UTM.NORTHHEM, False)
+
+# 11 - bool type sub parameters of choice parameter set
+app.MAP.UTM.NORTHHEM = True
+cm_assert(True, app.IsParameterEnabled('map.utm.northhem') )
+
+#12 - simple choice parameter set
+app.OUTPUTS.MODE = 'auto'
+cm_assert('auto', app.GetParameterString('outputs.mode'))
+
+#13 - simple choice parameter get
+app.SetParameterString('outputs.mode', 'orthofit')
+cm_assert(app.OUTPUTS.MODE, 'orthofit')
+
+#14 - inputxml parameter set
+app.INXML = argv[3]
+cm_assert(app.GetParameterString('inxml'), argv[3])
+
+#15 - outputxml parameter get
+app.SetParameterString('outxml', 'output.xml')
+cm_assert("output.xml", app.OUTXML)
+
+#16 - parameter float get
+app.SetParameterFloat('elev.default', 5.0)
+cm_assert(5.0, app.ELEV.DEFAULT)
+
+#17 -parameter float set
+app.ELEV.DEFAULT = -2.5
+cm_assert(app.GetParameterFloat('elev.default'), -2.5)
+
+#18 - parameter ram get
+app.SetParameterString('opt.ram', '256')
+cm_assert(256, app.OPT.RAM)
+
+#19 - parameter ram set
+app.OPT.RAM = '512'
+cm_assert(app.GetParameterInt('opt.ram'), 512)
+
+#20 - parameter bool set
+app.OUTPUTS.ISOTROPIC = True
+cm_assert(app.IsParameterEnabled('outputs.isotropic'), True)
+
+#21 - parameter bool get
+app.DisableParameter('outputs.isotropic')
+cm_assert(False, app.OUTPUTS.ISOTROPIC)
+
+#Do not execute. we need LARGEINPUT. so we tried a small application
+#app.Execute()
+
+app = None
+
+app = otb.Registry.CreateApplication('Smoothing')
+app.IN = argv[1]
+app.TYPE='anidif'
+app.OUT = argv[2]
+app.ExecuteAndWriteOutput()
diff --git a/Modules/Wrappers/SWIG/test/python/PythonNumpyTest.py b/Modules/Wrappers/SWIG/test/python/PythonNumpyTest.py
new file mode 100644
index 0000000..7aee4e2
--- /dev/null
+++ b/Modules/Wrappers/SWIG/test/python/PythonNumpyTest.py
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+# Author: Rashad Kanavath <rashad.kanavath at c-s.fr>
+#
+# Copyright: (c) CS Systemes d'information. All rights reserved
+#
+#  Example on testing numpy
+#
+
+import sys
+import os
+#from scipy import misc
+
+import numpy as np
+import otbApplication
+
+#from PIL import Image as PILImage
+
+inFile  = sys.argv[1]
+outFile = sys.argv[2]
+# pilimage = PILImage.open(inFile)
+# npimage = np.asarray(pilimage)
+# print npimage.dtype
+
+ExtractROI = otbApplication.Registry.CreateApplication("ExtractROI")
+ExtractROI.SetParameterString("in", inFile)
+ExtractROI.SetParameterInt("startx", 10)
+ExtractROI.SetParameterInt("starty", 10)
+ExtractROI.SetParameterInt("sizex", 250)
+ExtractROI.SetParameterInt("sizey", 250)
+
+#Bug or Design ?.
+#Anyway below two is needed only for ExtractROI application
+ExtractROI.SetParameterUserValue("sizex", True)
+ExtractROI.SetParameterUserValue("sizey", True)
+ExtractROI.Execute()
+
+ExtractROIOut = ExtractROI.GetVectorImageAsNumpyArray("out", 'float')
+
+#write RGB image to file via python
+#misc.imsave('ExtractROIOut.jpg', ExtractROIOut)
+
+Rescale = otbApplication.Registry.CreateApplication("Rescale")
+#take numpy array from ExtractROI and feed into Rescale
+Rescale.SetVectorImageFromNumpyArray("in", ExtractROIOut)
+Rescale.SetParameterFloat("outmin", 50, True)
+Rescale.SetParameterFloat("outmax", 100, True)
+Rescale.Execute()
+
+RescaleOut = Rescale.GetVectorImageAsNumpyArray("out", 'float')
+#misc.imsave('RescaleOut.jpg', RescaleOut)
+
+Convert = otbApplication.Registry.CreateApplication("Convert")
+#take numpy output from Rescale application and feed into Convert
+Convert.SetVectorImageFromNumpyArray("in", RescaleOut)
+Convert.SetParameterString("out", "ConvertOut.png")
+Convert.ExecuteAndWriteOutput()
+ConvertOut = Convert.GetVectorImageAsNumpyArray("out", 'float')
+
+Smoothing = otbApplication.Registry.CreateApplication("Smoothing")
+#take numpy output from Convert application and feed into Smoothing
+Smoothing.SetVectorImageFromNumpyArray("in", ConvertOut)
+Smoothing.SetParameterString("type", 'anidif')
+Smoothing.SetParameterString("out", outFile)
+Smoothing.ExecuteAndWriteOutput()
diff --git a/README b/README
index ba5a440..65895a9 100644
--- a/README
+++ b/README
@@ -2,6 +2,8 @@ This is the ORFEO Toolbox README file.
 Please see the Copyright directory for legal issues on the use of the software.
 Install information is available in the OTB Software Guide which can be downloaded from http://www.orfeo-toolbox.org.
 
+Please report any issue you might encouter to our bugtracker; http://bugs.orfeo-toolbox.org
+
 Thank you.
 
 The OTB Development Team.
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index de7cd26..67a236a 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,94 @@
+OTB-v.5.2.0 - Changes since version 5.0.0 (2015/12/22)
+------------------------------------------
+* Library (the corresponding requests for changes are mentioned):
+
+  * Core
+    * Read, write and manage no-data flags (RFC-1 & RFC-14)
+    * Improve otb::DEMHandler interface (RFC-2)
+    * Build examples based on available modules in OTB installation (RFC-3)
+    * Helper functions for string operations using boost (RFC-6)
+    * Gdal 2.0 support (RFC-11)
+    * Enhancement of python wrapping (RFC-12)
+
+  * Machine Learning
+    * Provide quality index for classification
+    * Regression mode in OTB and OTBApp (RFC-7)
+
+  * SAR
+    * Add basic support for Sentinel1 Product (RFC-4)
+    * Update SAR radiometric calibration application in OTB (RFC-9)
+    * New applications for SAR processing (RFC-10)
+
+  * Applications
+    * Improve ApplicationRegistry for application loading (RFC-15)
+    * Provide a default output pixel type in applications (RFC-17)
+
+  * SuperBuild
+    * Provide a script to build the all-in-one SuperBuild archive (RFC-5)
+    * Upgrade dependencies versions in SuperBuild (RFC-19)
+    * New dependency : Freetype 2.6
+    * ITK 4.7.1 -> 4.8.1
+    * JPEG v9a -> turbo 1.4.1
+    * OpenThreads 3.2 -> 3.4
+    * Ossim r23092 -> r23537
+    * GeoTIFF 1.4.0 -> 1.4.1
+    * muParser 2.2.3 -> 2.2.5
+    * OpenCV 2.4.10 -> 2.4.11
+    * OpenSSL 1.0.1e -> 1.0.1p
+    * Qt 4.8.6 -> 4.8.7
+    * Swig 3.0.5 -> 3.0.7
+    * TIFF 4.0.3 -> 4.0.6
+
+* Bug fixed:
+
+  * Monteverdi2
+    * 0001120: Unwanted zoom-to-extent when loading second image
+    * 0001103: OutputProcessXMLParameter pre-initialization used even if disabled.
+    * 0001111: Geoid-file <arning message needs restart displayed when not needed.
+    * 0001118: Crash when restoring UI layout if quicklook view is visible at startup.
+    * 0001104: Crash as soon as I open an image
+    * 0001100: Crash when trying to Apply same parameters (dynamic, effects, color map...) on images with different number of bands
+    * 0001072: I18nCoreApplication::ElevationSetup() exceptions not displayed
+    * 0001070: otb::DEMHandler not updated properly when resetting DEM-directory and/or Geoid-file.
+
+  * OTB-Packaging
+    * 0001049: Last Monteverdi2 and Mapla release Win package crash when we try to import JP2 file
+
+  * Orfeo Toolbox (OTB)
+    * 0001051: CMake warnings when preparing SuperBuild configuration
+    * 0001068: crash in otbcli_LSMSSegmentation
+    * 0001080: there are some characters can not be recognized, which make compile errors
+    * 0001088: Fedora 22 copr repo for OTB
+    * 0001092: ITK (4.7.1) provided by SuperBuild do not compile with GCC version > 5
+    * 0001090: SuperBuild Openthread download link broken
+    * 0001081: GDAL RPC tags export prevent correct export of wkt in ortho-rectified image
+    * 0001056: ComputeImagesStatistics applications produces incorrect std
+    * 0001093: CMake with Ninja generator configure fails when OTB_USE_QT4=ON
+    * 0001084: Deactivate all 3rd part components in OpenCV configuration
+    * 0001077: Superbuild: Broken open scene graph archive link
+    * 0001069: Unable to install gdal python bindings in custom install directory with OTB Superbuild
+    * 0001065: Build OTB Examples based on available modules in OTB installation
+    * 0001075: prTeEstimateRPCSensorModelExampleTest  always failing in examples
+    * 0001074: Missing ITCopyright.txt in OTB sources
+    * 0001066: missing file(Capitole-Shadows) from OTB-Data
+    * 0001055: SuperBuild builds ogr2ogr without sqlite driver
+
+  * OTB-lib
+    * 0001082: ImageFileReader<> crashes after ApplicationRegistry::RefreshApplicationFactories() is called
+    * 0001098: Exception raised when typing in input process XML parameter
+    * 0001097: Cannot manually type in input vector data line-edit.
+    * 0001085: Add a ::GetInput() accessor  to QtWidgetOutputImage/FilenameParameter
+    * 0001083: Extended filename parameters not updated when calling ImageFileReader<>::SetFileName() several times
+    * 0001078: Exception thrown (OTB-Ice) when opening image without projection info
+    * 0001071: Add otb::DEMHandler ::ClearDEMDirectory() and ::ClearGeoidFile() interface.
+
+  * OTB-applications
+    * 0001119: Band Math X cannot manage large neighborhood (>=25x25 pixels)
+    * 0001112: File not found if filename contains accents when using GUI
+    * 0001059: Input and output image parameters require absolute path
+    * 0001076: Application ComputeImagesStatistics gives wrong standard deviation
+
+
 OTB-v.5.0.0 - Changes since version 4.4.0 (2015/05/28)
 ------------------------------------------
 
@@ -71,6 +162,7 @@ OTB-v.5.0.0 - Changes since version 4.4.0 (2015/05/28)
     * 0001014: OTB does not compile with ITK 4.8
     * 0000597: Optical calibration gives values greater than 100% on PHR products
     * 0001047: Convolution test needs ITK with USE_FFTD
+    * 0001030: When writing images with no SRS / kwl, a default WGS84 projection is assigned in gdalImageIO
 
   * OTB-applications
     * 0001032: otbgui_RadiometricIndices output image without spatial reference system EPSG code
diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt
index 64d3e25..4dbab71 100644
--- a/Utilities/Doxygen/CMakeLists.txt
+++ b/Utilities/Doxygen/CMakeLists.txt
@@ -94,7 +94,10 @@ foreach( var ${OTB_DOXYGEN_OUTPUT} )
 endforeach()
 
 set(OTB_DOXYGEN_ITK_TAGFILE "" CACHE FILEPATH "Tagfile containing ITK doxygen")
+mark_as_advanced(OTB_DOXYGEN_ITK_TAGFILE)
+
 set(OTB_DOXYGEN_ITK_DOXYGEN_URL "" CACHE STRING "URL to ITK doxygen")
+mark_as_advanced(OTB_DOXYGEN_ITK_DOXYGEN_URL)
 
 if(("${OTB_DOXYGEN_ITK_TAGFILE}" STREQUAL "") OR ("${OTB_DOXYGEN_ITK_DOXYGEN_URL}" STREQUAL ""))
   set(OTB_DOXYGEN_TAGFILE_FIELD "")
diff --git a/Utilities/Maintenance/SuperbuildDownloadList.sh b/Utilities/Maintenance/SuperbuildDownloadList.sh
index 9ab5004..0b7de70 100755
--- a/Utilities/Maintenance/SuperbuildDownloadList.sh
+++ b/Utilities/Maintenance/SuperbuildDownloadList.sh
@@ -1,2 +1,69 @@
 #/bin/bash
-grep "http" ../../SuperBuild/CMake/*.cmake | grep URL | cut -d "\"" -f 2 | sed "s/\/download$//" | sort | uniq
+
+export LC_ALL=C
+if [ $# -eq 2 ]; then
+DOWNLOAD_DIR=$(readlink -f $1)
+OUTPUT_DIR=$(readlink -f $2)
+else
+echo 'Usage: '$0' <download_directory> <archive_output_directory>'
+exit 1
+fi
+
+SB_CMAKE_DIR_REL=$(dirname $0)/../../SuperBuild/CMake
+SB_CMAKE_DIR=$(readlink -f ${SB_CMAKE_DIR_REL})
+
+DOWNLOAD_LIST=$(grep -h -E "^[^#]*\"https?://.*(\.tar\.gz|\.tar\.bz2|\.tgz|\.tar\.xz|\.zip|export=download).*\"" ${SB_CMAKE_DIR}/*.cmake | grep -o -E "https?://[^\"]*" | sed "s/\/\(download\)\?$//" | sort | uniq)
+
+DOWNLOAD_NAMES=
+
+mkdir -p ${DOWNLOAD_DIR}
+cd ${DOWNLOAD_DIR}
+
+echo "Start downloads..."
+
+for url in ${DOWNLOAD_LIST}; do
+  # clean log file
+  echo "" >download.log
+
+  file_name=$(echo "${url}" | grep -o -E "[^\/]+$")
+  docs_google=$(echo "${file_name}" | grep -F "export=download")
+  if [ "${docs_google}" = "" ]; then
+    echo "Download ${file_name}..."
+    wget -N ${url} -o download.log
+  else
+    # look into the original file for a valid download name
+    file_name=$(grep -h -A 3 -B 3 -F "${url}" ${SB_CMAKE_DIR}/*.cmake | grep -E "^[^#]*DOWNLOAD_NAME" | grep -o -E "[^ ]*\.(tar\.gz|tar\.bz2|tar\.xz|zip)" | uniq)
+    if [ -z "$file_name" ]; then
+      echo "Can't find correct filename for url ${url} : skip download"
+    else
+      echo "Download ${file_name}..."
+      wget -O ${file_name} ${url} -o download.log
+    fi
+  fi
+
+  download_errors=$(grep "ERROR" download.log)
+  if [ "$download_errors" != "" ]; then
+      echo "[OTB] Error downloading ${file_name}"
+      echo "[OTB] Check your internet connectivity first!."
+      echo "[OTB] Check your firewall or proxy settings and then try again."
+      echo "[OTB] If you find that ${url} is unavailable,"
+      echo "         please file a bug immediately on bugs.orfeo-toolbox.org."
+      echo "   "
+      cat download.log
+      exit 1
+  else
+    if [ "$file_name" != "" ]; then
+      DOWNLOAD_NAMES="${DOWNLOAD_NAMES} ${file_name}"
+    fi
+  fi
+done
+
+rm download.log
+
+echo "Create archive..."
+
+cd ${OUTPUT_DIR}
+tar -cjf SuperBuild-archives.tar.bz2 -C ${DOWNLOAD_DIR} ${DOWNLOAD_NAMES}
+
+echo "Compute md5sum..."
+md5sum SuperBuild-archives.tar.bz2 >SuperBuild-archives.md5

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/otb.git



More information about the Pkg-grass-devel mailing list