Skip to content

Commit

Permalink
STYLE: Replace ...CoordRepType with ...CoordinateType within ITK
Browse files Browse the repository at this point in the history
Follow-up to pull request InsightSoftwareConsortium#4997
commit 15d189f
"STYLE: Replace CoordRepType with CoordinateType in ITK implementation"
  • Loading branch information
N-Dekker authored and hjmjohnson committed Dec 4, 2024
1 parent 0522246 commit a0555df
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ class ITK_TEMPLATE_EXPORT BorderQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEd
itkSetEnumMacro(BorderPick, BorderPickEnum);
itkGetConstMacro(BorderPick, BorderPickEnum);

itkSetMacro(Radius, InputCoordRepType);
itkGetConstMacro(Radius, InputCoordRepType);
itkSetMacro(Radius, InputCoordinateType);
itkGetConstMacro(Radius, InputCoordinateType);

void
ComputeTransform();
Expand All @@ -178,7 +178,7 @@ class ITK_TEMPLATE_EXPORT BorderQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEd
BorderTransformEnum m_TransformType{};
BorderPickEnum m_BorderPick{};

InputCoordRepType m_Radius{};
InputCoordinateType m_Radius{};

InputVectorPointType m_Border{};

Expand All @@ -202,7 +202,7 @@ class ITK_TEMPLATE_EXPORT BorderQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEd
InputPointType
GetMeshBarycentre();

InputCoordRepType
InputCoordinateType
RadiusMaxSquare();

void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::ComputeLongestBorder() -> Inp
itkGenericExceptionMacro("This filter requires at least one boundary");
}

InputCoordRepType max_length(0.0);
InputCoordRepType length(0.0);
auto oborder_it = list->begin();
InputCoordinateType max_length(0.0);
InputCoordinateType length(0.0);
auto oborder_it = list->begin();

for (auto b_it = list->begin(); b_it != list->end(); ++b_it)
{
Expand Down Expand Up @@ -194,21 +194,21 @@ BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::DiskTransform()

auto NbBoundaryPt = static_cast<InputPointIdentifier>(this->m_BoundaryPtMap.size());

InputCoordRepType r = this->RadiusMaxSquare();
InputCoordinateType r = this->RadiusMaxSquare();

InputCoordRepType two_r = 2.0 * r;
InputCoordRepType inv_two_r = 1.0 / two_r;
InputCoordinateType two_r = 2.0 * r;
InputCoordinateType inv_two_r = 1.0 / two_r;

InputPointIdentifier id = this->m_BoundaryPtMap.begin()->first;
InputPointType pt1 = input->GetPoint(id);

id = (--m_BoundaryPtMap.end())->first;
InputPointType pt2 = input->GetPoint(id);

InputCoordRepType dist = pt1.SquaredEuclideanDistanceTo(pt2);
InputCoordinateType dist = pt1.SquaredEuclideanDistanceTo(pt2);

std::vector<InputCoordRepType> tetas(NbBoundaryPt, 0.0);
tetas[0] = static_cast<InputCoordRepType>(std::acos((two_r - dist) * inv_two_r));
std::vector<InputCoordinateType> tetas(NbBoundaryPt, 0.0);
tetas[0] = static_cast<InputCoordinateType>(std::acos((two_r - dist) * inv_two_r));

auto BoundaryPtIterator = this->m_BoundaryPtMap.begin();

Expand All @@ -231,7 +231,7 @@ BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::DiskTransform()
++BoundaryPtIterator;
}

InputCoordRepType a = (2.0 * itk::Math::pi) / tetas[NbBoundaryPt - 1];
InputCoordinateType a = (2.0 * itk::Math::pi) / tetas[NbBoundaryPt - 1];

