Skip to content

Commit

Permalink
STYLE: Replace Fill w/ auto var = itk::MakeFilled in MeshIOTestHelper
Browse files Browse the repository at this point in the history
Replaced code of the form

    T var;
    var.Fill(x);

with `auto var = itk::MakeFilled<T>(x);`

- Follow-up to pull request InsightSoftwareConsortium#4891
"STYLE: Replace Fill calls with `auto var = itk::MakeFilled<T>` in tests"
  • Loading branch information
N-Dekker committed Oct 26, 2024
1 parent 8e482dc commit d2b9dbd
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions Modules/IO/MeshBase/include/itkMeshIOTestHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)

using RGBAPixelType = itk::RGBAPixel<FloatType>;

RGBAPixelType rgbaValue;
rgbaValue.Fill(1.0);
auto rgbaValue = itk::MakeFilled<RGBAPixelType>(1.0);
usePointPixel = true;
meshIO->SetPixelType(rgbaValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(4, meshIO->GetNumberOfPointPixelComponents());
Expand All @@ -116,8 +115,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
const itk::SizeValueType length = 5;
using VectorPixelType = itk::Vector<FloatType, length>;

VectorPixelType vectorValue;
vectorValue.Fill(1.0);
auto vectorValue = itk::MakeFilled<VectorPixelType>(1.0);
usePointPixel = true;
meshIO->SetPixelType(vectorValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(length, meshIO->GetNumberOfPointPixelComponents());
Expand All @@ -135,8 +133,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)

using CovariantVectorPixelType = itk::CovariantVector<FloatType, length>;

CovariantVectorPixelType covariantVectorValue;
covariantVectorValue.Fill(1.0);
auto covariantVectorValue = itk::MakeFilled<CovariantVectorPixelType>(1.0);
usePointPixel = true;
meshIO->SetPixelType(covariantVectorValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(length, meshIO->GetNumberOfPointPixelComponents());
Expand All @@ -154,8 +151,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)

using FixedArrayPixelType = itk::FixedArray<FloatType, length>;

FixedArrayPixelType fixedArrayValue;
fixedArrayValue.Fill(1.0);
auto fixedArrayValue = itk::MakeFilled<FixedArrayPixelType>(1.0);
usePointPixel = true;
meshIO->SetPixelType(fixedArrayValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(length, meshIO->GetNumberOfPointPixelComponents());
Expand All @@ -173,8 +169,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)

using SymmetricSecondRankTensorPixelType = itk::SymmetricSecondRankTensor<FloatType, length>;

SymmetricSecondRankTensorPixelType symmetricSecondRankTensorValue;
symmetricSecondRankTensorValue.Fill(1.0);
auto symmetricSecondRankTensorValue = itk::MakeFilled<SymmetricSecondRankTensorPixelType>(1.0);
usePointPixel = true;
meshIO->SetPixelType(symmetricSecondRankTensorValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(length * (length + 1) / 2, meshIO->GetNumberOfPointPixelComponents());
Expand All @@ -192,8 +187,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)

using DiffusionTensor3DPixelType = itk::DiffusionTensor3D<FloatType>;

DiffusionTensor3DPixelType diffusionTensor3DPixelValue;
diffusionTensor3DPixelValue.Fill(1.0);
auto diffusionTensor3DPixelValue = itk::MakeFilled<DiffusionTensor3DPixelType>(1.0);
usePointPixel = true;
meshIO->SetPixelType(diffusionTensor3DPixelValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(6, meshIO->GetNumberOfPointPixelComponents());
Expand All @@ -213,8 +207,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
const itk::SizeValueType cols = 2;
using MatrixPixelType = itk::Matrix<FloatType, rows, cols>;

MatrixPixelType matrixPixelValue;
matrixPixelValue.Fill(1.0);
auto matrixPixelValue = itk::MakeFilled<MatrixPixelType>(1.0);
usePointPixel = true;
meshIO->SetPixelType(matrixPixelValue, usePointPixel);
LOCAL_ITK_TEST_SET_GET_VALUE(rows * cols, meshIO->GetNumberOfPointPixelComponents());
Expand Down

0 comments on commit d2b9dbd

Please sign in to comment.