Skip to content

Commit

Permalink
STYLE: Rename TCoordRep template parameters to TCoordinate
Browse files Browse the repository at this point in the history
Aims to make template parameter names of coordinate types clearer.

Following the ITKSoftwareGuide/CodingStyleGuide guideline on Naming Conventions,
saying, "Names are generally spelled out; use of abbreviations is discouraged".
  • Loading branch information
N-Dekker committed Nov 27, 2024
1 parent 2816ed3 commit e37d95a
Show file tree
Hide file tree
Showing 98 changed files with 850 additions and 841 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ namespace itk
* \ingroup Functions ImageInterpolators
* \ingroup ITKCommon
*/
template <typename TCoordRep = float, unsigned int VSpaceDimension = 2, unsigned int VSplineOrder = 3>
template <typename TCoordinate = float, unsigned int VSpaceDimension = 2, unsigned int VSplineOrder = 3>
class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunction
: public FunctionBase<ContinuousIndex<TCoordRep, VSpaceDimension>,
: public FunctionBase<ContinuousIndex<TCoordinate, VSpaceDimension>,
FixedArray<double, Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension)>>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(BSplineInterpolationWeightFunction);

/** Standard class type aliases. */
using Self = BSplineInterpolationWeightFunction;
using Superclass = FunctionBase<ContinuousIndex<TCoordRep, VSpaceDimension>,
using Superclass = FunctionBase<ContinuousIndex<TCoordinate, VSpaceDimension>,
FixedArray<double, Math::UnsignedPower(VSplineOrder + 1, VSpaceDimension)>>;

using Pointer = SmartPointer<Self>;
Expand Down Expand Up @@ -83,7 +83,7 @@ class ITK_TEMPLATE_EXPORT BSplineInterpolationWeightFunction
using SizeType = Size<VSpaceDimension>;

/** ContinuousIndex type alias support. */
using ContinuousIndexType = ContinuousIndex<TCoordRep, VSpaceDimension>;
using ContinuousIndexType = ContinuousIndex<TCoordinate, VSpaceDimension>;

