Request for changes-122: Positive spacing enforcement

From OTBWiki
Jump to: navigation, search

[Request for changes-122] Positive spacing enforcement

Status

Summary

This RFC aims at imposing a positive spacing for an otb image, but keeping the information of the sign in the direction.

Rationale

With ITK 4.12.2 , positive spacing is enforced.

See : https://github.com/InsightSoftwareConsortium/ITK/commit/d447f0452bb5ea92a555e630d05b57da535bd3a9 and : https://github.com/InsightSoftwareConsortium/ITK/commit/7501479a970694b0dd4a8c4bbf7cbcc033fe059c

Implementation details

Classes and files

Basically we just add Get/SetSignedSpacing() in otbImage and otbVectorImage. Then we sed on the whole code to replace Set/GetSpacing() with Set/GetSignedSpacing() when used on an otbImage or otbVectorImage. If used on itkBaseImage we add a template function in otbImage.h. As the modifications are effective as soon as the image is read and end when it is written we do not need to modify any IO. We only enforce use of direction in GDALIO in case it is uses outside of the classical file writer.

M       Examples/DataRepresentation/Image/Image4.cxx
M       Examples/DataRepresentation/Path/PolyLineParametricPath1.cxx
M       Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx
M       Examples/FeatureExtraction/RightAngleDetectionExample.cxx
M       Examples/FeatureExtraction/SURFExample.cxx
M       Examples/IO/MetadataExample.cxx
M       Examples/Iterators/ImageLinearIteratorWithIndex2.cxx
M       Examples/Iterators/ImageRegionIterator.cxx
M       Examples/Patented/EstimateAffineTransformationExample.cxx
M       Examples/Patented/SIFTDisparityMapEstimation.cxx
M       Examples/Patented/SIFTExample.cxx
M       Examples/Patented/SIFTFastExample.cxx
M       Examples/Projections/GeometriesProjectionExample.cxx
M       Examples/Projections/SensorModelExample.cxx
M       Examples/Projections/VectorDataExtractROIExample.cxx
M       Examples/Projections/VectorDataProjectionExample.cxx
M       Examples/Registration/ImageRegistration1.cxx
M       Examples/Registration/ImageRegistration2.cxx
M       Examples/Registration/ImageRegistration5.cxx
M       Examples/Registration/ImageRegistration9.cxx
M       Modules/Core/Common/include/otbImportImageFilter.h
M       Modules/Core/Common/include/otbImportImageFilter.txx
M       Modules/Core/Common/include/otbImportVectorImageFilter.h
M       Modules/Core/Common/include/otbImportVectorImageFilter.txx
M       Modules/Core/ImageBase/include/otbExtractROIBase.txx
M       Modules/Core/ImageBase/include/otbImage.h
M       Modules/Core/ImageBase/include/otbImage.txx
M       Modules/Core/ImageBase/include/otbVectorImage.h
M       Modules/Core/ImageBase/include/otbVectorImage.txx
M       Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx
M       Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx
M       Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx
M       Modules/Core/Transform/include/otbGenericRSTransform.h
M       Modules/Core/Transform/include/otbStreamingWarpImageFilter.h
M       Modules/Core/Transform/include/otbStreamingWarpImageFilter.txx
M       Modules/Core/VectorDataBase/include/otbVectorData.h
M       Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx
M       Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx
M       Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx
M       Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx
M       Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx
M       Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx
M       Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx
M       Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx
M       Modules/Feature/Edge/include/otbLineSegmentDetector.txx
M       Modules/Feature/Edge/include/otbLocalHoughFilter.txx
M       Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx
M       Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx
M       Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx
M       Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx
M       Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx
M       Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx
M       Modules/Filtering/DEM/include/otbDEMToImageGenerator.h
M       Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx
M       Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx
M       Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.h
M       Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx
M       Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx
M       Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx
M       Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx
M       Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx
M       Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx
M       Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx
M       Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx
M       Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx
M       Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx
M       Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx
M       Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx
M       Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h
M       Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx
M       Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h
M       Modules/Filtering/Statistics/include/otbListSampleGenerator.txx
M       Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h
M       Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx
M       Modules/IO/IOGDAL/src/otbGDALImageIO.cxx
M       Modules/IO/ImageIO/include/otbImageFileReader.txx
M       Modules/IO/ImageIO/include/otbImageFileWriter.txx
M       Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx
M       Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx
M       Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h
M       Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.txx
M       Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx
M       Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx
M       Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx
M       Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx
M       Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx
M       Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx
M       Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx
M       Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx
M       Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx
M       Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx
M       Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx
M       Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx
M       Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx
M       Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx
M       Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx
M       Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx
M       Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h
M       Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx
M       Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx
M       Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h
M       Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx
M       Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h
M       Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h
M       Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx
M       Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx
M       Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx
M       Modules/Wrappers/SWIG/src/otbApplication.i