if (this->m_Radius == 0.0)
{
Expand All @@ -244,8 +244,8 @@ BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::DiskTransform()
id = BoundaryPtMapIterator->first;
j = BoundaryPtMapIterator->second;

pt1[0] = this->m_Radius * static_cast<InputCoordRepType>(std::cos(a * tetas[j]));
pt1[1] = this->m_Radius * static_cast<InputCoordRepType>(std::sin(a * tetas[j]));
pt1[0] = this->m_Radius * static_cast<InputCoordinateType>(std::cos(a * tetas[j]));
pt1[1] = this->m_Radius * static_cast<InputCoordinateType>(std::sin(a * tetas[j]));
pt1[2] = 0.0;

this->m_Border[j] = pt1;
Expand All @@ -255,19 +255,19 @@ BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::DiskTransform()
// ----------------------------------------------------------------------------
template <typename TInputMesh, typename TOutputMesh>
auto
BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::RadiusMaxSquare() -> InputCoordRepType
BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::RadiusMaxSquare() -> InputCoordinateType
{
InputMeshConstPointer input = this->GetInput();

InputPointType center = this->GetMeshBarycentre();

InputCoordRepType oRmax(0.);
InputCoordRepType r;
InputCoordinateType oRmax(0.);
InputCoordinateType r;

for (auto BoundaryPtIterator = this->m_BoundaryPtMap.begin(); BoundaryPtIterator != this->m_BoundaryPtMap.end();
++BoundaryPtIterator)
{
r = static_cast<InputCoordRepType>(center.SquaredEuclideanDistanceTo(input->GetPoint(BoundaryPtIterator->first)));
r = static_cast<InputCoordinateType>(center.SquaredEuclideanDistanceTo(input->GetPoint(BoundaryPtIterator->first)));

if (r > oRmax)
{
Expand Down Expand Up @@ -306,7 +306,7 @@ BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::GetMeshBarycentre() -> InputP
++PointIterator;
}

InputCoordRepType invNbOfPoints = 1.0 / static_cast<InputCoordRepType>(input->GetNumberOfPoints());
InputCoordinateType invNbOfPoints = 1.0 / static_cast<InputCoordinateType>(input->GetNumberOfPoints());

for (i = 0; i < PointDimension; ++i)
{
Expand Down Expand Up @@ -355,10 +355,10 @@ BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::ArcLengthSquareTransform()

auto NbBoundaryPt = static_cast<InputPointIdentifier>(this->m_BoundaryPtMap.size());

std::vector<InputCoordRepType> Length(NbBoundaryPt + 1, 0.0);
std::vector<InputCoordinateType> Length(NbBoundaryPt + 1, 0.0);

InputCoordRepType TotalLength(0.0);
InputCoordRepType distance;
InputCoordinateType TotalLength(0.0);
InputCoordinateType distance;

InputPointIdentifier i(0);
InputPointIdentifier org(0);
Expand All @@ -384,8 +384,8 @@ BorderQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::ArcLengthSquareTransform()
this->m_Radius = 1000.;
}

InputCoordRepType EdgeLength = 2.0 * this->m_Radius;
InputCoordRepType ratio = 4.0 * EdgeLength / TotalLength;
InputCoordinateType EdgeLength = 2.0 * this->m_Radius;
InputCoordinateType ratio = 4.0 * EdgeLength / TotalLength;

for (i = 0; i < NbBoundaryPt + 1; ++i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ITK_TEMPLATE_EXPORT CleanQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdg

using InputMeshType = TInputMesh;
using typename Superclass::InputMeshPointer;
using typename Superclass::InputCoordRepType;
using typename Superclass::InputCoordinateType;
using typename Superclass::InputPointType;
using typename Superclass::InputPointIdentifier;
using typename Superclass::InputQEPrimal;
Expand All @@ -74,7 +74,7 @@ class ITK_TEMPLATE_EXPORT CleanQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdg

using OutputMeshType = TOutputMesh;
using typename Superclass::OutputMeshPointer;
using typename Superclass::OutputCoordRepType;
using typename Superclass::OutputCoordinateType;
using typename Superclass::OutputPointType;
using typename Superclass::OutputPointIdentifier;
using typename Superclass::OutputQEPrimal;
Expand All @@ -88,7 +88,7 @@ class ITK_TEMPLATE_EXPORT CleanQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdg
using OutputCellsContainerIterator = typename OutputMeshType::CellsContainerIterator;

using BoundingBoxType =
BoundingBox<InputPointIdentifier, Self::PointDimension, InputCoordRepType, InputPointsContainer>;
BoundingBox<InputPointIdentifier, Self::PointDimension, InputCoordinateType, InputPointsContainer>;

using BoundingBoxPointer = typename BoundingBoxType::Pointer;

Expand All @@ -99,12 +99,12 @@ class ITK_TEMPLATE_EXPORT CleanQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdg
using DecimationPointer = typename DecimationType::Pointer;

/** TODO */
itkSetMacro(AbsoluteTolerance, InputCoordRepType);
itkGetConstMacro(AbsoluteTolerance, InputCoordRepType);
itkSetMacro(AbsoluteTolerance, InputCoordinateType);
itkGetConstMacro(AbsoluteTolerance, InputCoordinateType);

/** TODO */
itkSetClampMacro(RelativeTolerance, InputCoordRepType, 0.0, 1.0);
itkGetConstMacro(RelativeTolerance, InputCoordRepType);
itkSetClampMacro(RelativeTolerance, InputCoordinateType, 0.0, 1.0);
itkGetConstMacro(RelativeTolerance, InputCoordinateType);

protected:
CleanQuadEdgeMeshFilter();
Expand All @@ -115,7 +115,7 @@ class ITK_TEMPLATE_EXPORT CleanQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdg
GenerateData() override;

virtual void
MergePoints(const InputCoordRepType absoluteToleranceSquared);
MergePoints(const InputCoordinateType absoluteToleranceSquared);

virtual void
CleanPoints();
Expand All @@ -124,8 +124,8 @@ class ITK_TEMPLATE_EXPORT CleanQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdg
PrintSelf(std::ostream & os, Indent indent) const override;

private:
InputCoordRepType m_AbsoluteTolerance{};
InputCoordRepType m_RelativeTolerance{};
InputCoordinateType m_AbsoluteTolerance{};
InputCoordinateType m_RelativeTolerance{};

BoundingBoxPointer m_BoundingBox{};
CriterionPointer m_Criterion{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ namespace itk
template <typename TInputMesh, typename TOutputMesh>
CleanQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::CleanQuadEdgeMeshFilter()
{
this->m_AbsoluteTolerance = InputCoordRepType{};
this->m_RelativeTolerance = InputCoordRepType{};
this->m_AbsoluteTolerance = InputCoordinateType{};
this->m_RelativeTolerance = InputCoordinateType{};

this->m_BoundingBox = BoundingBoxType::New();

Expand All @@ -43,9 +43,9 @@ template <typename TInputMesh, typename TOutputMesh>
void
CleanQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::GenerateData()
{
InputCoordRepType zeroValue{};
InputCoordinateType zeroValue{};

InputCoordRepType absoluteToleranceSquared = this->m_AbsoluteTolerance * this->m_AbsoluteTolerance;
InputCoordinateType absoluteToleranceSquared = this->m_AbsoluteTolerance * this->m_AbsoluteTolerance;
if ((Math::ExactlyEquals(this->m_AbsoluteTolerance, zeroValue)) &&
(Math::NotExactlyEquals(this->m_RelativeTolerance, zeroValue)))
{
Expand All @@ -63,7 +63,7 @@ CleanQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::GenerateData()

template <typename TInputMesh, typename TOutputMesh>
void
CleanQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::MergePoints(const InputCoordRepType absoluteToleranceSquared)
CleanQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::MergePoints(const InputCoordinateType absoluteToleranceSquared)
{
OutputMeshPointer output = this->GetOutput();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ class ITK_TEMPLATE_EXPORT DelaunayConformingQuadEdgeMeshFilter
OutputVectorType v2A = ptA - pt2;
OutputVectorType v2B = ptB - pt2;

OutputCoordRepType sq_norm1A = v1A * v1A;
OutputCoordRepType sq_norm1B = v1B * v1B;
OutputCoordRepType sq_norm2A = v2A * v2A;
OutputCoordRepType sq_norm2B = v2B * v2B;
OutputCoordinateType sq_norm1A = v1A * v1A;
OutputCoordinateType sq_norm1B = v1B * v1B;
OutputCoordinateType sq_norm2A = v2A * v2A;
OutputCoordinateType sq_norm2B = v2B * v2B;

auto dotA = static_cast<CriterionValueType>(v1A * v2A);
auto dotB = static_cast<CriterionValueType>(v1B * v2B);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilter

/** Output types. */
using OutputMeshType = TOutputMesh;
using typename Superclass::OutputCoordRepType;
using typename Superclass::OutputCoordinateType;
using typename Superclass::OutputPointType;
using typename Superclass::OutputPointIdentifier;
using typename Superclass::OutputQEPrimal;
Expand Down Expand Up @@ -219,13 +219,13 @@ class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilter
}
};

using CoefficientMapType = std::unordered_map<OutputQEPrimal *, OutputCoordRepType, HashOutputQEPrimal>;
using CoefficientMapType = std::unordered_map<OutputQEPrimal *, OutputCoordinateType, HashOutputQEPrimal>;
using CoefficientMapConstIterator = typename CoefficientMapType::const_iterator;

using AreaMapType = std::unordered_map<OutputPointIdentifier, OutputCoordRepType>;
using AreaMapType = std::unordered_map<OutputPointIdentifier, OutputCoordinateType>;
using AreaMapConstIterator = typename AreaMapType::const_iterator;

using RowType = std::unordered_map<OutputPointIdentifier, OutputCoordRepType>;
using RowType = std::unordered_map<OutputPointIdentifier, OutputCoordinateType>;
using RowIterator = typename RowType::iterator;
using RowConstIterator = typename RowType::const_iterator;

Expand All @@ -242,9 +242,9 @@ class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilter
void
PrintSelf(std::ostream & os, Indent indent) const override;

OutputCoordRepType
OutputCoordinateType
ComputeMixedAreaForGivenVertex(OutputPointIdentifier iId);
OutputCoordRepType
OutputCoordinateType
ComputeMixedArea(OutputQEPrimal * iQE1, OutputQEPrimal * iQE2);

virtual void
Expand All @@ -254,7 +254,7 @@ class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilter
ComputeLaplacianMatrix(MatrixType & ioL);

void
FillMatrixRow(OutputPointIdentifier iId, unsigned int iDegree, OutputCoordRepType iWeight, RowType & ioRow);
FillMatrixRow(OutputPointIdentifier iId, unsigned int iDegree, OutputCoordinateType iWeight, RowType & ioRow);

/**
* \brief Fill matrix iM and vectors Bx, m_By and m_Bz depending on if one
Expand Down Expand Up @@ -289,14 +289,14 @@ class ITK_TEMPLATE_EXPORT LaplacianDeformationQuadEdgeMeshFilter
struct Triple
{
Triple() = default;
Triple(OutputPointIdentifier iV, OutputCoordRepType iWeight, unsigned int iDegree)
Triple(OutputPointIdentifier iV, OutputCoordinateType iWeight, unsigned int iDegree)
: m_Id(iV)
, m_Weight(iWeight)
, m_Degree(iDegree)
{}

OutputPointIdentifier m_Id;
OutputCoordRepType m_Weight;
OutputCoordinateType m_Weight;
unsigned int m_Degree;
};
};
Expand Down
Loading

0 comments on commit a0555df

Please sign in to comment.