Skip to content

Commit

Permalink
STYLE: CoordRepType -> CoordinateType code readability
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hjmjohnson authored and SimonRit committed Jan 27, 2025
1 parent 5a19579 commit b6faad6
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 150 deletions.
12 changes: 6 additions & 6 deletions applications/rtkprojectionmatrix/rtkprojectionmatrix.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace rtk
{
namespace Functor
{
template <class TInput, class TCoordRepType, class TOutput = TCoordRepType>
template <class TInput, class TCoordinateType, class TOutput = TCoordinateType>
class StoreSparseMatrixSplatWeightMultiplication
{
public:
Expand All @@ -49,11 +49,11 @@ class StoreSparseMatrixSplatWeightMultiplication
}

inline void
operator()(const TInput & rayValue,
TOutput & output,
const double stepLengthInVoxel,
const double voxelSize,
const TCoordRepType weight)
operator()(const TInput & rayValue,
TOutput & output,
const double stepLengthInVoxel,
const double voxelSize,
const TCoordinateType weight)
{
// One row of the matrix is one ray, it should be thread safe
m_SystemMatrix.put(
Expand Down
4 changes: 2 additions & 2 deletions include/rtkForwardWarpImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class ITK_TEMPLATE_EXPORT ForwardWarpImageFilter : public itk::WarpImageFilter<T
using DisplacementType = typename DisplacementFieldType::PixelType;

/** Point type */
using CoordRepType = double;
using PointType = itk::Point<CoordRepType, Self::ImageDimension>;
using CoordinateType = double;
using PointType = itk::Point<CoordinateType, Self::ImageDimension>;

/** Method for creation through the object factory. */
itkNewMacro(Self);
Expand Down
20 changes: 10 additions & 10 deletions include/rtkJosephBackAttenuatedProjectionImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace Functor
*
* \ingroup RTK Functions
*/
template <class TInput, class TCoordRepType, class TOutput = TInput>
template <class TInput, class TCoordinateType, class TOutput = TInput>
class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationAttenuatedBackProjection
{
public:
Expand All @@ -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;

Expand Down Expand Up @@ -150,7 +150,7 @@ class ITK_TEMPLATE_EXPORT ComputeAttenuationCorrectionBackProjection
*
* \ingroup RTK Functions
*/
template <class TInput, class TCoordRepType, class TOutput = TCoordRepType>
template <class TInput, class TCoordinateType, class TOutput = TCoordinateType>
class ITK_TEMPLATE_EXPORT SplatWeightMultiplicationAttenuated
{
public:
Expand All @@ -169,11 +169,11 @@ class ITK_TEMPLATE_EXPORT SplatWeightMultiplicationAttenuated
}

inline void
operator()(const TInput & rayValue,
TOutput & output,
const double stepLengthInVoxel,
const double itkNotUsed(voxelSize),
const TCoordRepType weight) const
operator()(const TInput & rayValue,
TOutput & output,
const double stepLengthInVoxel,
const double itkNotUsed(voxelSize),
const TCoordinateType weight) const
{
output += rayValue * weight * stepLengthInVoxel;
}
Expand Down Expand Up @@ -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<CoordRepType, TInputImage::ImageDimension>;
using CoordinateType = double;
using VectorType = itk::Vector<CoordinateType, TInputImage::ImageDimension>;
using GeometryType = rtk::ThreeDCircularProjectionGeometry;
using GeometryPointer = typename GeometryType::Pointer;

Expand Down
34 changes: 17 additions & 17 deletions include/rtkJosephBackProjectionImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Functor
*
* \ingroup RTK Functions
*/
template <class TInput, class TCoordRepType, class TOutput = TInput>
template <class TInput, class TCoordinateType, class TOutput = TInput>
class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationBackProjection
{
public:
Expand All @@ -55,10 +55,10 @@ class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationBackProjection
}

inline TOutput
operator()(const double itkNotUsed(stepLengthInVoxel),
const TCoordRepType itkNotUsed(weight),
const TInput * itkNotUsed(p),
const int itkNotUsed(i)) const
operator()(const double itkNotUsed(stepLengthInVoxel),
const TCoordinateType itkNotUsed(weight),
const TInput * itkNotUsed(p),
const int itkNotUsed(i)) const
{
return {};
}
Expand Down Expand Up @@ -107,7 +107,7 @@ class ITK_TEMPLATE_EXPORT ValueAlongRay
*
* \ingroup RTK Functions
*/
template <class TInput, class TCoordRepType, class TOutput = TCoordRepType>
template <class TInput, class TCoordinateType, class TOutput = TCoordinateType>
class ITK_TEMPLATE_EXPORT SplatWeightMultiplication
{
public:
Expand All @@ -125,11 +125,11 @@ class ITK_TEMPLATE_EXPORT SplatWeightMultiplication
}

inline void
operator()(const TInput & rayValue,
TOutput & output,
const double stepLengthInVoxel,
const double voxelSize,
const TCoordRepType weight) const
operator()(const TInput & rayValue,
TOutput & output,
const double stepLengthInVoxel,
const double voxelSize,
const TCoordinateType weight) const
{
output += rayValue * weight * voxelSize * stepLengthInVoxel;
}
Expand Down Expand Up @@ -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<CoordRepType, TInputImage::ImageDimension>;
using CoordinateType = double;
using VectorType = itk::Vector<CoordinateType, TInputImage::ImageDimension>;
using GeometryType = rtk::ThreeDCircularProjectionGeometry;
using GeometryPointer = typename GeometryType::Pointer;

Expand Down Expand Up @@ -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,
Expand Down
102 changes: 51 additions & 51 deletions include/rtkJosephBackProjectionImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ JosephBackProjectionImageFilter<TInputImage,
if (notMainDirInf > 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];
Expand All @@ -184,11 +184,11 @@ JosephBackProjectionImageFilter<TInputImage,
OutputPixelType * pxsys = pxsyi + offsety;

// Compute step size and go to first voxel
CoordRepType residualB = ns - np[mainDir];
CoordRepType residualE = fp[mainDir] - fs;
const CoordRepType norm = itk::NumericTraits<CoordRepType>::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<CoordinateType>::One / dirVox[mainDir];
CoordinateType stepx = dirVox[notMainDirInf] * norm;
CoordinateType stepy = dirVox[notMainDirSup] * norm;
if (np[mainDir] > fp[mainDir])
{
residualB *= -1;
Expand All @@ -197,8 +197,8 @@ JosephBackProjectionImageFilter<TInputImage,
stepx *= -1;
stepy *= -1;
}
CoordRepType currentx = np[notMainDirInf] + residualB * stepx;
CoordRepType currenty = np[notMainDirSup] + residualB * stepy;
CoordinateType currentx = np[notMainDirInf] + residualB * stepx;
CoordinateType currenty = np[notMainDirSup] + residualB * stepy;

// Compute voxel to millimeters conversion
stepMM[notMainDirInf] = this->GetInput(0)->GetSpacing()[notMainDirInf] * stepx;
Expand Down Expand Up @@ -344,13 +344,13 @@ JosephBackProjectionImageFilter<TInputImage,
const int ox,
const int oy)
{
int ix = itk::Math::floor(x);
int iy = itk::Math::floor(y);
int idx = ix * ox + iy * oy;
CoordRepType lx = x - ix;
CoordRepType ly = y - iy;
CoordRepType lxc = 1. - lx;
CoordRepType lyc = 1. - ly;
int ix = itk::Math::floor(x);
int iy = itk::Math::floor(y);
int idx = ix * ox + iy * oy;
CoordinateType lx = x - ix;
CoordinateType ly = y - iy;
CoordinateType lxc = 1. - lx;
CoordinateType lyc = 1. - ly;

m_SplatWeightMultiplication(rayValue, pxiyi[idx], stepLengthInVoxel, voxelSize, lxc * lyc);
m_SplatWeightMultiplication(rayValue, pxsyi[idx], stepLengthInVoxel, voxelSize, lx * lyc);
Expand Down Expand Up @@ -379,18 +379,18 @@ JosephBackProjectionImageFilter<TInputImage,
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)
{
int ix = itk::Math::floor(x);
int iy = itk::Math::floor(y);
int idx = ix * ox + iy * oy;
CoordRepType lx = x - ix;
CoordRepType ly = y - iy;
CoordRepType lxc = 1. - lx;
CoordRepType lyc = 1. - ly;
int ix = itk::Math::floor(x);
int iy = itk::Math::floor(y);
int idx = ix * ox + iy * oy;
CoordinateType lx = x - ix;
CoordinateType ly = y - iy;
CoordinateType lxc = 1. - lx;
CoordinateType lyc = 1. - ly;

int offset_xi = 0;
int offset_yi = 0;
Expand Down Expand Up @@ -431,18 +431,18 @@ JosephBackProjectionImageFilter<TInputImage,
const InputPixelType * pxsyi,
const InputPixelType * pxiys,
const InputPixelType * pxsys,
const CoordRepType x,
const CoordRepType y,
const CoordinateType x,
const CoordinateType y,
const int ox,
const int oy)
{
int ix = itk::Math::floor(x);
int iy = itk::Math::floor(y);
int idx = ix * ox + iy * oy;
CoordRepType lx = x - ix;
CoordRepType ly = y - iy;
CoordRepType lxc = 1. - lx;
CoordRepType lyc = 1. - ly;
int ix = itk::Math::floor(x);
int iy = itk::Math::floor(y);
int idx = ix * ox + iy * oy;
CoordinateType lx = x - ix;
CoordinateType ly = y - iy;
CoordinateType lxc = 1. - lx;
CoordinateType lyc = 1. - ly;
return (m_InterpolationWeightMultiplication(stepLengthInVoxel, lxc * lyc, pxiyi, idx) +
m_InterpolationWeightMultiplication(stepLengthInVoxel, lx * lyc, pxsyi, idx) +
m_InterpolationWeightMultiplication(stepLengthInVoxel, lxc * ly, pxiys, idx) +
Expand All @@ -468,22 +468,22 @@ JosephBackProjectionImageFilter<TInputImage,
const InputPixelType * pxsyi,
const InputPixelType * pxiys,
const InputPixelType * pxsys,
const CoordRepType x,
const CoordRepType y,
const CoordinateType x,
const CoordinateType 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)
{
int ix = itk::Math::floor(x);
int iy = itk::Math::floor(y);
int idx = ix * ox + iy * oy;
CoordRepType lx = x - ix;
CoordRepType ly = y - iy;
CoordRepType lxc = 1. - lx;
CoordRepType lyc = 1. - ly;
int ix = itk::Math::floor(x);
int iy = itk::Math::floor(y);
int idx = ix * ox + iy * oy;
CoordinateType lx = x - ix;
CoordinateType ly = y - iy;
CoordinateType lxc = 1. - lx;
CoordinateType lyc = 1. - ly;

int offset_xi = 0;
int offset_yi = 0;
Expand Down
16 changes: 8 additions & 8 deletions include/rtkJosephForwardAttenuatedProjectionImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Functor
*
* \ingroup RTK Functions
*/
template <class TInput, class TCoordRepType, class TOutput = TInput>
template <class TInput, class TCoordinateType, class TOutput = TInput>
class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationAttenuated
{
public:
Expand Down Expand Up @@ -67,11 +67,11 @@ class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplicationAttenuated
}

inline TOutput
operator()(const ThreadIdType threadId,
const double stepLengthInVoxel,
const TCoordRepType weight,
const TInput * p,
const int i)
operator()(const ThreadIdType threadId,
const double stepLengthInVoxel,
const TCoordinateType weight,
const TInput * p,
const int i)
{
const double w = weight * stepLengthInVoxel;

Expand Down Expand Up @@ -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<CoordRepType, TInputImage::ImageDimension>;
using CoordinateType = double;
using VectorType = itk::Vector<CoordinateType, TInputImage::ImageDimension>;

/** ImageDimension constants */
static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension;
Expand Down
16 changes: 8 additions & 8 deletions include/rtkJosephForwardProjectionImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Functor
*
* \ingroup RTK Functions
*/
template <class TInput, class TCoordRepType, class TOutput = TInput>
template <class TInput, class TCoordinateType, class TOutput = TInput>
class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplication
{
public:
Expand All @@ -57,11 +57,11 @@ class ITK_TEMPLATE_EXPORT InterpolationWeightMultiplication
}

inline TOutput
operator()(const ThreadIdType itkNotUsed(threadId),
const double itkNotUsed(stepLengthInVoxel),
const TCoordRepType weight,
const TInput * p,
const int i) const
operator()(const ThreadIdType itkNotUsed(threadId),
const double itkNotUsed(stepLengthInVoxel),
const TCoordinateType weight,
const TInput * p,
const int i) const
{
return weight * p[i];
}
Expand Down Expand Up @@ -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<CoordRepType, TInputImage::ImageDimension>;
using CoordinateType = double;
using VectorType = itk::Vector<CoordinateType, TInputImage::ImageDimension>;
using TClipImageType = itk::Image<double, TOutputImage::ImageDimension>;
using TClipImagePointer = typename TClipImageType::Pointer;

Expand Down
Loading

0 comments on commit b6faad6

Please sign in to comment.