Skip to content

Commit 7fdb792

Browse files
authored
Merge pull request #4904 from N-Dekker/Replace-Fill-empty-init-list-with-initialization
STYLE: Replace `Fill(T{})` on local variables with `{}` initialization
2 parents 0883d0c + d905400 commit 7fdb792

File tree

9 files changed

+17
-35
lines changed

9 files changed

+17
-35
lines changed

Modules/Core/Common/include/itkPoint.hxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,7 @@ auto
219219
BarycentricCombination<TPointContainer, TWeightContainer>::Evaluate(const PointContainerPointer & points,
220220
const WeightContainerType & weights) -> PointType
221221
{
222-
using ValueType = typename PointType::ValueType;
223-
PointType barycentre;
224-
barycentre.Fill(ValueType{}); // set to null
222+
PointType barycentre{}; // set to null
225223

226224
typename TPointContainer::Iterator point = points->Begin();
227225
typename TPointContainer::Iterator final = points->End();

Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ CentralDifferenceImageFunction<TInputImage, TCoordRep, TOutputType>::EvaluateSpe
344344
PixelType zeroPixel{};
345345

346346
ScalarDerivativeType componentDerivativeOut;
347-
ScalarDerivativeType componentDerivative;
348-
componentDerivative.Fill(OutputValueType{});
347+
ScalarDerivativeType componentDerivative{};
349348

350349
for (unsigned int dim = 0; dim < Self::ImageDimension; ++dim)
351350
{

Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ PointBasedSpatialObject<TDimension, TSpatialObjectPointType>::ComputeMyBoundingB
154154

155155
if (it == end)
156156
{
157-
typename BoundingBoxType::PointType pnt;
158-
pnt.Fill(typename BoundingBoxType::PointType::ValueType{});
157+
typename BoundingBoxType::PointType pnt{};
159158
this->GetModifiableMyBoundingBoxInObjectSpace()->SetMinimum(pnt);
160159
this->GetModifiableMyBoundingBoxInObjectSpace()->SetMaximum(pnt);
161160
return;

Modules/Core/SpatialObjects/include/itkSpatialObject.hxx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ template <unsigned int TDimension>
3838
void
3939
SpatialObject<TDimension>::Clear()
4040
{
41-
typename BoundingBoxType::PointType pnt;
42-
pnt.Fill(typename BoundingBoxType::PointType::ValueType{});
41+
typename BoundingBoxType::PointType pnt{};
4342
m_FamilyBoundingBoxInObjectSpace->SetMinimum(pnt);
4443
m_FamilyBoundingBoxInObjectSpace->SetMaximum(pnt);
4544
m_FamilyBoundingBoxInWorldSpace->SetMinimum(pnt);
@@ -601,8 +600,7 @@ template <unsigned int TDimension>
601600
void
602601
SpatialObject<TDimension>::ComputeMyBoundingBox()
603602
{
604-
typename BoundingBoxType::PointType pnt;
605-
pnt.Fill(typename BoundingBoxType::PointType::ValueType{});
603+
typename BoundingBoxType::PointType pnt{};
606604
if (m_MyBoundingBoxInObjectSpace->GetMinimum() != pnt || m_MyBoundingBoxInObjectSpace->GetMaximum() != pnt)
607605
{
608606
m_MyBoundingBoxInObjectSpace->SetMinimum(pnt);
@@ -638,8 +636,7 @@ SpatialObject<TDimension>::ComputeFamilyBoundingBox(unsigned int depth, const st
638636
{
639637
itkDebugMacro("Computing Bounding Box");
640638

641-
typename BoundingBoxType::PointType zeroPnt;
642-
zeroPnt.Fill(typename BoundingBoxType::PointType::ValueType{});
639+
typename BoundingBoxType::PointType zeroPnt{};
643640
m_FamilyBoundingBoxInObjectSpace->SetMinimum(zeroPnt);
644641
m_FamilyBoundingBoxInObjectSpace->SetMaximum(zeroPnt);
645642
bool bbDefined = false;

Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ TubeSpatialObject<TDimension, TTubePointType>::ComputeMyBoundingBox()
127127

128128
if (it == end)
129129
{
130-
typename BoundingBoxType::PointType pnt;
131-
pnt.Fill(typename BoundingBoxType::PointType::ValueType{});
130+
typename BoundingBoxType::PointType pnt{};
132131
this->GetModifiableMyBoundingBoxInObjectSpace()->SetMinimum(pnt);
133132
this->GetModifiableMyBoundingBoxInObjectSpace()->SetMaximum(pnt);
134133
return;

Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ LabelMapContourOverlayImageFilter<TLabelMap, TFeatureImage, TOutputImage>::Befor
153153
using SliceErodeType = BinaryErodeImageFilter<SliceInternalImageType, SliceInternalImageType, SliceKernelType>;
154154
auto serode = SliceErodeType::New();
155155
using RadiusType = typename SliceKernelType::RadiusType;
156-
RadiusType srad;
157-
srad.Fill(typename RadiusType::SizeValueType{});
156+
RadiusType srad{};
158157
for (unsigned int i = 0, j = 0; i < ImageDimension; ++i)
159158
{
160159
if (j != static_cast<unsigned int>(m_SliceDimension) && (j < (ImageDimension - 1)))

Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetCentroid(LabelPixelTy
631631
if (mapIt == m_LabelGeometryMapper.end())
632632
{
633633
// label does not exist, return a default value
634-
LabelPointType emptyCentroid;
635-
emptyCentroid.Fill(typename LabelPointType::ValueType{});
634+
LabelPointType emptyCentroid{};
636635
return emptyCentroid;
637636
}
638637
else
@@ -652,8 +651,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetWeightedCentroid(Labe
652651
if (mapIt == m_LabelGeometryMapper.end())
653652
{
654653
// label does not exist, return a default value
655-
LabelPointType emptyCentroid;
656-
emptyCentroid.Fill(typename LabelPointType::ValueType{});
654+
LabelPointType emptyCentroid{};
657655
return emptyCentroid;
658656
}
659657
else
@@ -710,8 +708,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetAxesLength(LabelPixel
710708
if (mapIt == m_LabelGeometryMapper.end())
711709
{
712710
// label does not exist, return a default value
713-
LabelPointType emptyAxesLength;
714-
emptyAxesLength.Fill(typename AxesLengthType::ValueType{});
711+
LabelPointType emptyAxesLength{};
715712
return emptyAxesLength;
716713
}
717714
else
@@ -801,8 +798,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetBoundingBox(LabelPixe
801798
mapIt = m_LabelGeometryMapper.find(label);
802799
if (mapIt == m_LabelGeometryMapper.end())
803800
{
804-
BoundingBoxType emptyBox;
805-
emptyBox.Fill(typename BoundingBoxType::ValueType{});
801+
BoundingBoxType emptyBox{};
806802
// label does not exist, return a default value
807803
return emptyBox;
808804
}
@@ -840,8 +836,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetBoundingBoxSize(Label
840836
if (mapIt == m_LabelGeometryMapper.end())
841837
{
842838
// label does not exist, return a default value
843-
LabelSizeType emptySize;
844-
emptySize.Fill(typename LabelSizeType::SizeValueType{});
839+
LabelSizeType emptySize{};
845840
return emptySize;
846841
}
847842
else
@@ -904,8 +899,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetOrientedBoundingBoxSi
904899
// LabelSizeType emptySize;
905900
// emptySize.Fill( LabelSizeType::SizeValueType{});
906901
// return emptySize;
907-
LabelPointType emptySize;
908-
emptySize.Fill(typename LabelPointType::ValueType{});
902+
LabelPointType emptySize{};
909903
return emptySize;
910904
}
911905
else
@@ -925,8 +919,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetOrientedBoundingBoxOr
925919
if (mapIt == m_LabelGeometryMapper.end())
926920
{
927921
// label does not exist, return a default value
928-
LabelPointType emptySize;
929-
emptySize.Fill(typename LabelPointType::ValueType{});
922+
LabelPointType emptySize{};
930923
return emptySize;
931924
}
932925
else

Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ ObjectToObjectMetric<TFixedDimension, TMovingDimension, TVirtualImage, TParamete
413413
}
414414
else
415415
{
416-
VirtualOriginType origin;
417-
origin.Fill(typename VirtualOriginType::ValueType{});
416+
VirtualOriginType origin{};
418417
return origin;
419418
}
420419
}

Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,7 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::ApplyGibbsLabeller()
525525
InputImagePixelType originPixelVec;
526526

527527
// Variable to store the modified pixel vector value.
528-
InputImagePixelType changedPixelVec;
529-
changedPixelVec.Fill(typename InputImagePixelType::ValueType{});
528+
InputImagePixelType changedPixelVec{};
530529

531530
// Set a variable to store the offset index.
532531
LabelledImageIndexType offsetIndex3D{};

0 commit comments

Comments
 (0)