Request for Changes-89: Remove deprecated code for 6.0

From OTBWiki
Jump to: navigation, search

Status

  • Author: Guillaume Pasero, Victor Poughon
  • Additional Contributors: Julien Michel
  • Submitted on 13.04.2017
  • Proposed target release 6.0
  • Adopted : +4 from Victor, Julien, Rémi, Guillaume
  • Merged : d3bd4b1f55a88278f3ebbfea383decb46e8626be

Summary

Remove deprecated classes and methods. A new major release (6.0) is the right time to do this.

The migration guide at the end of the RFC give the API details.

Rationale

The change of major version number is the occasion to clean some deprecated code that has been present in OTB for a long time.

Implementation details

Classes and files

M	Modules/Adapters/GdalAdapters/include/otbGeometriesToGeometriesFilter.h
M	Modules/Adapters/OSSIMAdapters/include/otbMapProjectionAdapter.h
M	Modules/Core/Common/include/otbImageAndVectorImageOperationFilter.h
M	Modules/Core/Common/include/otbSystem.h
M	Modules/Core/Transform/include/otbGenericMapProjection.h
M	Modules/Core/Transform/include/otbGenericRSTransform.h
M	Modules/Core/VectorDataBase/include/otbPolygon.h
M	Modules/Filtering/ColorMap/include/otbScalarToRainbowRGBPixelFunctor.h
M	Modules/Filtering/DEM/include/otbDEMToImageGenerator.h
M	Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.h
M	Modules/Filtering/Projection/include/otbGeometriesProjectionFilter.h
M	Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h
M	Modules/Wrappers/CommandLine/include/otbWrapperCommandLineLauncher.h
M	Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx
M	Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.h
M	Modules/Learning/Supervised/include/otbConfusionMatrixCalculator.txx
D       Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.h
D       Modules/Feature/Edge/include/otbAssymmetricFusionOfLineDetectorImageFilter.txx

These modifications remove various functions which had name typos or were obsolete.

M	Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.h
M	Modules/Filtering/ImageManipulation/include/otbChangeInformationImageFilter.txx

itk::MetaDataDictionary hadn't any "Erase()" function prior to version 4.6. Now we use at least ITK 4.8.

D	Modules/Filtering/Projection/include/otbMapProjectionDeprecated.h
D	Modules/Filtering/Projection/include/otbMapProjectionDeprecated.txx
M	Modules/Filtering/Projection/include/otbMapProjections.h
M	Modules/Wrappers/ApplicationEngine/src/otbWrapperMapProjectionParametersHandler.cxx

The deprecated class otb::MapProjectionDeprecated has been removed.

D	Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.h
D	Modules/Filtering/VectorDataRendering/include/otbVectorDataToImageFilter.txx

The class otb::VectorDataToImageFilter (using Mapnik for rasterization) has been removed ( otb::OGRDataSourceToImageFilter should be used instead).

M	Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.h
M	Modules/Registration/Stereo/include/otbStereoSensorModelToElevationMapFilter.txx

No DEM has to be set in this filter, the otb::DEMHandler is used.

M       Examples/DisparityMap/FineRegistrationImageFilterExample.cxx
M       Examples/DisparityMap/NCCRegistrationFilterExample.cxx
M       Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx
M       Modules/Core/Transform/include/otbStreamingWarpImageFilter.h
M       Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx
M       Modules/Core/Transform/test/otbStreamingWarpImageFilter.cxx
D       Modules/ThirdParty/ITK/include/otbWarpImageFilter.h
D       Modules/ThirdParty/ITK/include/otbWarpImageFilter.txx

The OTB clone of itk::WarpImageFilter has been removed. In ITK versions greater than 4.8, our patches have been integrated.

Applications

