Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "Type" from TCoordinateType template parameters, remove initial "T" from TCoordinateType alias #5016

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Modules/Core/Common/include/itkImageRegion.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ class ITK_TEMPLATE_EXPORT ImageRegion final
* We take into account the fact that each voxel has its
* center at the integer coordinate and extends half way
* to the next integer coordinate, inclusive on all sides. */
template <typename TCoordinateType>
template <typename TCoordinate>
bool
IsInside(const ContinuousIndex<TCoordinateType, VImageDimension> & index) const
IsInside(const ContinuousIndex<TCoordinate, VImageDimension> & index) const
{
constexpr TCoordinateType half = 0.5;
constexpr TCoordinate half = 0.5;
for (unsigned int i = 0; i < ImageDimension; ++i)
{
// Use negation of tests so that index[i]==NaN leads to returning false.
Expand Down
24 changes: 12 additions & 12 deletions Modules/Core/Common/test/itkImageRegionTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ itkImageRegionTest(int, char *[])

constexpr unsigned int dimension = 3;

using TCoordinateType = double;
using CoordinateType = double;
using RegionType = itk::ImageRegion<dimension>;
using IndexType = RegionType::IndexType;
using SizeType = RegionType::SizeType;
using SliceRegionType = RegionType::SliceRegion;
using ContinuousIndexType = itk::ContinuousIndex<TCoordinateType, dimension>;
using ContinuousIndexType = itk::ContinuousIndex<CoordinateType, dimension>;

using IndexNumericTraits = itk::NumericTraits<IndexType::IndexValueType>;
using ContinuousIndexNumericTraits = itk::NumericTraits<ContinuousIndexType::ValueType>;
Expand Down Expand Up @@ -273,21 +273,21 @@ itkImageRegionTest(int, char *[])
std::cout << "NaN < -1 = " << (indexC[0] < -1.0) << std::endl;
std::cout << "NaN > -1 = " << (indexC[0] > -1.0) << std::endl;

TCoordinateType NaN = ContinuousIndexNumericTraits::quiet_NaN();
std::cout << "RoundHalfIntegerUp(NaN): " << itk::Math::RoundHalfIntegerUp<TCoordinateType>(NaN) << std::endl;
std::cout << "RoundHalfIntegerUp< TCoordinateType >(NaN) < static_cast<TCoordinateType> (0): "
<< (itk::Math::RoundHalfIntegerUp<TCoordinateType>(NaN) < static_cast<TCoordinateType>(0)) << std::endl;
std::cout << "RoundHalfIntegerUp< TCoordinateType >(NaN) > static_cast<TCoordinateType> (0): "
<< (itk::Math::RoundHalfIntegerUp<TCoordinateType>(NaN) > static_cast<TCoordinateType>(0)) << std::endl;
auto rf = itk::Math::RoundHalfIntegerUp<TCoordinateType>(NaN);
std::cout << "TCoordinateType = RoundHalfIntegerUp(NaN): " << rf << std::endl;
auto rl = itk::Math::RoundHalfIntegerUp<RegionType::IndexValueType, TCoordinateType>(NaN);
CoordinateType NaN = ContinuousIndexNumericTraits::quiet_NaN();
std::cout << "RoundHalfIntegerUp(NaN): " << itk::Math::RoundHalfIntegerUp<CoordinateType>(NaN) << std::endl;
std::cout << "RoundHalfIntegerUp< CoordinateType >(NaN) < static_cast<CoordinateType> (0): "
<< (itk::Math::RoundHalfIntegerUp<CoordinateType>(NaN) < static_cast<CoordinateType>(0)) << std::endl;
std::cout << "RoundHalfIntegerUp< CoordinateType >(NaN) > static_cast<CoordinateType> (0): "
<< (itk::Math::RoundHalfIntegerUp<CoordinateType>(NaN) > static_cast<CoordinateType>(0)) << std::endl;
auto rf = itk::Math::RoundHalfIntegerUp<CoordinateType>(NaN);
std::cout << "CoordinateType = RoundHalfIntegerUp(NaN): " << rf << std::endl;
auto rl = itk::Math::RoundHalfIntegerUp<RegionType::IndexValueType, CoordinateType>(NaN);
std::cout << "RegionType::IndexValueType type = RoundHalfIntegerUp(NaN): " << rl << std::endl;
std::cout << "static_cast<RegionType::IndexValueType>( NaN ): " << static_cast<RegionType::IndexValueType>(NaN)
<< std::endl;
std::cout << "NumericTraits<RegionType::IndexValueType>::min(): "
<< itk::NumericTraits<RegionType::IndexValueType>::min() << std::endl;
std::cout << "TCoordinateType min(): " << ContinuousIndexNumericTraits::min() << std::endl;
std::cout << "CoordinateType min(): " << ContinuousIndexNumericTraits::min() << std::endl;
std::cout << "...end NaN tests." << std::endl << std::endl;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace itk
* Limitations: The coordinates must be in an image of the same dimension as the
* input image. There is no reason why this should be the case and future
* revisions should look at eliminating this limitation.
* Currently TCoordType must be the same as the input pixel type (TInputImage).
* Currently TCoordinate must be the same as the input pixel type (TInputImage).
* Again future revisions should look at eliminating this limitation.
* Though the output generation may be streamed the entire input image,
* must be supplied. The coordinates may be streamed in smaller blocks.
Expand All @@ -75,8 +75,8 @@ namespace itk

template <typename TInputImage,
typename TOutputImage,
typename TCoordType = typename TInputImage::PixelType,
typename InterpolatorType = BSplineInterpolateImageFunction<TInputImage, TCoordType>>
typename TCoordinate = typename TInputImage::PixelType,
typename InterpolatorType = BSplineInterpolateImageFunction<TInputImage, TCoordinate>>
class ITK_TEMPLATE_EXPORT InterpolateImagePointsFilter : public ImageToImageFilter<TInputImage, TOutputImage>
{
public:
Expand Down Expand Up @@ -115,7 +115,7 @@ class ITK_TEMPLATE_EXPORT InterpolateImagePointsFilter : public ImageToImageFilt
using ContinuousIndexType = typename InterpolatorType::ContinuousIndexType;

/** Typedefs to describe and access coordinate images */
using CoordImageType = Image<TCoordType, Self::ImageDimension>;
using CoordImageType = Image<TCoordinate, Self::ImageDimension>;

/** Typedef for region copier */
using RegionCopierType = ImageToImageFilterDetail::ImageRegionCopier<Self::ImageDimension, Self::ImageDimension>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
namespace itk
{

template <typename TInputImage, typename TOutputImage, typename TCoordType, typename InterpolatorType>
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, InterpolatorType>::InterpolateImagePointsFilter()
template <typename TInputImage, typename TOutputImage, typename TCoordinate, typename InterpolatorType>
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordinate, InterpolatorType>::InterpolateImagePointsFilter()
{
m_Interpolator = InterpolatorType::New();
m_DefaultPixelValue = 0;
Expand All @@ -44,9 +44,9 @@ InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, Interpolator
this->ThreaderUpdateProgressOff();
}

template <typename TInputImage, typename TOutputImage, typename TCoordType, typename InterpolatorType>
template <typename TInputImage, typename TOutputImage, typename TCoordinate, typename InterpolatorType>
void
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, InterpolatorType>::SetInputImage(
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordinate, InterpolatorType>::SetInputImage(
const TInputImage * inputImage)
{
this->SetInput(0, inputImage); // This is a data filter input
Expand All @@ -55,19 +55,19 @@ InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, Interpolator
m_Interpolator->SetInputImage(inputImage);
}

template <typename TInputImage, typename TOutputImage, typename TCoordType, typename InterpolatorType>
template <typename TInputImage, typename TOutputImage, typename TCoordinate, typename InterpolatorType>
void
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, InterpolatorType>::SetInterpolationCoordinate(
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordinate, InterpolatorType>::SetInterpolationCoordinate(
const CoordImageType * coordinate,
unsigned int setDimension)
{
// Set each coordinate as an input. Note that Input '0' is for the image.
this->SetInput(setDimension + 1, coordinate); // This is a data filter input
}

template <typename TInputImage, typename TOutputImage, typename TCoordType, typename InterpolatorType>
template <typename TInputImage, typename TOutputImage, typename TCoordinate, typename InterpolatorType>
void
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, InterpolatorType>::DynamicThreadedGenerateData(
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordinate, InterpolatorType>::DynamicThreadedGenerateData(
const OutputImageRegionType & outputRegionForThread)
{
OutputImagePointer outputPtr = this->GetOutput();
Expand Down Expand Up @@ -120,9 +120,9 @@ InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, Interpolator
}
}

template <typename TInputImage, typename TOutputImage, typename TCoordType, typename InterpolatorType>
template <typename TInputImage, typename TOutputImage, typename TCoordinate, typename InterpolatorType>
void
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, InterpolatorType>::GenerateInputRequestedRegion()
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordinate, InterpolatorType>::GenerateInputRequestedRegion()
{
// Call the superclass' implementation of this method
Superclass::GenerateInputRequestedRegion();
Expand All @@ -139,9 +139,9 @@ InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, Interpolator
inputPtr->SetRequestedRegionToLargestPossibleRegion();
}

template <typename TInputImage, typename TOutputImage, typename TCoordType, typename InterpolatorType>
template <typename TInputImage, typename TOutputImage, typename TCoordinate, typename InterpolatorType>
void
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, InterpolatorType>::GenerateOutputInformation()
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordinate, InterpolatorType>::GenerateOutputInformation()
{
// Call the superclass' implementation of this method
Superclass::GenerateOutputInformation();
Expand Down Expand Up @@ -169,10 +169,10 @@ InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, Interpolator
outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion);
}

template <typename TInputImage, typename TOutputImage, typename TCoordType, typename InterpolatorType>
template <typename TInputImage, typename TOutputImage, typename TCoordinate, typename InterpolatorType>
void
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordType, InterpolatorType>::PrintSelf(std::ostream & os,
Indent indent) const
InterpolateImagePointsFilter<TInputImage, TOutputImage, TCoordinate, InterpolatorType>::PrintSelf(std::ostream & os,
Indent indent) const
{
Superclass::PrintSelf(os, indent);

Expand Down
10 changes: 5 additions & 5 deletions Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace itk
*
* Template parameters for VoronoiDiagram2D:
*
* TCoordType = The type associated with the coordination of the seeds and
* TCoordinate = The type associated with the coordination of the seeds and
* the resulting vertices.
*
* \ingroup MeshObjects
Expand All @@ -47,16 +47,16 @@ namespace itk
* \sphinxexample{Segmentation/Voronoi/VoronoiDiagram,Voronoi Diagram}
* \endsphinx
*/
template <typename TCoordType>
template <typename TCoordinate>
class ITK_TEMPLATE_EXPORT VoronoiDiagram2D
: public Mesh<TCoordType, 2, DefaultDynamicMeshTraits<TCoordType, 2, 2, TCoordType>>
: public Mesh<TCoordinate, 2, DefaultDynamicMeshTraits<TCoordinate, 2, 2, TCoordinate>>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(VoronoiDiagram2D);

/** Standard class type aliases. */
using Self = VoronoiDiagram2D;
using Superclass = Mesh<TCoordType, 2, DefaultDynamicMeshTraits<TCoordType, 2, 2, TCoordType>>;
using Superclass = Mesh<TCoordinate, 2, DefaultDynamicMeshTraits<TCoordinate, 2, 2, TCoordinate>>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

Expand All @@ -67,7 +67,7 @@ class ITK_TEMPLATE_EXPORT VoronoiDiagram2D
itkOverrideGetNameOfClassMacro(VoronoiDiagram2D);

/** Define the mesh traits. */
using MeshTraits = DefaultDynamicMeshTraits<TCoordType, 2, 2, TCoordType>;
using MeshTraits = DefaultDynamicMeshTraits<TCoordinate, 2, 2, TCoordinate>;

/** Dimensions of the points and topology. */
static constexpr unsigned int PointDimension = MeshTraits::PointDimension;
Expand Down
68 changes: 34 additions & 34 deletions Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2D.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@
namespace itk
{

template <typename TCoordinateType>
VoronoiDiagram2D<TCoordinateType>::VoronoiDiagram2D()
template <typename TCoordinate>
VoronoiDiagram2D<TCoordinate>::VoronoiDiagram2D()
{
m_NumberOfSeeds = 0;
}

template <typename TCoordinateType>
template <typename TCoordinate>
void
VoronoiDiagram2D<TCoordinateType>::PrintSelf(std::ostream & os, Indent indent) const
VoronoiDiagram2D<TCoordinate>::PrintSelf(std::ostream & os, Indent indent) const
{
Superclass::PrintSelf(os, indent);
os << indent << "Number Of Seeds: " << m_NumberOfSeeds << std::endl;
}


/* Set the seed points, specify the number of seeds as "num". */
template <typename TCoordinateType>
template <typename TCoordinate>
void
VoronoiDiagram2D<TCoordinateType>::SetSeeds(int num, SeedsIterator begin)
VoronoiDiagram2D<TCoordinate>::SetSeeds(int num, SeedsIterator begin)
{
m_Seeds.clear();
auto ii(begin);
Expand All @@ -54,43 +54,43 @@ VoronoiDiagram2D<TCoordinateType>::SetSeeds(int num, SeedsIterator begin)


/* Set the rectangle that encloses the Voronoi Diagram. */
template <typename TCoordinateType>
template <typename TCoordinate>
void
VoronoiDiagram2D<TCoordinateType>::SetBoundary(PointType vorsize)
VoronoiDiagram2D<TCoordinate>::SetBoundary(PointType vorsize)
{
m_VoronoiBoundary[0] = vorsize[0];
m_VoronoiBoundary[1] = vorsize[1];
}


template <typename TCoordinateType>
template <typename TCoordinate>
void
VoronoiDiagram2D<TCoordinateType>::SetOrigin(PointType vorsize)
VoronoiDiagram2D<TCoordinate>::SetOrigin(PointType vorsize)
{
m_VoronoiBoundaryOrigin[0] = vorsize[0];
m_VoronoiBoundaryOrigin[1] = vorsize[1];
}


template <typename TCoordinateType>
template <typename TCoordinate>
void
VoronoiDiagram2D<TCoordinateType>::GetPoint(int pId, PointType * answer)
VoronoiDiagram2D<TCoordinate>::GetPoint(int pId, PointType * answer)
{
*answer = this->m_PointsContainer->ElementAt(pId);
}


template <typename TCoordinateType>
template <typename TCoordinate>
void
VoronoiDiagram2D<TCoordinateType>::GetCellId(CellIdentifier cellId, CellAutoPointer & cellPtr)
VoronoiDiagram2D<TCoordinate>::GetCellId(CellIdentifier cellId, CellAutoPointer & cellPtr)
{
cellPtr.TakeNoOwnership(m_VoronoiRegions[cellId]);
}


template <typename TCoordinateType>
template <typename TCoordinate>
auto
VoronoiDiagram2D<TCoordinateType>::GetSeedsIDAroundEdge(VoronoiEdge * task) -> EdgeInfo
VoronoiDiagram2D<TCoordinate>::GetSeedsIDAroundEdge(VoronoiEdge * task) -> EdgeInfo
{
EdgeInfo answer;

Expand All @@ -100,57 +100,57 @@ VoronoiDiagram2D<TCoordinateType>::GetSeedsIDAroundEdge(VoronoiEdge * task) -> E
}


template <typename TCoordinateType>
template <typename TCoordinate>
auto
VoronoiDiagram2D<TCoordinateType>::EdgeBegin() -> VoronoiEdgeIterator
VoronoiDiagram2D<TCoordinate>::EdgeBegin() -> VoronoiEdgeIterator
{
return m_EdgeList.begin();
}


template <typename TCoordinateType>
template <typename TCoordinate>
auto
VoronoiDiagram2D<TCoordinateType>::EdgeEnd() -> VoronoiEdgeIterator
VoronoiDiagram2D<TCoordinate>::EdgeEnd() -> VoronoiEdgeIterator
{
return m_EdgeList.end();
}


template <typename TCoordinateType>
template <typename TCoordinate>
auto
VoronoiDiagram2D<TCoordinateType>::NeighborIdsBegin(int seeds) -> NeighborIdIterator
VoronoiDiagram2D<TCoordinate>::NeighborIdsBegin(int seeds) -> NeighborIdIterator
{
return m_CellNeighborsID[seeds].begin();
}


template <typename TCoordinateType>
template <typename TCoordinate>
auto
VoronoiDiagram2D<TCoordinateType>::NeighborIdsEnd(int seeds) -> NeighborIdIterator
VoronoiDiagram2D<TCoordinate>::NeighborIdsEnd(int seeds) -> NeighborIdIterator
{
return m_CellNeighborsID[seeds].end();
}


template <typename TCoordinateType>
template <typename TCoordinate>
auto
VoronoiDiagram2D<TCoordinateType>::VertexBegin() -> VertexIterator
VoronoiDiagram2D<TCoordinate>::VertexBegin() -> VertexIterator
{
return this->m_PointsContainer->Begin();
}


template <typename TCoordinateType>
template <typename TCoordinate>
auto
VoronoiDiagram2D<TCoordinateType>::VertexEnd() -> VertexIterator
VoronoiDiagram2D<TCoordinate>::VertexEnd() -> VertexIterator
{
return this->m_PointsContainer->End();
}


template <typename TCoordinateType>
template <typename TCoordinate>
auto
VoronoiDiagram2D<TCoordinateType>::GetSeed(int SeedID) -> PointType
VoronoiDiagram2D<TCoordinate>::GetSeed(int SeedID) -> PointType
{
PointType answer;

Expand All @@ -160,9 +160,9 @@ VoronoiDiagram2D<TCoordinateType>::GetSeed(int SeedID) -> PointType
}


template <typename TCoordinateType>
template <typename TCoordinate>
void
VoronoiDiagram2D<TCoordinateType>::Reset()
VoronoiDiagram2D<TCoordinate>::Reset()
{
m_VoronoiRegions.clear();
m_VoronoiRegions.resize(m_NumberOfSeeds);
Expand All @@ -176,9 +176,9 @@ VoronoiDiagram2D<TCoordinateType>::Reset()
}


template <typename TCoordinateType>
template <typename TCoordinate>
void
VoronoiDiagram2D<TCoordinateType>::InsertCells()
VoronoiDiagram2D<TCoordinate>::InsertCells()
{
genericCellPointer cellPtr;

Expand Down
Loading
Loading