From 9b5d6859f3f483fff6ff07a4ae013d821c0d925d Mon Sep 17 00:00:00 2001 From: Antoine Regimbeau <antoine.regimbeau@c-s.fr> Date: Wed, 25 Oct 2017 17:50:11 +0200 Subject: [PATCH] BUG : NOT COMPILING! :result of sed modification for Get and set signed spacing --- Examples/DataRepresentation/Image/Image4.cxx | 10 +-- .../Path/PolyLineParametricPath1.cxx | 2 +- .../SimpleDisparityMapEstimationExample.cxx | 4 +- .../RightAngleDetectionExample.cxx | 2 +- Examples/FeatureExtraction/SURFExample.cxx | 2 +- Examples/IO/MetadataExample.cxx | 2 +- .../ImageLinearIteratorWithIndex2.cxx | 4 +- Examples/Iterators/ImageRegionIterator.cxx | 4 +- .../EstimateAffineTransformationExample.cxx | 2 +- .../Patented/SIFTDisparityMapEstimation.cxx | 2 +- Examples/Patented/SIFTExample.cxx | 2 +- Examples/Patented/SIFTFastExample.cxx | 2 +- .../GeometriesProjectionExample.cxx | 2 +- Examples/Projections/SensorModelExample.cxx | 4 +- .../VectorDataExtractROIExample.cxx | 8 +-- .../VectorDataProjectionExample.cxx | 2 +- Examples/Registration/ImageRegistration1.cxx | 2 +- Examples/Registration/ImageRegistration2.cxx | 2 +- Examples/Registration/ImageRegistration5.cxx | 6 +- Examples/Registration/ImageRegistration9.cxx | 2 +- .../otbComputePolylineFeatureFromImage.cxx | 6 +- .../app/otbHomologousPointsExtraction.cxx | 2 +- .../AppEdge/app/otbLineSegmentDetection.cxx | 2 +- .../AppImageUtils/app/otbReadImageInfo.cxx | 4 +- .../app/otbOrthoRectification.cxx | 2 +- .../app/otbRigidTransformResample.cxx | 6 +- .../AppProjection/app/otbSuperimpose.cxx | 4 +- .../app/otbVectorDataReprojection.cxx | 4 +- .../app/otbConnectedComponentSegmentation.cxx | 2 +- .../AppStereo/app/otbStereoFramework.cxx | 6 +- .../otbStereoRectificationGridGenerator.cxx | 6 +- .../app/otbRasterization.cxx | 2 +- .../app/otbVectorDataTransform.cxx | 4 +- .../Common/include/otbImportImageFilter.h | 2 +- .../Common/include/otbImportImageFilter.txx | 2 +- .../include/otbImportVectorImageFilter.h | 2 +- .../include/otbImportVectorImageFilter.txx | 2 +- .../ImageBase/include/otbExtractROIBase.txx | 4 +- Modules/Core/ImageBase/include/otbImage.h | 8 +++ Modules/Core/ImageBase/test/otbImageTest.cxx | 2 +- .../ImageBase/test/otbVectorImageTest.cxx | 2 +- .../otbBSplineInterpolateImageFunction.txx | 2 +- .../test/otbProlateValidationTest.cxx | 2 +- .../otbShapeAttributesLabelMapFilter.txx | 14 ++--- .../test/otbLabelObjectMapVectorizer.cxx | 2 +- .../otbSpatialObjectToImageDrawingFilter.txx | 4 +- .../Transform/include/otbGenericRSTransform.h | 4 +- .../VectorDataBase/include/otbVectorData.h | 2 +- .../otbGenericRoadExtractionFilter.txx | 2 +- .../include/otbImageToPathListAlignFilter.txx | 2 +- .../include/otbKeyPointDensityImageFilter.txx | 2 +- .../otbPointSetToDensityImageFilter.txx | 2 +- .../otbPointSetToDensityImageFilterTest.cxx | 2 +- ...rwardFourierMellinTransformImageFilter.txx | 2 +- .../otbImageToSIFTKeyPointSetFilter.txx | 10 +-- .../otbImageToSURFKeyPointSetFilter.txx | 2 +- .../test/otbFourierMellinDescriptors.cxx | 2 +- ...mageToSIFTKeyPointSetFilterDistanceMap.cxx | 6 +- ...mageToSIFTKeyPointSetFilterOutputImage.cxx | 2 +- .../otbHoughTransform2DLinesImageFilter.txx | 2 +- .../Edge/include/otbLineSegmentDetector.txx | 2 +- .../Edge/include/otbLocalHoughFilter.txx | 2 +- .../otbTouziEdgeDetectorImageFilter.txx | 2 +- .../test/otbFlusserMomentsImageFunction.cxx | 2 +- .../test/otbHuMomentsImageFunction.cxx | 2 +- .../include/otbAddCarvingPathFilter.txx | 4 +- .../include/otbRemoveCarvingPathFilter.txx | 4 +- ...otbScalarImageToAdvancedTexturesFilter.txx | 4 +- ...ScalarImageToHigherOrderTexturesFilter.txx | 4 +- .../otbScalarImageToTexturesFilter.txx | 4 +- .../DEM/include/otbDEMToImageGenerator.h | 2 +- .../DEM/include/otbDEMToImageGenerator.txx | 2 +- .../include/otbGridResampleImageFilter.txx | 14 ++--- .../otbStreamingResampleImageFilter.txx | 2 +- .../include/otbStreamingShrinkImageFilter.txx | 4 +- .../include/otbTileImageFilter.txx | 4 +- .../include/otbBandMathImageFilter.txx | 2 +- .../test/otbBandMathImageFilter.cxx | 6 +- .../include/otbBandMathXImageFilter.txx | 4 +- .../test/otbBandMathXImageFilter.cxx | 6 +- .../otbMorphologicalPyramidResampler.txx | 6 +- ...RegionImageToRectangularPathListFilter.txx | 2 +- ...ltiChannelsPolarimetricSynthesisFilter.txx | 4 +- .../otbGenericRSResampleImageFilter.txx | 4 +- .../include/otbGroundSpacingImageFunction.txx | 2 +- .../otbImportGeoInformationImageFilter.txx | 2 +- ...otbPhysicalToRPCSensorModelImageFilter.txx | 4 +- .../otbVectorDataIntoImageProjectionFilter.h | 2 +- ...otbVectorDataIntoImageProjectionFilter.txx | 4 +- .../include/otbVectorDataProjectionFilter.h | 4 +- ...GeometriesProjectionFilterFromGeoToMap.cxx | 2 +- ...ometriesProjectionFilterFromMapToImage.cxx | 2 +- ...metriesProjectionFilterFromMapToSensor.cxx | 2 +- .../otbImportGeoInformationImageFilter.cxx | 2 +- .../otbTileImageFilterRSTransformTest.cxx | 4 +- ...ectorDataIntoImageProjectionFilterTest.cxx | 2 +- ...ctorDataProjectionFilterFromMapToImage.cxx | 2 +- ...torDataProjectionFilterFromMapToSensor.cxx | 2 +- .../test/otbVectorDataTransformFilter.cxx | 2 +- .../include/otbListSampleGenerator.txx | 2 +- ...nuousMinimumMaximumImageCalculatorTest.cxx | 2 +- .../include/otbVectorDataToMapFilter.h | 2 +- .../include/otbVectorDataToMapFilter.txx | 2 +- .../otbVectorDataToMapFilterSensorModel.cxx | 2 +- .../test/otbExtendedFilenameTest.cxx | 2 +- .../IO/ImageIO/include/otbImageFileReader.txx | 6 +- .../IO/ImageIO/include/otbImageFileWriter.txx | 2 +- Modules/IO/ImageIO/test/negativespacing.cxx | 61 +++++++++++++++++++ .../ImageIO/test/otbImageFileReaderMSTAR.cxx | 4 +- .../otbImageFileWriterTestWithoutInput.cxx | 4 +- ...ageStreamingFileWriterTestWithoutInput.cxx | 4 +- ...bVectorImageFileWriterTestWithoutInput.cxx | 4 +- ...ageStreamingFileWriterTestWithoutInput.cxx | 4 +- Modules/IO/TestKernel/src/otbTestHelper.cxx | 6 +- .../test/otbVectorDataFileGeoReaderWriter.cxx | 2 +- .../Learning/SOM/test/otbSOMClassifier.cxx | 2 +- .../otbPersistentSamplingFilterBase.txx | 4 +- .../otbOGRDataToClassStatisticsFilterTest.cxx | 4 +- .../otbOGRDataToSamplePositionFilterTest.cxx | 8 +-- .../include/otbSimpleParallelTiffWriter.txx | 8 +-- .../MPIVrtWriter/include/otbMPIVrtWriter.h | 8 +-- .../include/otbSarDeburstImageFilter.txx | 2 +- .../include/otbImageSimulationMethod.txx | 4 +- .../otbDisparityMapEstimationMethod.txx | 4 +- .../include/otbDisparityMapTo3DFilter.txx | 2 +- .../include/otbDisparityMapToDEMFilter.txx | 4 +- .../otbFineRegistrationImageFilter.txx | 8 +-- .../otbMultiDisparityMapTo3DFilter.txx | 4 +- .../include/otbNCCRegistrationFunction.txx | 2 +- .../otbPixelWiseBlockMatchingImageFilter.txx | 10 +-- .../otbSubPixelDisparityImageFilter.txx | 4 +- ...tbPointSetToDisplacementFieldGenerator.txx | 2 +- .../include/otbAdhesionCorrectionFilter.txx | 8 +-- .../include/otbMulti3DMapToDEMFilter.txx | 16 ++--- ...eorectificationDisplacementFieldSource.txx | 28 ++++----- ...nentSegmentationOBIAToVectorDataFilter.txx | 4 +- .../otbLabelImageToOGRDataSourceFilter.txx | 16 ++--- .../otbLabelImageToVectorDataFilter.txx | 16 ++--- .../otbOGRDataSourceToLabelImageFilter.h | 2 +- .../otbOGRDataSourceToLabelImageFilter.txx | 12 ++-- .../include/otbRasterizeVectorDataFilter.txx | 8 +-- .../include/otbVectorDataToLabelImageFilter.h | 2 +- .../otbVectorDataToLabelImageFilter.txx | 12 ++-- .../include/otbVectorDataToLabelMapFilter.h | 2 +- .../include/otbVectorDataToLabelMapFilter.txx | 6 +- ...VectorDataToLabelMapWithAttributesFilter.h | 2 +- ...ctorDataToLabelMapWithAttributesFilter.txx | 2 +- .../test/otbLabelMapToVectorDataFilter.cxx | 2 +- .../test/otbVectorDataToLabelMapFilter.cxx | 2 +- ...amingImageToOGRLayerSegmentationFilter.txx | 4 +- .../itkTransformToDisplacementFieldSource.hxx | 4 +- .../include/itkUnaryFunctorImageFilter.hxx | 4 +- Modules/Wrappers/SWIG/src/otbApplication.i | 2 +- 153 files changed, 375 insertions(+), 304 deletions(-) create mode 100644 Modules/IO/ImageIO/test/negativespacing.cxx diff --git a/Examples/DataRepresentation/Image/Image4.cxx b/Examples/DataRepresentation/Image/Image4.cxx index 269524c5ab..d085b71633 100644 --- a/Examples/DataRepresentation/Image/Image4.cxx +++ b/Examples/DataRepresentation/Image/Image4.cxx @@ -114,20 +114,20 @@ int main(int, char *[]) // Software Guide : BeginLatex // // The array can be assigned to the image using - // the \code{SetSpacing()} method. + // the \code{SetSignedSpacing()} method. // - // \index{otb::Image!SetSpacing()} + // \index{otb::Image!SetSignedSpacing()} // // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex // // The spacing information can be retrieved from an image by using the - // \code{GetSpacing()} method. This method returns a reference to a + // \code{GetSignedSpacing()} method. This method returns a reference to a // \code{FixedArray}. The returned object can then be used to read the // contents of the array. Note the use of the \code{const} keyword to indicate // that the array will not be modified. @@ -135,7 +135,7 @@ int main(int, char *[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - const ImageType::SpacingType& sp = image->GetSpacing(); + const ImageType::SpacingType& sp = image->GetSignedSpacing(); std::cout << "Spacing = "; std::cout << sp[0] << ", " << sp[1] << std::endl; diff --git a/Examples/DataRepresentation/Path/PolyLineParametricPath1.cxx b/Examples/DataRepresentation/Path/PolyLineParametricPath1.cxx index da850ee075..0847b7d7b0 100644 --- a/Examples/DataRepresentation/Path/PolyLineParametricPath1.cxx +++ b/Examples/DataRepresentation/Path/PolyLineParametricPath1.cxx @@ -99,7 +99,7 @@ int main(int argc, char * argv[]) ImagePointType origin = image->GetOrigin(); - ImageType::SpacingType spacing = image->GetSpacing(); + ImageType::SpacingType spacing = image->GetSignedSpacing(); ImageType::SizeType size = image->GetBufferedRegion().GetSize(); ImagePointType point; diff --git a/Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx b/Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx index 22d646b231..ff70de113d 100644 --- a/Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx +++ b/Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx @@ -374,7 +374,7 @@ int main(int argc, char* argv[]) // Software Guide : BeginCodeSnippet generator->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin()); - generator->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing()); + generator->SetOutputSpacing(fixedReader->GetOutput()->GetSignedSpacing()); generator->SetOutputSize(fixedReader->GetOutput() ->GetLargestPossibleRegion().GetSize()); // Software Guide : EndCodeSnippet @@ -439,7 +439,7 @@ int main(int argc, char* argv[]) warper->SetInput(movingReader->GetOutput()); warper->SetDisplacementField(generator->GetOutput()); warper->SetOutputOrigin(fixedReader->GetOutput()->GetOrigin()); - warper->SetOutputSpacing(fixedReader->GetOutput()->GetSpacing()); + warper->SetOutputSpacing(fixedReader->GetOutput()->GetSignedSpacing()); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff --git a/Examples/FeatureExtraction/RightAngleDetectionExample.cxx b/Examples/FeatureExtraction/RightAngleDetectionExample.cxx index 04eaaf308a..453ebe1170 100644 --- a/Examples/FeatureExtraction/RightAngleDetectionExample.cxx +++ b/Examples/FeatureExtraction/RightAngleDetectionExample.cxx @@ -179,7 +179,7 @@ int main(int argc, char * argv[]) vectorDataRenderer->SetSize(reader->GetOutput()->GetLargestPossibleRegion().GetSize()); vectorDataRenderer->SetOrigin(reader->GetOutput()->GetOrigin()); - vectorDataRenderer->SetSpacing(reader->GetOutput()->GetSpacing()); + vectorDataRenderer->SetSpacing(reader->GetOutput()->GetSignedSpacing()); vectorDataRenderer->SetRenderingStyleType(VectorDataRendererType::Binary); blendingFilter->SetInput1(reader->GetOutput()); diff --git a/Examples/FeatureExtraction/SURFExample.cxx b/Examples/FeatureExtraction/SURFExample.cxx index 8259160148..f9432cdad3 100644 --- a/Examples/FeatureExtraction/SURFExample.cxx +++ b/Examples/FeatureExtraction/SURFExample.cxx @@ -237,7 +237,7 @@ int main(int argc, char * argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); + ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing(); ImageType::PointType origin = reader->GetOutput()->GetOrigin(); //OutputImageType::SizeType size = outputImage->GetLargestPossibleRegion().GetSize(); diff --git a/Examples/IO/MetadataExample.cxx b/Examples/IO/MetadataExample.cxx index a77e107145..cfd2158c3d 100644 --- a/Examples/IO/MetadataExample.cxx +++ b/Examples/IO/MetadataExample.cxx @@ -116,7 +116,7 @@ int main(int itkNotUsed(argc), char* argv[]) // SoftwareGuide: EndLatex // SoftwareGuide : BeginCodeSnippet - file << "Spacing " << image->GetSpacing() << std::endl; + file << "Spacing " << image->GetSignedSpacing() << std::endl; file << "Origin " << image->GetOrigin() << std::endl; file << "Projection REF " << image->GetProjectionRef() << std::endl; diff --git a/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx b/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx index e1d40f7d48..a18ffe3abb 100644 --- a/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx +++ b/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) Index4DType index4D = region4D.GetIndex(); Size4DType size4D = region4D.GetSize(); - Spacing4DType spacing4D = image4D->GetSpacing(); + Spacing4DType spacing4D = image4D->GetSignedSpacing(); Origin4DType origin4D = image4D->GetOrigin(); for (unsigned int i = 0; i < 3; ++i) @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) origin3D[i] = origin4D[i]; } - image3D->SetSpacing(spacing3D); + image3D->SetSignedSpacing(spacing3D); image3D->SetOrigin(origin3D); Region3DType region3D; diff --git a/Examples/Iterators/ImageRegionIterator.cxx b/Examples/Iterators/ImageRegionIterator.cxx index 06441e2f3f..11eed0204f 100644 --- a/Examples/Iterators/ImageRegionIterator.cxx +++ b/Examples/Iterators/ImageRegionIterator.cxx @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) // Software Guide : BeginCodeSnippet ImageType::Pointer outputImage = ImageType::New(); outputImage->SetRegions(outputRegion); - const ImageType::SpacingType& spacing = reader->GetOutput()->GetSpacing(); + const ImageType::SpacingType& spacing = reader->GetOutput()->GetSignedSpacing(); const ImageType::PointType& inputOrigin = reader->GetOutput()->GetOrigin(); double outputOrigin[Dimension]; @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) outputOrigin[i] = inputOrigin[i] + spacing[i] * inputStart[i]; } - outputImage->SetSpacing(spacing); + outputImage->SetSignedSpacing(spacing); outputImage->SetOrigin(outputOrigin); outputImage->Allocate(); // Software Guide : EndCodeSnippet diff --git a/Examples/Patented/EstimateAffineTransformationExample.cxx b/Examples/Patented/EstimateAffineTransformationExample.cxx index 0ad58c9dab..40554e544f 100644 --- a/Examples/Patented/EstimateAffineTransformationExample.cxx +++ b/Examples/Patented/EstimateAffineTransformationExample.cxx @@ -321,7 +321,7 @@ int main(int argc, char* argv[]) resampler->SetTransform(estimator->GetAffineTransform()); resampler->SetSize(fixedImage->GetLargestPossibleRegion().GetSize()); resampler->SetOutputOrigin(fixedImage->GetOrigin()); - resampler->SetOutputSpacing(fixedImage->GetSpacing()); + resampler->SetOutputSpacing(fixedImage->GetSignedSpacing()); resampler->SetDefaultPixelValue(100); // Software Guide : EndCodeSnippet diff --git a/Examples/Patented/SIFTDisparityMapEstimation.cxx b/Examples/Patented/SIFTDisparityMapEstimation.cxx index 0bc424d728..f6799c4d92 100644 --- a/Examples/Patented/SIFTDisparityMapEstimation.cxx +++ b/Examples/Patented/SIFTDisparityMapEstimation.cxx @@ -304,7 +304,7 @@ int main(int argc, char* argv[]) // Software Guide : BeginCodeSnippet ImageType::ConstPointer fixedImage = fixedReader->GetOutput(); - deformer->SetOutputSpacing(fixedImage->GetSpacing()); + deformer->SetOutputSpacing(fixedImage->GetSignedSpacing()); deformer->SetOutputOrigin(fixedImage->GetOrigin()); deformer->SetOutputRegion(fixedImage->GetLargestPossibleRegion()); // Software Guide : EndCodeSnippet diff --git a/Examples/Patented/SIFTExample.cxx b/Examples/Patented/SIFTExample.cxx index 5936983a50..a7cf97e230 100644 --- a/Examples/Patented/SIFTExample.cxx +++ b/Examples/Patented/SIFTExample.cxx @@ -234,7 +234,7 @@ int main(int argc, char * argv[]) } PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); - ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); + ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing(); ImageType::PointType origin = reader->GetOutput()->GetOrigin(); OutputImageType::SizeType size = outputImage->GetLargestPossibleRegion().GetSize(); diff --git a/Examples/Patented/SIFTFastExample.cxx b/Examples/Patented/SIFTFastExample.cxx index 9c5eefbdb6..22b3b43a60 100644 --- a/Examples/Patented/SIFTFastExample.cxx +++ b/Examples/Patented/SIFTFastExample.cxx @@ -239,7 +239,7 @@ int main(int argc, char * argv[]) // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); + ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing(); ImageType::PointType origin = reader->GetOutput()->GetOrigin(); // Software Guide : EndCodeSnippet diff --git a/Examples/Projections/GeometriesProjectionExample.cxx b/Examples/Projections/GeometriesProjectionExample.cxx index ce5ed38823..023c869be7 100644 --- a/Examples/Projections/GeometriesProjectionExample.cxx +++ b/Examples/Projections/GeometriesProjectionExample.cxx @@ -129,7 +129,7 @@ int main(int argc, char* argv[]) // necessary for sensors filter->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); // necessary for sensors - filter->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); + filter->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing()); // ~ wkt filter->SetOutputProjectionRef( imageReader->GetOutput()->GetProjectionRef()); // Software Guide : EndCodeSnippet diff --git a/Examples/Projections/SensorModelExample.cxx b/Examples/Projections/SensorModelExample.cxx index 5fd771eef3..2fab615191 100644 --- a/Examples/Projections/SensorModelExample.cxx +++ b/Examples/Projections/SensorModelExample.cxx @@ -93,7 +93,7 @@ int main(int argc, char* argv[]) reader->GenerateOutputInformation(); std::cout << "Original input imagine spacing: " << - reader->GetOutput()->GetSpacing() << std::endl; + reader->GetOutput()->GetSignedSpacing() << std::endl; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -197,7 +197,7 @@ int main(int argc, char* argv[]) outputImage->SetOrigin(origin); outputImage->SetRegions(region); - outputImage->SetSpacing(spacing); + outputImage->SetSignedSpacing(spacing); outputImage->Allocate(); // Software Guide : EndCodeSnippet diff --git a/Examples/Projections/VectorDataExtractROIExample.cxx b/Examples/Projections/VectorDataExtractROIExample.cxx index 5bd357e552..dfe15526aa 100644 --- a/Examples/Projections/VectorDataExtractROIExample.cxx +++ b/Examples/Projections/VectorDataExtractROIExample.cxx @@ -105,13 +105,13 @@ int main(int argc, char* argv[]) TypedRegion::IndexType index; size[0] = imageReader->GetOutput()->GetLargestPossibleRegion().GetSize()[0] - * imageReader->GetOutput()->GetSpacing()[0]; + * imageReader->GetOutput()->GetSignedSpacing()[0]; size[1] = imageReader->GetOutput()->GetLargestPossibleRegion().GetSize()[1] - * imageReader->GetOutput()->GetSpacing()[1]; + * imageReader->GetOutput()->GetSignedSpacing()[1]; index[0] = imageReader->GetOutput()->GetOrigin()[0] - - 0.5 * imageReader->GetOutput()->GetSpacing()[0]; + - 0.5 * imageReader->GetOutput()->GetSignedSpacing()[0]; index[1] = imageReader->GetOutput()->GetOrigin()[1] - - 0.5 * imageReader->GetOutput()->GetSpacing()[1]; + - 0.5 * imageReader->GetOutput()->GetSignedSpacing()[1]; region.SetSize(size); region.SetOrigin(index); diff --git a/Examples/Projections/VectorDataProjectionExample.cxx b/Examples/Projections/VectorDataProjectionExample.cxx index 685960fc46..46cc784f31 100644 --- a/Examples/Projections/VectorDataProjectionExample.cxx +++ b/Examples/Projections/VectorDataProjectionExample.cxx @@ -143,7 +143,7 @@ int main(int argc, char* argv[]) vectorDataProjection->SetOutputOrigin( imageReader->GetOutput()->GetOrigin()); vectorDataProjection->SetOutputSpacing( - imageReader->GetOutput()->GetSpacing()); + imageReader->GetOutput()->GetSignedSpacing()); vectorDataProjection->SetOutputProjectionRef( imageReader->GetOutput()->GetProjectionRef()); // Software Guide : EndCodeSnippet diff --git a/Examples/Registration/ImageRegistration1.cxx b/Examples/Registration/ImageRegistration1.cxx index 9bbc67bd28..06b1731262 100644 --- a/Examples/Registration/ImageRegistration1.cxx +++ b/Examples/Registration/ImageRegistration1.cxx @@ -596,7 +596,7 @@ int main(int argc, char *argv[]) FixedImageType::Pointer fixedImage = fixedImageReader->GetOutput(); resampler->SetSize(fixedImage->GetLargestPossibleRegion().GetSize()); resampler->SetOutputOrigin(fixedImage->GetOrigin()); - resampler->SetOutputSpacing(fixedImage->GetSpacing()); + resampler->SetOutputSpacing(fixedImage->GetSignedSpacing()); resampler->SetDefaultPixelValue(100); // Software Guide : EndCodeSnippet diff --git a/Examples/Registration/ImageRegistration2.cxx b/Examples/Registration/ImageRegistration2.cxx index 92924c5537..497e3cf9ea 100644 --- a/Examples/Registration/ImageRegistration2.cxx +++ b/Examples/Registration/ImageRegistration2.cxx @@ -481,7 +481,7 @@ int main(int argc, char *argv[]) resample->SetSize(fixedImage->GetLargestPossibleRegion().GetSize()); resample->SetOutputOrigin(fixedImage->GetOrigin()); - resample->SetOutputSpacing(fixedImage->GetSpacing()); + resample->SetOutputSpacing(fixedImage->GetSignedSpacing()); resample->SetDefaultPixelValue(100); typedef unsigned char OutputPixelType; diff --git a/Examples/Registration/ImageRegistration5.cxx b/Examples/Registration/ImageRegistration5.cxx index 6585c8b8f2..cc5ef6d674 100644 --- a/Examples/Registration/ImageRegistration5.cxx +++ b/Examples/Registration/ImageRegistration5.cxx @@ -277,7 +277,7 @@ int main(int argc, char *argv[]) // Software Guide : BeginCodeSnippet FixedImageType::Pointer fixedImage = fixedImageReader->GetOutput(); - const SpacingType fixedSpacing = fixedImage->GetSpacing(); + const SpacingType fixedSpacing = fixedImage->GetSignedSpacing(); const OriginType fixedOrigin = fixedImage->GetOrigin(); const RegionType fixedRegion = fixedImage->GetLargestPossibleRegion(); const SizeType fixedSize = fixedRegion.GetSize(); @@ -297,7 +297,7 @@ int main(int argc, char *argv[]) // Software Guide : BeginCodeSnippet MovingImageType::Pointer movingImage = movingImageReader->GetOutput(); - const SpacingType movingSpacing = movingImage->GetSpacing(); + const SpacingType movingSpacing = movingImage->GetSignedSpacing(); const OriginType movingOrigin = movingImage->GetOrigin(); const RegionType movingRegion = movingImage->GetLargestPossibleRegion(); const SizeType movingSize = movingRegion.GetSize(); @@ -528,7 +528,7 @@ int main(int argc, char *argv[]) resample->SetSize(fixedImage->GetLargestPossibleRegion().GetSize()); resample->SetOutputOrigin(fixedImage->GetOrigin()); - resample->SetOutputSpacing(fixedImage->GetSpacing()); + resample->SetOutputSpacing(fixedImage->GetSignedSpacing()); resample->SetDefaultPixelValue(100); typedef otb::ImageFileWriter<FixedImageType> WriterFixedType; diff --git a/Examples/Registration/ImageRegistration9.cxx b/Examples/Registration/ImageRegistration9.cxx index 1a063f3840..87e62f7239 100644 --- a/Examples/Registration/ImageRegistration9.cxx +++ b/Examples/Registration/ImageRegistration9.cxx @@ -544,7 +544,7 @@ int main(int argc, char *argv[]) resampler->SetSize(fixedImage->GetLargestPossibleRegion().GetSize()); resampler->SetOutputOrigin(fixedImage->GetOrigin()); - resampler->SetOutputSpacing(fixedImage->GetSpacing()); + resampler->SetOutputSpacing(fixedImage->GetSignedSpacing()); resampler->SetDefaultPixelValue(100); typedef unsigned char OutputPixelType; diff --git a/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx b/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx index 385a97c9f2..1e098e7846 100644 --- a/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx +++ b/Modules/Applications/AppClassification/app/otbComputePolylineFeatureFromImage.cxx @@ -219,10 +219,10 @@ private: TransformType::ParametersType params; params.SetSize(6); - params[0] = inImage->GetSpacing()[0]; + params[0] = inImage->GetSignedSpacing()[0]; params[1] = 0; params[2] = 0; - params[3] = inImage->GetSpacing()[1]; + params[3] = inImage->GetSignedSpacing()[1]; params[4] = inImage->GetOrigin()[0]; params[5] = inImage->GetOrigin()[1]; @@ -250,7 +250,7 @@ private: vproj->SetOutputKeywordList(inImage->GetImageKeywordlist()); vproj->SetOutputProjectionRef(inImage->GetProjectionRef()); vproj->SetOutputOrigin(inImage->GetOrigin()); - vproj->SetOutputSpacing(inImage->GetSpacing()); + vproj->SetOutputSpacing(inImage->GetSignedSpacing()); // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); diff --git a/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx b/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx index f186df01d8..073e53727f 100644 --- a/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx +++ b/Modules/Applications/AppDescriptors/app/otbHomologousPointsExtraction.cxx @@ -281,7 +281,7 @@ private: pprime1 = rsTransform->TransformPoint(point1); error = vcl_sqrt((point2[0]-pprime1[0])*(point2[0]-pprime1[0])+(point2[1]-pprime1[1])*(point2[1]-pprime1[1])); - if(error>GetParameterFloat("precision")*vcl_sqrt(vcl_abs(im2->GetSpacing()[0]*im2->GetSpacing()[1]))) + if(error>GetParameterFloat("precision")*vcl_sqrt(vcl_abs(im2->GetSignedSpacing()[0]*im2->GetSignedSpacing()[1]))) { filtered = true; } diff --git a/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx b/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx index b9eccc12eb..45bc66c51d 100644 --- a/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx +++ b/Modules/Applications/AppEdge/app/otbLineSegmentDetection.cxx @@ -185,7 +185,7 @@ private: vproj->SetInput(vd); vproj->SetInputKeywordList(GetParameterImage("in")->GetImageKeywordlist()); //vproj->SetInputOrigin(GetParameterImage("in")->GetOrigin()); - //vproj->SetInputSpacing(GetParameterImage("in")->GetSpacing()); + //vproj->SetInputSpacing(GetParameterImage("in")->GetSignedSpacing()); // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); diff --git a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx index 62857abd2b..74bb9c42da 100644 --- a/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx +++ b/Modules/Applications/AppImageUtils/app/otbReadImageInfo.cxx @@ -316,8 +316,8 @@ private: ossOutput << "\tOrigin : [" << GetParameterFloat("originx") << "," << GetParameterFloat("originy") << "]" << std::endl; //Get image spacing - SetParameterFloat("spacingx",inImage->GetSpacing()[0], false); - SetParameterFloat("spacingy",inImage->GetSpacing()[1], false); + SetParameterFloat("spacingx",inImage->GetSignedSpacing()[0], false); + SetParameterFloat("spacingy",inImage->GetSignedSpacing()[1], false); ossOutput << "\tSpacing : [" << GetParameterFloat("spacingx") << "," << GetParameterFloat("spacingy") << "]" << std::endl; //Estimate ground spacing diff --git a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx index 2dc6a6119f..4b1a5d235e 100644 --- a/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx +++ b/Modules/Applications/AppProjection/app/otbOrthoRectification.cxx @@ -533,7 +533,7 @@ private: FloatVectorImageType::Pointer inOrtho = GetParameterImage("outputs.ortho"); ResampleFilterType::OriginType orig = inOrtho->GetOrigin(); - ResampleFilterType::SpacingType spacing = inOrtho->GetSpacing(); + ResampleFilterType::SpacingType spacing = inOrtho->GetSignedSpacing(); ResampleFilterType::SizeType size = inOrtho->GetLargestPossibleRegion().GetSize(); SetParameterInt("outputs.sizex",size[0]); diff --git a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx index f1941b5e9a..7b6da7d245 100644 --- a/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx +++ b/Modules/Applications/AppProjection/app/otbRigidTransformResample.cxx @@ -234,7 +234,7 @@ private: scale[1] = 1.0 / GetParameterFloat("transform.type.id.scaley"); // Evaluate spacing - FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing(); + FloatVectorImageType::SpacingType spacing = inputImage->GetSignedSpacing(); FloatVectorImageType::SpacingType OutputSpacing; OutputSpacing[0] = spacing[0] * scale[0]; OutputSpacing[1] = spacing[1] * scale[1]; @@ -279,7 +279,7 @@ private: scale[1] = 1.0 / GetParameterFloat("transform.type.translation.scaley"); // Evaluate spacing - FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing(); + FloatVectorImageType::SpacingType spacing = inputImage->GetSignedSpacing(); FloatVectorImageType::SpacingType OutputSpacing; OutputSpacing[0] = spacing[0] * scale[0]; OutputSpacing[1] = spacing[1] * scale[1]; @@ -312,7 +312,7 @@ private: ScalableTransformType::Pointer transform = ScalableTransformType::New(); FloatVectorImageType::SizeType inSize = inputImage->GetLargestPossibleRegion().GetSize(); - FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing(); + FloatVectorImageType::SpacingType spacing = inputImage->GetSignedSpacing(); itk::ContinuousIndex<double,2> ULindex(inputImage->GetLargestPossibleRegion().GetIndex()); ULindex[0] += -0.5; diff --git a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx index 95ed2a5e93..1d1018e8fc 100644 --- a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx +++ b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx @@ -214,7 +214,7 @@ private: otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); // Set up output image information - FloatVectorImageType::SpacingType spacing = refImage->GetSpacing(); + FloatVectorImageType::SpacingType spacing = refImage->GetSignedSpacing(); FloatVectorImageType::IndexType start = refImage->GetLargestPossibleRegion().GetIndex(); FloatVectorImageType::SizeType size = refImage->GetLargestPossibleRegion().GetSize(); FloatVectorImageType::PointType origin = refImage->GetOrigin(); @@ -278,7 +278,7 @@ private: m_BasicResampler->SetOutputOrigin(origin); - FloatVectorImageType::SpacingType xsSpacing = GetParameterImage("inm")->GetSpacing(); + FloatVectorImageType::SpacingType xsSpacing = GetParameterImage("inm")->GetSignedSpacing(); xsSpacing*=0.25; m_BasicResampler->SetOutputSpacing(xsSpacing); diff --git a/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx b/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx index 82efac5377..fe9e070a8b 100644 --- a/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx +++ b/Modules/Applications/AppProjection/app/otbVectorDataReprojection.cxx @@ -144,7 +144,7 @@ private: { FloatVectorImageType::Pointer inImage = GetParameterFloatVectorImage("in.kwl"); m_GeometriesProjFilter->SetInputOrigin(inImage->GetOrigin()); // nec qd capteur - m_GeometriesProjFilter->SetInputSpacing(inImage->GetSpacing()); // nec qd capteur + m_GeometriesProjFilter->SetInputSpacing(inImage->GetSignedSpacing()); // nec qd capteur m_GeometriesProjFilter->SetInputKeywordList(inImage->GetImageKeywordlist()); //otbAppLogINFO(<<"kwl."<<std::endl); } @@ -156,7 +156,7 @@ private: if (outImage) { m_GeometriesProjFilter->SetOutputOrigin(outImage->GetOrigin()); // nec qd capteur - m_GeometriesProjFilter->SetOutputSpacing(outImage->GetSpacing()); // nec qd capteur + m_GeometriesProjFilter->SetOutputSpacing(outImage->GetSignedSpacing()); // nec qd capteur m_OutputProjectionRef = outImage->GetProjectionRef(); // ~ wkt if (m_OutputProjectionRef.empty()) { diff --git a/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx index c141e8c8c9..b9bc876f11 100644 --- a/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbConnectedComponentSegmentation.cxx @@ -173,7 +173,7 @@ private: m_Vproj->SetInput(m_Connected->GetFilter()->GetOutputVectorData()); m_Vproj->SetInputKeywordList(inputImage->GetImageKeywordlist()); //m_Vproj->SetInputOrigin(inputImage->GetOrigin()); - //m_Vproj->SetInputSpacing(inputImage->GetSpacing()); + //m_Vproj->SetInputSpacing(inputImage->GetSignedSpacing()); // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); diff --git a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx index 312cff69e5..12ef2d890c 100644 --- a/Modules/Applications/AppStereo/app/otbStereoFramework.cxx +++ b/Modules/Applications/AppStereo/app/otbStereoFramework.cxx @@ -688,8 +688,8 @@ private: epipolarGridSource->Update(); FloatImageType::SpacingType epiSpacing; - epiSpacing[0] = 0.5 * (vcl_abs(inleft->GetSpacing()[0]) + vcl_abs(inleft->GetSpacing()[1])); - epiSpacing[1] = 0.5 * (vcl_abs(inleft->GetSpacing()[0]) + vcl_abs(inleft->GetSpacing()[1])); + epiSpacing[0] = 0.5 * (vcl_abs(inleft->GetSignedSpacing()[0]) + vcl_abs(inleft->GetSignedSpacing()[1])); + epiSpacing[1] = 0.5 * (vcl_abs(inleft->GetSignedSpacing()[0]) + vcl_abs(inleft->GetSignedSpacing()[1])); FloatImageType::SizeType epiSize; epiSize = epipolarGridSource->GetRectifiedImageSize(); @@ -721,7 +721,7 @@ private: leftInverseDisplacementFieldFilter->SetInput(leftDisplacement); FloatVectorImageType::PointType lorigin = inleft->GetOrigin(); - FloatVectorImageType::SpacingType lspacing = inleft->GetSpacing(); + FloatVectorImageType::SpacingType lspacing = inleft->GetSignedSpacing(); FloatVectorImageType::SizeType lsize = inleft->GetLargestPossibleRegion().GetSize(); double gridStep = epipolarGridSource->GetGridStep(); lspacing[0] *= gridStep; diff --git a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx index ed0d0fddb0..17a8807b1f 100644 --- a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx +++ b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx @@ -229,7 +229,7 @@ private: { FloatImageType::PointType origin = GetParameterImage("io.inleft")->GetOrigin(); FloatImageType::SizeType size = GetParameterImage("io.inleft")->GetLargestPossibleRegion().GetSize(); - FloatImageType::SpacingType spacing = GetParameterImage("io.inleft")->GetSpacing(); + FloatImageType::SpacingType spacing = GetParameterImage("io.inleft")->GetSignedSpacing(); size[0]/=GetParameterInt("epi.elevation.avgdem.step"); size[1]/=GetParameterInt("epi.elevation.avgdem.step"); @@ -289,7 +289,7 @@ private: m_LeftInvertDisplacementFieldFilter->SetInput(m_LeftDisplacementFieldCaster->GetOutput()); FloatVectorImageType::PointType lorigin = GetParameterImage("io.inleft")->GetOrigin(); - FloatVectorImageType::SpacingType lspacing = GetParameterImage("io.inleft")->GetSpacing(); + FloatVectorImageType::SpacingType lspacing = GetParameterImage("io.inleft")->GetSignedSpacing(); FloatVectorImageType::SizeType lsize = GetParameterImage("io.inleft")->GetLargestPossibleRegion().GetSize(); if (lsize[0]*lsize[1]>256*256) @@ -331,7 +331,7 @@ private: m_RightInvertDisplacementFieldFilter->SetInput(m_RightDisplacementFieldCaster->GetOutput()); FloatVectorImageType::PointType rorigin = GetParameterImage("io.inright")->GetOrigin(); - FloatVectorImageType::SpacingType rspacing = GetParameterImage("io.inright")->GetSpacing(); + FloatVectorImageType::SpacingType rspacing = GetParameterImage("io.inright")->GetSignedSpacing(); FloatVectorImageType::SizeType rsize = GetParameterImage("io.inright")->GetLargestPossibleRegion().GetSize(); if (rsize[0]*rsize[1]>256*256) diff --git a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx index 7e35f67165..748d8f27be 100644 --- a/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx +++ b/Modules/Applications/AppVectorDataTranslation/app/otbRasterization.cxx @@ -233,7 +233,7 @@ private: origin = referenceImage->GetOrigin(); - spacing = referenceImage->GetSpacing(); + spacing = referenceImage->GetSignedSpacing(); } else if (HasValue("spx") && HasValue("spy")) { diff --git a/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx b/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx index 8dc890b605..cab6f808d8 100644 --- a/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx +++ b/Modules/Applications/AppVectorUtils/app/otbVectorDataTransform.cxx @@ -140,8 +140,8 @@ private: parameters[1] = CONST_PI * GetParameterFloat("transform.ro")/180.; parameters[2] = GetParameterFloat("transform.centerx"); parameters[3] = GetParameterFloat("transform.centery"); - parameters[4] = inImage->GetSpacing()[0] * GetParameterFloat("transform.tx"); - parameters[5] = vcl_abs(inImage->GetSpacing()[1]) * GetParameterFloat("transform.ty"); + parameters[4] = inImage->GetSignedSpacing()[0] * GetParameterFloat("transform.tx"); + parameters[5] = vcl_abs(inImage->GetSignedSpacing()[1]) * GetParameterFloat("transform.ty"); // Set the parameters to the transform m_Transform->SetParameters(parameters); diff --git a/Modules/Core/Common/include/otbImportImageFilter.h b/Modules/Core/Common/include/otbImportImageFilter.h index 7c322b6ab1..9f21873c3c 100644 --- a/Modules/Core/Common/include/otbImportImageFilter.h +++ b/Modules/Core/Common/include/otbImportImageFilter.h @@ -113,7 +113,7 @@ public: } /** Set the spacing (size of a pixel) of the image. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ itkSetVectorMacro(Spacing, const double, OutputImageType::ImageDimension); itkSetVectorMacro(Spacing, const float, OutputImageType::ImageDimension); diff --git a/Modules/Core/Common/include/otbImportImageFilter.txx b/Modules/Core/Common/include/otbImportImageFilter.txx index a28fc33d6d..204899ac41 100644 --- a/Modules/Core/Common/include/otbImportImageFilter.txx +++ b/Modules/Core/Common/include/otbImportImageFilter.txx @@ -169,7 +169,7 @@ ImportImageFilter<TOutputImage> // we need to compute the output spacing, the output origin, the // output image size, and the output image start index - outputPtr->SetSpacing(m_Spacing); + outputPtr->SetSignedSpacing(m_Spacing); outputPtr->SetOrigin(m_Origin); outputPtr->SetDirection(m_Direction); outputPtr->SetLargestPossibleRegion(m_Region); diff --git a/Modules/Core/Common/include/otbImportVectorImageFilter.h b/Modules/Core/Common/include/otbImportVectorImageFilter.h index 899651a7e0..c7db035c25 100644 --- a/Modules/Core/Common/include/otbImportVectorImageFilter.h +++ b/Modules/Core/Common/include/otbImportVectorImageFilter.h @@ -114,7 +114,7 @@ public: } /** Set the spacing (size of a pixel) of the image. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ itkSetVectorMacro(Spacing, const double, OutputImageType::ImageDimension); itkSetVectorMacro(Spacing, const float, OutputImageType::ImageDimension); diff --git a/Modules/Core/Common/include/otbImportVectorImageFilter.txx b/Modules/Core/Common/include/otbImportVectorImageFilter.txx index 49c95abc23..1db7462175 100644 --- a/Modules/Core/Common/include/otbImportVectorImageFilter.txx +++ b/Modules/Core/Common/include/otbImportVectorImageFilter.txx @@ -170,7 +170,7 @@ ImportVectorImageFilter<TOutputImage> // we need to compute the output spacing, the output origin, the // output image size, and the output image start index - outputPtr->SetSpacing(m_Spacing); + outputPtr->SetSignedSpacing(m_Spacing); outputPtr->SetOrigin(m_Origin); outputPtr->SetDirection(m_Direction); outputPtr->SetLargestPossibleRegion(m_Region); diff --git a/Modules/Core/ImageBase/include/otbExtractROIBase.txx b/Modules/Core/ImageBase/include/otbExtractROIBase.txx index b7c6e0e2a8..78f546387f 100644 --- a/Modules/Core/ImageBase/include/otbExtractROIBase.txx +++ b/Modules/Core/ImageBase/include/otbExtractROIBase.txx @@ -247,7 +247,7 @@ ExtractROIBase<TInputImage, TOutputImage> // This logic needs to be augmented with logic that select which // dimensions to copy const typename InputImageType::SpacingType& - inputSpacing = inputPtr->GetSpacing(); + inputSpacing = inputPtr->GetSignedSpacing(); const typename InputImageType::DirectionType& inputDirection = inputPtr->GetDirection(); const typename InputImageType::PointType& @@ -304,7 +304,7 @@ ExtractROIBase<TInputImage, TOutputImage> } // set the spacing and origin - outputPtr->SetSpacing(outputSpacing); + outputPtr->SetSignedSpacing(outputSpacing); outputPtr->SetDirection(outputDirection); outputPtr->SetOrigin(outputOrigin); diff --git a/Modules/Core/ImageBase/include/otbImage.h b/Modules/Core/ImageBase/include/otbImage.h index 0921e060be..ba484e90ba 100644 --- a/Modules/Core/ImageBase/include/otbImage.h +++ b/Modules/Core/ImageBase/include/otbImage.h @@ -177,6 +177,14 @@ public: /** Get signed spacing */ SpacingType GetSignedSpacing() const; + // SpacingType GetSpacing() const + // { + // PixelType a; + // a.toto(); + // SpacingType t = this->GetSignedSpacing(); + // return t ; + // }; + /** Set signed spacing */ virtual void SetSignedSpacing( SpacingType spacing ); virtual void SetSignedSpacing( double spacing[ VImageDimension ] ); diff --git a/Modules/Core/ImageBase/test/otbImageTest.cxx b/Modules/Core/ImageBase/test/otbImageTest.cxx index ab3036a129..f95afb8448 100644 --- a/Modules/Core/ImageBase/test/otbImageTest.cxx +++ b/Modules/Core/ImageBase/test/otbImageTest.cxx @@ -61,7 +61,7 @@ int otbImageTest(int itkNotUsed(argc), char* argv[]) std::cout << "---------------------" << std::endl; file << "------ IMAGE --------" << std::endl; - file << "Spacing " << image->GetSpacing() << std::endl; + file << "Spacing " << image->GetSignedSpacing() << std::endl; file << "Origin " << image->GetOrigin() << std::endl; file << "Projection REF " << image->GetProjectionRef() << std::endl; file << "GCP Projection " << image->GetGCPProjection() << std::endl; diff --git a/Modules/Core/ImageBase/test/otbVectorImageTest.cxx b/Modules/Core/ImageBase/test/otbVectorImageTest.cxx index 00d7f377cb..5fa76642d7 100644 --- a/Modules/Core/ImageBase/test/otbVectorImageTest.cxx +++ b/Modules/Core/ImageBase/test/otbVectorImageTest.cxx @@ -63,7 +63,7 @@ int otbVectorImageLegacyTest(int argc, char* argv[]) std::cout << "---------------------" << std::endl; file << "------ IMAGE --------" << std::endl; - file << "Spacing " << image->GetSpacing() << std::endl; + file << "Spacing " << image->GetSignedSpacing() << std::endl; file << "Origin " << image->GetOrigin() << std::endl; file << "Projection REF " << image->GetProjectionRef() << std::endl; file << "GCP Projection " << image->GetGCPProjection() << std::endl; diff --git a/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx b/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx index b6a8c96c04..28b393767d 100644 --- a/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx +++ b/Modules/Core/Interpolation/include/otbBSplineInterpolateImageFunction.txx @@ -245,7 +245,7 @@ BSplineInterpolateImageFunction<TImageType, TCoordRep, TCoefficientType> } derivativeValue[n] += m_Coefficients->GetPixel(coefficientIndex) * tempValue; } - derivativeValue[n] /= this->GetInputImage()->GetSpacing()[n]; // take spacing into account + derivativeValue[n] /= this->GetInputImage()->GetSignedSpacing()[n]; // take spacing into account } return (derivativeValue); diff --git a/Modules/Core/Interpolation/test/otbProlateValidationTest.cxx b/Modules/Core/Interpolation/test/otbProlateValidationTest.cxx index 2964cde1c7..b45a5d60a3 100644 --- a/Modules/Core/Interpolation/test/otbProlateValidationTest.cxx +++ b/Modules/Core/Interpolation/test/otbProlateValidationTest.cxx @@ -54,7 +54,7 @@ int otbProlateValidationTest(int itkNotUsed(argc), char * argv[]) reader->UpdateOutputInformation(); ImageType::PointType origin = reader->GetOutput()->GetOrigin(); - ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); + ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing(); ImageType::SpacingType newSpacing; newSpacing[0] = spacing[0] * factor; newSpacing[1] = spacing[1] * factor; diff --git a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx index a2cb207970..6393feda96 100644 --- a/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx +++ b/Modules/Core/LabelMap/include/otbShapeAttributesLabelMapFilter.txx @@ -205,13 +205,13 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage> double sizePerPixel = 1; for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i) { - sizePerPixel *= vcl_abs(m_LabelImage->GetSpacing()[i]); + sizePerPixel *= vcl_abs(m_LabelImage->GetSignedSpacing()[i]); } typename std::vector<double> sizePerPixelPerDimension; for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i) { - sizePerPixelPerDimension.push_back(sizePerPixel / vcl_abs(m_LabelImage->GetSpacing()[i])); + sizePerPixelPerDimension.push_back(sizePerPixel / vcl_abs(m_LabelImage->GetSignedSpacing()[i])); } // compute the max the index on the border of the image @@ -367,7 +367,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage> // get the physical position and the spacing - they are used several times later typename TLabelImage::PointType physicalPosition; m_LabelImage->TransformIndexToPhysicalPoint(idx, physicalPosition); - const typename TLabelImage::SpacingType& spacing = m_LabelImage->GetSpacing(); + const typename TLabelImage::SpacingType& spacing = m_LabelImage->GetSignedSpacing(); // the sum of x positions, also reused several times double sumX = length * (physicalPosition[0] + (spacing[0] * (length - 1)) / 2.0); // the real job - the sum of square of x positions @@ -406,7 +406,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage> { centroid[i] /= size; regionSize[i] = maxs[i] - mins[i] + 1; - double s = regionSize[i] * vcl_abs(m_LabelImage->GetSpacing()[i]); + double s = regionSize[i] * vcl_abs(m_LabelImage->GetSignedSpacing()[i]); minSize = std::min(s, minSize); maxSize = std::max(s, maxSize); for (DimensionType j = 0; j < LabelObjectType::ImageDimension; ++j) @@ -550,7 +550,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage> SimplifyPolygonFunctorType simplifyFunctor; polygonFunctor.SetStartIndex(m_LabelImage->GetLargestPossibleRegion().GetIndex()); polygonFunctor.SetOrigin(m_LabelImage->GetOrigin()); - polygonFunctor.SetSpacing(m_LabelImage->GetSpacing()); + polygonFunctor.SetSpacing(m_LabelImage->GetSignedSpacing()); typename PolygonType::Pointer polygon = simplifyFunctor(polygonFunctor(lo)); lo->SetPolygon(polygon); } @@ -622,7 +622,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage> double length = 0; for (DimensionType i = 0; i < LabelObjectType::ImageDimension; ++i) { - length += vcl_pow((iIt1->operator[] (i) - iIt2->operator[] (i)) * m_LabelImage->GetSpacing()[i], 2); + length += vcl_pow((iIt1->operator[] (i) - iIt2->operator[] (i)) * m_LabelImage->GetSignedSpacing()[i], 2); } if (feretDiameter < length) { @@ -853,7 +853,7 @@ ShapeAttributesLabelObjectFunctor<TLabelObject, TLabelImage> } // compute the perimeter based on the intercept counts - double perimeter = PerimeterFromInterceptCount( intercepts, m_LabelImage->GetSpacing() ); + double perimeter = PerimeterFromInterceptCount( intercepts, m_LabelImage->GetSignedSpacing() ); return perimeter; } diff --git a/Modules/Core/LabelMap/test/otbLabelObjectMapVectorizer.cxx b/Modules/Core/LabelMap/test/otbLabelObjectMapVectorizer.cxx index dbefe32e1d..588a890231 100644 --- a/Modules/Core/LabelMap/test/otbLabelObjectMapVectorizer.cxx +++ b/Modules/Core/LabelMap/test/otbLabelObjectMapVectorizer.cxx @@ -135,7 +135,7 @@ int otbLabelObjectMapVectorizer(int argc, char * argv[]) VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); vectorDataProjection->SetInputOrigin(lreader->GetOutput()->GetOrigin()); - vectorDataProjection->SetInputSpacing(lreader->GetOutput()->GetSpacing()); + vectorDataProjection->SetInputSpacing(lreader->GetOutput()->GetSignedSpacing()); vectorDataProjection->SetInput(data); writer->SetFileName(outfname); diff --git a/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx b/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx index 9d2615fd04..70991ea191 100644 --- a/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx +++ b/Modules/Core/SpatialObjects/include/otbSpatialObjectToImageDrawingFilter.txx @@ -362,11 +362,11 @@ SpatialObjectToImageDrawingFilter<TInputSpatialObject, TOutputImage> if (specified) { - OutputImage->SetSpacing(this->m_Spacing); // set spacing + OutputImage->SetSignedSpacing(this->m_Spacing); // set spacing } else { - OutputImage->SetSpacing(InputObject->GetIndexToObjectTransform()->GetScaleComponent()); // set spacing + OutputImage->SetSignedSpacing(InputObject->GetIndexToObjectTransform()->GetScaleComponent()); // set spacing m_Spacing[0] = InputObject->GetIndexToObjectTransform()->GetScaleComponent()[0]; m_Spacing[1] = InputObject->GetIndexToObjectTransform()->GetScaleComponent()[1]; } diff --git a/Modules/Core/Transform/include/otbGenericRSTransform.h b/Modules/Core/Transform/include/otbGenericRSTransform.h index 09a8ed3786..aac8f94684 100644 --- a/Modules/Core/Transform/include/otbGenericRSTransform.h +++ b/Modules/Core/Transform/include/otbGenericRSTransform.h @@ -142,7 +142,7 @@ public: itkGetConstReferenceMacro(InputOrigin, OriginType); /** Set the spacing (size of a pixel) of the vector data. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ itkSetMacro(InputSpacing, SpacingType); itkGetConstReferenceMacro(InputSpacing, SpacingType); @@ -152,7 +152,7 @@ public: itkGetConstReferenceMacro(OutputOrigin, OriginType); /** Set the spacing (size of a pixel) of the vector data. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ itkSetMacro(OutputSpacing, SpacingType); itkGetConstReferenceMacro(OutputSpacing, SpacingType); diff --git a/Modules/Core/VectorDataBase/include/otbVectorData.h b/Modules/Core/VectorDataBase/include/otbVectorData.h index 54ea18cada..0a1b8968e0 100644 --- a/Modules/Core/VectorDataBase/include/otbVectorData.h +++ b/Modules/Core/VectorDataBase/include/otbVectorData.h @@ -103,7 +103,7 @@ public: /** Set the spacing of the vector data to put it in the corresponding * image coordinates - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ virtual void SetSpacing(const SpacingType& spacing); virtual void SetSpacing(const double spacing[2]); virtual void SetSpacing(const float spacing[2]); diff --git a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx index bb83922775..32d2638ea9 100644 --- a/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbGenericRoadExtractionFilter.txx @@ -82,7 +82,7 @@ GenericRoadExtractionFilter<TInputImage, TOutputPath> ::BeforeGenerateData() { /** Calculation of resolution value */ - typename InputImageType::SpacingType spacing = this->GetInput()->GetSpacing(); + typename InputImageType::SpacingType spacing = this->GetInput()->GetSignedSpacing(); // Getting x Spacing for the resolution m_Resolution = static_cast<double>(spacing[0]); if (m_Resolution == 0.) diff --git a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx index 10c0d816f5..459b09310f 100644 --- a/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx +++ b/Modules/Detection/RoadExtraction/include/otbImageToPathListAlignFilter.txx @@ -239,7 +239,7 @@ ImageToPathListAlignFilter<TInputImage, TOutputPath> region.SetIndex(IndexOut); m_AngleImage->SetRegions(region); m_AngleImage->SetOrigin(InputImage->GetOrigin()); - m_AngleImage->SetSpacing(InputImage->GetSpacing()); + m_AngleImage->SetSignedSpacing(InputImage->GetSignedSpacing()); m_AngleImage->Allocate(); n = Taille[0]; diff --git a/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx b/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx index f007b11bc3..e08c7e52bb 100644 --- a/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx +++ b/Modules/Feature/Density/include/otbKeyPointDensityImageFilter.txx @@ -70,7 +70,7 @@ KeyPointDensityImageFilter<TInputImage, TOutputImage, TDetector> /** Applying the pointsetTodensityImageFilter*/ m_PointSetToDensityImageFilter->SetInput(m_Detector->GetOutput()); m_PointSetToDensityImageFilter->SetRadius(m_NeighborhoodRadius); - m_PointSetToDensityImageFilter->SetSpacing(ptr->GetSpacing()); + m_PointSetToDensityImageFilter->SetSpacing(ptr->GetSignedSpacing()); m_PointSetToDensityImageFilter->SetSize(ptr->GetLargestPossibleRegion().GetSize()); m_PointSetToDensityImageFilter->SetOrigin(ptr->GetOrigin()); m_PointSetToDensityImageFilter->Update(); diff --git a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx index 474c6b1283..603c52e583 100644 --- a/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx +++ b/Modules/Feature/Density/include/otbPointSetToDensityImageFilter.txx @@ -113,7 +113,7 @@ PointSetToDensityImageFilter<TInputPointSet, TOutputImage, TDensityFunction> region.SetIndex(start); outputPtr->SetOrigin(this->GetOrigin()); - outputPtr->SetSpacing(this->GetSpacing()); + outputPtr->SetSignedSpacing(this->GetSignedSpacing()); outputPtr->SetRegions(region); } diff --git a/Modules/Feature/Density/test/otbPointSetToDensityImageFilterTest.cxx b/Modules/Feature/Density/test/otbPointSetToDensityImageFilterTest.cxx index 773a117ce1..937d64a7d4 100644 --- a/Modules/Feature/Density/test/otbPointSetToDensityImageFilterTest.cxx +++ b/Modules/Feature/Density/test/otbPointSetToDensityImageFilterTest.cxx @@ -63,7 +63,7 @@ int otbPointSetToDensityImageFilterTest(int itkNotUsed(argc), char* argv[]) /** PointSetImageToDensity ImageFilter*/ filter->SetInput(detector->GetOutput()); filter->SetRadius(radius); - filter->SetSpacing(reader->GetOutput()->GetSpacing()); + filter->SetSpacing(reader->GetOutput()->GetSignedSpacing()); filter->SetSize(reader->GetOutput()->GetLargestPossibleRegion().GetSize()); filter->SetOrigin(reader->GetOutput()->GetOrigin()); diff --git a/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx b/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx index 4871b8fd2a..9d48d66ff2 100644 --- a/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx +++ b/Modules/Feature/Descriptors/include/otbForwardFourierMellinTransformImageFilter.txx @@ -81,7 +81,7 @@ ForwardFourierMellinTransformImageFilter<TPixel, TInterpol, Dimension> // Compute centre of the transform SizeType inputSize = this->GetInput()->GetLargestPossibleRegion().GetSize(); - SpacingType inputSpacing = this->GetInput()->GetSpacing(); + SpacingType inputSpacing = this->GetInput()->GetSignedSpacing(); itk::ContinuousIndex<double,2> centre; centre[0] = -0.5 + 0.5 * static_cast<double>(inputSize[0]); centre[1] = -0.5 + 0.5 * static_cast<double>(inputSize[1]); diff --git a/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx b/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx index 8c3d0e7217..e34a5a8ba4 100644 --- a/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx +++ b/Modules/Feature/Descriptors/include/otbImageToSIFTKeyPointSetFilter.txx @@ -144,7 +144,7 @@ ImageToSIFTKeyPointSetFilter<TInputImage, TOutputPointSet> input = m_ShrinkFilter->GetOutput(); typename InputImageType::PointType origin1; - typename InputImageType::SpacingType spacing = input->GetSpacing(); + typename InputImageType::SpacingType spacing = input->GetSignedSpacing(); origin1[0] = origin0[0] + spacing[0] * 0.25; origin1[1] = origin0[1] + spacing[1] * 0.25; @@ -181,7 +181,7 @@ ImageToSIFTKeyPointSetFilter<TInputImage, TOutputPointSet> typename InputImageType::PointType origin0 = this->GetInput()->GetOrigin(); typename InputImageType::PointType origin1; - typename InputImageType::SpacingType spacing = m_ExpandFilter->GetOutput()->GetSpacing(); + typename InputImageType::SpacingType spacing = m_ExpandFilter->GetOutput()->GetSignedSpacing(); origin1[0] = origin0[0] - spacing[0] * 0.5; origin1[1] = origin0[1] - spacing[1] * 0.5; @@ -213,8 +213,8 @@ ImageToSIFTKeyPointSetFilter<TInputImage, TOutputPointSet> // // with multiply by spacing before filtering, length sigma gaussian // is compute in pixel - double xsigman = vcl_abs(input->GetSpacing()[0]) * m_Sigma0; - double ysigman = vcl_abs(input->GetSpacing()[1]) * m_Sigma0; + double xsigman = vcl_abs(input->GetSignedSpacing()[0]) * m_Sigma0; + double ysigman = vcl_abs(input->GetSignedSpacing()[1]) * m_Sigma0; for (lScale = 0; lScale != m_ScalesNumber + 2; lScale++) { @@ -276,7 +276,7 @@ ImageToSIFTKeyPointSetFilter<TInputImage, TOutputPointSet> typename ImageListType::Iterator lIterDoG = m_DoGList->Begin() + 1; unsigned int lScale = 1; OutputPointSetPointerType outputPointSet = this->GetOutput(); - typename InputImageType::SpacingType spacing = lIterDoG.Get()->GetSpacing(); + typename InputImageType::SpacingType spacing = lIterDoG.Get()->GetSignedSpacing(); while ((lIterDoG + 1) != m_DoGList->End()) { diff --git a/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx b/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx index 4c7ffe0d6c..4221e4ba0c 100644 --- a/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx +++ b/Modules/Feature/Descriptors/include/otbImageToSURFKeyPointSetFilter.txx @@ -94,7 +94,7 @@ ImageToSURFKeyPointSetFilter<TInputImage, TOutputPointSet> sigma_in = 2.; m_ImageList = ImageListType::New(); - spacing = this->GetInput()->GetSpacing(); + spacing = this->GetInput()->GetSignedSpacing(); /*-------------------------------------------------------- Octave per octave diff --git a/Modules/Feature/Descriptors/test/otbFourierMellinDescriptors.cxx b/Modules/Feature/Descriptors/test/otbFourierMellinDescriptors.cxx index 1d0e44e2f7..675f831849 100644 --- a/Modules/Feature/Descriptors/test/otbFourierMellinDescriptors.cxx +++ b/Modules/Feature/Descriptors/test/otbFourierMellinDescriptors.cxx @@ -218,7 +218,7 @@ int otbFourierMellinDescriptorsRotationInvariant(int itkNotUsed(argc), char * ar filter->SetInterpolator(interpolator); filter->SetDefaultPixelValue( 100 ); - const InputImageType::SpacingType & spacing = reader->GetOutput()->GetSpacing(); + const InputImageType::SpacingType & spacing = reader->GetOutput()->GetSignedSpacing(); const InputImageType::PointType & origin = reader->GetOutput()->GetOrigin(); InputImageType::SizeType size = reader->GetOutput()->GetLargestPossibleRegion().GetSize(); diff --git a/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx b/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx index d9741eeaed..afbedddd9b 100644 --- a/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx +++ b/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx @@ -74,7 +74,7 @@ OutputImageType::Pointer sift(ImageType::Pointer input, pointSetFilter->SetOutsideValue(0); pointSetFilter->SetInsideValue(255); pointSetFilter->SetSize(input->GetLargestPossibleRegion().GetSize()); - pointSetFilter->SetSpacing(input->GetSpacing()); + pointSetFilter->SetSpacing(input->GetSignedSpacing()); pointSetFilter->SetOrigin(input->GetOrigin()); pointSetFilter->Update(); @@ -116,7 +116,7 @@ ImageType::Pointer rotate(ImageType::Pointer input, TransformType::OutputVectorType translation1; TransformType::OutputVectorType translation2; - const ImageType::SpacingType& spacing = input->GetSpacing(); + const ImageType::SpacingType& spacing = input->GetSignedSpacing(); const ImageType::PointType& origin = input->GetOrigin(); ImageType::SizeType size = input->GetLargestPossibleRegion().GetSize(); @@ -155,7 +155,7 @@ OutputImageType::Pointer invRotate(OutputImageType::Pointer input, TransformType::OutputVectorType translation1; TransformType::OutputVectorType translation2; - const ImageType::SpacingType& spacing = input->GetSpacing(); + const ImageType::SpacingType& spacing = input->GetSignedSpacing(); const ImageType::PointType& origin = input->GetOrigin(); ImageType::SizeType size = input->GetLargestPossibleRegion().GetSize(); diff --git a/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputImage.cxx b/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputImage.cxx index e8e5671474..355dc8d46a 100644 --- a/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputImage.cxx +++ b/Modules/Feature/Descriptors/test/otbImageToSIFTKeyPointSetFilterOutputImage.cxx @@ -116,7 +116,7 @@ int otbImageToSIFTKeyPointSetFilterOutputImage(int itkNotUsed(argc), char * argv std::cout << "Copy Input image in Output image" << std::endl; PointsIteratorType pIt = filter->GetOutput()->GetPoints()->Begin(); - ImageType::SpacingType spacing = reader->GetOutput()->GetSpacing(); + ImageType::SpacingType spacing = reader->GetOutput()->GetSignedSpacing(); ImageType::PointType origin = reader->GetOutput()->GetOrigin(); //OutputImageType::SizeType size = outputImage->GetLargestPossibleRegion().GetSize(); diff --git a/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx b/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx index a9c1e88226..7f8aa38e98 100644 --- a/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx +++ b/Modules/Feature/Edge/include/otbHoughTransform2DLinesImageFilter.txx @@ -195,7 +195,7 @@ HoughTransform2DLinesImageFilter<TInputPixelType, TOutputPixelType> m_SimplifyAccumulator = OutputImageType::New(); m_SimplifyAccumulator->SetRegions(outputImage->GetLargestPossibleRegion()); m_SimplifyAccumulator->SetOrigin(inputImage->GetOrigin()); - m_SimplifyAccumulator->SetSpacing(inputImage->GetSpacing()); + m_SimplifyAccumulator->SetSignedSpacing(inputImage->GetSignedSpacing()); m_SimplifyAccumulator->Allocate(); m_SimplifyAccumulator->FillBuffer(0); diff --git a/Modules/Feature/Edge/include/otbLineSegmentDetector.txx b/Modules/Feature/Edge/include/otbLineSegmentDetector.txx index aecdb8b29f..c06344e183 100644 --- a/Modules/Feature/Edge/include/otbLineSegmentDetector.txx +++ b/Modules/Feature/Edge/include/otbLineSegmentDetector.txx @@ -323,7 +323,7 @@ LineSegmentDetector<TInputImage, TPrecision> this->GetOutput(0)->GetDataTree()->Add(folder, document); this->GetOutput(0)->SetProjectionRef(this->GetInput()->GetProjectionRef()); - SpacingType spacing = this->GetInput()->GetSpacing(); + SpacingType spacing = this->GetInput()->GetSignedSpacing(); OriginType origin = this->GetInput()->GetOrigin(); /** store the lines*/ diff --git a/Modules/Feature/Edge/include/otbLocalHoughFilter.txx b/Modules/Feature/Edge/include/otbLocalHoughFilter.txx index 0d78f6879d..a3b0d6e6be 100644 --- a/Modules/Feature/Edge/include/otbLocalHoughFilter.txx +++ b/Modules/Feature/Edge/include/otbLocalHoughFilter.txx @@ -195,7 +195,7 @@ LocalHoughFilter<TInputImage> region.SetIndex(index); localImage->SetRegions(region); localImage->SetOrigin(filterImage->GetOrigin()); - localImage->SetSpacing(filterImage->GetSpacing()); + localImage->SetSignedSpacing(filterImage->GetSignedSpacing()); localImage->Allocate(); typedef itk::ImageRegionIteratorWithIndex<InputImageType> LocalIteratorType; diff --git a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx index fec32eb248..8f80efc200 100644 --- a/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx +++ b/Modules/Feature/Edge/include/otbTouziEdgeDetectorImageFilter.txx @@ -115,7 +115,7 @@ TouziEdgeDetectorImageFilter<TInputImage, TOutputImage, TOutputImageDirection> region.SetIndex(output->GetRequestedRegion().GetIndex()); direction->SetRegions(region); direction->SetOrigin(output->GetOrigin()); - direction->SetSpacing(output->GetSpacing()); + direction->SetSignedSpacing(output->GetSignedSpacing()); direction->Allocate(); } diff --git a/Modules/Feature/Moments/test/otbFlusserMomentsImageFunction.cxx b/Modules/Feature/Moments/test/otbFlusserMomentsImageFunction.cxx index bdeef7475f..e2e5c387e1 100644 --- a/Modules/Feature/Moments/test/otbFlusserMomentsImageFunction.cxx +++ b/Modules/Feature/Moments/test/otbFlusserMomentsImageFunction.cxx @@ -205,7 +205,7 @@ int otbFlusserMomentsImageFunctionRotationInvariant(int itkNotUsed(argc), char * filter->SetInterpolator(interpolator); filter->SetDefaultPixelValue( 100 ); - const InputImageType::SpacingType & spacing = reader->GetOutput()->GetSpacing(); + const InputImageType::SpacingType & spacing = reader->GetOutput()->GetSignedSpacing(); const InputImageType::PointType & origin = reader->GetOutput()->GetOrigin(); InputImageType::SizeType size = reader->GetOutput()->GetLargestPossibleRegion().GetSize(); diff --git a/Modules/Feature/Moments/test/otbHuMomentsImageFunction.cxx b/Modules/Feature/Moments/test/otbHuMomentsImageFunction.cxx index eceb2d338e..3a1da3fc52 100644 --- a/Modules/Feature/Moments/test/otbHuMomentsImageFunction.cxx +++ b/Modules/Feature/Moments/test/otbHuMomentsImageFunction.cxx @@ -204,7 +204,7 @@ int otbHuMomentsImageFunctionRotationInvariant(int itkNotUsed(argc), char * argv filter->SetInterpolator(interpolator); filter->SetDefaultPixelValue( 100 ); - const InputImageType::SpacingType & spacing = reader->GetOutput()->GetSpacing(); + const InputImageType::SpacingType & spacing = reader->GetOutput()->GetSignedSpacing(); const InputImageType::PointType & origin = reader->GetOutput()->GetOrigin(); InputImageType::SizeType size = reader->GetOutput()->GetLargestPossibleRegion().GetSize(); diff --git a/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx b/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx index d43274f8fc..506f894347 100644 --- a/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx +++ b/Modules/Feature/SeamCarving/include/otbAddCarvingPathFilter.txx @@ -226,7 +226,7 @@ AddCarvingPathFilter<TInputImage, TInputPath, TOutputImage> // we need to compute the output spacing, the output image size, and the // output image start index const typename TInputImage::SpacingType& - inputSpacing = inputPtr->GetSpacing(); + inputSpacing = inputPtr->GetSignedSpacing(); const typename TInputImage::SizeType& inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); const typename TInputImage::IndexType& inputStartIndex @@ -245,7 +245,7 @@ AddCarvingPathFilter<TInputImage, TInputPath, TOutputImage> // we remove one column of the image outputSize[dir0] = inputSize[dir0] + 1; - outputPtr->SetSpacing(outputSpacing); + outputPtr->SetSignedSpacing(outputSpacing); typename TOutputImage::RegionType outputLargestPossibleRegion; outputLargestPossibleRegion.SetSize(outputSize); diff --git a/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx b/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx index ceed579d6f..5052be60db 100644 --- a/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx +++ b/Modules/Feature/SeamCarving/include/otbRemoveCarvingPathFilter.txx @@ -191,7 +191,7 @@ RemoveCarvingPathFilter<TInputImage, TInputPath, TOutputImage> // we need to compute the output spacing, the output image size, and the // output image start index const typename TInputImage::SpacingType& - inputSpacing = inputPtr->GetSpacing(); + inputSpacing = inputPtr->GetSignedSpacing(); const typename TInputImage::SizeType& inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); const typename TInputImage::IndexType& inputStartIndex @@ -210,7 +210,7 @@ RemoveCarvingPathFilter<TInputImage, TInputPath, TOutputImage> // we remove one column of the image outputSize[dir0] = inputSize[dir0] - 1; - outputPtr->SetSpacing(outputSpacing); + outputPtr->SetSignedSpacing(outputSpacing); typename TOutputImage::RegionType outputLargestPossibleRegion; outputLargestPossibleRegion.SetSize(outputSize); diff --git a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx index 94a5cbf4c1..43ab8ca08e 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx +++ b/Modules/Feature/Textures/include/otbScalarImageToAdvancedTexturesFilter.txx @@ -212,7 +212,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> outputRegion.SetSize(0, 1 + (inputRegion.GetSize(0) - 1 - m_SubsampleOffset[0]) / m_SubsampleFactor[0]); outputRegion.SetSize(1, 1 + (inputRegion.GetSize(1) - 1 - m_SubsampleOffset[1]) / m_SubsampleFactor[1]); - typename OutputImageType::SpacingType outSpacing = this->GetInput()->GetSpacing(); + typename OutputImageType::SpacingType outSpacing = this->GetInput()->GetSignedSpacing(); outSpacing[0] *= m_SubsampleFactor[0]; outSpacing[1] *= m_SubsampleFactor[1]; @@ -224,7 +224,7 @@ ScalarImageToAdvancedTexturesFilter<TInputImage, TOutputImage> OutputImagePointerType outputPtr = this->GetOutput(i); outputPtr->SetLargestPossibleRegion(outputRegion); outputPtr->SetOrigin(outOrigin); - outputPtr->SetSpacing(outSpacing); + outputPtr->SetSignedSpacing(outSpacing); } } diff --git a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx index abeba22eab..9c7aed6895 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx +++ b/Modules/Feature/Textures/include/otbScalarImageToHigherOrderTexturesFilter.txx @@ -254,7 +254,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> outputRegion.SetSize(0, 1 + (inputRegion.GetSize(0) - 1 - m_SubsampleOffset[0]) / m_SubsampleFactor[0]); outputRegion.SetSize(1, 1 + (inputRegion.GetSize(1) - 1 - m_SubsampleOffset[1]) / m_SubsampleFactor[1]); - typename OutputImageType::SpacingType outSpacing = this->GetInput()->GetSpacing(); + typename OutputImageType::SpacingType outSpacing = this->GetInput()->GetSignedSpacing(); outSpacing[0] *= m_SubsampleFactor[0]; outSpacing[1] *= m_SubsampleFactor[1]; @@ -266,7 +266,7 @@ ScalarImageToHigherOrderTexturesFilter<TInputImage, TOutputImage> OutputImagePointerType outputPtr = this->GetOutput(i); outputPtr->SetLargestPossibleRegion(outputRegion); outputPtr->SetOrigin(outOrigin); - outputPtr->SetSpacing(outSpacing); + outputPtr->SetSignedSpacing(outSpacing); } } diff --git a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx index 59396979f3..e7473f705a 100644 --- a/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx +++ b/Modules/Feature/Textures/include/otbScalarImageToTexturesFilter.txx @@ -187,7 +187,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> outputRegion.SetSize(0, 1 + (inputRegion.GetSize(0) - 1 - m_SubsampleOffset[0]) / m_SubsampleFactor[0]); outputRegion.SetSize(1, 1 + (inputRegion.GetSize(1) - 1 - m_SubsampleOffset[1]) / m_SubsampleFactor[1]); - typename OutputImageType::SpacingType outSpacing = this->GetInput()->GetSpacing(); + typename OutputImageType::SpacingType outSpacing = this->GetInput()->GetSignedSpacing(); outSpacing[0] *= m_SubsampleFactor[0]; outSpacing[1] *= m_SubsampleFactor[1]; @@ -199,7 +199,7 @@ ScalarImageToTexturesFilter<TInputImage, TOutputImage> OutputImagePointerType outputPtr = this->GetOutput(i); outputPtr->SetLargestPossibleRegion(outputRegion); outputPtr->SetOrigin(outOrigin); - outputPtr->SetSpacing(outSpacing); + outputPtr->SetSignedSpacing(outSpacing); } } diff --git a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h index 04ad63740f..26464e39fc 100644 --- a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h +++ b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.h @@ -165,7 +165,7 @@ public: template <class TImageType> void SetOutputParametersFromImage(const TImageType * image) { this->SetOutputOrigin ( image->GetOrigin() ); - this->SetOutputSpacing ( image->GetSpacing() ); + this->SetOutputSpacing ( image->GetSignedSpacing() ); //this->SetOutputStartIndex ( image->GetLargestPossibleRegion().GetIndex() ); this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() ); this->SetOutputProjectionRef(image->GetProjectionRef()); diff --git a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx index c87816bf07..140fd20416 100644 --- a/Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx +++ b/Modules/Filtering/DEM/include/otbDEMToImageGenerator.txx @@ -63,7 +63,7 @@ void DEMToImageGenerator<TDEMImage> largestPossibleRegion.SetIndex(start); output->SetLargestPossibleRegion(largestPossibleRegion); - output->SetSpacing(m_OutputSpacing); + output->SetSignedSpacing(m_OutputSpacing); output->SetOrigin(m_OutputOrigin); diff --git a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx index 423b57cee7..6b8411967a 100644 --- a/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbGridResampleImageFilter.txx @@ -68,7 +68,7 @@ GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision> ::SetOutputParametersFromImage(const ImageBaseType * image) { this->SetOutputOrigin ( image->GetOrigin() ); - this->SetOutputSpacing ( image->GetSpacing() ); + this->SetOutputSpacing ( image->GetSignedSpacing() ); this->SetOutputStartIndex ( image->GetLargestPossibleRegion().GetIndex() ); this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() ); } @@ -95,7 +95,7 @@ GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision> outputLargestPossibleRegion.SetIndex(m_OutputStartIndex); outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); - outputPtr->SetSpacing(m_OutputSpacing); + outputPtr->SetSignedSpacing(m_OutputSpacing); outputPtr->SetOrigin(m_OutputOrigin); // TODO: Report no data value here @@ -266,8 +266,8 @@ GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision> this->GetInput()->TransformIndexToPhysicalPoint(inUL,inULp); this->GetInput()->TransformIndexToPhysicalPoint(inLR,inLRp); - inULp-=0.5*this->GetInput()->GetSpacing(); - inLRp+=0.5*this->GetInput()->GetSpacing(); + inULp-=0.5*this->GetInput()->GetSignedSpacing(); + inLRp+=0.5*this->GetInput()->GetSignedSpacing(); ContinuousInputIndexType outUL; ContinuousInputIndexType outLR; @@ -340,9 +340,9 @@ GridResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecision> InterpolatorOutputType interpolatorValue; //(this->GetOutput()->GetNumberOfComponentsPerPixel()); OutputPixelType outputValue; //(this->GetOutput()->GetNumberOfComponentsPerPixel()); - // TODO: assert outputPtr->GetSpacing() != 0 here - assert(outputPtr->GetSpacing()[0]!=0&&"Null spacing will cause division by zero."); - const double delta = outputPtr->GetSpacing()[0]/inputPtr->GetSpacing()[0]; + // TODO: assert outputPtr->GetSignedSpacing() != 0 here + assert(outputPtr->GetSignedSpacing()[0]!=0&&"Null spacing will cause division by zero."); + const double delta = outputPtr->GetSignedSpacing()[0]/inputPtr->GetSignedSpacing()[0]; // Iterate through the output region outIt.GoToBegin(); diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx index 71b4327b91..73fb3f35c6 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingResampleImageFilter.txx @@ -121,7 +121,7 @@ StreamingResampleImageFilter<TInputImage, TOutputImage, TInterpolatorPrecisionTy ::SetOutputParametersFromImage(const ImageBaseType * image) { this->SetOutputOrigin ( image->GetOrigin() ); - this->SetOutputSpacing ( image->GetSpacing() ); + this->SetOutputSpacing ( image->GetSignedSpacing() ); this->SetOutputStartIndex ( image->GetLargestPossibleRegion().GetIndex() ); this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() ); } diff --git a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx index 68a55f3646..124f20e116 100644 --- a/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbStreamingShrinkImageFilter.txx @@ -125,7 +125,7 @@ PersistentShrinkImageFilter<TInputImage, TOutputImage> m_ShrunkOutput->CopyInformation(inputPtr); const typename InputImageType::SpacingType& - inputSpacing = inputPtr->GetSpacing(); + inputSpacing = inputPtr->GetSignedSpacing(); const typename InputImageType::SizeType& inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); const typename InputImageType::IndexType& inputIndex @@ -154,7 +154,7 @@ PersistentShrinkImageFilter<TInputImage, TOutputImage> shrunkOutputStartIndex[i] = 0; } - m_ShrunkOutput->SetSpacing(shrunkOutputSpacing); + m_ShrunkOutput->SetSignedSpacing(shrunkOutputSpacing); m_ShrunkOutput->SetOrigin(shrunkOutputOrigin); shrunkOutputLargestPossibleRegion.SetSize(shrunkOutputSize); diff --git a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx index 4159907e2f..3a67aa469e 100644 --- a/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx +++ b/Modules/Filtering/ImageManipulation/include/otbTileImageFilter.txx @@ -62,7 +62,7 @@ TileImageFilter<TImage> itkExceptionMacro(<<"Layout has "<<numberOfImages<<" tiles, but only "<<this->GetNumberOfInputs()<<" inputs are found."); } - typename ImageType::SpacingType spacing = this->GetInput()->GetSpacing(); + typename ImageType::SpacingType spacing = this->GetInput()->GetSignedSpacing(); unsigned int nbComp = this->GetInput()->GetNumberOfComponentsPerPixel(); m_ColumnsSizes.clear(); @@ -94,7 +94,7 @@ TileImageFilter<TImage> itkExceptionMacro(<<"Inconsistent sizes in layout detected!"); } - if(spacing != currentTile->GetSpacing()) + if(spacing != currentTile->GetSignedSpacing()) { itkExceptionMacro(<<"Inconsistent spacings in layout detected!"); } diff --git a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx index 0a03bc57a8..919894cc95 100644 --- a/Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx +++ b/Modules/Filtering/MathParser/include/otbBandMathImageFilter.txx @@ -181,7 +181,7 @@ void BandMathImageFilter<TImage> } // Store images specs - m_Spacing = this->GetNthInput(0)->GetSpacing(); + m_Spacing = this->GetNthInput(0)->GetSignedSpacing(); m_Origin = this->GetNthInput(0)->GetOrigin(); // Allocate and initialize the thread temporaries diff --git a/Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx b/Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx index b1ebc4da0a..366e84ba0a 100644 --- a/Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx +++ b/Modules/Filtering/MathParser/test/otbBandMathImageFilter.cxx @@ -237,11 +237,11 @@ int otbBandMathImageFilterWithIdx( int itkNotUsed(argc), char* argv[]) IteratorType it3(image3, region); image1->SetOrigin(origin); - image1->SetSpacing(spacing); + image1->SetSignedSpacing(spacing); image2->SetOrigin(origin); - image2->SetSpacing(spacing); + image2->SetSignedSpacing(spacing); image3->SetOrigin(origin); - image3->SetSpacing(spacing); + image3->SetSignedSpacing(spacing); for (it1.GoToBegin(), it2.GoToBegin(), it3.GoToBegin(); !it1.IsAtEnd(); ++it1, ++it2, ++it3) { diff --git a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx index 9407dba601..11da024a2b 100644 --- a/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx +++ b/Modules/Filtering/MathParserX/include/otbBandMathXImageFilter.txx @@ -665,13 +665,13 @@ void BandMathXImageFilter<TImage> if (m_AImage[i][j].type == 2) //imiPhyX { - SpacingType spacing = this->GetNthInput(m_AImage[i][j].info[0])->GetSpacing(); + SpacingType spacing = this->GetNthInput(m_AImage[i][j].info[0])->GetSignedSpacing(); m_AImage[i][j].value = ValueType(static_cast<double>(spacing[0])); } if (m_AImage[i][j].type == 3) //imiPhyY { - SpacingType spacing = this->GetNthInput(m_AImage[i][j].info[0])->GetSpacing(); + SpacingType spacing = this->GetNthInput(m_AImage[i][j].info[0])->GetSignedSpacing(); m_AImage[i][j].value = ValueType(static_cast<double>(spacing[1])); } diff --git a/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx b/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx index d48b558ba4..111441bcb5 100644 --- a/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx +++ b/Modules/Filtering/MathParserX/test/otbBandMathXImageFilter.cxx @@ -520,11 +520,11 @@ int otbBandMathXImageFilterWithIdx( int itkNotUsed(argc), char* argv[]) IteratorType it3(image3, region); image1->SetOrigin(origin); - image1->SetSpacing(spacing); + image1->SetSignedSpacing(spacing); image2->SetOrigin(origin); - image2->SetSpacing(spacing); + image2->SetSignedSpacing(spacing); image3->SetOrigin(origin); - image3->SetSpacing(spacing); + image3->SetSignedSpacing(spacing); for (it1.GoToBegin(), it2.GoToBegin(), it3.GoToBegin(); !it1.IsAtEnd(); ++it1, ++it2, ++it3) { diff --git a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx index 2146f7bac3..aec83b9230 100644 --- a/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx +++ b/Modules/Filtering/MorphologicalPyramid/include/otbMorphologicalPyramidResampler.txx @@ -96,7 +96,7 @@ Resampler<TInputImage, TOutputImage> } unsigned int i; // Computing output spacing, size and index from input data - const typename InputImageType::SpacingType& inputSpacing = inputPtr->GetSpacing(); + const typename InputImageType::SpacingType& inputSpacing = inputPtr->GetSignedSpacing(); const typename InputImageType::IndexType& inputStartIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); typename OutputImageType::IndexType outputStartIndex; typename OutputImageType::SpacingType spacing; @@ -105,7 +105,7 @@ Resampler<TInputImage, TOutputImage> outputStartIndex[i] = inputStartIndex[i]; } - outputPtr->SetSpacing(inputSpacing); + outputPtr->SetSignedSpacing(inputSpacing); typename OutputImageType::RegionType outputLargestPossibleRegion; outputLargestPossibleRegion.SetSize(this->GetSize()); outputLargestPossibleRegion.SetIndex(outputStartIndex); @@ -134,7 +134,7 @@ Resampler<TInputImage, TOutputImage> // Scale parameters computation typename TransformType::InputVectorType scales; typename InputImageType::SizeType inputSize = this->GetInput()->GetLargestPossibleRegion().GetSize(); - typename InputImageType::SpacingType inputSpacing = this->GetInput()->GetSpacing(); + typename InputImageType::SpacingType inputSpacing = this->GetInput()->GetSignedSpacing(); scales[0] = static_cast<double>(inputSize[0]) / static_cast<double>(m_Size[0]); scales[1] = static_cast<double>(inputSize[1]) / static_cast<double>(m_Size[1]); transform->SetScale(scales); diff --git a/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx b/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx index 4b32e9d737..abb678bebe 100644 --- a/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx +++ b/Modules/Filtering/Path/include/otbRegionImageToRectangularPathListFilter.txx @@ -82,7 +82,7 @@ RegionImageToRectangularPathListFilter<TInputImage, TOutputPath> typename InputImageType::PointType origin; typename InputImageType::SpacingType spacing; origin = InputImage->GetOrigin(); - spacing = InputImage->GetSpacing(); + spacing = InputImage->GetSignedSpacing(); std::cout << "Image origin : " << origin << std::endl; std::cout << "Image spacing : " << spacing << std::endl; diff --git a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx index 4a5c0edc8f..923a07fadb 100644 --- a/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx +++ b/Modules/Filtering/Polarimetry/include/otbMultiChannelsPolarimetricSynthesisFilter.txx @@ -87,7 +87,7 @@ MultiChannelsPolarimetricSynthesisFilter<TInputImage, TOutputImage, TFunction> // dimensions to copy unsigned int i, j; const typename InputImageType::SpacingType& - inputSpacing = inputPtr->GetSpacing(); + inputSpacing = inputPtr->GetSignedSpacing(); const typename InputImageType::PointType& inputOrigin = inputPtr->GetOrigin(); const typename InputImageType::DirectionType& @@ -133,7 +133,7 @@ MultiChannelsPolarimetricSynthesisFilter<TInputImage, TOutputImage, TFunction> } // set the spacing and origin - outputPtr->SetSpacing(outputSpacing); + outputPtr->SetSignedSpacing(outputSpacing); outputPtr->SetOrigin(outputOrigin); outputPtr->SetDirection(outputDirection); diff --git a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx index ac6c36280f..7635cdcea7 100644 --- a/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbGenericRSResampleImageFilter.txx @@ -225,7 +225,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage> const InputImageType * src = dynamic_cast<const InputImageType*>(image); this->SetOutputOrigin ( src->GetOrigin() ); - this->SetOutputSpacing ( src->GetSpacing() ); + this->SetOutputSpacing ( src->GetSignedSpacing() ); this->SetOutputStartIndex ( src->GetLargestPossibleRegion().GetIndex() ); this->SetOutputSize ( src->GetLargestPossibleRegion().GetSize() ); this->SetOutputProjectionRef(src->GetProjectionRef()); @@ -243,7 +243,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage> ::SetOutputParametersFromImage(const TImageType * image) { this->SetOutputOrigin ( image->GetOrigin() ); - this->SetOutputSpacing ( image->GetSpacing() ); + this->SetOutputSpacing ( image->GetSignedSpacing() ); this->SetOutputStartIndex ( image->GetLargestPossibleRegion().GetIndex() ); this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() ); this->SetOutputProjectionRef(image->GetProjectionRef()); diff --git a/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx b/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx index bd152c5f74..acc92106b5 100644 --- a/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx +++ b/Modules/Filtering/Projection/include/otbGroundSpacingImageFunction.txx @@ -131,7 +131,7 @@ GroundSpacingImageFunction<TInputImage, TCoordRep> const itk::MetaDataDictionary& inputDict = this->GetInputImage()->GetMetaDataDictionary(); transform->SetInputDictionary(inputDict); transform->SetInputOrigin(this->GetInputImage()->GetOrigin()); - transform->SetInputSpacing(this->GetInputImage()->GetSpacing()); + transform->SetInputSpacing(this->GetInputImage()->GetSignedSpacing()); transform->InstantiateTransform(); return transform->TransformPoint(inputPoint); diff --git a/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx b/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx index 1b0cf01992..35e9ba8682 100644 --- a/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbImportGeoInformationImageFilter.txx @@ -102,7 +102,7 @@ ImportGeoInformationImageFilter<TImage, TSourceImage> // outputPtr->CopyInformation(sourcePtr); // // Don't forget to copy also the origin and spacing, not handled by the CopyInformation method. // outputPtr->SetOrigin(sourcePtr->GetOrigin()); -// outputPtr->SetSpacing(sourcePtr->GetSpacing()); +// outputPtr->SetSignedSpacing(sourcePtr->GetSignedSpacing()); // } /** diff --git a/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx b/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx index 2f8e542c05..01c10488d0 100644 --- a/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx +++ b/Modules/Filtering/Projection/include/otbPhysicalToRPCSensorModelImageFilter.txx @@ -81,8 +81,8 @@ PhysicalToRPCSensorModelImageFilter<TImage> for(unsigned int py = 0; py<m_GridSize[1]; ++py) { PointType inputPoint = input->GetOrigin(); - inputPoint[0] += (px * gridSpacingX + 0.5) * input->GetSpacing()[0]; - inputPoint[1] += (py * gridSpacingY + 0.5) * input->GetSpacing()[1]; + inputPoint[0] += (px * gridSpacingX + 0.5) * input->GetSignedSpacing()[0]; + inputPoint[1] += (py * gridSpacingY + 0.5) * input->GetSignedSpacing()[1]; PointType outputPoint = rsTransform->TransformPoint(inputPoint); m_GCPsToSensorModelFilter->AddGCP(inputPoint, outputPoint); } diff --git a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h index b55573f92c..b86c9c78ac 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h +++ b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.h @@ -93,7 +93,7 @@ public: itkGetConstReferenceMacro(OutputOrigin, OriginType); /** Set the spacing (size of a pixel) of the output vector data. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ virtual void SetOutputSpacing(const SpacingType& spacing); virtual void SetOutputSpacing(const double spacing[2]); virtual void SetOutputSpacing(const float spacing[2]); diff --git a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx index b38ec9fcec..ccf2dc45ec 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx +++ b/Modules/Filtering/Projection/include/otbVectorDataIntoImageProjectionFilter.txx @@ -128,7 +128,7 @@ VectorDataIntoImageProjectionFilter<TInputVectorData, TInputImage> itkExceptionMacro("Invalid input image."); } - /*std::cout << "Spacing of the input image: "<< m_InputImage->GetSpacing() << std::endl; + /*std::cout << "Spacing of the input image: "<< m_InputImage->GetSignedSpacing() << std::endl; std::cout << "Origin of the input image: "<< m_InputImage->GetOrigin() << std::endl; std::cout << "Size of the input image: "<< m_InputImage->GetLargestPossibleRegion() << std::endl; std::cout << "ProjRef of the input image: "<< m_InputImage->GetProjectionRef() << std::endl; @@ -203,7 +203,7 @@ VectorDataIntoImageProjectionFilter<TInputVectorData, TInputImage> if (m_UseOutputSpacingAndOriginFromImage) { m_VdProjFilter->SetOutputOrigin(m_InputImage->GetOrigin()); - m_VdProjFilter->SetOutputSpacing(m_InputImage->GetSpacing()); + m_VdProjFilter->SetOutputSpacing(m_InputImage->GetSignedSpacing()); } else { diff --git a/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h b/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h index 18fc93404a..3178d4c71a 100644 --- a/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h +++ b/Modules/Filtering/Projection/include/otbVectorDataProjectionFilter.h @@ -150,7 +150,7 @@ public: itkGetConstReferenceMacro(InputOrigin, OriginType); /** Set the spacing (size of a pixel) of the vector data. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ virtual void SetInputSpacing(const SpacingType& spacing); virtual void SetInputSpacing(const double spacing[2]); virtual void SetInputSpacing(const float spacing[2]); @@ -166,7 +166,7 @@ public: itkGetConstReferenceMacro(OutputOrigin, OriginType); /** Set the spacing (size of a pixel) of the vector data. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ virtual void SetOutputSpacing(const SpacingType& spacing); virtual void SetOutputSpacing(const double spacing[2]); virtual void SetOutputSpacing(const float spacing[2]); diff --git a/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromGeoToMap.cxx b/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromGeoToMap.cxx index decd1d354f..b4ea5eb5fe 100644 --- a/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromGeoToMap.cxx +++ b/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromGeoToMap.cxx @@ -65,7 +65,7 @@ int otbGeometriesProjectionFilterFromGeoToMap(int argc, char * argv[]) filter->SetOutput(out_set); filter->SetOutputProjectionRef(imageReader->GetOutput()->GetProjectionRef()); filter->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); - filter->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); + filter->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing()); filter->Update(); diff --git a/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToImage.cxx b/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToImage.cxx index bbca57fa39..da3833bf1c 100644 --- a/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToImage.cxx +++ b/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToImage.cxx @@ -65,7 +65,7 @@ int otbGeometriesProjectionFilterFromMapToImage(int argc, char * argv[]) filter->SetOutput(out_set); filter->SetOutputProjectionRef(imageReader->GetOutput()->GetProjectionRef()); filter->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); - filter->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); + filter->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing()); filter->Update(); diff --git a/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToSensor.cxx b/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToSensor.cxx index 1d86a408fc..ec0a201c47 100644 --- a/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToSensor.cxx +++ b/Modules/Filtering/Projection/test/otbGeometriesProjectionFilterFromMapToSensor.cxx @@ -65,7 +65,7 @@ int otbGeometriesProjectionFilterFromMapToSensor(int argc, char * argv[]) filter->SetOutput(out_set); filter->SetOutputKeywordList(imageReader->GetOutput()->GetImageKeywordlist()); filter->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); - filter->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); + filter->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing()); filter->Update(); diff --git a/Modules/Filtering/Projection/test/otbImportGeoInformationImageFilter.cxx b/Modules/Filtering/Projection/test/otbImportGeoInformationImageFilter.cxx index ea687e9a3d..a8d11a849d 100644 --- a/Modules/Filtering/Projection/test/otbImportGeoInformationImageFilter.cxx +++ b/Modules/Filtering/Projection/test/otbImportGeoInformationImageFilter.cxx @@ -56,7 +56,7 @@ int otbImportGeoInformationImageFilter(int itkNotUsed(argc), char * argv[]) std::cout << "black: " << black->GetLargestPossibleRegion() << std::endl; black->SetOrigin(reader->GetOutput()->GetOrigin()); - black->SetSpacing(reader->GetOutput()->GetSpacing()); + black->SetSignedSpacing(reader->GetOutput()->GetSignedSpacing()); import->SetInput(black); import->SetSource(reader->GetOutput()); diff --git a/Modules/Filtering/Projection/test/otbTileImageFilterRSTransformTest.cxx b/Modules/Filtering/Projection/test/otbTileImageFilterRSTransformTest.cxx index 13d39b4fc3..9e2a16f1ca 100644 --- a/Modules/Filtering/Projection/test/otbTileImageFilterRSTransformTest.cxx +++ b/Modules/Filtering/Projection/test/otbTileImageFilterRSTransformTest.cxx @@ -67,9 +67,9 @@ int otbTileImageFilterRSTransformTest(int argc, char * argv[]) // Compute tile center PointType center = reader->GetOutput()->GetOrigin(); - center[0] += reader->GetOutput()->GetSpacing()[0] + center[0] += reader->GetOutput()->GetSignedSpacing()[0] * reader->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/2; - center[1] += reader->GetOutput()->GetSpacing()[1] + center[1] += reader->GetOutput()->GetSignedSpacing()[1] * reader->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/2; points.push_back(center); diff --git a/Modules/Filtering/Projection/test/otbVectorDataIntoImageProjectionFilterTest.cxx b/Modules/Filtering/Projection/test/otbVectorDataIntoImageProjectionFilterTest.cxx index e7efcbff64..be39753484 100644 --- a/Modules/Filtering/Projection/test/otbVectorDataIntoImageProjectionFilterTest.cxx +++ b/Modules/Filtering/Projection/test/otbVectorDataIntoImageProjectionFilterTest.cxx @@ -227,7 +227,7 @@ int otbVectorDataIntoImageProjectionFilterCompareImplTest(int itkNotUsed(argc), vproj->SetOutputKeywordList(reader->GetOutput()->GetImageKeywordlist()); vproj->SetOutputProjectionRef(reader->GetOutput()->GetProjectionRef()); vproj->SetOutputOrigin(reader->GetOutput()->GetOrigin()); - vproj->SetOutputSpacing(reader->GetOutput()->GetSpacing()); + vproj->SetOutputSpacing(reader->GetOutput()->GetSignedSpacing()); //---------- // WRITE diff --git a/Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToImage.cxx b/Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToImage.cxx index 6f4946be82..6971f7fe0f 100644 --- a/Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToImage.cxx +++ b/Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToImage.cxx @@ -60,7 +60,7 @@ int otbVectorDataProjectionFilterFromMapToImage(int argc, char * argv[]) vectorDataProjection->SetOutputProjectionRef(imageReader->GetOutput()->GetProjectionRef()); vectorDataProjection->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); - vectorDataProjection->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); + vectorDataProjection->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing()); typedef otb::VectorDataFileWriter<OutputVectorDataType> VectorDataFileWriterType; VectorDataFileWriterType::Pointer writer = VectorDataFileWriterType::New(); diff --git a/Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToSensor.cxx b/Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToSensor.cxx index 888f0965c0..299a14db3d 100644 --- a/Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToSensor.cxx +++ b/Modules/Filtering/Projection/test/otbVectorDataProjectionFilterFromMapToSensor.cxx @@ -60,7 +60,7 @@ int otbVectorDataProjectionFilterFromMapToSensor(int argc, char * argv[]) vectorDataProjection->SetOutputKeywordList(imageReader->GetOutput()->GetImageKeywordlist()); vectorDataProjection->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); - vectorDataProjection->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); + vectorDataProjection->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing()); typedef otb::VectorDataFileWriter<OutputVectorDataType> VectorDataFileWriterType; VectorDataFileWriterType::Pointer writer = VectorDataFileWriterType::New(); diff --git a/Modules/Filtering/Projection/test/otbVectorDataTransformFilter.cxx b/Modules/Filtering/Projection/test/otbVectorDataTransformFilter.cxx index d4b30d199c..e0f5ee5ee8 100644 --- a/Modules/Filtering/Projection/test/otbVectorDataTransformFilter.cxx +++ b/Modules/Filtering/Projection/test/otbVectorDataTransformFilter.cxx @@ -75,7 +75,7 @@ int otbVectorDataTransformFilter (int itkNotUsed(argc), char * argv[]) TransformType::Pointer transform = TransformType::New(); TranslationParamType translationParam; translationParam[0] = 0; - translationParam[1] = 8. * reader->GetOutput()->GetSpacing()[1]; + translationParam[1] = 8. * reader->GetOutput()->GetSignedSpacing()[1]; transform->SetTranslation(translationParam); VectorDataTransformType::Pointer transformFilter = VectorDataTransformType::New(); diff --git a/Modules/Filtering/Statistics/include/otbListSampleGenerator.txx b/Modules/Filtering/Statistics/include/otbListSampleGenerator.txx index 995e1099c5..d1fc246236 100644 --- a/Modules/Filtering/Statistics/include/otbListSampleGenerator.txx +++ b/Modules/Filtering/Statistics/include/otbListSampleGenerator.txx @@ -435,7 +435,7 @@ double ListSampleGenerator<TImage, TVectorData> ::GetPolygonAreaInPixelsUnits(DataNodeType* polygonDataNode, ImageType* image) { - const double pixelArea = vcl_abs(image->GetSpacing()[0] * image->GetSpacing()[1]); + const double pixelArea = vcl_abs(image->GetSignedSpacing()[0] * image->GetSignedSpacing()[1]); // Compute area of exterior ring in pixels PolygonPointerType exteriorRing = polygonDataNode->GetPolygonExteriorRing(); diff --git a/Modules/Filtering/Statistics/test/otbContinuousMinimumMaximumImageCalculatorTest.cxx b/Modules/Filtering/Statistics/test/otbContinuousMinimumMaximumImageCalculatorTest.cxx index bd2431cb34..d8ab360d4b 100644 --- a/Modules/Filtering/Statistics/test/otbContinuousMinimumMaximumImageCalculatorTest.cxx +++ b/Modules/Filtering/Statistics/test/otbContinuousMinimumMaximumImageCalculatorTest.cxx @@ -54,7 +54,7 @@ otbContinuousMinimumMaximumImageCalculatorTest(int, char *[]) // Set origin and spacing of physical coordinates image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); PixelType minimum = -52; PixelType maximum = 103; diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h index 976b04172f..57beb9ef2f 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.h @@ -152,7 +152,7 @@ public: itkGetConstReferenceMacro(Origin, OriginType); /** Set the spacing (size of a pixel) of the vector data. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ virtual void SetSpacing(const SpacingType& spacing); virtual void SetSpacing(const double spacing[2]); virtual void SetSpacing(const float spacing[2]); diff --git a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx index 62a651e75e..116f309a90 100644 --- a/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx +++ b/Modules/Filtering/VectorDataRendering/include/otbVectorDataToMapFilter.txx @@ -182,7 +182,7 @@ VectorDataToMapFilter<TVectorData, TImage> outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); // Set spacing and origin - outputPtr->SetSpacing(m_Spacing); + outputPtr->SetSignedSpacing(m_Spacing); outputPtr->SetOrigin(m_Origin); outputPtr->SetDirection(m_Direction); diff --git a/Modules/Filtering/VectorDataRendering/test/otbVectorDataToMapFilterSensorModel.cxx b/Modules/Filtering/VectorDataRendering/test/otbVectorDataToMapFilterSensorModel.cxx index 845c3941cc..bbe6a7afe7 100644 --- a/Modules/Filtering/VectorDataRendering/test/otbVectorDataToMapFilterSensorModel.cxx +++ b/Modules/Filtering/VectorDataRendering/test/otbVectorDataToMapFilterSensorModel.cxx @@ -65,7 +65,7 @@ int otbVectorDataToMapFilterSensorModel(int argc, char * argv []) projection->SetOutputKeywordList(imageReader->GetOutput()->GetImageKeywordlist()); projection->SetOutputOrigin(imageReader->GetOutput()->GetOrigin()); - projection->SetOutputSpacing(imageReader->GetOutput()->GetSpacing()); + projection->SetOutputSpacing(imageReader->GetOutput()->GetSignedSpacing()); //Convert the vector data into an image typedef itk::RGBAPixel<unsigned char> PixelType; diff --git a/Modules/IO/ExtendedFilename/test/otbExtendedFilenameTest.cxx b/Modules/IO/ExtendedFilename/test/otbExtendedFilenameTest.cxx index 137e5ee656..f2e6cf1c79 100644 --- a/Modules/IO/ExtendedFilename/test/otbExtendedFilenameTest.cxx +++ b/Modules/IO/ExtendedFilename/test/otbExtendedFilenameTest.cxx @@ -55,7 +55,7 @@ int otbImageFileReaderWithExtendedFilename(int itkNotUsed(argc), char* argv[]) file2 << "ProjRef: " << reader->GetOutput()->GetProjectionRef() << std::endl; file2 << "Origin: " << reader->GetOutput()->GetOrigin() << std::endl; - file2 << "Spacing: " << reader->GetOutput()->GetSpacing() << std::endl; + file2 << "Spacing: " << reader->GetOutput()->GetSignedSpacing() << std::endl; return EXIT_SUCCESS; } diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.txx b/Modules/IO/ImageIO/include/otbImageFileReader.txx index 966fe434b9..7c47d9f41a 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.txx +++ b/Modules/IO/ImageIO/include/otbImageFileReader.txx @@ -385,10 +385,12 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> } } - output->SetSpacing(spacing); // Set the image spacing output->SetOrigin(origin); // Set the image origin output->SetDirection(direction); // Set the image direction cosines - + output->SetSignedSpacing(spacing); // Set the image spacing + // Need to set spacing after direction as we are setting a signed spacing + // it might change signes of direction column + if(!m_KeywordListUpToDate && !m_FilenameHelper->GetSkipGeom()) { diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.txx b/Modules/IO/ImageIO/include/otbImageFileWriter.txx index 37bb644ed2..db1a85e821 100644 --- a/Modules/IO/ImageIO/include/otbImageFileWriter.txx +++ b/Modules/IO/ImageIO/include/otbImageFileWriter.txx @@ -554,7 +554,7 @@ ImageFileWriter<TInputImage> // Setup the ImageIO with information from inputPtr // m_ImageIO->SetNumberOfDimensions(TInputImage::ImageDimension); - const typename TInputImage::SpacingType& spacing = inputPtr->GetSpacing(); + const typename TInputImage::SpacingType& spacing = inputPtr->GetSignedSpacing(); const typename TInputImage::PointType& origin = inputPtr->GetOrigin(); const typename TInputImage::DirectionType& direction = inputPtr->GetDirection(); diff --git a/Modules/IO/ImageIO/test/negativespacing.cxx b/Modules/IO/ImageIO/test/negativespacing.cxx new file mode 100644 index 0000000000..0bd4b75547 --- /dev/null +++ b/Modules/IO/ImageIO/test/negativespacing.cxx @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "otbImageIOFactory.h" +#include "itkMacro.h" +#include <iostream> + +#include "otbImageFileWriter.h" +#include "otbImageFileReader.h" +#include "otbImage.h" +#include "otbVectorImage.h" + + +int negativespacing(int itkNotUsed(argc), char * itkNotUsed(argv) []) +{ + typedef float InputPixelType; + const unsigned int Dimension = 2; + + typedef otb::Image< InputPixelType , Dimension > OTBInputImageType; + + typedef otb::ImageFileReader< OTBInputImageType > OTBReaderType; + typedef otb::ImageFileWriter< OTBInputImageType > OTBWriterType; + + OTBReaderType::Pointer otbReader ( OTBReaderType::New() ); + OTBWriterType::Pointer otbWriter ( OTBWriterType::New() ); + otbReader->SetFileName( "/home/antoine/dev/my_data/spacing/input_negat_spacing.tif" ); + otbWriter->SetFileName( "/home/antoine/dev/my_data/spacing/input_negat_spacing_result.tif" ); + otbReader->UpdateOutputInformation(); + + otbReader->Update(); + OTBInputImageType::Pointer otbinput = otbReader->GetOutput(); + + std::cout<<otbinput->GetSpacing()<<std::endl; + auto spacing = otbinput->GetSpacing(); + // spacing[0] = -spacing[0]; + otbinput->SetSignedSpacing(spacing); + std::cout<<otbinput->GetSpacing()<<std::endl; + std::cout<<otbinput->GetSignedSpacing()<<std::endl; + otbWriter->SetInput( otbReader->GetOutput() ); + otbWriter->Update(); + std::cout<<"OTBWriter"<<std::endl; + + return EXIT_SUCCESS; +} diff --git a/Modules/IO/ImageIO/test/otbImageFileReaderMSTAR.cxx b/Modules/IO/ImageIO/test/otbImageFileReaderMSTAR.cxx index ad551085fe..b44e4c4b7e 100644 --- a/Modules/IO/ImageIO/test/otbImageFileReaderMSTAR.cxx +++ b/Modules/IO/ImageIO/test/otbImageFileReaderMSTAR.cxx @@ -74,7 +74,7 @@ int otbImageFileReaderMSTAR(int itkNotUsed(argc), char* argv[]) InternalImageType::Pointer magnitude = InternalImageType::New(); magnitude->SetRegions(inputRegion); - const InternalImageType::SpacingType& spacing = reader->GetOutput()->GetSpacing(); + const InternalImageType::SpacingType& spacing = reader->GetOutput()->GetSignedSpacing(); const InternalImageType::PointType& inputOrigin = reader->GetOutput()->GetOrigin(); double outputOrigin[InputDimension]; @@ -83,7 +83,7 @@ int otbImageFileReaderMSTAR(int itkNotUsed(argc), char* argv[]) outputOrigin[i] = inputOrigin[i] + spacing[i] * inputStart[i]; } - magnitude->SetSpacing(spacing); + magnitude->SetSignedSpacing(spacing); magnitude->SetOrigin(outputOrigin); magnitude->Allocate(); diff --git a/Modules/IO/ImageIO/test/otbImageFileWriterTestWithoutInput.cxx b/Modules/IO/ImageIO/test/otbImageFileWriterTestWithoutInput.cxx index 8d67754a39..cca2bf2fb9 100644 --- a/Modules/IO/ImageIO/test/otbImageFileWriterTestWithoutInput.cxx +++ b/Modules/IO/ImageIO/test/otbImageFileWriterTestWithoutInput.cxx @@ -68,7 +68,7 @@ int otbImageScalarFileWriterTestWithoutInputGeneric(int itkNotUsed(argc), char* SpacingType spacing; spacing.Fill(1.0); image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); image->SetRegions(region); image->Allocate(); @@ -146,7 +146,7 @@ int otbImageComplexFileWriterTestWithoutInputGeneric(int itkNotUsed(argc), char* SpacingType spacing; spacing.Fill(1.0); image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); image->SetRegions(region); image->Allocate(); diff --git a/Modules/IO/ImageIO/test/otbImageStreamingFileWriterTestWithoutInput.cxx b/Modules/IO/ImageIO/test/otbImageStreamingFileWriterTestWithoutInput.cxx index 822c710c5e..858141455b 100644 --- a/Modules/IO/ImageIO/test/otbImageStreamingFileWriterTestWithoutInput.cxx +++ b/Modules/IO/ImageIO/test/otbImageStreamingFileWriterTestWithoutInput.cxx @@ -69,7 +69,7 @@ int otbImageScalarStreamingFileWriterTestWithoutInputGeneric(int itkNotUsed(argc SpacingType spacing; spacing.Fill(1.0); image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); image->SetRegions(region); image->Allocate(); @@ -148,7 +148,7 @@ int otbImageComplexStreamingFileWriterTestWithoutInputGeneric(int itkNotUsed(arg SpacingType spacing; spacing.Fill(1.0); image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); image->SetRegions(region); image->Allocate(); diff --git a/Modules/IO/ImageIO/test/otbVectorImageFileWriterTestWithoutInput.cxx b/Modules/IO/ImageIO/test/otbVectorImageFileWriterTestWithoutInput.cxx index 6c822d2e99..7c9fa1b658 100644 --- a/Modules/IO/ImageIO/test/otbVectorImageFileWriterTestWithoutInput.cxx +++ b/Modules/IO/ImageIO/test/otbVectorImageFileWriterTestWithoutInput.cxx @@ -77,7 +77,7 @@ int otbVectorImageFileWriterScalarTestWithoutInputGeneric(int argc, char* argv[] SpacingType spacing; spacing.Fill(1.0); image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); image->SetRegions(region); image->SetNumberOfComponentsPerPixel(atoi(argv[3])); @@ -180,7 +180,7 @@ int otbVectorImageFileWriterComplexTestWithoutInputGeneric(int argc, char* argv[ SpacingType spacing; spacing.Fill(1.0); image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); image->SetRegions(region); image->SetNumberOfComponentsPerPixel(atoi(argv[3])); diff --git a/Modules/IO/ImageIO/test/otbVectorImageStreamingFileWriterTestWithoutInput.cxx b/Modules/IO/ImageIO/test/otbVectorImageStreamingFileWriterTestWithoutInput.cxx index b4623bc5dc..e95ba584eb 100644 --- a/Modules/IO/ImageIO/test/otbVectorImageStreamingFileWriterTestWithoutInput.cxx +++ b/Modules/IO/ImageIO/test/otbVectorImageStreamingFileWriterTestWithoutInput.cxx @@ -77,7 +77,7 @@ int otbVectorImageStreamingFileWriterScalarTestWithoutInputGeneric(int argc, cha SpacingType spacing; spacing.Fill(1.0); image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); image->SetRegions(region); image->SetNumberOfComponentsPerPixel(atoi(argv[3])); @@ -180,7 +180,7 @@ int otbVectorImageStreamingFileWriterComplexTestWithoutInputGeneric(int argc, ch SpacingType spacing; spacing.Fill(1.0); image->SetOrigin(origin); - image->SetSpacing(spacing); + image->SetSignedSpacing(spacing); image->SetRegions(region); image->SetNumberOfComponentsPerPixel(atoi(argv[3])); diff --git a/Modules/IO/TestKernel/src/otbTestHelper.cxx b/Modules/IO/TestKernel/src/otbTestHelper.cxx index 9c1559a713..a7c84deb09 100644 --- a/Modules/IO/TestKernel/src/otbTestHelper.cxx +++ b/Modules/IO/TestKernel/src/otbTestHelper.cxx @@ -1529,11 +1529,11 @@ int TestHelper::RegressionTestMetaData(const char *testImageFilename, const char } // test spacing - if (blImPtr->GetSpacing() != testImPtr->GetSpacing()) + if (blImPtr->GetSignedSpacing() != testImPtr->GetSignedSpacing()) { std::cerr << "The spacing of the baseline image and Test image do not match!" << std::endl; - std::cerr << "baseline image: " << baselineImageFilename << " has spacing " << blImPtr->GetSpacing() << std::endl; - std::cerr << "Test image: " << testImageFilename << " has spacing " << testImPtr->GetSpacing() << std::endl; + std::cerr << "baseline image: " << baselineImageFilename << " has spacing " << blImPtr->GetSignedSpacing() << std::endl; + std::cerr << "Test image: " << testImageFilename << " has spacing " << testImPtr->GetSignedSpacing() << std::endl; errcount++; } diff --git a/Modules/IO/VectorDataIO/test/otbVectorDataFileGeoReaderWriter.cxx b/Modules/IO/VectorDataIO/test/otbVectorDataFileGeoReaderWriter.cxx index 5f3cc1c374..77b1f26360 100644 --- a/Modules/IO/VectorDataIO/test/otbVectorDataFileGeoReaderWriter.cxx +++ b/Modules/IO/VectorDataIO/test/otbVectorDataFileGeoReaderWriter.cxx @@ -42,7 +42,7 @@ int otbVectorDataFileGeoReaderWriter(int itkNotUsed(argc), char * argv[]) vectorDataReader->SetFileName(argv[1]); // vectorData->SetOrigin(m_Reader->GetOutput()->GetOrigin()); -// vectorData->SetSpacing(m_Reader->GetOutput()->GetSpacing()); +// vectorData->SetSignedSpacing(m_Reader->GetOutput()->GetSignedSpacing()); std::string projectionRef; itk::ExposeMetaData<std::string>( diff --git a/Modules/Learning/SOM/test/otbSOMClassifier.cxx b/Modules/Learning/SOM/test/otbSOMClassifier.cxx index 4e0e7ef5d1..9e72e42620 100644 --- a/Modules/Learning/SOM/test/otbSOMClassifier.cxx +++ b/Modules/Learning/SOM/test/otbSOMClassifier.cxx @@ -90,7 +90,7 @@ int otbSOMClassifier(int argc, char* argv[]) OutputImageType::Pointer outputImage = OutputImageType::New(); outputImage->SetRegions(reader->GetOutput()->GetLargestPossibleRegion()); outputImage->SetOrigin(reader->GetOutput()->GetOrigin()); - outputImage->SetSpacing(reader->GetOutput()->GetSpacing()); + outputImage->SetSignedSpacing(reader->GetOutput()->GetSignedSpacing()); outputImage->Allocate(); ClassifierType::OutputType* membershipSample = classifier->GetOutput(); diff --git a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx index 7fa8822ec6..35723e178d 100644 --- a/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx +++ b/Modules/Learning/Sampling/include/otbPersistentSamplingFilterBase.txx @@ -135,7 +135,7 @@ PersistentSamplingFilterBase<TInputImage,TMaskImage> { itkGenericExceptionMacro("Mask and input image have a different origin!"); } - if (mask->GetSpacing() != input->GetSpacing()) + if (mask->GetSignedSpacing() != input->GetSignedSpacing()) { itkGenericExceptionMacro("Mask and input image have a different spacing!"); } @@ -472,7 +472,7 @@ PersistentSamplingFilterBase<TInputImage,TMaskImage> TMaskImage* mask = const_cast<TMaskImage*>(this->GetMask()); typename TInputImage::IndexType imgIndex; typename TInputImage::PointType imgPoint; - typename TInputImage::SpacingType imgAbsSpacing = img->GetSpacing(); + typename TInputImage::SpacingType imgAbsSpacing = img->GetSignedSpacing(); if (imgAbsSpacing[0] < 0) imgAbsSpacing[0] = -imgAbsSpacing[0]; if (imgAbsSpacing[1] < 0) imgAbsSpacing[1] = -imgAbsSpacing[1]; diff --git a/Modules/Learning/Sampling/test/otbOGRDataToClassStatisticsFilterTest.cxx b/Modules/Learning/Sampling/test/otbOGRDataToClassStatisticsFilterTest.cxx index 178585784e..47da4c0553 100644 --- a/Modules/Learning/Sampling/test/otbOGRDataToClassStatisticsFilterTest.cxx +++ b/Modules/Learning/Sampling/test/otbOGRDataToClassStatisticsFilterTest.cxx @@ -69,7 +69,7 @@ int otbOGRDataToClassStatisticsFilter(int argc, char* argv[]) inputImage->SetNumberOfComponentsPerPixel(3); inputImage->SetLargestPossibleRegion(region); inputImage->SetOrigin(origin); - inputImage->SetSpacing(spacing); + inputImage->SetSignedSpacing(spacing); // Don't allocate the input image, the filter should not need it //inputImage->Allocate(); //inputImage->FillBuffer(pixel); @@ -77,7 +77,7 @@ int otbOGRDataToClassStatisticsFilter(int argc, char* argv[]) MaskImageType::Pointer mask = MaskImageType::New(); mask->SetRegions(region); mask->SetOrigin(origin); - mask->SetSpacing(spacing); + mask->SetSignedSpacing(spacing); mask->Allocate(); itk::ImageRegionIterator<MaskImageType> it(mask,region); unsigned int count = 0; diff --git a/Modules/Learning/Sampling/test/otbOGRDataToSamplePositionFilterTest.cxx b/Modules/Learning/Sampling/test/otbOGRDataToSamplePositionFilterTest.cxx index 68403ff09f..91994335ea 100644 --- a/Modules/Learning/Sampling/test/otbOGRDataToSamplePositionFilterTest.cxx +++ b/Modules/Learning/Sampling/test/otbOGRDataToSamplePositionFilterTest.cxx @@ -179,7 +179,7 @@ int otbOGRDataToSamplePositionFilter(int argc, char* argv[]) inputImage->SetNumberOfComponentsPerPixel(3); inputImage->SetLargestPossibleRegion(region); inputImage->SetOrigin(origin); - inputImage->SetSpacing(spacing); + inputImage->SetSignedSpacing(spacing); // Don't allocate the input image, the filter should not need it //inputImage->Allocate(); //inputImage->FillBuffer(pixel); @@ -187,7 +187,7 @@ int otbOGRDataToSamplePositionFilter(int argc, char* argv[]) MaskImageType::Pointer mask = MaskImageType::New(); mask->SetRegions(region); mask->SetOrigin(origin); - mask->SetSpacing(spacing); + mask->SetSignedSpacing(spacing); mask->Allocate(); itk::ImageRegionIterator<MaskImageType> it(mask,region); unsigned int count = 0; @@ -263,7 +263,7 @@ int otbOGRDataToSamplePositionFilterPattern(int argc, char* argv[]) inputImage->SetNumberOfComponentsPerPixel(3); inputImage->SetLargestPossibleRegion(region); inputImage->SetOrigin(origin); - inputImage->SetSpacing(spacing); + inputImage->SetSignedSpacing(spacing); // Don't allocate the input image, the filter should not need it //inputImage->Allocate(); //inputImage->FillBuffer(pixel); @@ -271,7 +271,7 @@ int otbOGRDataToSamplePositionFilterPattern(int argc, char* argv[]) MaskImageType::Pointer mask = MaskImageType::New(); mask->SetRegions(region); mask->SetOrigin(origin); - mask->SetSpacing(spacing); + mask->SetSignedSpacing(spacing); mask->Allocate(); itk::ImageRegionIterator<MaskImageType> it(mask,region); unsigned int count = 0; diff --git a/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx index 5895959f3b..e54081c300 100644 --- a/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx +++ b/Modules/MPI/MPITiffWriter/include/otbSimpleParallelTiffWriter.txx @@ -546,12 +546,12 @@ SimpleParallelTiffWriter<TInputImage> { // Set geotransform double geotransform[6]; - geotransform[0] = inputPtr->GetOrigin()[0] - 0.5*inputPtr->GetSpacing()[0]; - geotransform[1] = inputPtr->GetSpacing()[0]; + geotransform[0] = inputPtr->GetOrigin()[0] - 0.5*inputPtr->GetSignedSpacing()[0]; + geotransform[1] = inputPtr->GetSignedSpacing()[0]; geotransform[2] = 0.0; - geotransform[3] = inputPtr->GetOrigin()[1] - 0.5*inputPtr->GetSpacing()[1]; + geotransform[3] = inputPtr->GetOrigin()[1] - 0.5*inputPtr->GetSignedSpacing()[1]; geotransform[4] = 0.0; - geotransform[5] = inputPtr->GetSpacing()[1]; + geotransform[5] = inputPtr->GetSignedSpacing()[1]; // Call SPTW routine that creates the output raster SPTW_ERROR sperr = create_generic_raster(m_FileName, diff --git a/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h index 899c56a723..ecec379e6d 100644 --- a/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h +++ b/Modules/MPI/MPIVrtWriter/include/otbMPIVrtWriter.h @@ -210,12 +210,12 @@ template <typename TImage> void WriteMPI(TImage *img, const std::string &output, // Set GeoTransform double gt[6]; - gt[0] = img->GetOrigin()[0] - 0.5*img->GetSpacing()[0]; - gt[1] = img->GetSpacing()[0]; + gt[0] = img->GetOrigin()[0] - 0.5*img->GetSignedSpacing()[0]; + gt[1] = img->GetSignedSpacing()[0]; gt[2] = 0.0; - gt[3] = img->GetOrigin()[1] - 0.5*img->GetSpacing()[1]; + gt[3] = img->GetOrigin()[1] - 0.5*img->GetSignedSpacing()[1]; gt[4] = 0.0; - gt[5] = img->GetSpacing()[1]; + gt[5] = img->GetSignedSpacing()[1]; VRTOutput->SetGeoTransform(gt); // Set projection diff --git a/Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.txx b/Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.txx index ef9c1638a8..372bc8affd 100644 --- a/Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.txx +++ b/Modules/Radiometry/SARCalibration/include/otbSarDeburstImageFilter.txx @@ -48,7 +48,7 @@ SarDeburstImageFilter<TImage>::GenerateOutputInformation() ImageType * outputPtr = this->GetOutput(); // Check that azimuth spacing has not been modified - if(vcl_abs(inputPtr->GetSpacing()[1]-1.)>=std::numeric_limits<double>::epsilon()) + if(vcl_abs(inputPtr->GetSignedSpacing()[1]-1.)>=std::numeric_limits<double>::epsilon()) itkExceptionMacro("Can not perform deburst if input image azimuth spacing is not 1."); // Check that the azimuth sampling grid has not been modified diff --git a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx index d42b05f94b..60a23d17ef 100644 --- a/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx +++ b/Modules/Radiometry/Simulation/include/otbImageSimulationMethod.txx @@ -185,7 +185,7 @@ ImageSimulationMethod< TInputVectorData, TSpatialisation, TSimulationStep1, TSim FTMFilter->SetInterpolator(interpolator); // FTMFilter->SetOutputSize(multiToMonoChannelFilter->GetOutput()->GetLargestPossibleRegion().GetSize()); FTMFilter->SetSize(multiToMonoChannelFilter->GetOutput()->GetLargestPossibleRegion().GetSize()); - FTMFilter->SetOutputSpacing(multiToMonoChannelFilter->GetOutput()->GetSpacing()); + FTMFilter->SetOutputSpacing(multiToMonoChannelFilter->GetOutput()->GetSignedSpacing()); FTMFilter->SetOutputOrigin(multiToMonoChannelFilter->GetOutput()->GetOrigin()); FTMFilter->SetInput(multiToMonoChannelFilter->GetOutput()); FTMFilter->Update(); @@ -246,7 +246,7 @@ ImageSimulationMethod< TInputVectorData, TSpatialisation, TSimulationStep1, TSim // FTMFilter->SetInterpolator(interpolator); // // FTMFilter->SetOutputSize(multiToMonoChannelFilter->GetOutput()->GetLargestPossibleRegion().GetSize()); // FTMFilter->SetSize(multiToMonoChannelFilter->GetOutput()->GetLargestPossibleRegion().GetSize()); -// FTMFilter->SetOutputSpacing(multiToMonoChannelFilter->GetOutput()->GetSpacing()); +// FTMFilter->SetOutputSpacing(multiToMonoChannelFilter->GetOutput()->GetSignedSpacing()); // FTMFilter->SetOutputOrigin(multiToMonoChannelFilter->GetOutput()->GetOrigin()); // FTMFilter->SetInput(multiToMonoChannelFilter->GetOutput()); // FTMFilter->Update(); diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx b/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx index cadaf1c600..0f18582508 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapEstimationMethod.txx @@ -189,9 +189,9 @@ DisparityMapEstimationMethod<TFixedImage, TMovingImage, TPointSet> movingExtractor->Update(); // std::cout<<"Fixed extract origin: "<<fixedExtractor->GetOutput()->GetOrigin()<<std::endl; -// std::cout<<"Fixed extract spacing: "<<fixedExtractor->GetOutput()->GetSpacing()<<std::endl; +// std::cout<<"Fixed extract spacing: "<<fixedExtractor->GetOutput()->GetSignedSpacing()<<std::endl; // std::cout<<"Moving extract origin: "<<movingExtractor->GetOutput()->GetOrigin()<<std::endl; -// std::cout<<"Moving extract spacing: "<<movingExtractor->GetOutput()->GetSpacing()<<std::endl; +// std::cout<<"Moving extract spacing: "<<movingExtractor->GetOutput()->GetSignedSpacing()<<std::endl; // typedef otb::ImageFileWriter<FixedImageType> FixedWriterType; // typedef otb::ImageFileWriter<MovingImageType> MovingWriterType; diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx b/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx index b974232845..8a90738d4a 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapTo3DFilter.txx @@ -177,7 +177,7 @@ DisparityMapTo3DFilter<TDisparityImage,TOutputImage,TEpipolarGridImage,TMaskImag // copy also origin and spacing outputPtr->SetOrigin(horizDisp->GetOrigin()); - outputPtr->SetSpacing(horizDisp->GetSpacing()); + outputPtr->SetSignedSpacing(horizDisp->GetSignedSpacing()); } template <class TDisparityImage, class TOutputImage, diff --git a/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx b/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx index 3bdf6bcc34..96965071cf 100644 --- a/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbDisparityMapToDEMFilter.txx @@ -339,7 +339,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri typename TOutputDEMImage::SpacingType outSpacing; outSpacing[0] = 57.295779513 * m_DEMGridStep / (6378137.0 * vcl_cos((box_ymin + box_ymax) * 0.5 * 0.01745329251)); outSpacing[1] = -57.295779513 * m_DEMGridStep / 6378137.0; - outputPtr->SetSpacing(outSpacing); + outputPtr->SetSignedSpacing(outSpacing); // Choose origin typename TOutputDEMImage::PointType outOrigin; @@ -381,7 +381,7 @@ DisparityMapToDEMFilter<TDisparityImage,TInputImage,TOutputDEMImage,TEpipolarGri typename DEMImageType::RegionType outRegion = outputDEM->GetRequestedRegion(); typename DEMImageType::PointType outOrigin = outputDEM->GetOrigin(); - typename DEMImageType::SpacingType outSpacing = outputDEM->GetSpacing(); + typename DEMImageType::SpacingType outSpacing = outputDEM->GetSignedSpacing(); RSTransformType::Pointer groundToLeftTransform = RSTransformType::New(); groundToLeftTransform->SetOutputKeywordList(leftSensor->GetImageKeywordlist()); diff --git a/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx b/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx index 1261e6baf1..b19bcedfb1 100644 --- a/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbFineRegistrationImageFilter.txx @@ -145,7 +145,7 @@ FineRegistrationImageFilter<TInputImage, TOutputCorrelation, TOutputDisplacement // Update size and spacing according to grid step InputImageRegionType largestRegion = outputPtr->GetLargestPossibleRegion(); SizeType outputSize = largestRegion.GetSize(); - SpacingType outputSpacing = outputPtr->GetSpacing(); + SpacingType outputSpacing = outputPtr->GetSignedSpacing(); for(unsigned int dim = 0; dim < TOutputCorrelation::ImageDimension; ++dim) { @@ -154,8 +154,8 @@ FineRegistrationImageFilter<TInputImage, TOutputCorrelation, TOutputDisplacement } // Set spacing - outputPtr->SetSpacing(outputSpacing); - outputFieldPtr->SetSpacing(outputSpacing); + outputPtr->SetSignedSpacing(outputSpacing); + outputFieldPtr->SetSignedSpacing(outputSpacing); // Set largest region size largestRegion.SetSize(outputSize); @@ -406,7 +406,7 @@ FineRegistrationImageFilter<TInputImage, TOutputCorrelation, TOutputDisplacement SpacingType localOffset = m_InitialOffset; // Get fixed image spacing - SpacingType fixedSpacing = fixedPtr->GetSpacing(); + SpacingType fixedSpacing = fixedPtr->GetSignedSpacing(); // Walk the images diff --git a/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx b/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx index 125285d1a6..511538896b 100644 --- a/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbMultiDisparityMapTo3DFilter.txx @@ -216,10 +216,10 @@ MultiDisparityMapTo3DFilter<TDisparityImage,TOutputImage,TMaskImage,TResidueImag // copy also origin and spacing outputPtr->SetOrigin(horizDisp->GetOrigin()); - outputPtr->SetSpacing(horizDisp->GetSpacing()); + outputPtr->SetSignedSpacing(horizDisp->GetSignedSpacing()); residuePtr->SetOrigin(horizDisp->GetOrigin()); - residuePtr->SetSpacing(horizDisp->GetSpacing()); + residuePtr->SetSignedSpacing(horizDisp->GetSignedSpacing()); if (this->m_ReferenceKeywordList.GetSize() > 0) { diff --git a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx index 893eba2135..eb5f109337 100644 --- a/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx +++ b/Modules/Registration/DisparityMap/include/otbNCCRegistrationFunction.txx @@ -101,7 +101,7 @@ NCCRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField> } // cache fixed image information - m_FixedImageSpacing = this->m_FixedImage->GetSpacing(); + m_FixedImageSpacing = this->m_FixedImage->GetSignedSpacing(); m_FixedImageOrigin = this->m_FixedImage->GetOrigin(); // setup gradient calculator diff --git a/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx b/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx index fd1333e0de..69041e41e2 100644 --- a/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbPixelWiseBlockMatchingImageFilter.txx @@ -343,17 +343,17 @@ TOutputDisparityImage,TMaskImage,TBlockMatchingFunctor> outVDispPtr->SetLargestPossibleRegion(outputLargest); // Adapt spacing - SpacingType outSpacing = inLeftPtr->GetSpacing(); + SpacingType outSpacing = inLeftPtr->GetSignedSpacing(); outSpacing[0] *= static_cast<double>(this->m_Step); outSpacing[1] *= static_cast<double>(this->m_Step); - outMetricPtr->SetSpacing(outSpacing); - outHDispPtr->SetSpacing(outSpacing); - outVDispPtr->SetSpacing(outSpacing); + outMetricPtr->SetSignedSpacing(outSpacing); + outHDispPtr->SetSignedSpacing(outSpacing); + outVDispPtr->SetSignedSpacing(outSpacing); // Adapt origin PointType outOrigin = inLeftPtr->GetOrigin(); - SpacingType inSpacing = inLeftPtr->GetSpacing(); + SpacingType inSpacing = inLeftPtr->GetSignedSpacing(); outOrigin[0] += inSpacing[0] * static_cast<double>(this->m_GridIndex[0]); outOrigin[1] += inSpacing[1] * static_cast<double>(this->m_GridIndex[1]); diff --git a/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx b/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx index 72346289ec..a8b9426849 100644 --- a/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx +++ b/Modules/Registration/DisparityMap/include/otbSubPixelDisparityImageFilter.txx @@ -429,8 +429,8 @@ TDisparityImage,TMaskImage,TBlockMatchingFunctor> outVDispPtr->CopyInformation(inHDispPtr); // Check the size of the input disparity maps (possible subsampled grid) - SpacingType leftSpacing = inLeftPtr->GetSpacing(); - SpacingType dispSpacing = inHDispPtr->GetSpacing(); + SpacingType leftSpacing = inLeftPtr->GetSignedSpacing(); + SpacingType dispSpacing = inHDispPtr->GetSignedSpacing(); PointType leftOrigin = inLeftPtr->GetOrigin(); PointType dispOrigin = inHDispPtr->GetOrigin(); diff --git a/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx b/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx index 75c8376937..66009e3ff6 100644 --- a/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx +++ b/Modules/Registration/DisplacementField/include/otbPointSetToDisplacementFieldGenerator.txx @@ -76,7 +76,7 @@ PointSetToDisplacementFieldGenerator<TPointSet, TDisplacementField> index.Fill(0); largest.SetIndex(index); outputPtr->SetRegions(largest); - outputPtr->SetSpacing(m_OutputSpacing); + outputPtr->SetSignedSpacing(m_OutputSpacing); outputPtr->SetOrigin(m_OutputOrigin); // Force the displacement field to have vector pixel of size 2. outputPtr->SetNumberOfComponentsPerPixel(2); diff --git a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx index 488826d45f..fca8ff2a53 100644 --- a/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx +++ b/Modules/Registration/Stereo/include/otbAdhesionCorrectionFilter.txx @@ -182,12 +182,12 @@ AdhesionCorrectionFilter<TImage, TMask> ImageRegionType largestRegion = outputPtr->GetLargestPossibleRegion(); SizeType outputSize = largestRegion.GetSize(); m_ImageSize = outputSize; - SpacingType outputSpacing = outputPtr->GetSpacing(); + SpacingType outputSpacing = outputPtr->GetSignedSpacing(); // Set spacing - outputPtr->SetSpacing(outputSpacing); - outputMaskPtr->SetSpacing(outputSpacing); - outputriskedgesPtr->SetSpacing(outputSpacing); + outputPtr->SetSignedSpacing(outputSpacing); + outputMaskPtr->SetSignedSpacing(outputSpacing); + outputriskedgesPtr->SetSignedSpacing(outputSpacing); // Set largest region size largestRegion.SetSize(outputSize); diff --git a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx index 4d0a45c5d7..811a24f35b 100644 --- a/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx +++ b/Modules/Registration/Stereo/include/otbMulti3DMapToDEMFilter.txx @@ -242,7 +242,7 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::SetOutputPara //std::cout<<" GrisStep "<<m_DEMGridStep<<std::endl; outSpacing[0] = 57.295779513 * m_DEMGridStep / (6378137.0 * vcl_cos((box_ymin + box_ymax) * 0.5 * 0.01745329251)); outSpacing[1] = -57.295779513 * m_DEMGridStep / 6378137.0; - outputPtr->SetSpacing(outSpacing); + outputPtr->SetSignedSpacing(outSpacing); // Choose origin typename TOutputDEMImage::PointType outOrigin; @@ -278,7 +278,7 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::SetOutputPara // genericRSEstimator->SetInputProjectionRef( static_cast<std::string>(otb::GeoInformationConversion::ToWKT(4326))); genericRSEstimator->SetOutputProjectionRef(m_ProjectionRef); genericRSEstimator->Compute(); - outputPtr->SetSpacing(genericRSEstimator->GetOutputSpacing()); + outputPtr->SetSignedSpacing(genericRSEstimator->GetOutputSpacing()); outputPtr->SetOrigin(genericRSEstimator->GetOutputOrigin()); // Compute output size @@ -311,7 +311,7 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::GenerateOutpu if (this->m_OutputParametersFrom3DMap == -2) { outputPtr->SetOrigin(m_OutputOrigin); - outputPtr->SetSpacing(m_OutputSpacing); + outputPtr->SetSignedSpacing(m_OutputSpacing); typename TOutputDEMImage::RegionType outRegion; outRegion.SetIndex(m_OutputStartIndex); @@ -357,7 +357,7 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::GenerateInput typename TOutputDEMImage::RegionType outRegion = outputDEM->GetRequestedRegion(); typename TOutputDEMImage::PointType outOrigin = outputDEM->GetOrigin(); - typename TOutputDEMImage::SpacingType outSpacing = outputDEM->GetSpacing(); + typename TOutputDEMImage::SpacingType outSpacing = outputDEM->GetSignedSpacing(); // up left at elevation min TDPointType corners[8]; @@ -402,12 +402,12 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::GenerateInput RSTransformType::Pointer groundToSensorTransform = RSTransformType::New(); //groundToSensorTransform->SetInputKeywordList(outputDEM->GetImageKeywordlist()); //groundToSensorTransform->SetInputOrigin(outputDEM->GetOrigin()); - //groundToSensorTransform->SetInputSpacing(outputDEM->GetSpacing()); + //groundToSensorTransform->SetInputSpacing(outputDEM->GetSignedSpacing()); groundToSensorTransform->SetInputProjectionRef(m_ProjectionRef); groundToSensorTransform->SetOutputKeywordList(imgPtr->GetImageKeywordlist()); groundToSensorTransform->SetOutputOrigin(imgPtr->GetOrigin()); - groundToSensorTransform->SetOutputSpacing(imgPtr->GetSpacing()); + groundToSensorTransform->SetOutputSpacing(imgPtr->GetSignedSpacing()); groundToSensorTransform->InstantiateTransform(); typename T3DImage::RegionType mapRegion = imgPtr->GetLargestPossibleRegion(); @@ -568,7 +568,7 @@ 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->GetSignedSpacing(); //convert requested region to Long/Lat @@ -606,7 +606,7 @@ void Multi3DMapToDEMFilter<T3DImage, TMaskImage, TOutputDEMImage>::ThreadedGener typename InputMapType::PointType origin; origin = imgPtr->GetOrigin(); typename InputMapType::SpacingType spacing; - spacing = imgPtr->GetSpacing(); + spacing = imgPtr->GetSignedSpacing(); if (static_cast<unsigned int> (threadId) < m_NumberOfSplit[k]) { diff --git a/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx b/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx index 94c7c434d8..3806958e49 100644 --- a/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx +++ b/Modules/Registration/Stereo/include/otbStereorectificationDisplacementFieldSource.txx @@ -159,9 +159,9 @@ StereorectificationDisplacementFieldSource<TInputImage, TOutputImage> // First, spacing : choose a square spacing, SpacingType outputSpacing; outputSpacing.Fill(m_Scale * m_GridStep); - double mean_spacing=0.5*(vcl_abs(m_LeftImage->GetSpacing()[0])+vcl_abs(m_LeftImage->GetSpacing()[1])); - //double ratio_x = mean_spacing / vcl_abs(m_LeftImage->GetSpacing()[0]); - //double ratio_y = mean_spacing / vcl_abs(m_LeftImage->GetSpacing()[1]); + double mean_spacing=0.5*(vcl_abs(m_LeftImage->GetSignedSpacing()[0])+vcl_abs(m_LeftImage->GetSignedSpacing()[1])); + //double ratio_x = mean_spacing / vcl_abs(m_LeftImage->GetSignedSpacing()[0]); + //double ratio_y = mean_spacing / vcl_abs(m_LeftImage->GetSignedSpacing()[1]); outputSpacing[0]*=mean_spacing; outputSpacing[1]*=mean_spacing; @@ -240,14 +240,14 @@ StereorectificationDisplacementFieldSource<TInputImage, TOutputImage> // First we compute coordinates of the 4 corners (we omit ulx which // coordinates are {0,0}) - double urx = ux * m_LeftImage->GetLargestPossibleRegion().GetSize()[0] * m_LeftImage->GetSpacing()[0]; - double ury = vx * m_LeftImage->GetLargestPossibleRegion().GetSize()[0] * m_LeftImage->GetSpacing()[0]; - double llx = uy * m_LeftImage->GetLargestPossibleRegion().GetSize()[1] * m_LeftImage->GetSpacing()[1]; - double lly = vy * m_LeftImage->GetLargestPossibleRegion().GetSize()[1] * m_LeftImage->GetSpacing()[1]; - double lrx = ux * m_LeftImage->GetLargestPossibleRegion().GetSize()[0] * m_LeftImage->GetSpacing()[0] - + uy * m_LeftImage->GetLargestPossibleRegion().GetSize()[1] * m_LeftImage->GetSpacing()[1]; - double lry = vx * m_LeftImage->GetLargestPossibleRegion().GetSize()[0] * m_LeftImage->GetSpacing()[0] - + vy * m_LeftImage->GetLargestPossibleRegion().GetSize()[1] * m_LeftImage->GetSpacing()[1]; + double urx = ux * m_LeftImage->GetLargestPossibleRegion().GetSize()[0] * m_LeftImage->GetSignedSpacing()[0]; + double ury = vx * m_LeftImage->GetLargestPossibleRegion().GetSize()[0] * m_LeftImage->GetSignedSpacing()[0]; + double llx = uy * m_LeftImage->GetLargestPossibleRegion().GetSize()[1] * m_LeftImage->GetSignedSpacing()[1]; + double lly = vy * m_LeftImage->GetLargestPossibleRegion().GetSize()[1] * m_LeftImage->GetSignedSpacing()[1]; + double lrx = ux * m_LeftImage->GetLargestPossibleRegion().GetSize()[0] * m_LeftImage->GetSignedSpacing()[0] + + uy * m_LeftImage->GetLargestPossibleRegion().GetSize()[1] * m_LeftImage->GetSignedSpacing()[1]; + double lry = vx * m_LeftImage->GetLargestPossibleRegion().GetSize()[0] * m_LeftImage->GetSignedSpacing()[0] + + vy * m_LeftImage->GetLargestPossibleRegion().GetSize()[1] * m_LeftImage->GetSignedSpacing()[1]; // Bounding box (this time we do not omit ulx) double minx = std::min(std::min(std::min(urx,llx),lrx),0.); @@ -279,8 +279,8 @@ StereorectificationDisplacementFieldSource<TInputImage, TOutputImage> leftDFPtr->SetLargestPossibleRegion(outputLargestRegion); rightDFPtr->SetLargestPossibleRegion(outputLargestRegion); - leftDFPtr->SetSpacing(outputSpacing); - rightDFPtr->SetSpacing(outputSpacing); + leftDFPtr->SetSignedSpacing(outputSpacing); + rightDFPtr->SetSignedSpacing(outputSpacing); leftDFPtr->SetNumberOfComponentsPerPixel(2); rightDFPtr->SetNumberOfComponentsPerPixel(2); @@ -333,7 +333,7 @@ StereorectificationDisplacementFieldSource<TInputImage, TOutputImage> double localElevation = otb::DEMHandler::Instance()->GetDefaultHeightAboveEllipsoid(); // Use the mean spacing as before - double mean_spacing=0.5*(vcl_abs(m_LeftImage->GetSpacing()[0])+vcl_abs(m_LeftImage->GetSpacing()[1])); + double mean_spacing=0.5*(vcl_abs(m_LeftImage->GetSignedSpacing()[0])+vcl_abs(m_LeftImage->GetSignedSpacing()[1])); // Initialize currentPoint1 = m_OutputOriginInLeftImage; diff --git a/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx b/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx index 19901747c4..1556cc70e6 100644 --- a/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx +++ b/Modules/Segmentation/CCOBIA/include/otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.txx @@ -138,10 +138,10 @@ PersistentConnectedComponentSegmentationOBIAToVectorDataFilter<TVImage, TLabelIm typename TransformType::ParametersType params; params.SetSize(6); - params[0] = this->GetInput()->GetSpacing()[0]; + params[0] = this->GetInput()->GetSignedSpacing()[0]; params[1] = 0; params[2] = 0; - params[3] = this->GetInput()->GetSpacing()[1]; + params[3] = this->GetInput()->GetSignedSpacing()[1]; params[4] = this->GetInput()->GetOrigin()[0]; params[5] = this->GetInput()->GetOrigin()[1]; diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx b/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx index 8bce44f877..7bfeed219d 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbLabelImageToOGRDataSourceFilter.txx @@ -187,10 +187,10 @@ LabelImageToOGRDataSourceFilter<TInputImage> IndexType bufferIndexOrigin = this->GetInput()->GetBufferedRegion().GetIndex(); OriginType bufferOrigin; this->GetInput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInput()->GetSpacing()[0]; - geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInput()->GetSpacing()[1]; - geoTransform[1] = this->GetInput()->GetSpacing()[0]; - geoTransform[5] = this->GetInput()->GetSpacing()[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInput()->GetSignedSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInput()->GetSignedSpacing()[1]; + geoTransform[1] = this->GetInput()->GetSignedSpacing()[0]; + geoTransform[5] = this->GetInput()->GetSignedSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters if (projSize == 0) { @@ -257,10 +257,10 @@ LabelImageToOGRDataSourceFilter<TInputImage> // the spacing is unchanged, the origin is relative to the buffered region bufferIndexOrigin = this->GetInputMask()->GetBufferedRegion().GetIndex(); this->GetInputMask()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInputMask()->GetSpacing()[0]; - geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInputMask()->GetSpacing()[1]; - geoTransform[1] = this->GetInputMask()->GetSpacing()[0]; - geoTransform[5] = this->GetInputMask()->GetSpacing()[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInputMask()->GetSignedSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInputMask()->GetSignedSpacing()[1]; + geoTransform[1] = this->GetInputMask()->GetSignedSpacing()[0]; + geoTransform[5] = this->GetInputMask()->GetSignedSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters if (projSize == 0) { diff --git a/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx b/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx index 7374c85c42..698b326eb9 100644 --- a/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbLabelImageToVectorDataFilter.txx @@ -167,10 +167,10 @@ LabelImageToVectorDataFilter<TInputImage, TPrecision> IndexType bufferIndexOrigin = this->GetInput()->GetBufferedRegion().GetIndex(); OriginType bufferOrigin; this->GetInput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInput()->GetSpacing()[0]; - geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInput()->GetSpacing()[1]; - geoTransform[1] = this->GetInput()->GetSpacing()[0]; - geoTransform[5] = this->GetInput()->GetSpacing()[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInput()->GetSignedSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInput()->GetSignedSpacing()[1]; + geoTransform[1] = this->GetInput()->GetSignedSpacing()[0]; + geoTransform[5] = this->GetInput()->GetSignedSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters if (projSize == 0) { @@ -237,10 +237,10 @@ LabelImageToVectorDataFilter<TInputImage, TPrecision> // the spacing is unchanged, the origin is relative to the buffered region bufferIndexOrigin = this->GetInputMask()->GetBufferedRegion().GetIndex(); this->GetInputMask()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInputMask()->GetSpacing()[0]; - geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInputMask()->GetSpacing()[1]; - geoTransform[1] = this->GetInputMask()->GetSpacing()[0]; - geoTransform[5] = this->GetInputMask()->GetSpacing()[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInputMask()->GetSignedSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInputMask()->GetSignedSpacing()[1]; + geoTransform[1] = this->GetInputMask()->GetSignedSpacing()[0]; + geoTransform[5] = this->GetInputMask()->GetSignedSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters if (projSize == 0) { diff --git a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h index d6dff7de76..421075334f 100644 --- a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h +++ b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.h @@ -109,7 +109,7 @@ public: itkGetConstReferenceMacro(OutputOrigin, OutputOriginType); /** Set the spacing (size of a pixel) of the output image. - * \sa GetSpacing() + * \sa GetSignedSpacing() */ virtual void SetOutputSpacing(const OutputSpacingType& spacing); virtual void SetOutputSpacing(const double spacing[2]); diff --git a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx index 6dbb4b8bb7..5fc2d4e6a4 100644 --- a/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbOGRDataSourceToLabelImageFilter.txx @@ -126,7 +126,7 @@ OGRDataSourceToLabelImageFilter<TOutputImage> ::SetOutputParametersFromImage(const ImageBaseType * image) { this->SetOutputOrigin ( image->GetOrigin() ); - this->SetOutputSpacing ( image->GetSpacing() ); + this->SetOutputSpacing ( image->GetSignedSpacing() ); this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() ); ImageMetadataInterfaceBase::Pointer imi = ImageMetadataInterfaceFactory::CreateIMI(image->GetMetaDataDictionary()); @@ -153,7 +153,7 @@ OGRDataSourceToLabelImageFilter<TOutputImage> outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); // Set spacing and origin - outputPtr->SetSpacing(m_OutputSpacing); + outputPtr->SetSignedSpacing(m_OutputSpacing); outputPtr->SetOrigin(m_OutputOrigin); itk::MetaDataDictionary& dict = outputPtr->GetMetaDataDictionary(); @@ -229,10 +229,10 @@ OGRDataSourceToLabelImageFilter<TOutputImage>::GenerateData() OutputIndexType bufferIndexOrigin = bufferedRegion.GetIndex(); OutputOriginType bufferOrigin; this->GetOutput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSpacing()[0]; - geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSpacing()[1]; - geoTransform[1] = this->GetOutput()->GetSpacing()[0]; - geoTransform[5] = this->GetOutput()->GetSpacing()[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSignedSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSignedSpacing()[1]; + geoTransform[1] = this->GetOutput()->GetSignedSpacing()[0]; + geoTransform[5] = this->GetOutput()->GetSignedSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters geoTransform[2] = 0.; diff --git a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx index 69752f7a68..58f817ce10 100644 --- a/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbRasterizeVectorDataFilter.txx @@ -178,10 +178,10 @@ RasterizeVectorDataFilter<TVectorData, TInputImage, TOutputImage>::GenerateData( InputIndexType bufferIndexOrigin = bufferedRegion.GetIndex(); InputPointType bufferOrigin; this->GetOutput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSpacing()[0]; - geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSpacing()[1]; - geoTransform[1] = this->GetOutput()->GetSpacing()[0]; - geoTransform[5] = this->GetOutput()->GetSpacing()[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSignedSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSignedSpacing()[1]; + geoTransform[1] = this->GetOutput()->GetSignedSpacing()[0]; + geoTransform[5] = this->GetOutput()->GetSignedSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters geoTransform[2] = 0.; diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h index e8b7b0d667..c7a0627250 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.h @@ -107,7 +107,7 @@ public: itkGetConstReferenceMacro(OutputOrigin, OutputOriginType); /** Set the spacing (size of a pixel) of the output image. - * \sa GetSpacing() + * \sa GetSignedSpacing() */ virtual void SetOutputSpacing(const OutputSpacingType& spacing); virtual void SetOutputSpacing(const double spacing[2]); diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx index 20ce77a9d1..7197fcc99e 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelImageFilter.txx @@ -127,7 +127,7 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage> ::SetOutputParametersFromImage(const ImageBaseType * src) { this->SetOutputOrigin ( src->GetOrigin() ); - this->SetOutputSpacing ( src->GetSpacing() ); + this->SetOutputSpacing ( src->GetSignedSpacing() ); this->SetOutputSize ( src->GetLargestPossibleRegion().GetSize() ); ImageMetadataInterfaceBase::Pointer imi = ImageMetadataInterfaceFactory::CreateIMI(src->GetMetaDataDictionary()); this->SetOutputProjectionRef(imi->GetProjectionRef()); @@ -152,7 +152,7 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage> outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); // Set spacing and origin - outputPtr->SetSpacing(m_OutputSpacing); + outputPtr->SetSignedSpacing(m_OutputSpacing); outputPtr->SetOrigin(m_OutputOrigin); itk::MetaDataDictionary& dict = outputPtr->GetMetaDataDictionary(); @@ -301,10 +301,10 @@ VectorDataToLabelImageFilter<TVectorData, TOutputImage>::GenerateData() OutputIndexType bufferIndexOrigin = bufferedRegion.GetIndex(); OutputOriginType bufferOrigin; this->GetOutput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSpacing()[0]; - geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSpacing()[1]; - geoTransform[1] = this->GetOutput()->GetSpacing()[0]; - geoTransform[5] = this->GetOutput()->GetSpacing()[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSignedSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSignedSpacing()[1]; + geoTransform[1] = this->GetOutput()->GetSignedSpacing()[0]; + geoTransform[5] = this->GetOutput()->GetSignedSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters geoTransform[2] = 0.; diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h index 8048c31bda..924b6ff894 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.h @@ -147,7 +147,7 @@ public: itkGetConstReferenceMacro(StartIndex, IndexType); itkSetMacro(StartIndex, IndexType); /** Set the spacing (size of a pixel) of the vector data. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ virtual void SetSpacing(const SpacingType& spacing); virtual void SetSpacing(const double spacing[2]); virtual void SetSpacing(const float spacing[2]); diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.txx b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.txx index fa29f1bb96..c039272505 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapFilter.txx @@ -305,17 +305,17 @@ VectorDataToLabelMapFilter<TVectorData, TLabelMap> VertexType vertex; otbMsgDevMacro( "Polygon bounding region " << polygonExtRingBoundReg); otbMsgDevMacro( "output origin " << this->GetOutput()->GetOrigin()); - otbMsgDevMacro( "spacing " << this->GetOutput()->GetSpacing()); + otbMsgDevMacro( "spacing " << this->GetOutput()->GetSignedSpacing()); // For each position in the bounding region of the polygon for (double i = polygonExtRingBoundReg.GetOrigin(0); i < polygonExtRingBoundReg.GetOrigin(0) + polygonExtRingBoundReg.GetSize(0); - i += this->GetOutput()->GetSpacing()[0]) + i += this->GetOutput()->GetSignedSpacing()[0]) { vertex[0] = static_cast<VertexValueType>(i); for (double j = polygonExtRingBoundReg.GetOrigin(1); j < polygonExtRingBoundReg.GetOrigin(1) + polygonExtRingBoundReg.GetSize(1); - j += this->GetOutput()->GetSpacing()[1]) + j += this->GetOutput()->GetSignedSpacing()[1]) { vertex[1] = static_cast<VertexValueType>(j); diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h index 8bf4d55a50..acedfcebeb 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.h @@ -162,7 +162,7 @@ public: ; itkSetMacro(StartIndex, IndexType) ; /** Set the spacing (size of a pixel) of the vector data. - * \sa GetSpacing() */ + * \sa GetSignedSpacing() */ virtual void SetSpacing(const SpacingType& spacing); virtual void SetSpacing(const double spacing[2]); virtual void SetSpacing(const float spacing[2]); diff --git a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.txx b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.txx index 3a026a063a..20cced4295 100644 --- a/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.txx +++ b/Modules/Segmentation/Conversion/include/otbVectorDataToLabelMapWithAttributesFilter.txx @@ -148,7 +148,7 @@ void VectorDataToLabelMapWithAttributesFilter<TVectorData, TLabelMap> // Compute origin and size SizeType size; - SpacingType spacing = this->GetInput()->GetSpacing(); + SpacingType spacing = this->GetInput()->GetSignedSpacing(); OriginType origin = m_VectorDataProperties->GetBoundingRegion().GetOrigin(); for (unsigned int i=0; i<2; ++i) { diff --git a/Modules/Segmentation/Conversion/test/otbLabelMapToVectorDataFilter.cxx b/Modules/Segmentation/Conversion/test/otbLabelMapToVectorDataFilter.cxx index df1429d352..f32a91eb67 100644 --- a/Modules/Segmentation/Conversion/test/otbLabelMapToVectorDataFilter.cxx +++ b/Modules/Segmentation/Conversion/test/otbLabelMapToVectorDataFilter.cxx @@ -79,7 +79,7 @@ int otbLabelMapToVectorDataFilter(int argc, char * argv[]) VectorDataFilterType::Pointer vectorDataProjection = VectorDataFilterType::New(); vectorDataProjection->SetInputOrigin(lreader->GetOutput()->GetOrigin()); - vectorDataProjection->SetInputSpacing(lreader->GetOutput()->GetSpacing()); + vectorDataProjection->SetInputSpacing(lreader->GetOutput()->GetSignedSpacing()); vectorDataProjection->SetInput(MyFilter->GetOutput()); writer->SetFileName(outfname); diff --git a/Modules/Segmentation/Conversion/test/otbVectorDataToLabelMapFilter.cxx b/Modules/Segmentation/Conversion/test/otbVectorDataToLabelMapFilter.cxx index 94c7ab5bd1..787b09ab7b 100644 --- a/Modules/Segmentation/Conversion/test/otbVectorDataToLabelMapFilter.cxx +++ b/Modules/Segmentation/Conversion/test/otbVectorDataToLabelMapFilter.cxx @@ -94,7 +94,7 @@ int otbVectorDataToLabelMapFilter(int argc, char * argv[]) //Set size, origin and spacing of the output labelmap myFilter->SetSize(p->GetBoundingRegion().GetImageRegion().GetSize()); myFilter->SetOrigin(origin); - myFilter->SetSpacing(reader->GetOutput()->GetSpacing()); + myFilter->SetSpacing(reader->GetOutput()->GetSignedSpacing()); // Translate the LabelMap in a labeld image LabelMapToLabelImageFilterType::Pointer labelMapToImageFilter = LabelMapToLabelImageFilterType::New(); diff --git a/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx b/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx index 7c8db05e04..5ecbfa89bd 100644 --- a/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx +++ b/Modules/Segmentation/OGRProcessing/include/otbStreamingImageToOGRLayerSegmentationFilter.txx @@ -133,7 +133,7 @@ PersistentImageToOGRLayerSegmentationFilter<TImageType, TSegmentationFilter> OGRDataSourcePointerType tmpDS = const_cast<OGRDataSourceType *>(labelImageToOGRDataFilter->GetOutput()); OGRLayerType tmpLayer = tmpDS->GetLayer(0); - const typename InputImageType::SpacingType inSpacing = this->GetInput()->GetSpacing(); + const typename InputImageType::SpacingType inSpacing = this->GetInput()->GetSignedSpacing(); const double tol = m_SimplificationTolerance * std::max(vcl_abs(inSpacing[0]),vcl_abs(inSpacing[1])); typename OGRLayerType::iterator featIt = tmpLayer.begin(); @@ -160,7 +160,7 @@ PersistentImageToOGRLayerSegmentationFilter<TImageType, TSegmentationFilter> { double area = static_cast<const OGRPolygon *>((*featIt).GetGeometry())->get_Area(); //convert into pixel coordinates - typename InputImageType::SpacingType spacing = this->GetInput()->GetSpacing(); + typename InputImageType::SpacingType spacing = this->GetInput()->GetSignedSpacing(); double pixelsArea = area / (vcl_abs(spacing[0]*spacing[1])); otbMsgDebugMacro(<<"DN = "<<field.GetValue<int>()<<", area = "<<pixelsArea); if( pixelsArea < m_MinimumObjectSize ) diff --git a/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx b/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx index 212a0f8839..c8db8c9d6f 100644 --- a/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx +++ b/Modules/ThirdParty/ITK/include/itkTransformToDisplacementFieldSource.hxx @@ -155,7 +155,7 @@ TransformToDisplacementFieldSource< TOutputImage, TTransformPrecisionType > } this->SetOutputOrigin( image->GetOrigin() ); - this->SetOutputSpacing( image->GetSpacing() ); + this->SetOutputSpacing( image->GetSignedSpacing() ); this->SetOutputDirection( image->GetDirection() ); this->SetOutputRegion( image->GetLargestPossibleRegion() ); } // end SetOutputParametersFromImage() @@ -352,7 +352,7 @@ TransformToDisplacementFieldSource< TOutputImage, TTransformPrecisionType > outputPtr->SetLargestPossibleRegion(m_OutputRegion); - outputPtr->SetSpacing(m_OutputSpacing); + outputPtr->SetSignedSpacing(m_OutputSpacing); outputPtr->SetOrigin(m_OutputOrigin); outputPtr->SetDirection(m_OutputDirection); } // end GenerateOutputInformation() diff --git a/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx b/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx index c84c6d94aa..0aa469df92 100644 --- a/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx +++ b/Modules/ThirdParty/ITK/include/itkUnaryFunctorImageFilter.hxx @@ -87,7 +87,7 @@ UnaryFunctorImageFilter< TInputImage, TOutputImage, TFunction > // dimensions to copy unsigned int i, j; const typename InputImageType::SpacingType & - inputSpacing = inputPtr->GetSpacing(); + inputSpacing = inputPtr->GetSignedSpacing(); const typename InputImageType::PointType & inputOrigin = inputPtr->GetOrigin(); const typename InputImageType::DirectionType & @@ -133,7 +133,7 @@ UnaryFunctorImageFilter< TInputImage, TOutputImage, TFunction > } // set the spacing and origin - outputPtr->SetSpacing(outputSpacing); + outputPtr->SetSignedSpacing(outputSpacing); outputPtr->SetOrigin(outputOrigin); outputPtr->SetDirection(outputDirection); outputPtr->SetNumberOfComponentsPerPixel( // propagate vector length info diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i index 72adde8bd4..72063281ea 100644 --- a/Modules/Wrappers/SWIG/src/otbApplication.i +++ b/Modules/Wrappers/SWIG/src/otbApplication.i @@ -279,7 +279,7 @@ public: spacing.Fill( 1.0 ); \ direction.SetIdentity(); \ output->SetOrigin( origin ); \ - output->SetSpacing( spacing ); \ + output->SetSignedSpacing( spacing ); \ output->SetDirection(direction); \ output->SetLargestPossibleRegion(region); \ output->SetRequestedRegion(output->GetLargestPossibleRegion()); \ -- GitLab