M	Modules/Applications/AppClassification/app/CMakeLists.txt
M	Modules/Applications/AppClassification/app/otbComputeOGRLayersFeaturesStatistics.cxx
M	Modules/Applications/AppClassification/app/otbOGRLayerClassifier.cxx
D	Modules/Applications/AppClassification/app/otbTrainOGRLayersClassifier.cxx
M	Modules/Applications/AppClassification/test/CMakeLists.txt
M	Modules/Applications/AppSARCalibration/app/CMakeLists.txt
D	Modules/Applications/AppSARCalibration/app/otbSarRadiometricCalibration.cxx
M	Modules/Applications/AppSARCalibration/test/CMakeLists.txt

These two deprecated applications TrainOGRLayersClassifier and SarRadiometricCalibration have been removed, they already have clones.

M	Modules/Learning/Supervised/include/otbMachineLearningModel.h
M	Modules/Learning/Supervised/include/otbMachineLearningModel.txx
M	Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx
M       Modules/Applications/AppClassification/app/otbTrainRegression.cxx
M       Modules/Applications/AppClassification/app/otbTrainVectorClassifier.cxx
M       Modules/Applications/AppClassification/include/otbLearningApplicationBase.h
M       Modules/Applications/AppClassification/include/otbLearningApplicationBase.txx

The PredictAll() function has been replaced by PredictBatch(). At the same time, the interface of otb::Wrapper::LearningApplicationBase::Classify() has changed : the resulting predicted list sample is returned by the function.

M	Modules/Applications/AppProjection/app/otbObtainUTMZoneFromGeoPoint.cxx

Minor fix on the headers to include.

Tests

M	Modules/Filtering/Projection/test/CMakeLists.txt
M	Modules/Filtering/Projection/test/otbMapProjection.cxx
M	Modules/Filtering/Projection/test/otbMapProjectionsNew.cxx
D	Modules/Filtering/Projection/test/otbProjectionBaseNew.cxx
M	Modules/Filtering/Projection/test/otbProjectionTestDriver.cxx
M	Modules/Filtering/VectorDataRendering/test/CMakeLists.txt
M	Modules/Filtering/VectorDataRendering/test/otbVectorDataRenderingTestDriver.cxx
D	Modules/Filtering/VectorDataRendering/test/otbVectorDataToImageFilter.cxx

Test updated due to removal of otb::MapProjectionDeprecated and otb::VectorDataToImageFilter.

Migration of SVMLearning module

This section describes what happened to the SVMLearning module : all the sources in it have been removed.

