Skip to content

Commit

Permalink
STYLE: Replace CoordRepType with CoordinateType in tests
Browse files Browse the repository at this point in the history
Did Replace in Files on "itk*Test*.cxx" and "itk*Test*.h".
  • Loading branch information
N-Dekker authored and dzenanz committed Nov 29, 2024
1 parent 5ea1a9a commit 324eaf1
Show file tree
Hide file tree
Showing 57 changed files with 193 additions and 192 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ itkBSplineInterpolationWeightFunctionTest(int, char *[])
{

{ // Creating a local scope
using CoordRepType = double;
using CoordinateType = double;
constexpr unsigned int SpaceDimension = 1;
constexpr unsigned int SplineOrder = 2;

std::cout << "Testing SpaceDimension= " << SpaceDimension;
std::cout << " and SplineOrder= " << SplineOrder << std::endl;

using FunctionType = itk::BSplineInterpolationWeightFunction<CoordRepType, SpaceDimension, SplineOrder>;
using FunctionType = itk::BSplineInterpolationWeightFunction<CoordinateType, SpaceDimension, SplineOrder>;
using ContinuousIndexType = FunctionType::ContinuousIndexType;
using IndexType = FunctionType::IndexType;
using WeightsType = FunctionType::WeightsType;
Expand Down Expand Up @@ -145,14 +145,14 @@ itkBSplineInterpolationWeightFunctionTest(int, char *[])
std::cout << "Test passed. " << std::endl;
}
{ // Creating a local scope
using CoordRepType = double;
using CoordinateType = double;
constexpr unsigned int SpaceDimension = 1;
constexpr unsigned int SplineOrder = 3;

std::cout << "Testing SpaceDimension= " << SpaceDimension;
std::cout << " and SplineOrder= " << SplineOrder << std::endl;

using FunctionType = itk::BSplineInterpolationWeightFunction<CoordRepType, SpaceDimension, SplineOrder>;
using FunctionType = itk::BSplineInterpolationWeightFunction<CoordinateType, SpaceDimension, SplineOrder>;
using ContinuousIndexType = FunctionType::ContinuousIndexType;
using IndexType = FunctionType::IndexType;
using WeightsType = FunctionType::WeightsType;
Expand Down Expand Up @@ -234,13 +234,13 @@ itkBSplineInterpolationWeightFunctionTest(int, char *[])
}

{ // Creating a local scope
using CoordRepType = double;
using CoordinateType = double;
constexpr unsigned int SpaceDimension = 3;
constexpr unsigned int SplineOrder = 3;
std::cout << "Testing SpaceDimension= " << SpaceDimension;
std::cout << " and SplineOrder= " << SplineOrder << std::endl;

using FunctionType = itk::BSplineInterpolationWeightFunction<CoordRepType, SpaceDimension, SplineOrder>;
using FunctionType = itk::BSplineInterpolationWeightFunction<CoordinateType, SpaceDimension, SplineOrder>;
using ContinuousIndexType = FunctionType::ContinuousIndexType;
using IndexType = FunctionType::IndexType;
using WeightsType = FunctionType::WeightsType;
Expand Down
4 changes: 2 additions & 2 deletions Modules/Core/Common/test/itkBoundingBoxTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ itkBoundingBoxTest(int, char *[])
const BB::BoundsArrayType & bounds = myBox->GetBounds();
for (unsigned int i = 0; i < bounds.Size(); ++i)
{
if (itk::Math::NotExactlyEquals(bounds[i], BB::CoordRepType{}))
if (itk::Math::NotExactlyEquals(bounds[i], BB::CoordinateType{}))
{
std::cerr << "Bounding Box initialization test failed" << std::endl;
std::cerr << bounds << std::endl;
Expand All @@ -54,7 +54,7 @@ itkBoundingBoxTest(int, char *[])
BB::PointType center = myBox->GetCenter();
for (unsigned int i = 0; i < 1; ++i)
{
if (itk::Math::NotExactlyEquals(center[i], BB::CoordRepType{}))
if (itk::Math::NotExactlyEquals(center[i], BB::CoordinateType{}))
{
std::cerr << "Empty Box GetCenter initialization test failed" << std::endl;
return EXIT_FAILURE;
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/test/itkCrossHelperTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ itkCrossHelperTest(int itkNotUsed(argc), char * itkNotUsed(argv)[])
constexpr unsigned int Dimension3D = 3;
constexpr unsigned int Dimension4D = 4;

using CoordRepType = double;
using CoordinateType = double;

using Vector2DType = itk::Vector<CoordRepType, Dimension2D>;
using Vector3DType = itk::Vector<CoordRepType, Dimension3D>;
using Vector4DType = itk::Vector<CoordRepType, Dimension4D>;
using Vector2DType = itk::Vector<CoordinateType, Dimension2D>;
using Vector3DType = itk::Vector<CoordinateType, Dimension3D>;
using Vector4DType = itk::Vector<CoordinateType, Dimension4D>;

using Cross2DType = itk::CrossHelper<Vector2DType>;
Cross2DType cross2d;
Expand Down
9 changes: 5 additions & 4 deletions Modules/Core/Common/test/itkPointSetGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,24 @@ template <typename TPointSet>
void
TestSetPointsByCoordinates(TPointSet & pointSet)
{
using CoordRepType = typename TPointSet::CoordRepType;
using CoordinateType = typename TPointSet::CoordinateType;

static constexpr auto PointDimension = TPointSet::PointDimension;

for (unsigned int numberOfCoordinates{ 1 }; numberOfCoordinates < PointDimension; ++numberOfCoordinates)
{
// SetPointsByCoordinates is expected to throw an exception when the specified number of coordinates is not a
// multiple of PointDimension.
EXPECT_THROW(pointSet.SetPointsByCoordinates(std::vector<CoordRepType>(numberOfCoordinates)), itk::ExceptionObject);
EXPECT_THROW(pointSet.SetPointsByCoordinates(std::vector<CoordinateType>(numberOfCoordinates)),
itk::ExceptionObject);
}

for (const unsigned int numberOfPoints : { 2, 1, 0 })
{
std::vector<CoordRepType> coordinates(numberOfPoints * PointDimension);
std::vector<CoordinateType> coordinates(numberOfPoints * PointDimension);

// Just make sure that all coordinates have different values, for the purpose of the test.
std::iota(coordinates.begin(), coordinates.end(), CoordRepType());
std::iota(coordinates.begin(), coordinates.end(), CoordinateType());
{
const auto modifiedTime = pointSet.GetMTime();
pointSet.SetPointsByCoordinates(coordinates);
Expand Down
8 changes: 4 additions & 4 deletions Modules/Core/Common/test/itkPointSetTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ itkPointSetTest(int, char *[])
/**
* Define the 3d geometric positions for 8 points in a cube.
*/
PointSet::CoordRepType testPointCoords[3];
PointSet::CoordinateType testPointCoords[3];

/**
* Create the point set through its object factory.
Expand All @@ -67,9 +67,9 @@ itkPointSetTest(int, char *[])
{
for (int i = 0; i < numOfPoints; ++i)
{
testPointCoords[0] = (PointSet::CoordRepType)vnl_sample_uniform(-1.0, 1.0);
testPointCoords[1] = (PointSet::CoordRepType)vnl_sample_uniform(-1.0, 1.0);
testPointCoords[2] = (PointSet::CoordRepType)vnl_sample_uniform(-1.0, 1.0);
testPointCoords[0] = (PointSet::CoordinateType)vnl_sample_uniform(-1.0, 1.0);
testPointCoords[1] = (PointSet::CoordinateType)vnl_sample_uniform(-1.0, 1.0);
testPointCoords[2] = (PointSet::CoordinateType)vnl_sample_uniform(-1.0, 1.0);
pset->SetPoint(i, PointType(testPointCoords));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@


using InputPixelType = double;
using CoordRepType = itk::SpacePrecisionType;
using CoordinateType = itk::SpacePrecisionType;

// Set up for 1D Images
enum
Expand All @@ -46,7 +46,7 @@ enum
using ImageType1D = itk::Image<InputPixelType, ImageDimension1D>;
using ImageTypePtr1D = ImageType1D::Pointer;
using SizeType1D = ImageType1D::SizeType;
using InterpolatorType1D = itk::BSplineInterpolateImageFunction<ImageType1D, CoordRepType>;
using InterpolatorType1D = itk::BSplineInterpolateImageFunction<ImageType1D, CoordinateType>;
// using IndexType1D = InterpolatorType1D::IndexType;
using PointType1D = InterpolatorType1D::PointType;
using ContinuousIndexType1D = InterpolatorType1D::ContinuousIndexType;
Expand All @@ -62,7 +62,7 @@ enum
using ImageType2D = itk::Image<InputPixelType, ImageDimension2D>;
using ImageTypePtr2D = ImageType2D::Pointer;
using SizeType2D = ImageType2D::SizeType;
using InterpolatorType2D = itk::BSplineInterpolateImageFunction<ImageType2D, CoordRepType>;
using InterpolatorType2D = itk::BSplineInterpolateImageFunction<ImageType2D, CoordinateType>;
// using IndexType2D = InterpolatorType2D::IndexType;
using PointType2D = InterpolatorType2D::PointType;
using ContinuousIndexType2D = InterpolatorType2D::ContinuousIndexType;
Expand All @@ -78,13 +78,13 @@ enum
using ImageType3D = itk::Image<InputPixelType, ImageDimension3D>;
using ImageTypePtr3D = ImageType3D::Pointer;
using SizeType3D = ImageType3D::SizeType;
using InterpolatorType3D = itk::BSplineInterpolateImageFunction<ImageType3D, CoordRepType>;
using InterpolatorType3D = itk::BSplineInterpolateImageFunction<ImageType3D, CoordinateType>;
using IndexType3D = InterpolatorType3D::IndexType;
using PointType3D = InterpolatorType3D::PointType;
using ContinuousIndexType3D = InterpolatorType3D::ContinuousIndexType;

using ImageIntegerType3D = itk::Image<unsigned int, ImageDimension3D>;
using InterpolatorIntegerType3D = itk::BSplineInterpolateImageFunction<ImageIntegerType3D, CoordRepType>;
using InterpolatorIntegerType3D = itk::BSplineInterpolateImageFunction<ImageIntegerType3D, CoordinateType>;
using IndexIntegerType3D = InterpolatorIntegerType3D::IndexType;
using PointIntegerType3D = InterpolatorIntegerType3D::PointType;
using ContinuousIntegerIndexType3D = InterpolatorIntegerType3D::ContinuousIndexType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ itkCentralDifferenceImageFunctionOnVectorSpeedTestRun(char * argv[])
}

// set up central difference calculator
using CoordRepType = float;
using CoordinateType = float;
using DerivativeType = itk::Matrix<double, vecLength, 2>;

using FunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordRepType, DerivativeType>;
using FunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordinateType, DerivativeType>;
using OutputType = typename FunctionType::OutputType;

auto function = FunctionType::New();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ itkCentralDifferenceImageFunctionOnVectorTestRun()
}

// set up central difference calculator
using CoordRepType = float;
using CoordinateType = float;
using DerivativeType = itk::Matrix<double, VectorLength, ImageDimension>;

using FunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordRepType, DerivativeType>;
using FunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordinateType, DerivativeType>;
using OutputType = typename FunctionType::OutputType;
using OutputValueType = typename FunctionType::OutputValueType;

Expand Down Expand Up @@ -352,7 +352,7 @@ itkCentralDifferenceImageFunctionOnVectorTestRun()
// Test with incorrectly-sized output type
using BadDerivativeType = itk::Matrix<double, 10, ImageDimension>;

using BadFunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordRepType, BadDerivativeType>;
using BadFunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordinateType, BadDerivativeType>;

auto badFunction = BadFunctionType::New();
ITK_TRY_EXPECT_EXCEPTION(badFunction->SetInputImage(image));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ itkCentralDifferenceImageFunctionSpeedTest(int argc, char * argv[])
}

// set up central difference calculator
using CoordRepType = float;
using FunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordRepType>;
using CoordinateType = float;
using FunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordinateType>;
using OutputType = FunctionType::OutputType;

auto function = FunctionType::New();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ itkCentralDifferenceImageFunctionTest(int, char *[])
}

// set up central difference calculator
using CoordRepType = float;
using FunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordRepType>;
using CoordinateType = float;
using FunctionType = itk::CentralDifferenceImageFunction<ImageType, CoordinateType>;
using OutputType = FunctionType::OutputType;
using OutputValueType = FunctionType::OutputValueType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ enum
using ImageType = itk::Image<InputPixelType, ImageDimension>;
using ImageAdaptorType = itk::ImageAdaptor<ImageType, RedChannelPixelAccessor>;

using CoordRepType = itk::SpacePrecisionType;
using CoordinateType = itk::SpacePrecisionType;

using InterpolatorType = itk::LinearInterpolateImageFunction<ImageAdaptorType, CoordRepType>;
using InterpolatorType = itk::LinearInterpolateImageFunction<ImageAdaptorType, CoordinateType>;
using IndexType = InterpolatorType::IndexType;
using PointType = ImageType::PointType;
using ContinuousIndexType = InterpolatorType::ContinuousIndexType;
Expand Down
6 changes: 3 additions & 3 deletions Modules/Core/ImageFunction/test/itkInterpolateTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@

using SizeType = itk::Size<3>;
using ImageType = itk::Image<unsigned short, 3>;
using CoordRepType = itk::SpacePrecisionType;
using InterpolatorType = itk::LinearInterpolateImageFunction<ImageType, CoordRepType>;
using CoordinateType = itk::SpacePrecisionType;
using InterpolatorType = itk::LinearInterpolateImageFunction<ImageType, CoordinateType>;
using IndexType = InterpolatorType::IndexType;
using PointType = InterpolatorType::PointType;
using ContinuousIndexType = InterpolatorType::ContinuousIndexType;

using NNInterpolatorType = itk::NearestNeighborInterpolateImageFunction<ImageType, CoordRepType>;
using NNInterpolatorType = itk::NearestNeighborInterpolateImageFunction<ImageType, CoordinateType>;
namespace
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ itkLabelImageGaussianInterpolateImageFunctionTest(int, char *[])
using SizeType = RegionType::SizeType;
using IndexType = ImageType::IndexType;

using CoordRepType = float;
using CoordinateType = float;

// The ImageSizeToCompute
constexpr double FOV = 10.0;
Expand Down Expand Up @@ -84,7 +84,7 @@ itkLabelImageGaussianInterpolateImageFunctionTest(int, char *[])
}
}

using InterpolatorType = itk::LabelImageGaussianInterpolateImageFunction<ImageType, CoordRepType>;
using InterpolatorType = itk::LabelImageGaussianInterpolateImageFunction<ImageType, CoordinateType>;
auto interpolator = InterpolatorType::New();
interpolator->SetInputImage(small_image);
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ RunLinearInterpolateTest()
using SizeType = typename RegionType::SizeType;
using IndexType = typename ImageType::IndexType;

using CoordRepType = float;
using ContinuousIndexType = typename itk::ContinuousIndex<CoordRepType, Dimensions>;
using CoordinateType = float;
using ContinuousIndexType = typename itk::ContinuousIndex<CoordinateType, Dimensions>;

using AccumulatorType = typename ContinuousIndexType::ValueType;

using PointType = typename itk::Point<CoordRepType, Dimensions>;
using PointType = typename itk::Point<CoordinateType, Dimensions>;

using InterpolatorType = typename itk::LinearInterpolateImageFunction<ImageType, CoordRepType>;
using VectorInterpolatorType = typename itk::LinearInterpolateImageFunction<VectorImageType, CoordRepType>;
using InterpolatorType = typename itk::LinearInterpolateImageFunction<ImageType, CoordinateType>;
using VectorInterpolatorType = typename itk::LinearInterpolateImageFunction<VectorImageType, CoordinateType>;
using VariableVectorInterpolatorType =
typename itk::LinearInterpolateImageFunction<VariableVectorImageType, CoordRepType>;
typename itk::LinearInterpolateImageFunction<VariableVectorImageType, CoordinateType>;

using InterpolatedVectorType = typename VectorInterpolatorType::OutputType;
using InterpolatedVariableVectorType = typename VariableVectorInterpolatorType::OutputType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ itkNearestNeighborInterpolateImageFunctionTest(int, char *[])

using PointType = itk::Point<float, 2>;

using CoordRepType = float;
using InterpolatorType = itk::NearestNeighborInterpolateImageFunction<ImageType, CoordRepType>;
using VectorInterpolatorType = itk::NearestNeighborInterpolateImageFunction<VectorImageType, CoordRepType>;
using CoordinateType = float;
using InterpolatorType = itk::NearestNeighborInterpolateImageFunction<ImageType, CoordinateType>;
using VectorInterpolatorType = itk::NearestNeighborInterpolateImageFunction<VectorImageType, CoordinateType>;
using VariableVectorInterpolatorType =
itk::NearestNeighborInterpolateImageFunction<VariableVectorImageType, CoordRepType>;
itk::NearestNeighborInterpolateImageFunction<VariableVectorImageType, CoordinateType>;

using InterpolatedVectorType = VectorInterpolatorType::OutputType;
using InterpolatedVariableVectorType = VariableVectorInterpolatorType::OutputType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ enum
}; // RGB is a vector of dimension 3
using PixelType = itk::RGBPixel<unsigned short>;
using ImageType = itk::Image<PixelType, ImageDimension>;
using CoordRepType = itk::SpacePrecisionType;
using InterpolatorType = itk::VectorLinearInterpolateImageFunction<ImageType, CoordRepType>;
using CoordinateType = itk::SpacePrecisionType;
using InterpolatorType = itk::VectorLinearInterpolateImageFunction<ImageType, CoordinateType>;
using IndexType = InterpolatorType::IndexType;
using PointType = InterpolatorType::PointType;
using ContinuousIndexType = InterpolatorType::ContinuousIndexType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ enum
};
using PixelType = itk::Vector<unsigned short, VectorDimension>;
using ImageType = itk::Image<PixelType, ImageDimension>;
using CoordRepType = itk::SpacePrecisionType;
using InterpolatorType = itk::VectorLinearInterpolateImageFunction<ImageType, CoordRepType>;
using CoordinateType = itk::SpacePrecisionType;
using InterpolatorType = itk::VectorLinearInterpolateImageFunction<ImageType, CoordinateType>;
using IndexType = InterpolatorType::IndexType;
using PointType = InterpolatorType::PointType;
using ContinuousIndexType = InterpolatorType::ContinuousIndexType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ enum
};
using PixelType = itk::Vector<unsigned short, VectorDimension>;
using ImageType = itk::Image<PixelType, ImageDimension>;
using CoordRepType = itk::SpacePrecisionType;
using CoordinateType = itk::SpacePrecisionType;

using InterpolatorType = itk::VectorLinearInterpolateNearestNeighborExtrapolateImageFunction<ImageType, CoordRepType>;
using InterpolatorType = itk::VectorLinearInterpolateNearestNeighborExtrapolateImageFunction<ImageType, CoordinateType>;

using IndexType = InterpolatorType::IndexType;
using PointType = InterpolatorType::PointType;
Expand Down
Loading

0 comments on commit 324eaf1

Please sign in to comment.