diff --git a/Examples/DataRepresentation/Image/Image4.cxx b/Examples/DataRepresentation/Image/Image4.cxx index 269524c5ab6f638deb9c5bd71223c310d8c2667f..d085b71633da5a06cd5209b1793d9efc3acfea95 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 da850ee075530c0e07ab862130136f76042ab7c3..0847b7d7b03445c1f32daff941d95262ff01446a 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 22d646b2318a164692edff8bdd7dc99f7b71f166..ff70de113d0319739fe2c31093fdf1177111488a 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 04eaaf308ad0151cca3ff9ea8185cd2976fc0689..453ebe11707ce965d177faa4ce1b880d390eb721 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 8259160148a8316352b3f3de789708f9a6ed89ad..f9432cdad32919ff75f2fa64eaee1bfd294c37e2 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 a77e107145fc0e12697f34b5d4451d18186fa8a8..cfd2158c3d271489156ab2a9d329ee2442cf90ae 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 e1d40f7d48054db500a031ab59c5b6652cacedd6..a18ffe3abbeaca77bb9d90638d9930072ba34892 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 06441e2f3f4b29927166f154604f39050ee03470..11eed0204f652462e68832ddd72510a94c737b30 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 0ad58c9dabfc900ffda4519684418402271687d5..40554e544f8029c0b6522d1aa43715f4771bb3a0 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 0bc424d7284038ea4989836b4746fd883f012482..f6799c4d929aff2fd3c9aca7dbfdd18059fa17e4 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 5936983a5051e2fbdbdf6238283656708687ee04..a7cf97e230de8d4e99326c82233eeac5dea3022d 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 9c5eefbdb62e1ea0294d0fdf9813811808049ed4..22b3b43a60c21b33779b0e1024bdaae1c4cddf90 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 ce5ed38823e1248ce97fcbef6924ed936afc4a2a..023c869be74713768056be44afeec8653dc0f2d8 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 5fd771eef3ff3e951d2f3c206644147c9f167629..2fab615191b2a6c4e6d749856f038bb4a97aa66f 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 5bd357e55273955b1b5fdcddd675dd80174d4649..dfe15526aabbeb6dec0aec8ae53ae69b449850d8 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 685960fc46ccdefc977d3720731afabdfedcb6e8..46cc784f315298c3444e444a71ca4a4cf891b8e1 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 9bbc67bd289093b75c85132aa65e705448952795..06b17312620374ce4bb8254ef32e5913e19c865a 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 92924c5537f9c186563e983c1d10f8d11fbb8022..497e3cf9ea0685cd8f390334371bb2a2ffd433a6 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 6585c8b8f272ec2a22b917b7f275ae9669e3bed5..cc5ef6d67434588d5d60d866fde36a5a6158668b 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 1a063f3840b7ccd632f4d35a4c117ed5b7b1910d..87e62f7239fa606a89b48c74b2e04e3f5bcde709 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 385a97c9f264dacaf128f3ab47d576a29c592072..1e098e7846e0bd13aa19f2cb61fd07d05ca0cdde 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 f186df01d8a091296296cc324f627a4de605c7a4..073e53727f6b194b27e49887c4cf8c70469c537f 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 b9eccc12eb2f02004ffe1f2156ebd65bdb55d53f..45bc66c51d3562a5850bf83c269f8102e87828e0 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 62857abd2bbbd6d000f8e3cace1acc599d4df260..74bb9c42dadb51c605f164d14c228f5a6e5602c3 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 2dc6a6119f70ce75cd81e2483d32392e10933fc6..4b1a5d235eecbb591304342060202ba5f328cf9a 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 f1941b5e9a4637fdd3d8318c34129cf079b9c870..7b6da7d245c8e9b2d37f7191e56867903a2a76af 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 95ed2a5e93dd031c513799aa44337b027240a18f..1d1018e8fc74a755fa8b425a86369e4c0afc7d22 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 82efac5377770e0e18f83f83c18170784f1def27..fe9e070a8b592c14e2fc63b6d8f16a65e79cd2a7 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 c141e8c8c942be5c797726e0efa3fd7bdd1db252..b9bc876f11d21efe230cbbea773c60e99cd78c55 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 312cff69e50867b3ac2ee6d0b5c4ce9bce98b4b5..12ef2d890ca681803036b98b32d43413131b853b 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 ed0d0fddb05a79d64082bdbbf236409064f02a03..17a8807b1f33bac5c0353706a45203650ad8d8da 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 7e35f67165e2ac5108cc54e1dcaf20f2a21b12b8..748d8f27be36f75205398bcbf7114b4b66343856 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 8dc890b605564e56f7dc813f114fed0e97a53823..cab6f808d8d6ebbe7ea4604947b8fdea4e6556c9 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 7c322b6ab1baffc2063b63b4c4858994bfc72825..9f21873c3c5c8a57fe4f5132577a3737f551c519 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 a28fc33d6ddce04617c5d7131b5d505d9f818de3..204899ac41aefa6bc1fd99c169d1aeb09d88b475 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 899651a7e019d9bd2de7806d4dbc9bb079e74bf5..c7db035c2581d9d555eab57be384e855b71a48c6 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 49c95abc232b6889af1d934b29c07050546fd848..1db74621750ddc78adb71512d17a6bc27a63437c 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 b7c6e0e2a8add6e95b77f025053555c25c1a3f37..78f546387ffad9fd276030426eaf6abb1529480d 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 0921e060be689ed2bae119a02f51f8c878cf8aa0..ba484e90bac0b8d8ea3a0d66843e796eee455fcd 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 ab3036a1290d176ec5d3461d33e7f7de3bfbea8f..f95afb8448e924d2956414d2dc9f04148fdad8c6 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 00d7f377cba40e2e9e03fc196a7f7b7557c56532..5fa76642d72f70cacea2814608ccd216df77c314 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 b6a8c96c046809d0dd6ec6eb1b1380f01cb90ebc..28b393767d0858adddb8bc86341e59b289444a82 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 2964cde1c7a7814de146eb38e5a365115c81c88e..b45a5d60a35c4a29a61da747f22361b54b66f86b 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 a2cb2079707c34a0d4b70cc553e6823945a8ef97..6393feda9648887753000a6a38cefc85d8d1428c 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 dbefe32e1d964ef677a353649673601dba3e80fd..588a8902319d3489613f72fbda0ecbc2f72b2ac3 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 9d2615fd04167902c30d89e94e3aac3ab3f78058..70991ea19196d1e20f55038517944e013c92451e 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 09a8ed37867f476b0e28c6632680a437f712748a..aac8f9468435e2b2b8e57508fcabcaa4278d316a 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 54ea18cada267dff810fef1d34882184ae2998a2..0a1b8968e07179d3c599dc99374c16e38dea897e 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 bb839227755d888a68e22d671ee94a7b1623efb7..32d2638ea98e9874e1f29761f3cf685922ed4c68 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 10c0d816f58c904eac673a72fca69898880a223f..459b09310f7322a71d252756955835d74f7daaf8 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 f007b11bc3d7c87baf8f0792dfe5af4379cdf672..e08c7e52bbd8f7063498a2a4f413b66f29b4cb11 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 474c6b1283f06437e3bf7cfe6f3f5ebd5050cf0a..603c52e583894a897a3220052fe801c9c3224ec7 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 773a117ce13478df29d68b21de28711862ad873d..937d64a7d442ee744f1b3cf007e2c7a7a99f038f 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 4871b8fd2adc5c5694ab00af7508ff143e6058d6..9d48d66ff2b2b05216781442a8623f8d158fd47a 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 8c3d0e721720030ef314a58038b54326b4506ba5..e34a5a8ba4de886670793a0fb20fce5907bf176b 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 4c7ffe0d6c5735afa0213acd8c9d7fa7353650b5..4221e4ba0c7bbc1215715cf7ab07ae6387c67ba5 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 1d0e44e2f7a6d5e90cc88953ed5794263a4f81a0..675f83184903ed54499e0fff55338b1f907867c9 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 d9741eeaed6b55c8bad6cd43ff6cc73b42bd7b21..afbedddd9be159bb2af146ff9a2b482bf3aab706 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 e8e5671474e22626c90f3e9077d892179b3e55f8..355dc8d46a877a1087528445561029e1dd307f1d 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 a9c1e8822602a5af376701339eab07f7e790c12b..7f8aa38e98e2a90329f9ee98e483dc72fd73bb1b 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 aecdb8b29f6097ff5a04ed17bcab06e3e4e096df..c06344e1831c17e0f9c07448a40f7ceb1b154155 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 0d78f6879d0e074818e248b1ed3e967a62c0172d..a3b0d6e6be609527145600c5024aa0f8ffec19a3 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 fec32eb248e115e6fcef077828610b9f3e2332a5..8f80efc20018234a3bf13da7ca95f8e9fddb691b 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 bdeef7475fc61dabd7d5b3274f41381b0db1c5b9..e2e5c387e1826fd8e37c9b2e0155c3518bbca81a 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 eceb2d338e52b158bc80f2c3d457ab4bdb607064..3a1da3fc5269011ccc3443bea34734473f82697f 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 d43274f8fc2ac1062acbfcda385dc162b5aa2246..506f894347ff4f8a4e5f9bf23754bf20a7de116a 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 ceed579d6f8b0aa271749d21a8247fb9071ce800..5052be60db0810c7898812ff3459c9c1654e6c85 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 94a5cbf4c149a63da4940ce89c8e7c31e1db7de2..43ab8ca08e686e0e123541ed0a8fc2fb7854b54e 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 abeba22eabcf6237a6bd634c02fdb499761549a0..9c7aed6895d64d8b61dc327331e6347361a34f9d 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 59396979f31834ba3b4de57bdce58f7926bd0861..e7473f705ae6ffbe8151d71305445ec7d42eb5b6 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 04ad63740fcbbd8d0e04e5c7a38360dbcdb8c5e8..26464e39fc79babb9f8dfdf92412ca42886550d7 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 c87816bf07bdc67c39076955690c9a36ff2c8c0c..140fd20416acd50bd9b706a8228068fb740cb8ed 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 423b57cee7a10a43068d2c40294c05af37a01f7c..6b8411967a0fc1cbf3d49343fa4a59126713efad 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 71b4327b910cee8e0fb56d6f20c4c74ae1be4433..73fb3f35c6bb2f064b016b9cea19b6ae6b3687f5 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 68a55f3646fea880d2c270e5d627758dd09246e3..124f20e116d73ceddb3a065e54ba882f10809750 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 4159907e2f6b9cc0c489c8c929ff71a9ea5ca388..3a67aa469e4229a782c7d3db49c972c0b5b40daf 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 0a03bc57a88487448aa0196909143a841ebdc4bf..919894cc95ca74f603d885179acdc8f5c0158343 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 b1ebc4da0ad65457ccbdd40f52691200ed1837cd..366e84ba0aaa3d3ea7061dd3a57c4783c1300f4f 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 9407dba601ee8b81594227f39ec2b153062f990e..11da024a2be740df77acbf5fd42d442987de1420 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 d48b558ba47f02b96e6fe35a9aec627d6401f74a..111441bcb50b9ecea3244474eb997a2ab39c6cd8 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 2146f7bac3a248c9e0ea72358681183e1bea8148..aec83b9230bceb0a3718c8e0662cf1ad6441ec6f 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 4b32e9d737b15c5a9e1f344332a263d5ade2ea0e..abb678bebee4c3b00a24c2db31cb6679962b896e 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 4a5c0edc8fbac16935c9d63b4d02505e6f84a528..923a07fadbd8b726196a977730765abc87581652 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 ac6c36280fbe0f70816a70384ad15dfcee9f5571..7635cdcea7c215848a90ae60efb5a119bc58d1a4 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 bd152c5f74e2ad96e57534c161e983ff11792bec..acc92106b5ca9d9caf0bc3964631b4e1a8b8f2fe 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 1b0cf01992e82b507c9bc0b04fadff2e5f62005a..35e9ba8682a8a3e14948858f8af5024928b3b366 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 2f8e542c056944cf1a7561da2ecedcc74ac76910..01c10488d008f36d6c6cde98977f4aaef2223a82 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 b55573f92cf701f9c7e97bb194b6a2f978173463..b86c9c78acaf19896ba659b549bde48962987a9d 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 b38ec9fcec32b97f827d9ef573387e06a1d136dd..ccf2dc45ec5aa943fb0f31d58febcee6ce35ef22 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 18fc93404ae46febf4fcd730c942ce0c76720a63..3178d4c71af131efc3ac3e171984fad42abb1a39 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 decd1d354fe75352a35b38977b3a9a7732cfa7d3..b4ea5eb5fe7d8ecabe5522293b7dbe28f6fa1ff8 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 bbca57fa39457cb873deff1ee0f51397a196769d..da3833bf1c4f012153f2e03545b9943178a05852 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 1d86a408fcc7bb66c835ee762b3f78ea2f00138e..ec0a201c47ced1d145e7ec9add1f8aa0d03090a4 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 ea687e9a3ddcbd78b512066f340abc409ef0b10d..a8d11a849de2449c5cd6c781d8d7479299eec2b0 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 13d39b4fc3e06fe0b7f5d260445b17cf7e8a95e2..9e2a16f1ca2a0bc9047bd528a44f7bddeb5a029b 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 e7efcbff64cca8ad7d83d58a4bf39b64528a7586..be39753484d4ea49e85f4f946f43d62951e87c45 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 6f4946be82d326ed448cd7d48172fb4adb48fd23..6971f7fe0f0036f69a26d4ab5c97e055e666ffd1 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 888f0965c00bcb7bd5c1866848a3aa8dffad5926..299a14db3d6c83c241b58f5df7d3b10e97423baf 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 d4b30d199cd90144e05b6f03c9aef0a16b068126..e0f5ee5ee81c7c0c1e2e668c610afe13b1b663cf 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 995e1099c570d5f917da07b032692bc4966a0053..d1fc246236b624f03391a57636655edfb5aeb22e 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 bd2431cb34b173ecba7054873752ac8f18130d45..d8ab360d4bd4aa70d44c2df41a896fe3b28457ff 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 976b04172ffcdbe1442c7d5b4e525439c00bea28..57beb9ef2fa2671d535963cbff31dad13ced4f12 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 62a651e75ec431a219fe7165f138f493d8a8062b..116f309a90ea6afc195f9142968abda183cfec50 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 845c3941ccdc32fe55fb2e7353fd03606ed5cbff..bbe6a7afe719991388f4e7686986c377c63cb1f5 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 137e5ee65669436c4931be1eb826692ec47f5573..f2e6cf1c79cfff1df00e8e93a7f97163ae4fa9b7 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 966fe434b9ebf1ab7fd58711e55f9e171d7575f3..7c47d9f41a9197fa4b7b7e7cb1ff600ccf0aed3c 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 37bb644ed2731560caa13bc13851954290027b58..db1a85e821eb82271b6be22a2129963405a7dc0b 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 0000000000000000000000000000000000000000..0bd4b7554766064dedc6edfc61c63d2277a710f9 --- /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 ad551085fe1df4ba62980d325ba607f4f5573d5e..b44e4c4b7e493f57a28db0394d4741ea4ccdd918 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 8d67754a390fdb4c73e49c290c78025539d608e2..cca2bf2fb9ba12aeb081a2368fb3ede198ae1128 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 822c710c5e759e59cf7da0ac823c0904eb0e8755..858141455b1ba3b0382ded9610655547c4cd7854 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 6c822d2e99fa1e1b426e115955c812304f98eba9..7c9fa1b6582cc01f5efa00fac262f34baed8dce3 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 b4623bc5dc65fa48d29e80c82fd6fca1fb8bafda..e95ba584eb513fab20d015fcd1b361cce08896ab 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 9c1559a7138dbd3da2f5917ee6d2fe66d4dae441..a7c84deb0925cdb9c00a20dfc763e1f081360aea 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 5f3cc1c3742f1ef2b07e663926cac883ef0a1e3f..77b1f26360858f51a275e3e130d36a049c790263 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 4e0e7ef5d10c5a0d235ecf7742e0cb47c1180132..9e72e426205f69df8266319bcb34272b9c259fc7 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 7fa8822ec670b416ed36e9b7eab478afca57fccb..35723e178dcc6796b68d2690419f509ba0443cf0 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 178585784e245ab3a6562e3da505c24c0e60cfc9..47da4c0553e90b795d09f6d8f959033573b1429e 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 68403ff09ff42bcd463ae450d39daf8574ce00e3..91994335eacc01e13db9269632815a368b59ffe7 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 5895959f3b05cf231d108e6b5db1d3be1049eea6..e54081c300bbf84b0d387377ad33c128ee3902d6 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 899c56a723a2d684f113782cb139c6b0f1948ede..ecec379e6d0cdaab2a6b39817b61ccd1a533c524 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 ef9c1638a8b00694cb36e2dbf0f807f6196ac659..372bc8affd2fd42273a9e6113a32f524575fc6d1 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 d42b05f94bf4b7f26ee2a361f424c30801a514d7..60a23d17ef51b493c7c0ec2d496275cbe9bf67e4 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 cadaf1c6007fc9a6ebe51f6261ad58a453a4a71d..0f185825088aa67c6fe5907c84ab0bef6bd06649 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 b97423284516b6351e8c1588bb9c7a51b4a09db5..8a90738d4ac1291df6562959663d7e0061833647 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 3bdf6bcc34835ed215d494775f03f5ffea519a84..96965071cfab0f5b6470b0c80c6e805567f07688 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 1261e6baf10ec446c3f790c33ff01dcd23575dbc..b19bcedfb10e6f718e82fbefce62a57b837e9017 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 125285d1a63d3cf0f2110d9aa7735a09ec9a0d27..511538896ba3cce58010166c71de44577ab047bb 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 893eba21355f6822bd90cc493e0b75ceb78f8026..eb5f1093370b549ac58458e2e3133235cd1a6ad3 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 fd1333e0de3649ec43c9d291514597a99abb0454..69041e41e2bfbfd8b1dcd0b253d1e2af77754cfc 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 72346289ec9036e4e70a43fc6f1ed0c0577f3a79..a8b9426849f1f271692c9e9087cbf4dce2930dda 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 75c837693780c772d4cb2111f141a509290608c1..66009e3ff6b84b8a6265d3495ec49a6889835e63 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 488826d45f00d0bb15499446e45119f7b009b054..fca8ff2a53c711a2dcb7d6f68fd32dc231a17933 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 4d0a45c5d715f1c8843433567132884b8526c402..811a24f35b4cdf5d7151b7e7aed6826b86f03483 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 94c7c434d8c1c123fd8a8093dd34348f8b55962f..3806958e493543fa82a298a2f660a91d99a0dd18 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 19901747c48983d2d454b2f545e709917e4742b5..1556cc70e6a4488307d9b5f7669db731aba55892 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 8bce44f877fd70e0f168c407eca4381cc66f5022..7bfeed219da832ca95fbe648759fec1df2a89d16 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 7374c85c42ef49676dca2b65961350a02ec5d9e2..698b326eb9cb176344c74c07811e5e730976dc1d 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 d6dff7de76ffb0ca02e2ebb0b77545b729ba3a56..421075334f14fb41a2ebc4b9f4a826f4f44e8e82 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 6dbb4b8bb7f532f5ddd7bcda468217e113390e49..5fc2d4e6a4d9ce7bf576d4c5606d985963e5f6ba 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 69752f7a68e9fbf685307198a43dcd8fe1460aba..58f817ce10f036705dc664f3db19fa2f5eaf1122 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 e8b7b0d667454e77d197ee68b2f8b156d1fa8e5b..c7a0627250ab9516d93412d7e55fd81e0e5e1cb6 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 20ce77a9d1206e14523654150721d3bb466c4352..7197fcc99e102477a8746a9f586a92f456230711 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 8048c31bdaf5afcdddcd5b2e853ffb9bd8546460..924b6ff894961d86f2153036444bf8baf3f42fae 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 fa29f1bb9694ba87b7322267e1141b4a5bde26c2..c039272505f0d3ea922b4df24783c0c1aa0a1d5e 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 8bf4d55a508d55bc2dd9f60893241bd80647caa8..acedfcebebbc1093331c8be85a22ec28bab0b596 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 3a026a063a6cd1cd7487b75aeb0e4b5e9e31dbd7..20cced4295d38360cb85423aaa99104acd6a02a9 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 df1429d3526eabc0a39804959af064a273b4a1d9..f32a91eb67af8d4ee91e8ea73f42bff54dc86d56 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 94c7ab5bd12096bce1431b70adb49e0354c7d0d8..787b09ab7bd852590c993c38b32af6b26d85ff91 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 7c8db05e0414b5a7cd63256c2c125ad95af76e42..5ecbfa89bd72e42bb82acdc40ec8b809bbaeef31 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 212a0f883915ac7b78ef829aaf3a75cb8918eaba..c8db8c9d6fe02cc109b0b25b1c87eb117a9c2919 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 c84c6d94aac1b29003f283b02161ada346a457eb..0aa469df929022e758c5348a71b910747a22db13 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 72adde8bd4d3181aee5c712ea41f0822ece49f39..72063281ea00067cad4cb2d51219e976416a490d 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()); \