And in Monteverdi and Ice : few occurrences that concern otbImages. Most of the work is done internally so those modifications should be enough.

M:   Modules/Visualization/Ice/src/otbGlImageActor.cxx
M:   Modules/Visualization/Ice/src/otbNonOptGlImageActor.cxx
M:   Modules/Visualization/MonteverdiCore/include/mvdAbstractImageModel.h
M:   Modules/Visualization/MonteverdiCore/src/mvdVectorImageModel.cxx

Applications

M       Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx
M       Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx
M       Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx
M       Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx
M       Modules/Applications/AppProjection/app/otbOrthoRectification.cxx
M       Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx
M       Modules/Applications/AppProjection/app/otbSuperimpose.cxx
M       Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx
M       Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx
M       Modules/Applications/AppStereo/app/otbStereoFramework.cxx
M       Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx
M       Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx
M       Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx

Tests

M       Modules/Core/ImageBase/test/otbImageTest.cxx
M       Modules/Core/ImageBase/test/otbVectorImageTest.cxx
M       Modules/Core/Interpolation/test/otbProlateValidationTest.cxx
M       Modules/Core/LabelMap/test/otbLabelObjectMapVectorizer.cxx
M       Modules/Feature/Density/test/otbPointSetToDensityImageFilterTest.cxx
M       Modules/Feature/Descriptors/test/otbFourierMellinDescriptors.cxx
M       Modules/Feature/Descriptors/test/otbHistogramOfOrientedGradientCovariantImageFunction.cxx
M       Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx
M       Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputImage.cxx
M       Modules/Feature/Moments/test/otbFlusserMomentsImageFunction.cxx
M       Modules/Feature/Moments/test/otbHuMomentsImageFunction.cxx
M       Modules/Filtering/ImageManipulation/test/otbGridResampleImageFilter.cxx
M       Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx
M       Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx
M       Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromGeoToMap.cxx
M       Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToImage.cxx
M       Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToSensor.cxx
M       Modules/Filtering/Projection/test/otbImportGeoInformationImageFilter.cxx
M       Modules/Filtering/Projection/test/otbTileImageFilterRSTransformTest.cxx
M       Modules/Filtering/Projection/test/otbVectorDataIntoImageProjectionFilterTest.cxx
M       Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToImage.cxx
M       Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToSensor.cxx
M       Modules/Filtering/Projection/test/otbVectorDataTransformFilter.cxx
M       Modules/Filtering/Statistics/test/otbContinuousMinimumMaximumImageCalculatorTest.cxx
M       Modules/Filtering/VectorDataRendering/test/otbVectorDataToMapFilterSensorModel.cxx
M       Modules/IO/ExtendedFilename/test/otbExtendedFilenameTest.cxx
M       Modules/IO/ImageIO/test/otbImageFileReaderMSTAR.cxx
M       Modules/IO/ImageIO/test/otbImageFileWriterTestWithoutInput.cxx
M       Modules/IO/ImageIO/test/otbImageStreamingFileWriterTestWithoutInput.cxx
M       Modules/IO/ImageIO/test/otbVectorImageFileWriterTestWithoutInput.cxx
M       Modules/IO/ImageIO/test/otbVectorImageStreamingFileWriterTestWithoutInput.cxx
M       Modules/IO/TestKernel/src/otbTestHelper.cxx
M       Modules/IO/VectorDataIO/test/otbVectorDataFileGeoReaderWriter.cxx
M       Modules/Learning/SOM/test/otbSOMClassifier.cxx
M       Modules/Learning/Sampling/test/otbOGRDataToClassStatisticsFilterTest.cxx
M       Modules/Learning/Sampling/test/otbOGRDataToSamplePositionFilterTest.cxx
M       Modules/Segmentation/Conversion/test/otbLabelMapToVectorDataFilter.cxx

Two baselines have been modified as the printself of an image now gives an unsigned spacing and a signed direction.

Documentation

In order to avoid confusion and to keep the use of spacing as it was before we implemented a GetSignedSpacing() and a SetSignedSpacing(). Those two methods just combine the Get/SetSpacing() and Get/SetDirection() of itk and do the calculation.

Additional notes

Warning : spacing and direction are still accessible through the corresponding methods.