Skip to content

Commit

Permalink
STYLE: Replace CoordRepType with CoordinateType in ITK implementation
Browse files Browse the repository at this point in the history
Did Notepad++ Replace in Files in ITK/Modules, on "itk*.cxx", "itk*.hxx", and
"itk*.h". Skipped the `using CoordRepType = CoordinateType` declarations.
  • Loading branch information
N-Dekker authored and dzenanz committed Nov 29, 2024
1 parent 324eaf1 commit 15d189f
Show file tree
Hide file tree
Showing 98 changed files with 428 additions and 423 deletions.
6 changes: 3 additions & 3 deletions Modules/Core/Common/include/itkBoundingBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ class ITK_TEMPLATE_EXPORT BoundingBox : public Object
using PointsContainerPointer = typename PointsContainer::Pointer;
using PointsContainerConstPointer = typename PointsContainer::ConstPointer;

using PointType = Point<CoordRepType, VPointDimension>;
using BoundsArrayType = FixedArray<CoordRepType, VPointDimension * 2>;
using PointType = Point<CoordinateType, VPointDimension>;
using BoundsArrayType = FixedArray<CoordinateType, VPointDimension * 2>;

/** Hold on to the dimensions specified by the template parameters. */
static constexpr unsigned int PointDimension = VPointDimension;
Expand Down Expand Up @@ -173,7 +173,7 @@ class ITK_TEMPLATE_EXPORT BoundingBox : public Object
/** Get the length squared of the diagonal of the bounding box.
* Returns zero if bounding box cannot be computed. Note that the
* Accumulate type is used to represent the length. */
using AccumulateType = typename NumericTraits<CoordRepType>::AccumulateType;
using AccumulateType = typename NumericTraits<CoordinateType>::AccumulateType;
AccumulateType
GetDiagonalLength2() const;