D	Modules/Learning/SVMLearning/CMakeLists.txt
D	Modules/Learning/SVMLearning/include/otbExhaustiveExponentialOptimizer.h
D	Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.h
D	Modules/Learning/SVMLearning/include/otbLabelMapSVMClassifier.txx
D	Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.h
D	Modules/Learning/SVMLearning/include/otbObjectDetectionClassifier.txx
D	Modules/Learning/SVMLearning/include/otbSVMClassifier.h
D	Modules/Learning/SVMLearning/include/otbSVMClassifier.txx
D	Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.h
D	Modules/Learning/SVMLearning/include/otbSVMCrossValidationCostFunction.txx
D	Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.h
D	Modules/Learning/SVMLearning/include/otbSVMImageClassificationFilter.txx
D	Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.h
D	Modules/Learning/SVMLearning/include/otbSVMImageClassificationWithRuleFilter.txx
D	Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.h
D	Modules/Learning/SVMLearning/include/otbSVMImageModelEstimator.txx
D	Modules/Learning/SVMLearning/include/otbSVMMarginSampler.h
D	Modules/Learning/SVMLearning/include/otbSVMMarginSampler.txx
D	Modules/Learning/SVMLearning/include/otbSVMModel.h
D	Modules/Learning/SVMLearning/include/otbSVMModel.txx
D	Modules/Learning/SVMLearning/include/otbSVMModelEstimator.h
D	Modules/Learning/SVMLearning/include/otbSVMModelEstimator.txx
D	Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.h
D	Modules/Learning/SVMLearning/include/otbSVMPointSetModelEstimator.txx
D	Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.h
D	Modules/Learning/SVMLearning/include/otbSVMSampleListModelEstimator.txx
D	Modules/Learning/SVMLearning/otb-module.cmake
D	Modules/Learning/SVMLearning/src/CMakeLists.txt
D	Modules/Learning/SVMLearning/src/otbExhaustiveExponentialOptimizer.cxx
D	Modules/Learning/SVMLearning/test/CMakeLists.txt
D	Modules/Learning/SVMLearning/test/otbExhaustiveExponentialOptimizerNew.cxx
D	Modules/Learning/SVMLearning/test/otbExhaustiveExponentialOptimizerTest.cxx
D	Modules/Learning/SVMLearning/test/otbLabelMapSVMClassifier.cxx
D	Modules/Learning/SVMLearning/test/otbObjectDetectionClassifier.cxx
D	Modules/Learning/SVMLearning/test/otbSVMClassifierNew.cxx
D	Modules/Learning/SVMLearning/test/otbSVMClassifierPointSet.cxx
D	Modules/Learning/SVMLearning/test/otbSVMCrossValidationCostFunctionNew.cxx
D	Modules/Learning/SVMLearning/test/otbSVMImageClassificationFilter.cxx
D	Modules/Learning/SVMLearning/test/otbSVMImageClassificationFilterNew.cxx
D	Modules/Learning/SVMLearning/test/otbSVMImageClassificationWithRuleFilter.cxx
D	Modules/Learning/SVMLearning/test/otbSVMImageClassificationWithRuleFilterNew.cxx
D	Modules/Learning/SVMLearning/test/otbSVMImageModelEstimatorModelAccessor.cxx
D	Modules/Learning/SVMLearning/test/otbSVMImageModelEstimatorNew.cxx
D	Modules/Learning/SVMLearning/test/otbSVMImageModelEstimatorTrain.cxx
D	Modules/Learning/SVMLearning/test/otbSVMImageModelEstimatorTrainOneClass.cxx
D	Modules/Learning/SVMLearning/test/otbSVMLearningTestDriver.cxx
D	Modules/Learning/SVMLearning/test/otbSVMMarginSampler.cxx
D	Modules/Learning/SVMLearning/test/otbSVMModelAccessor.cxx
D	Modules/Learning/SVMLearning/test/otbSVMModelCopyTest.cxx
D	Modules/Learning/SVMLearning/test/otbSVMModelLoad.cxx
D	Modules/Learning/SVMLearning/test/otbSVMModelLoadSave.cxx
D	Modules/Learning/SVMLearning/test/otbSVMModelNew.cxx
D	Modules/Learning/SVMLearning/test/otbSVMPointSetModelEstimatorNew.cxx
D	Modules/Learning/SVMLearning/test/otbSVMPointSetModelEstimatorTrain.cxx
D	Modules/Learning/SVMLearning/test/otbSVMSampleListModelEstimatorTest.cxx

Some classes have been revamped into the Supervised module. In particular, the deprecated otb::SVMModel has been ported into otb::LibSVMMachineLearningModel :

A	Modules/Learning/Supervised/include/otbExhaustiveExponentialOptimizer.h
A	Modules/Learning/Supervised/include/otbLabelMapClassifier.h
A	Modules/Learning/Supervised/include/otbLabelMapClassifier.txx
M	Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.h
M	Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx
A	Modules/Learning/Supervised/include/otbSVMCrossValidationCostFunction.h
A	Modules/Learning/Supervised/include/otbSVMCrossValidationCostFunction.txx
A	Modules/Learning/Supervised/include/otbSVMMarginSampler.h
A	Modules/Learning/Supervised/include/otbSVMMarginSampler.txx
M	Modules/Learning/Supervised/otb-module.cmake
M	Modules/Learning/Supervised/src/CMakeLists.txt
A	Modules/Learning/Supervised/src/otbExhaustiveExponentialOptimizer.cxx
M	Modules/Learning/Supervised/test/CMakeLists.txt
A	Modules/Learning/Supervised/test/otbExhaustiveExponentialOptimizerNew.cxx
A	Modules/Learning/Supervised/test/otbExhaustiveExponentialOptimizerTest.cxx
A	Modules/Learning/Supervised/test/otbLabelMapClassifier.cxx
A	Modules/Learning/Supervised/test/otbSVMCrossValidationCostFunctionNew.cxx
A	Modules/Learning/Supervised/test/otbSVMMarginSampler.cxx
M	Modules/Learning/Supervised/test/otbSupervisedTestDriver.cxx
M	Modules/Learning/Supervised/test/otbTrainMachineLearningModel.cxx
M	Modules/Learning/Supervised/test/tests-libsvm.cmake