/** The support region size: a hypercube of length SplineOrder + 1 */
static constexpr SizeType SupportSize{ SizeType::Filled(VSplineOrder + 1) };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
namespace itk
{
/** Compute weights for interpolation at continuous index position */
template <typename TCoordRep, unsigned int VSpaceDimension, unsigned int VSplineOrder>
template <typename TCoordinate, unsigned int VSpaceDimension, unsigned int VSplineOrder>
auto
BSplineInterpolationWeightFunction<TCoordRep, VSpaceDimension, VSplineOrder>::Evaluate(
BSplineInterpolationWeightFunction<TCoordinate, VSpaceDimension, VSplineOrder>::Evaluate(
const ContinuousIndexType & index) const -> WeightsType
{
WeightsType weights;
Expand All @@ -40,9 +40,9 @@ BSplineInterpolationWeightFunction<TCoordRep, VSpaceDimension, VSplineOrder>::Ev
}

/** Compute weights for interpolation at continuous index position */
template <typename TCoordRep, unsigned int VSpaceDimension, unsigned int VSplineOrder>
template <typename TCoordinate, unsigned int VSpaceDimension, unsigned int VSplineOrder>
void
BSplineInterpolationWeightFunction<TCoordRep, VSpaceDimension, VSplineOrder>::Evaluate(
BSplineInterpolationWeightFunction<TCoordinate, VSpaceDimension, VSplineOrder>::Evaluate(
const ContinuousIndexType & index,
WeightsType & weights,
IndexType & startIndex) const
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/include/itkBoundingBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace itk
* Template parameters for BoundingBox:
*
* \tparam TPointIdentifier The type used to access a particular point (i.e., a point's id)
* \tparam TCoordRep Numerical type with which to represent each coordinate value.
* \tparam TCoordinate Numerical type with which to represent each coordinate value.
* \tparam VPointDimension Geometric dimension of space.
*
* \ingroup DataRepresentation
Expand All @@ -65,8 +65,8 @@ namespace itk
*/
template <typename TPointIdentifier = IdentifierType,
unsigned int VPointDimension = 3,
typename TCoordRep = float,
typename TPointsContainer = VectorContainer<TPointIdentifier, Point<TCoordRep, VPointDimension>>>
typename TCoordinate = float,
typename TPointsContainer = VectorContainer<TPointIdentifier, Point<TCoordinate, VPointDimension>>>
class ITK_TEMPLATE_EXPORT BoundingBox : public Object
{
public:
Expand All @@ -89,7 +89,7 @@ class ITK_TEMPLATE_EXPORT BoundingBox : public Object

/** Hold on to the type information specified by the template parameters. */
using PointIdentifier = TPointIdentifier;
using CoordRepType = TCoordRep;
using CoordRepType = TCoordinate;
using PointsContainer = TPointsContainer;
using PointsContainerPointer = typename PointsContainer::Pointer;
using PointsContainerConstPointer = typename PointsContainer::ConstPointer;
Expand Down
70 changes: 35 additions & 35 deletions Modules/Core/Common/include/itkBoundingBox.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ namespace itk
/**
* Print out the bounding box.
*/
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
void
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::PrintSelf(std::ostream & os,
Indent indent) const
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::PrintSelf(std::ostream & os,
Indent indent) const
{
Superclass::PrintSelf(os, indent);

Expand All @@ -53,9 +53,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Pri
/**
* Access routine to set the points container.
*/
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
void
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::SetPoints(const PointsContainer * points)
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::SetPoints(const PointsContainer * points)
{
itkDebugMacro("setting Points container to " << points);
if (m_PointsContainer != points)
Expand All @@ -66,9 +66,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Set
}

/** Access routine to get the points container. */
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::GetPoints() const
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::GetPoints() const
-> const PointsContainer *
{
itkDebugMacro("returning Points container of " << m_PointsContainer);
Expand All @@ -77,9 +77,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Get
}

/** Compute and get the corners of the bounding box */
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::ComputeCorners() const
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::ComputeCorners() const
-> std::array<PointType, NumberOfCorners>
{
std::array<PointType, NumberOfCorners> result;
Expand Down Expand Up @@ -110,9 +110,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Com

#if !defined(ITK_LEGACY_REMOVE)
/** Compute and get the corners of the bounding box */
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::GetCorners() -> const PointsContainer *
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::GetCorners() -> const PointsContainer *
{
m_CornersContainer->clear();
m_CornersContainer->Reserve(NumberOfCorners);
Expand All @@ -128,9 +128,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Get
#endif


template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
bool
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::ComputeBoundingBox() const
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::ComputeBoundingBox() const
{
if (!m_PointsContainer)
{
Expand All @@ -153,8 +153,8 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Com
return false;
}

PointsContainerConstIterator ci = m_PointsContainer->Begin();
Point<TCoordRep, VPointDimension> point = ci->Value(); // point value
PointsContainerConstIterator ci = m_PointsContainer->Begin();
Point<TCoordinate, VPointDimension> point = ci->Value(); // point value
for (unsigned int i = 0; i < PointDimension; ++i)
{
m_Bounds[2 * i] = point[i];
Expand Down Expand Up @@ -187,9 +187,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Com
return true;
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::GetCenter() const -> PointType
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::GetCenter() const -> PointType
{
this->ComputeBoundingBox();

Expand All @@ -202,9 +202,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Get
return center;
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::GetMinimum() const -> PointType
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::GetMinimum() const -> PointType
{
this->ComputeBoundingBox();

Expand All @@ -217,9 +217,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Get
return minimum;
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
void
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::SetMinimum(const PointType & point)
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::SetMinimum(const PointType & point)
{
for (unsigned int i = 0; i < PointDimension; ++i)
{
Expand All @@ -229,9 +229,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Set
m_BoundsMTime.Modified();
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::GetMaximum() const -> PointType
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::GetMaximum() const -> PointType
{
this->ComputeBoundingBox();

Expand All @@ -244,9 +244,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Get
return maximum;
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
void
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::SetMaximum(const PointType & point)
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::SetMaximum(const PointType & point)
{
for (unsigned int i = 0; i < PointDimension; ++i)
{
Expand All @@ -256,9 +256,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Set
m_BoundsMTime.Modified();
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
void
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::ConsiderPoint(const PointType & point)
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::ConsiderPoint(const PointType & point)
{
bool changed = false;

Expand All @@ -282,9 +282,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Con
}
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::GetDiagonalLength2() const
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::GetDiagonalLength2() const
-> AccumulateType
{
typename NumericTraits<CoordRepType>::AccumulateType dist2 = CoordRepType{};
Expand All @@ -300,9 +300,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Get
return dist2;
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
bool
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::IsInside(const PointType & point) const
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::IsInside(const PointType & point) const
{
unsigned int j = 0;
unsigned int i = 0;
Expand All @@ -322,9 +322,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::IsI
return true;
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
ModifiedTimeType
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::GetMTime() const
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::GetMTime() const
{
ModifiedTimeType latestTime = Object::GetMTime();

Expand All @@ -335,9 +335,9 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::Get
return latestTime;
}

template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordRep, typename TPointsContainer>
template <typename TPointIdentifier, unsigned int VPointDimension, typename TCoordinate, typename TPointsContainer>
auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer>::DeepCopy() const -> Pointer
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::DeepCopy() const -> Pointer
{
Pointer clone = Self::New();

Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkCellInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ class ITK_TEMPLATE_EXPORT CellInterface
* \ingroup ITKCommon
*/
template <int VPointDimension,
typename TCoordRep,
typename TCoordinate,
typename TInterpolationWeight,
typename TPointIdentifier,
typename TCellIdentifier,
Expand All @@ -525,7 +525,7 @@ class ITK_TEMPLATE_EXPORT CellTraitsInfo
{
public:
static constexpr unsigned int PointDimension = VPointDimension;
using CoordRepType = TCoordRep;
using CoordRepType = TCoordinate;
using InterpolationWeightType = TInterpolationWeight;
using PointIdentifier = TPointIdentifier;
using CellIdentifier = TCellIdentifier;
Expand Down
16 changes: 8 additions & 8 deletions Modules/Core/Common/include/itkContinuousIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace itk
*
* ContinuousIndex is a templated class that holds a set of coordinates
* (components).
* The template parameter TCoordRep can be any floating point type (float, double).
* The template parameter TCoordinate can be any floating point type (float, double).
* The VIndexDimension defines the number of components in the continuous
* index array.
*
Expand All @@ -42,21 +42,21 @@ namespace itk
*
* \ingroup ITKCommon
*/
template <typename TCoordRep = double, unsigned int VIndexDimension = 2>
class ITK_TEMPLATE_EXPORT ContinuousIndex : public Point<TCoordRep, VIndexDimension>
template <typename TCoordinate = double, unsigned int VIndexDimension = 2>
class ITK_TEMPLATE_EXPORT ContinuousIndex : public Point<TCoordinate, VIndexDimension>
{
static_assert(std::is_floating_point_v<TCoordRep>,
static_assert(std::is_floating_point_v<TCoordinate>,
"The coordinates of a continuous index must be represented by floating point numbers.");

public:
/** Standard class type aliases. */
using Self = ContinuousIndex;
using Superclass = Point<TCoordRep, VIndexDimension>;
using Superclass = Point<TCoordinate, VIndexDimension>;

/** ValueType can be used to declare a variable that is the same type
* as a data element held in an Point. */
using ValueType = TCoordRep;
using CoordRepType = TCoordRep;
using ValueType = TCoordinate;
using CoordRepType = TCoordinate;

/** Dimension of the Space */
static constexpr unsigned int IndexDimension = VIndexDimension;
Expand All @@ -83,7 +83,7 @@ class ITK_TEMPLATE_EXPORT ContinuousIndex : public Point<TCoordRep, VIndexDimens
{
for (unsigned int i = 0; i < VIndexDimension; ++i)
{
(*this)[i] = static_cast<TCoordRep>(index[i]);
(*this)[i] = static_cast<TCoordinate>(index[i]);
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkCovariantVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ class ITK_TEMPLATE_EXPORT CovariantVector : public FixedArray<T, VVectorDimensio

/** Copy from another CovariantVector with a different representation type.
* Casting is done with C-Like rules */
template <typename TCoordRepB>
template <typename TCoordinateB>
void
CastFrom(const CovariantVector<TCoordRepB, VVectorDimension> & pa)
CastFrom(const CovariantVector<TCoordinateB, VVectorDimension> & pa)
{
for (unsigned int i = 0; i < VVectorDimension; ++i)
{
Expand Down
6 changes: 3 additions & 3 deletions Modules/Core/Common/include/itkDefaultDynamicMeshTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace itk
* \tparam VMaxTopologicalDimension Max topological dimension of a cell
* that can be inserted into this mesh.
*
* \tparam TCoordRep Numerical type to store each coordinate value.
* \tparam TCoordinate Numerical type to store each coordinate value.
*
* \tparam TInterpolationWeight Numerical type to store interpolation
* weights.
Expand All @@ -57,7 +57,7 @@ namespace itk
template <typename TPixelType,
unsigned int VPointDimension = 3,
unsigned int VMaxTopologicalDimension = VPointDimension,
typename TCoordRep = float,
typename TCoordinate = float,
typename TInterpolationWeight = float,
typename TCellPixelType = TPixelType>
class DefaultDynamicMeshTraits
Expand All @@ -69,7 +69,7 @@ class DefaultDynamicMeshTraits
/** Just save all the template parameters. */
using PixelType = TPixelType;
using CellPixelType = TCellPixelType;
using CoordRepType = TCoordRep;
using CoordRepType = TCoordinate;
using InterpolationWeightType = TInterpolationWeight;

/** Just save all the template parameters. */
Expand Down
Loading

0 comments on commit e37d95a

Please sign in to comment.