From a7aa063ff26581997ff29924218d62518f77f5e6 Mon Sep 17 00:00:00 2001 From: Hans Johnson Date: Sun, 26 Jan 2025 12:56:46 -0600 Subject: [PATCH] STYLE: CoordRepType -> CoordinateType code readability For the sake of code readability, a new 'CoordinateType' alias is added for each nested 'CoordRepType' alias. The old 'CoordRepType' aliases will still be available with ITK 6.0, but it is recommended to use 'CoordinateType' instead. The 'CoordRepType' aliases will be removed when 'ITK_FUTURE_LEGACY_REMOVE' is enabled. Similarly, 'InputCoordinateType', 'OutputCoordinateType', and 'ImagePointCoordinateType' replace 'InputCoordRepType', 'OutputCoordRepType', and 'ImagePointCoordRepType', respectively. --- .../rtkprojectionmatrix.cxx | 4 +- include/rtkForwardWarpImageFilter.h | 4 +- ...osephBackAttenuatedProjectionImageFilter.h | 12 +-- include/rtkJosephBackProjectionImageFilter.h | 20 ++--- .../rtkJosephBackProjectionImageFilter.hxx | 78 +++++++++---------- ...phForwardAttenuatedProjectionImageFilter.h | 8 +- .../rtkJosephForwardProjectionImageFilter.h | 8 +- .../rtkJosephForwardProjectionImageFilter.hxx | 66 ++++++++-------- include/rtkZengBackProjectionImageFilter.hxx | 6 +- .../rtkZengForwardProjectionImageFilter.hxx | 6 +- 10 files changed, 106 insertions(+), 106 deletions(-) diff --git a/applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx b/applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx index 10b3c15f7..99f393691 100644 --- a/applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx +++ b/applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx @@ -30,7 +30,7 @@ namespace rtk { namespace Functor { -template +template class StoreSparseMatrixSplatWeightMultiplication { public: @@ -53,7 +53,7 @@ class StoreSparseMatrixSplatWeightMultiplication TOutput & output, const double stepLengthInVoxel, const double voxelSize, - const TCoordRepType weight) + const TCoordinateType weight) { // One row of the matrix is one ray, it should be thread safe m_SystemMatrix.put( diff --git a/include/rtkForwardWarpImageFilter.h b/include/rtkForwardWarpImageFilter.h index 155bb62c0..b8cb8c55b 100644 --- a/include/rtkForwardWarpImageFilter.h +++ b/include/rtkForwardWarpImageFilter.h @@ -60,8 +60,8 @@ class ITK_TEMPLATE_EXPORT ForwardWarpImageFilter : public itk::WarpImageFilter; + using CoordinateType = double; + using PointType = itk::Point; /** Method for creation through the object factory. */ itkNewMacro(Self); diff --git a/include/rtkJosephBackAttenuatedProjectionImageFilter.h b/include/rtkJosephBackAttenuatedProjectionImageFilter.h index b683eae86..ed55956f6 100644 --- a/include/rtkJosephBackAttenuatedProjectionImageFilter.h +++ b/include/rtkJosephBackAttenuatedProjectionImageFilter.h @@ -35,7 +35,7 @@ namespace Functor * * \ingroup RTK Functions */ -template +template class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationAttenuatedBackProjection { public: @@ -55,7 +55,7 @@ class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationAttenuatedBackProject } inline TOutput - operator()(const double stepLengthInVoxel, const TCoordRepType weight, const TInput * p, const int i) + operator()(const double stepLengthInVoxel, const TCoordinateType weight, const TInput * p, const int i) { const double w = weight * stepLengthInVoxel; @@ -150,7 +150,7 @@ class ITK_TEMPLATE_EXPORT ComputeAttenuationCorrectionBackProjection * * \ingroup RTK Functions */ -template +template class ITK_TEMPLATE_EXPORT SplatWeightMultiplicationAttenuated { public: @@ -173,7 +173,7 @@ class ITK_TEMPLATE_EXPORT SplatWeightMultiplicationAttenuated TOutput & output, const double stepLengthInVoxel, const double itkNotUsed(voxelSize), - const TCoordRepType weight) const + const TCoordinateType weight) const { output += rayValue * weight * stepLengthInVoxel; } @@ -226,8 +226,8 @@ class ITK_TEMPLATE_EXPORT JosephBackAttenuatedProjectionImageFilter using InputPixelType = typename TInputImage::PixelType; using OutputPixelType = typename TOutputImage::PixelType; using OutputImageRegionType = typename TOutputImage::RegionType; - using CoordRepType = double; - using VectorType = itk::Vector; + using CoordinateType = double; + using VectorType = itk::Vector; using GeometryType = rtk::ThreeDCircularProjectionGeometry; using GeometryPointer = typename GeometryType::Pointer; diff --git a/include/rtkJosephBackProjectionImageFilter.h b/include/rtkJosephBackProjectionImageFilter.h index de2b86976..3be8603ee 100644 --- a/include/rtkJosephBackProjectionImageFilter.h +++ b/include/rtkJosephBackProjectionImageFilter.h @@ -37,7 +37,7 @@ namespace Functor * * \ingroup RTK Functions */ -template +template class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationBackProjection { public: @@ -56,7 +56,7 @@ class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationBackProjection inline TOutput operator()(const double itkNotUsed(stepLengthInVoxel), - const TCoordRepType itkNotUsed(weight), + const TCoordinateType itkNotUsed(weight), const TInput * itkNotUsed(p), const int itkNotUsed(i)) const { @@ -107,7 +107,7 @@ class ITK_TEMPLATE_EXPORT ValueAlongRay * * \ingroup RTK Functions */ -template +template class ITK_TEMPLATE_EXPORT SplatWeightMultiplication { public: @@ -129,7 +129,7 @@ class ITK_TEMPLATE_EXPORT SplatWeightMultiplication TOutput & output, const double stepLengthInVoxel, const double voxelSize, - const TCoordRepType weight) const + const TCoordinateType weight) const { output += rayValue * weight * voxelSize * stepLengthInVoxel; } @@ -174,8 +174,8 @@ class ITK_TEMPLATE_EXPORT JosephBackProjectionImageFilter : public BackProjectio using InputPixelType = typename TInputImage::PixelType; using OutputPixelType = typename TOutputImage::PixelType; using OutputImageRegionType = typename TOutputImage::RegionType; - using CoordRepType = double; - using VectorType = itk::Vector; + using CoordinateType = double; + using VectorType = itk::Vector; using GeometryType = rtk::ThreeDCircularProjectionGeometry; using GeometryPointer = typename GeometryType::Pointer; @@ -298,10 +298,10 @@ class ITK_TEMPLATE_EXPORT JosephBackProjectionImageFilter : public BackProjectio const double y, const int ox, const int oy, - const CoordRepType minx, - const CoordRepType miny, - const CoordRepType maxx, - const CoordRepType maxy); + const CoordinateType minx, + const CoordinateType miny, + const CoordinateType maxx, + const CoordinateType maxy); inline OutputPixelType BilinearInterpolation(const double stepLengthInVoxel, diff --git a/include/rtkJosephBackProjectionImageFilter.hxx b/include/rtkJosephBackProjectionImageFilter.hxx index 6389aceb8..61fadfb36 100644 --- a/include/rtkJosephBackProjectionImageFilter.hxx +++ b/include/rtkJosephBackProjectionImageFilter.hxx @@ -168,10 +168,10 @@ JosephBackProjectionImageFilter notMainDirSup) std::swap(notMainDirInf, notMainDirSup); - const CoordRepType minx = box->GetBoxMin()[notMainDirInf]; - const CoordRepType miny = box->GetBoxMin()[notMainDirSup]; - const CoordRepType maxx = box->GetBoxMax()[notMainDirInf]; - const CoordRepType maxy = box->GetBoxMax()[notMainDirSup]; + const CoordinateType minx = box->GetBoxMin()[notMainDirInf]; + const CoordinateType miny = box->GetBoxMin()[notMainDirSup]; + const CoordinateType maxx = box->GetBoxMax()[notMainDirInf]; + const CoordinateType maxy = box->GetBoxMax()[notMainDirSup]; // Init data pointers to first pixel of slice ns (i)nferior and (s)uperior (x|y) corner const int offsetx = offsets[notMainDirInf]; @@ -184,11 +184,11 @@ JosephBackProjectionImageFilter::One / dirVox[mainDir]; - CoordRepType stepx = dirVox[notMainDirInf] * norm; - CoordRepType stepy = dirVox[notMainDirSup] * norm; + CoordinateType residualB = ns - np[mainDir]; + CoordinateType residualE = fp[mainDir] - fs; + const CoordinateType norm = itk::NumericTraits::One / dirVox[mainDir]; + CoordinateType stepx = dirVox[notMainDirInf] * norm; + CoordinateType stepy = dirVox[notMainDirSup] * norm; if (np[mainDir] > fp[mainDir]) { residualB *= -1; @@ -197,8 +197,8 @@ JosephBackProjectionImageFilterGetInput(0)->GetSpacing()[notMainDirInf] * stepx; @@ -347,10 +347,10 @@ JosephBackProjectionImageFilter +template class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationAttenuated { public: @@ -69,7 +69,7 @@ class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationAttenuated inline TOutput operator()(const ThreadIdType threadId, const double stepLengthInVoxel, - const TCoordRepType weight, + const TCoordinateType weight, const TInput * p, const int i) { @@ -284,8 +284,8 @@ class ITK_TEMPLATE_EXPORT JosephForwardAttenuatedProjectionImageFilter using InputPixelType = typename TInputImage::PixelType; using OutputPixelType = typename TOutputImage::PixelType; using OutputImageRegionType = typename TOutputImage::RegionType; - using CoordRepType = double; - using VectorType = itk::Vector; + using CoordinateType = double; + using VectorType = itk::Vector; /** ImageDimension constants */ static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension; diff --git a/include/rtkJosephForwardProjectionImageFilter.h b/include/rtkJosephForwardProjectionImageFilter.h index 7b8257158..1f351f47a 100644 --- a/include/rtkJosephForwardProjectionImageFilter.h +++ b/include/rtkJosephForwardProjectionImageFilter.h @@ -39,7 +39,7 @@ namespace Functor * * \ingroup RTK Functions */ -template +template class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplication { public: @@ -59,7 +59,7 @@ class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplication inline TOutput operator()(const ThreadIdType itkNotUsed(threadId), const double itkNotUsed(stepLengthInVoxel), - const TCoordRepType weight, + const TCoordinateType weight, const TInput * p, const int i) const { @@ -184,8 +184,8 @@ class ITK_TEMPLATE_EXPORT JosephForwardProjectionImageFilter using InputPixelType = typename TInputImage::PixelType; using OutputPixelType = typename TOutputImage::PixelType; using OutputImageRegionType = typename TOutputImage::RegionType; - using CoordRepType = double; - using VectorType = itk::Vector; + using CoordinateType = double; + using VectorType = itk::Vector; using TClipImageType = itk::Image; using TClipImagePointer = typename TClipImageType::Pointer; diff --git a/include/rtkJosephForwardProjectionImageFilter.hxx b/include/rtkJosephForwardProjectionImageFilter.hxx index 9d0f7485b..54d90f763 100644 --- a/include/rtkJosephForwardProjectionImageFilter.hxx +++ b/include/rtkJosephForwardProjectionImageFilter.hxx @@ -294,10 +294,10 @@ JosephForwardProjectionImageFilter notMainDirSup) std::swap(notMainDirInf, notMainDirSup); - const CoordRepType minx = box->GetBoxMin()[notMainDirInf]; - const CoordRepType miny = box->GetBoxMin()[notMainDirSup]; - const CoordRepType maxx = box->GetBoxMax()[notMainDirInf]; - const CoordRepType maxy = box->GetBoxMax()[notMainDirSup]; + const CoordinateType minx = box->GetBoxMin()[notMainDirInf]; + const CoordinateType miny = box->GetBoxMin()[notMainDirSup]; + const CoordinateType maxx = box->GetBoxMax()[notMainDirInf]; + const CoordinateType maxy = box->GetBoxMax()[notMainDirSup]; // Init data pointers to first pixel of slice ns (i)nferior and (s)uperior (x|y) corner const int offsetx = offsets[notMainDirInf]; @@ -310,11 +310,11 @@ JosephForwardProjectionImageFilter::One / dirVox[mainDir]; - CoordRepType stepx = dirVox[notMainDirInf] * norm; - CoordRepType stepy = dirVox[notMainDirSup] * norm; + CoordinateType residualB = ns - np[mainDir]; + CoordinateType residualE = fp[mainDir] - fs; + const CoordinateType norm = itk::NumericTraits::One / dirVox[mainDir]; + CoordinateType stepx = dirVox[notMainDirInf] * norm; + CoordinateType stepy = dirVox[notMainDirSup] * norm; if (np[mainDir] > fp[mainDir]) { residualB *= -1; @@ -323,8 +323,8 @@ JosephForwardProjectionImageFilterGetInput(1)->GetSpacing()[notMainDirInf] * stepx; @@ -443,18 +443,18 @@ JosephForwardProjectionImageFilter::GenerateOutputInformat const typename OuputCPUImageType::PointType originProjection = this->GetInput(1)->GetOrigin(); // Find the center of the volume - using CoordRepType = typename PointType ::ValueType; - using ContinuousIndexType = itk::ContinuousIndex; + using CoordinateType = typename PointType ::ValueType; + using ContinuousIndexType = itk::ContinuousIndex; using ContinuousIndexValueType = typename ContinuousIndexType::ValueType; ContinuousIndexType centerIndex; @@ -193,7 +193,7 @@ ZengBackProjectionImageFilter::GenerateOutputInformat using ValueType = typename PointType::ValueType; m_centerVolume = - this->GetInput(0)->template TransformContinuousIndexToPhysicalPoint(centerIndex); + this->GetInput(0)->template TransformContinuousIndexToPhysicalPoint(centerIndex); PointType centerRotation; centerRotation.Fill(0); diff --git a/include/rtkZengForwardProjectionImageFilter.hxx b/include/rtkZengForwardProjectionImageFilter.hxx index 91fed1a16..43bebc675 100644 --- a/include/rtkZengForwardProjectionImageFilter.hxx +++ b/include/rtkZengForwardProjectionImageFilter.hxx @@ -181,8 +181,8 @@ ZengForwardProjectionImageFilter::GenerateOutputInfor // Find the center of the volume - using CoordRepType = typename PointType ::ValueType; - using ContinuousIndexType = itk::ContinuousIndex; + using CoordinateType = typename PointType ::ValueType; + using ContinuousIndexType = itk::ContinuousIndex; using ContinuousIndexValueType = typename ContinuousIndexType::ValueType; ContinuousIndexType centerIndex; @@ -194,7 +194,7 @@ ZengForwardProjectionImageFilter::GenerateOutputInfor using ValueType = typename PointType::ValueType; m_centerVolume = - this->GetInput(1)->template TransformContinuousIndexToPhysicalPoint(centerIndex); + this->GetInput(1)->template TransformContinuousIndexToPhysicalPoint(centerIndex); PointType centerRotation; centerRotation.Fill(0);