Skip to content

Commit 056a225

Browse files
authored
Merge pull request InsightSoftwareConsortium#4905 from N-Dekker/Replace-Fill-in-MeshIOTestHelper
Remove `Fill` on empty variables, replace other `Fill` calls with `itk::MakeFilled`, in MeshIOTestHelper
2 parents 7fdb792 + d2b9dbd commit 056a225

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

Modules/IO/MeshBase/include/itkMeshIOTestHelper.h

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
9696

9797
using RGBAPixelType = itk::RGBAPixel<FloatType>;
9898

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

119-
VectorPixelType vectorValue;
120-
vectorValue.Fill(1.0);
118+
auto vectorValue = itk::MakeFilled<VectorPixelType>(1.0);
121119
usePointPixel = true;
122120
meshIO->SetPixelType(vectorValue, usePointPixel);
123121
LOCAL_ITK_TEST_SET_GET_VALUE(length, meshIO->GetNumberOfPointPixelComponents());
@@ -135,8 +133,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
135133

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

138-
CovariantVectorPixelType covariantVectorValue;
139-
covariantVectorValue.Fill(1.0);
136+
auto covariantVectorValue = itk::MakeFilled<CovariantVectorPixelType>(1.0);
140137
usePointPixel = true;
141138
meshIO->SetPixelType(covariantVectorValue, usePointPixel);
142139
LOCAL_ITK_TEST_SET_GET_VALUE(length, meshIO->GetNumberOfPointPixelComponents());
@@ -154,8 +151,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
154151

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

157-
FixedArrayPixelType fixedArrayValue;
158-
fixedArrayValue.Fill(1.0);
154+
auto fixedArrayValue = itk::MakeFilled<FixedArrayPixelType>(1.0);
159155
usePointPixel = true;
160156
meshIO->SetPixelType(fixedArrayValue, usePointPixel);
161157
LOCAL_ITK_TEST_SET_GET_VALUE(length, meshIO->GetNumberOfPointPixelComponents());
@@ -173,8 +169,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
173169

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

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

193188
using DiffusionTensor3DPixelType = itk::DiffusionTensor3D<FloatType>;
194189

195-
DiffusionTensor3DPixelType diffusionTensor3DPixelValue;
196-
diffusionTensor3DPixelValue.Fill(1.0);
190+
auto diffusionTensor3DPixelValue = itk::MakeFilled<DiffusionTensor3DPixelType>(1.0);
197191
usePointPixel = true;
198192
meshIO->SetPixelType(diffusionTensor3DPixelValue, usePointPixel);
199193
LOCAL_ITK_TEST_SET_GET_VALUE(6, meshIO->GetNumberOfPointPixelComponents());
@@ -213,8 +207,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
213207
const itk::SizeValueType cols = 2;
214208
using MatrixPixelType = itk::Matrix<FloatType, rows, cols>;
215209

216-
MatrixPixelType matrixPixelValue;
217-
matrixPixelValue.Fill(1.0);
210+
auto matrixPixelValue = itk::MakeFilled<MatrixPixelType>(1.0);
218211
usePointPixel = true;
219212
meshIO->SetPixelType(matrixPixelValue, usePointPixel);
220213
LOCAL_ITK_TEST_SET_GET_VALUE(rows * cols, meshIO->GetNumberOfPointPixelComponents());
@@ -250,8 +243,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
250243

251244
using ArrayPixelType = itk::Array<FloatType>;
252245

253-
ArrayPixelType arrayPixelValue;
254-
arrayPixelValue.Fill(1.0);
246+
ArrayPixelType arrayPixelValue{};
255247
usePointPixel = true;
256248
meshIO->SetPixelType(arrayPixelValue, usePointPixel);
257249
LOCAL_ITK_TEST_SET_GET_VALUE(arrayPixelValue.Size(), meshIO->GetNumberOfPointPixelComponents());
@@ -269,8 +261,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
269261

270262
using VariableLengthVectorPixelType = itk::VariableLengthVector<FloatType>;
271263

272-
VariableLengthVectorPixelType variableLengthVectorValue;
273-
variableLengthVectorValue.Fill(1.0);
264+
VariableLengthVectorPixelType variableLengthVectorValue{};
274265
usePointPixel = true;
275266
meshIO->SetPixelType(variableLengthVectorValue, usePointPixel);
276267
LOCAL_ITK_TEST_SET_GET_VALUE(variableLengthVectorValue.Size(), meshIO->GetNumberOfPointPixelComponents());
@@ -288,8 +279,7 @@ TestBaseClassMethodsMeshIO(typename TMeshIO::Pointer meshIO)
288279

289280
using VariableSizeMatrixType = itk::VariableSizeMatrix<FloatType>;
290281

291-
VariableSizeMatrixType matrix;
292-
matrix.Fill(1.0);
282+
VariableSizeMatrixType matrix{};
293283
usePointPixel = true;
294284
meshIO->SetPixelType(matrix, usePointPixel);
295285
LOCAL_ITK_TEST_SET_GET_VALUE(matrix.Rows() * matrix.Cols(), meshIO->GetNumberOfPointPixelComponents());

0 commit comments

Comments
 (0)