From c9b342eefbd95a2506c8e816e33c11976ea0de62 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Tue, 17 Dec 2024 20:11:43 -0600 Subject: [PATCH] COMP: Fix building with ITK_USE_FLOAT_SPACE_PRECISION=ON Need to match precision for types used to allow building. In a few cases double precision was assumed for values related to spacing precision. --- Examples/DataRepresentation/Image/Image4.cxx | 3 ++- Modules/Core/Common/include/itkImageAlgorithm.hxx | 4 ++-- .../test/itkPhysicalPointImageSourceTest.cxx | 10 ++-------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/Examples/DataRepresentation/Image/Image4.cxx b/Examples/DataRepresentation/Image/Image4.cxx index 980f34e9fb2..ceb4c49a2d0 100644 --- a/Examples/DataRepresentation/Image/Image4.cxx +++ b/Examples/DataRepresentation/Image/Image4.cxx @@ -453,7 +453,8 @@ main(int, char *[]) image->GetDirection(); const ImageType::PointType & ImageOrigin = image->GetOrigin(); - using VectorType = itk::Vector; + using VectorType = + itk::Vector; VectorType LeftEyeIndexVector; LeftEyeIndexVector[0] = LeftEyeIndex[0]; LeftEyeIndexVector[1] = LeftEyeIndex[1]; diff --git a/Modules/Core/Common/include/itkImageAlgorithm.hxx b/Modules/Core/Common/include/itkImageAlgorithm.hxx index 73c6765809e..5bf85f8564d 100644 --- a/Modules/Core/Common/include/itkImageAlgorithm.hxx +++ b/Modules/Core/Common/include/itkImageAlgorithm.hxx @@ -207,7 +207,7 @@ ImageAlgorithm::EnlargeRegionOverBox(const typename InputImageType::RegionType & { numberOfInputCorners *= 2; } - using ContinuousIndexValueType = double; + using ContinuousIndexValueType = ContinuousIndex::ValueType; using ContinuousInputIndexType = ContinuousIndex; using ContinuousOutputIndexType = ContinuousIndex; @@ -241,7 +241,7 @@ ImageAlgorithm::EnlargeRegionOverBox(const typename InputImageType::RegionType & using InputPointType = Point; const InputPointType inputPoint = - inputImage->template TransformContinuousIndexToPhysicalPoint( + inputImage->template TransformContinuousIndexToPhysicalPoint( currentInputCornerIndex); using OutputPointType = Point; OutputPointType outputPoint{}; diff --git a/Modules/Filtering/ImageSources/test/itkPhysicalPointImageSourceTest.cxx b/Modules/Filtering/ImageSources/test/itkPhysicalPointImageSourceTest.cxx index 8b0de554f4a..00bb6ddbf56 100644 --- a/Modules/Filtering/ImageSources/test/itkPhysicalPointImageSourceTest.cxx +++ b/Modules/Filtering/ImageSources/test/itkPhysicalPointImageSourceTest.cxx @@ -100,13 +100,6 @@ itkPhysicalPointImageSourceTest(int argc, char * argv[]) ITK_EXERCISE_BASIC_OBJECT_METHODS(physicalPointImageSource, PhysicalPointImageSource, GenerateImageSource); - - double theta = 0; - if (argc >= 4) - { - theta = std::stod(argv[3]); - } - int testStatus = EXIT_SUCCESS; auto spacing = itk::MakeFilled(1.0); ImageType::PointType origin{}; @@ -129,7 +122,8 @@ itkPhysicalPointImageSourceTest(int argc, char * argv[]) } else { - itk::SpacePrecisionType M[] = { std::cos(theta), -std::sin(theta), std::sin(theta), std::cos(theta) }; + const itk::SpacePrecisionType theta = (argc >= 4) ? std::stod(argv[3]) : 0; + itk::SpacePrecisionType M[] = { std::cos(theta), -std::sin(theta), std::sin(theta), std::cos(theta) }; direction = vnl_matrix(M, 2, 2); testStatus = itkPhysicalPointImageSourceTest>(