The refactored otb::LibSVMMachineLearningModel offers the same features as the previous model, but with a different interface. It is compliant with the interface defined by the base class otb::MachineLearningModel. In order to expose the output probabilities and hyperplane distances, different confidence modes have been introduced. The optional confidence output in function "TargetType Predict(SampleType s, double *c)" has been used to output vectors of probabilities and hyperplane distances. However, the PredictBatch() function will not be able to work with these output vectors since it assumes that the ConfidenceSampleType is an itk::FixedArray<double,1>. Further work is needed to generalize the confidence output to vector types and not scalar types. In the case of LibSVM, the probabilities and hyperplane distances are obtained in a double* buffer, and no intermediate buffer is used to convert TConfidenceValue to/from double. So in the case of LibSVM model, the TConfidenceValue type has to be double (which is the default).

One class (otb::ObjectDetectionClassifier) has been moved to ObjectDetection module :

A	Modules/Detection/ObjectDetection/include/otbObjectDetectionClassifier.h
A	Modules/Detection/ObjectDetection/include/otbObjectDetectionClassifier.txx
A	Modules/Detection/ObjectDetection/test/otbObjectDetectionClassifier.cxx
M	Modules/Detection/ObjectDetection/test/otbObjectDetectionTestDriver.cxx

A small addition has been made to filter all the log messages from LibSVM (unless OTB_SHOW_ALL_MSG_DEBUG is set). It uses the libsvm function svm_set_print_string_function to redirect the print function to a function that does nothing (otb::Utils::PrintNothing) :

M	Modules/Core/Common/include/otbUtils.h
M	Modules/Core/Common/src/otbUtils.cxx

Other modules were using the deprecated SVMModel in their tests, it has been replaced by the refactored otb::LibSVMMachineLearningModel.

M	Modules/Radiometry/Simulation/otb-module.cmake
M	Modules/Radiometry/Simulation/test/otbAtmosphericCorrectionsRSRSVMClassifier.cxx
M	Modules/Radiometry/Simulation/test/otbImageSimulationMethodSVMClassif.cxx
M	Modules/Radiometry/Simulation/test/otbReduceSpectralResponseSVMClassifier.cxx
M	Modules/Detection/ObjectDetection/otb-module.cmake
M	Modules/Detection/ObjectDetection/test/CMakeLists.txt
M	Modules/Detection/ObjectDetection/test/otbDescriptorsListSampleGenerator.cxx

Documentation

The following table contains the MIGRATION GUIDE for version 6.0. The first column shows the impacted Classes and Functions(). The 2nd column gives the action done on the impacted code. The 3rd column gives a potential replacement class/function (by default, the replacement function is in the same class).