Expand Down
6 changes: 3 additions & 3 deletions Modules/Core/Common/include/itkBoundingBox.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::C
{
if (this->GetMTime() > m_BoundsMTime)
{
m_Bounds.Fill(CoordRepType{});
m_Bounds.Fill(CoordinateType{});
m_BoundsMTime.Modified();
}
return false;
Expand All @@ -148,7 +148,7 @@ BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::C
// start by initializing the values
if (m_PointsContainer->Size() < 1)
{
m_Bounds.Fill(CoordRepType{});
m_Bounds.Fill(CoordinateType{});
m_BoundsMTime.Modified();
return false;
}
Expand Down Expand Up @@ -287,7 +287,7 @@ auto
BoundingBox<TPointIdentifier, VPointDimension, TCoordinate, TPointsContainer>::GetDiagonalLength2() const
-> AccumulateType
{
typename NumericTraits<CoordRepType>::AccumulateType dist2 = CoordRepType{};
typename NumericTraits<CoordinateType>::AccumulateType dist2 = CoordinateType{};

if (this->ComputeBoundingBox())
{
Expand Down
44 changes: 22 additions & 22 deletions Modules/Core/Common/include/itkCellInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
using typename Superclass::CellRawPointer; \
using typename Superclass::CellConstRawPointer; \
using typename Superclass::CellTraits; \
using typename Superclass::CoordRepType; \
using typename Superclass::CoordinateType; \
using typename Superclass::InterpolationWeightType; \
using typename Superclass::PointIdentifier; \
using typename Superclass::PointIdIterator; \
Expand Down Expand Up @@ -109,7 +109,7 @@ class ITK_TEMPLATE_EXPORT CellInterface
using CellTraits = TCellTraits;

/** Save type information for this cell. */
using CoordinateType = typename CellTraits::CoordRepType;
using CoordinateType = typename CellTraits::CoordinateType;
using CoordRepType = CoordinateType;
using InterpolationWeightType = typename CellTraits::InterpolationWeightType;
using PointIdentifier = typename CellTraits::PointIdentifier;
Expand Down Expand Up @@ -141,7 +141,7 @@ class ITK_TEMPLATE_EXPORT CellInterface
using CellFeatureCount = CellFeatureIdentifier;

/** Types needed to contour the cells */
using ParametricCoordArrayType = Array<CoordRepType>;
using ParametricCoordArrayType = Array<CoordinateType>;
using ShapeFunctionsArrayType = Array<InterpolationWeightType>;

// static int GetNextUserCellId(); // never return > MAX_INTERFACE
Expand Down Expand Up @@ -314,7 +314,7 @@ class ITK_TEMPLATE_EXPORT CellInterface
* topological dimension CellDimension-1. If the "inside" pointer is not
* nullptr, the flag is set to indicate whether the point is inside the cell. */
virtual bool
GetClosestBoundary(CoordRepType[], bool *, CellAutoPointer &)
GetClosestBoundary(CoordinateType[], bool *, CellAutoPointer &)
{
return false;
}
Expand All @@ -336,10 +336,10 @@ class ITK_TEMPLATE_EXPORT CellInterface
* - Get the interpolation weights for the cell
* (Returns through pointer to array: weights[NumberOfPoints]). */
virtual bool
EvaluatePosition(CoordRepType *,
EvaluatePosition(CoordinateType *,
PointsContainer *,
CoordRepType *,
CoordRepType[],
CoordinateType *,
CoordinateType[],
double *,
InterpolationWeightType *)
{
Expand Down Expand Up @@ -369,12 +369,12 @@ class ITK_TEMPLATE_EXPORT CellInterface
*
* Returns whether an intersection exists within the given tolerance. */
virtual bool
IntersectWithLine(CoordRepType[PointDimension],
CoordRepType[PointDimension],
CoordRepType,
CoordRepType[PointDimension],
CoordRepType *,
CoordRepType[])
IntersectWithLine(CoordinateType[PointDimension],
CoordinateType[PointDimension],
CoordinateType,
CoordinateType[PointDimension],
CoordinateType *,
CoordinateType[])
{
return bool();
}
Expand All @@ -383,13 +383,13 @@ class ITK_TEMPLATE_EXPORT CellInterface
* Array is ordered (xmin, xmax, ymin, ymax, ....). A pointer to the
* array is returned for convenience. This allows code like:
* "CoordRep* bounds = cell->GetBoundingBox(new CoordRep[6]);". */
CoordRepType * GetBoundingBox(CoordRepType[PointDimension * 2]) { return nullptr; }
CoordinateType * GetBoundingBox(CoordinateType[PointDimension * 2]) { return nullptr; }

/** Compute the square of the diagonal length of the bounding box. */
CoordRepType
CoordinateType
GetBoundingBoxDiagonalLength2()
{
return CoordRepType{};
return CoordinateType{};
}

/** Intersect the given bounding box (bounds[PointDimension*2]) with a line
Expand All @@ -404,11 +404,11 @@ class ITK_TEMPLATE_EXPORT CellInterface
* (returned through "t" pointer).
*
* Returns whether an intersection exists. */
virtual bool IntersectBoundingBoxWithLine(CoordRepType[PointDimension * 2],
CoordRepType[PointDimension],
CoordRepType[PointDimension],
CoordRepType[PointDimension],
CoordRepType *)
virtual bool IntersectBoundingBoxWithLine(CoordinateType[PointDimension * 2],
CoordinateType[PointDimension],
CoordinateType[PointDimension],
CoordinateType[PointDimension],
CoordinateType *)
{
return bool();
}
Expand Down Expand Up @@ -542,7 +542,7 @@ class ITK_TEMPLATE_EXPORT CellTraitsInfo

#define itkMakeCellTraitsMacro \
CellTraitsInfo<Self::PointDimension, \
CoordRepType, \
CoordinateType, \
InterpolationWeightType, \
PointIdentifier, \
CellIdentifier, \
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkDefaultDynamicMeshTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ class DefaultDynamicMeshTraits
using CellFeatureIdentifier = IdentifierType;

/** The type of point used by the mesh. */
using PointType = Point<CoordRepType, VPointDimension>;
using PointType = Point<CoordinateType, VPointDimension>;

/** The type of point used for hashing. This should never change from
* this setting, regardless of the mesh type. */
using PointHashType = Point<CoordRepType, VPointDimension>;
using PointHashType = Point<CoordinateType, VPointDimension>;

/** The container type for use in storing points. It must conform to
* the IndexedContainerInterface. */
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/include/itkDefaultStaticMeshTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ class ITK_TEMPLATE_EXPORT DefaultStaticMeshTraits
using CellFeatureIdentifier = IdentifierType;

/** The type of point used by the mesh. */
using PointType = Point<CoordRepType, VPointDimension>;
using PointType = Point<CoordinateType, VPointDimension>;

/** The type of point used for hashing. This should never change from
* this setting, regardless of the mesh type. */
using PointHashType = Point<CoordRepType, VPointDimension>;
using PointHashType = Point<CoordinateType, VPointDimension>;

/** The container type for use in storing points. It must conform to
* the IndexedContainer interface. */
Expand Down
16 changes: 8 additions & 8 deletions Modules/Core/Common/include/itkHexahedronCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ class ITK_TEMPLATE_EXPORT HexahedronCell

/** Evaluate the position inside the cell */
bool
EvaluatePosition(CoordRepType *,
EvaluatePosition(CoordinateType *,
PointsContainer *,
CoordRepType *,
CoordRepType[],
CoordinateType *,
CoordinateType[],
double *,
InterpolationWeightType *) override;

Expand All @@ -157,15 +157,15 @@ class ITK_TEMPLATE_EXPORT HexahedronCell
NumericTraits<PointIdentifier>::max()) };

void
InterpolationDerivs(CoordRepType pcoords[Self::CellDimension],
CoordRepType derivs[Self::CellDimension * Self::NumberOfPoints]);
InterpolationDerivs(CoordinateType pcoords[Self::CellDimension],
CoordinateType derivs[Self::CellDimension * Self::NumberOfPoints]);
void
InterpolationFunctions(CoordRepType pcoords[Self::CellDimension], InterpolationWeightType sf[Self::NumberOfPoints]);
InterpolationFunctions(CoordinateType pcoords[Self::CellDimension], InterpolationWeightType sf[Self::NumberOfPoints]);
void
EvaluateLocation(int & itkNotUsed(subId),
PointsContainer * points,
CoordRepType pcoords[Self::CellDimension],
CoordRepType x[Self::CellDimension],
CoordinateType pcoords[Self::CellDimension],
CoordinateType x[Self::CellDimension],
InterpolationWeightType * weights);

public:
Expand Down
42 changes: 21 additions & 21 deletions Modules/Core/Common/include/itkHexahedronCell.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ HexahedronCell<TCellInterface>::GetFace(CellFeatureIdentifier faceId, FaceAutoPo
/** Evaluate the position inside the cell */
template <typename TCellInterface>
bool
HexahedronCell<TCellInterface>::EvaluatePosition(CoordRepType * x,
HexahedronCell<TCellInterface>::EvaluatePosition(CoordinateType * x,
PointsContainer * points,
CoordRepType * closestPoint,
CoordRepType pcoord[],
CoordinateType * closestPoint,
CoordinateType pcoord[],
double * dist2,
InterpolationWeightType * weight)
{
Expand All @@ -346,12 +346,12 @@ HexahedronCell<TCellInterface>::EvaluatePosition(CoordRepType * x,
double tcol[Self::PointDimension3D];
double d;
PointType pt;
CoordRepType derivs[CellDimension3D * Self::NumberOfPoints]{ 0 };
CoordinateType derivs[CellDimension3D * Self::NumberOfPoints]{ 0 };
InterpolationWeightType weights[Self::NumberOfPoints];

// set initial position for Newton's method
int subId{ 0 };
CoordRepType pcoords[CellDimension3D]{ 0.5, 0.5, 0.5 };
int subId{ 0 };
CoordinateType pcoords[CellDimension3D]{ 0.5, 0.5, 0.5 };

// NOTE: Avoid compiler warning. The code below only runs if PointType::Dimension == Self::PointDimension3D
constexpr unsigned int PREVENT_OVERRUN_OF_INVALID_INSTANTIATIONS =
Expand Down Expand Up @@ -392,7 +392,7 @@ HexahedronCell<TCellInterface>::EvaluatePosition(CoordRepType * x,
static_assert(Self::PointDimension3D == HARD_CODED_POINT_DIM,
"ERROR: Self::PointDimension3D does not equal HARD_CODED_POINT_DIM (i.e. 3).");
// compute determinants and generate improvements
vnl_matrix_fixed<CoordRepType, HARD_CODED_POINT_DIM, CellDimension3D> mat;
vnl_matrix_fixed<CoordinateType, HARD_CODED_POINT_DIM, CellDimension3D> mat;
for (unsigned int i = 0; i < Self::PointDimension3D; ++i)
{
mat.put(0, i, rcol[i]);
Expand All @@ -408,23 +408,23 @@ HexahedronCell<TCellInterface>::EvaluatePosition(CoordRepType * x,
return false;
}

vnl_matrix_fixed<CoordRepType, HARD_CODED_POINT_DIM, CellDimension3D> mat1;
vnl_matrix_fixed<CoordinateType, HARD_CODED_POINT_DIM, CellDimension3D> mat1;
for (unsigned int i = 0; i < Self::PointDimension3D; ++i)
{
mat1.put(0, i, fcol[i]);
mat1.put(1, i, scol[i]);
mat1.put(2, i, tcol[i]);
}

vnl_matrix_fixed<CoordRepType, HARD_CODED_POINT_DIM, CellDimension3D> mat2;
vnl_matrix_fixed<CoordinateType, HARD_CODED_POINT_DIM, CellDimension3D> mat2;
for (unsigned int i = 0; i < Self::PointDimension3D; ++i)
{
mat2.put(0, i, rcol[i]);
mat2.put(1, i, fcol[i]);
mat2.put(2, i, tcol[i]);
}

vnl_matrix_fixed<CoordRepType, HARD_CODED_POINT_DIM, CellDimension3D> mat3;
vnl_matrix_fixed<CoordinateType, HARD_CODED_POINT_DIM, CellDimension3D> mat3;
for (unsigned int i = 0; i < Self::PointDimension3D; ++i)
{
mat3.put(0, i, rcol[i]);
Expand Down Expand Up @@ -501,8 +501,8 @@ HexahedronCell<TCellInterface>::EvaluatePosition(CoordRepType * x,
}
else
{
CoordRepType pc[CellDimension3D];
CoordRepType w[Self::NumberOfPoints];
CoordinateType pc[CellDimension3D];
CoordinateType w[Self::NumberOfPoints];
if (closestPoint)
{
for (unsigned int i = 0; i < CellDimension3D; ++i) // only approximate, not really true
Expand Down Expand Up @@ -536,7 +536,7 @@ HexahedronCell<TCellInterface>::EvaluatePosition(CoordRepType * x,
/** Compute iso-parametric interpolation functions */
template <typename TCellInterface>
void
HexahedronCell<TCellInterface>::InterpolationFunctions(CoordRepType pcoords[Self::CellDimension],
HexahedronCell<TCellInterface>::InterpolationFunctions(CoordinateType pcoords[Self::CellDimension],
InterpolationWeightType sf[Self::NumberOfPoints])
{
// Throw an exception if trying to EvaluatePosition for anything other than
Expand All @@ -548,7 +548,7 @@ HexahedronCell<TCellInterface>::InterpolationFunctions(CoordRepType p
}
else
{
CoordRepType pcoords3D[Self::CellDimension3D]{ 0 };
CoordinateType pcoords3D[Self::CellDimension3D]{ 0 };
// NOTE: Avoid compiler warning. The code below only runs if PointType::Dimension == Self::PointDimension3D
constexpr unsigned int PREVENT_OVERRUN_OF_INVALID_INSTANTIATIONS =
hexahedron_constexpr_min(PointType::Dimension, Self::PointDimension3D);
Expand Down Expand Up @@ -580,8 +580,8 @@ HexahedronCell<TCellInterface>::InterpolationFunctions(CoordRepType p
/** Compute iso-parametric interpolation functions */
template <typename TCellInterface>
void
HexahedronCell<TCellInterface>::InterpolationDerivs(CoordRepType pcoords[Self::CellDimension],
CoordRepType derivs[Self::CellDimension * Self::NumberOfPoints])
HexahedronCell<TCellInterface>::InterpolationDerivs(CoordinateType pcoords[Self::CellDimension],
CoordinateType derivs[Self::CellDimension * Self::NumberOfPoints])
{
// Throw an exception if trying to EvaluatePosition for anything other than
// a 3D point or cell dimension. This implementation is hard-coded to 3D.
Expand All @@ -593,8 +593,8 @@ HexahedronCell<TCellInterface>::InterpolationDerivs(CoordRepType pcoords[Self::C
else
{

CoordRepType pcoords3D[Self::CellDimension3D]{ 0 };
CoordRepType derivs3D[Self::CellDimension3D * Self::NumberOfPoints]{ 0 };
CoordinateType pcoords3D[Self::CellDimension3D]{ 0 };
CoordinateType derivs3D[Self::CellDimension3D * Self::NumberOfPoints]{ 0 };
// NOTE: Avoid compiler warning. The code below only runs if PointType::Dimension == Self::PointDimension3D
constexpr unsigned int PREVENT_OVERRUN_OF_INVALID_INSTANTIATIONS =
hexahedron_constexpr_min(PointType::Dimension, Self::PointDimension3D);
Expand Down Expand Up @@ -658,8 +658,8 @@ template <typename TCellInterface>
void
HexahedronCell<TCellInterface>::EvaluateLocation(int & itkNotUsed(subId),
PointsContainer * points,
CoordRepType pcoords[Self::CellDimension],
CoordRepType x[Self::CellDimension],
CoordinateType pcoords[Self::CellDimension],
CoordinateType x[Self::CellDimension],
InterpolationWeightType * weights)
{
// Throw an exception if trying to EvaluatePosition for anything other than
Expand All @@ -684,7 +684,7 @@ HexahedronCell<TCellInterface>::EvaluateLocation(int & itkNo

for (unsigned int j = 0; j < PREVENT_OVERRUN_OF_INVALID_INSTANTIATIONS; ++j)
{
const CoordRepType t = pt[j] * weights[i];
const CoordinateType t = pt[j] * weights[i];
x[j] += t;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Modules/Core/Common/include/itkPointSetBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ class ITK_TEMPLATE_EXPORT PointSetBase : public DataObject

/** Convenient type alias obtained from TPointsContainer template parameter. */
using PointType = typename TPointsContainer::Element;
using CoordinateType = typename PointType::CoordRepType;
using CoordinateType = typename PointType::CoordinateType;
using CoordRepType = CoordinateType;
using PointIdentifier = typename TPointsContainer::ElementIdentifier;
using PointsContainer = TPointsContainer;

/** For improving Python support for PointSetBase and Meshes **/
using PointsVectorContainer = typename itk::VectorContainer<PointIdentifier, CoordRepType>;
using PointsVectorContainer = typename itk::VectorContainer<PointIdentifier, CoordinateType>;
using PointsVectorContainerPointer = typename PointsVectorContainer::Pointer;

/** Convenient constant, indirectly obtained from TPointsContainer template parameter. */
Expand Down Expand Up @@ -131,7 +131,7 @@ class ITK_TEMPLATE_EXPORT PointSetBase : public DataObject

/** Sets the points by specifying its coordinates. */
void
SetPointsByCoordinates(const std::vector<CoordRepType> & coordinates);
SetPointsByCoordinates(const std::vector<CoordinateType> & coordinates);

/** Get the points container. */
PointsContainer *
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkPointSetBase.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ PointSetBase<TPointsContainer>::SetPoints(PointsVectorContainer * points)

template <typename TPointsContainer>
void
PointSetBase<TPointsContainer>::SetPointsByCoordinates(const std::vector<CoordRepType> & coordinates)
PointSetBase<TPointsContainer>::SetPointsByCoordinates(const std::vector<CoordinateType> & coordinates)
{
itkDebugMacro("Setting the points to the specified coordinates");

Expand Down
Loading

0 comments on commit 15d189f

Please sign in to comment.