Deprecated code Action Replacement Details
otb::GeometriesToGeometriesFilter::DoFinalizeInitialisation() Removed DoFinalizeInitialization() typo
otb::MapProjectionAdapter::InstanciateProjection() Removed InstantiateProjection() typo
TrainOGRLayersClassifier (OTB application) Removed TrainVectorClassifier all ML models supported
SarRadiometricCalibration (OTB application) Removed SARCalibration
otb::ImageAndVectorImageOperationFilter::GetUseSubstraction() Removed GetUseSubtraction() typo
otb::System::ParseFileNameForAdditonalInfo() Removed ParseFileNameForAdditionalInfo() typo
otb::GenericMapProjection::InstanciateProjection() Removed InstantiateProjection() typo
otb::GenericRSTransform::InstanciateTransform() Removed InstantiateProjection() typo
otb::Polygon::GetSurface() Removed GetArea()
otb::AssymmetricFusionOfLineDetectorImageFilter Removed otb:: AsymmetricFusionOfLineDetectorImageFilter typo
otb::ObjectDetectionClassifier Refactored Moved to ObjectDetection, now supports any ML model
otb::ObjectDetectionClassifier::SetSVMModel() Changed to SetModel()
otb::ObjectDetectionClassifier::GetSVMModel() Changed to GetModel()
otb::Functor::ScalarToRainbowRGBPixelFunctor::SetMaximum() Removed SetMaximumInputValue()
otb::Functor::ScalarToRainbowRGBPixelFunctor::SetMinimum() Removed SetMinimumInputValue()
otb::DEMToImageGenerator::InstanciateTransform() Removed InstantiateTransform() typo
otb::ChangeInformationImageFilter::RemoveKeyFromDictionary() Removed itk::MetaDataDictionary::Erase() Valid after ITK 4.6
otb::StreamingShrinkImageFilter::GetShrinkedOutput() Removed GetShrunkOutput() typo
otb::GeometriesProjectionFilter::DoFinalizeInitialisation() Removed DoFinalizeInitialization() typo
otb::MapProjectionDeprecated Removed otb::GenericMapProjection
otb::VectorDataProjectionFilter::InstanciateTransform() Removed InstantiateTransform() typo
otb::VectorDataToImageFilter Removed otb::OGRDataSourceToLabelImageFilter
otb::ExhaustiveExponentialOptimizer Moved into Supervised module
otb::LabelMapSVMClassifier Refactored otb::LabelMapClassifier moved to Supervised, now support any ML model
otb::SVMClassifier Removed otb::LibSVMMachineLearningModel
otb::SVMCrossValidationCostFunction Refactored moved into OTBSupervised module, adapted for otb::LibSVMMachineLearningModel
otb::SVMImageClassificationFilter Removed otb::ImageClassificationFilter
otb::SVMImageClassificationWithRuleFilter Removed otb::ImageClassificationFilter The replacement filter only support a scalar output confidence index (difference between highest and second highest probabilities)
otb::SVMImageModelEstimator Removed Fallback strategy is to iterate over an Image and fill two ListSamples (samples and labels), and call Train()
otb::SVMMarginSampler Refactored Moved to OTBSupervised, adapted for otb::LibSVMMachineLearningModel
otb::SVMModel Refactored otb::LibSVMMachineLearningModel The model implementation has been reused in LibSVMMachineLearningModel
otb::SVMModelEstimator Refactored otb::LibSVMMachineLearningModel Estimator implementation reused in LibSVMMachineLearningModel
otb::SVMPointSetModelEstimator Removed Fallback strategy is to iterate the PointSet and fill two ListSamples (samples and labels), and call Train()
otb::SVMSampleListModelEstimator Removed The Train() function already uses ListSamples
otb::ConfusionMatrixCalculator::Update() Removed Compute()
otb::LibSVMMachineLearningModel Refactored Now contains the whole model implementation (coming from otb::SVMModel and otb::SVMModelEstimator). The output of probabilities and hyperplane distances are done through the optional confidence index output. There is a ConfidenceMode setting that allow to choose between a scalar confidence index, the full vector of probabilities and the vector of hyperplane distances. A 'double' buffer can be given to Predict() in order to retrieve these values. However the PredictBatch() method doesn't support vector confidence outputs for now.
otb::MachineLearningModel::PredictAll() Removed PredictBatch()
void otb::Wrapper::LearningApplicationBase:: Classify(in,out,model) API change TargetListSample otb::Wrapper::LearningApplicationBase:: Classify(in,model) The output predicted list sample isn't anymore a parameter of the function, it is the returned value.
otb::Wrapper::CommandLineLauncher::

CommandLineLauncher(const char * exp)

Removed CommandLineLauncher() Use default constructor instead
otb::WarpImageFilter Removed itk::WarpImageFilter Patches integrated in ITK 4.8

Additional notes

List remaining open issues if any, and additional notes.