Skip to content

Commit

Permalink
STYLE: Replace Fill(T{}) on local variables with {} initialization
Browse files Browse the repository at this point in the history
Using Notepad++, Replace in Files, doing:

    Find what: ^( [ ]+[^ ].* )(\w+);[\r\n]+ [ ]+\2\.Fill\(.*{}\);
    Replace with: $1$2{};
    Directory: D:\Src\ITK\Modules

Manually removed the ValueType alias from `BarycentricCombination::Evaluate`, to
avoid "unused type alias" warnings.

- Follow-up to pull request InsightSoftwareConsortium#4897
commit 4733550
"STYLE: Replace `Fill(0)` on local variables with `{}` initialization"
  • Loading branch information
N-Dekker committed Oct 25, 2024
1 parent f8b31d8 commit d905400
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 35 deletions.
4 changes: 1 addition & 3 deletions Modules/Core/Common/include/itkPoint.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,7 @@ auto
BarycentricCombination<TPointContainer, TWeightContainer>::Evaluate(const PointContainerPointer & points,
const WeightContainerType & weights) -> PointType
{
using ValueType = typename PointType::ValueType;
PointType barycentre;
barycentre.Fill(ValueType{}); // set to null
PointType barycentre{}; // set to null

typename TPointContainer::Iterator point = points->Begin();
typename TPointContainer::Iterator final = points->End();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ CentralDifferenceImageFunction<TInputImage, TCoordRep, TOutputType>::EvaluateSpe
PixelType zeroPixel{};

ScalarDerivativeType componentDerivativeOut;
ScalarDerivativeType componentDerivative;
componentDerivative.Fill(OutputValueType{});
ScalarDerivativeType componentDerivative{};

for (unsigned int dim = 0; dim < Self::ImageDimension; ++dim)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ PointBasedSpatialObject<TDimension, TSpatialObjectPointType>::ComputeMyBoundingB

if (it == end)
{
typename BoundingBoxType::PointType pnt;
pnt.Fill(typename BoundingBoxType::PointType::ValueType{});
typename BoundingBoxType::PointType pnt{};
this->GetModifiableMyBoundingBoxInObjectSpace()->SetMinimum(pnt);
this->GetModifiableMyBoundingBoxInObjectSpace()->SetMaximum(pnt);
return;
Expand Down
9 changes: 3 additions & 6 deletions Modules/Core/SpatialObjects/include/itkSpatialObject.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ template <unsigned int TDimension>
void
SpatialObject<TDimension>::Clear()
{
typename BoundingBoxType::PointType pnt;
pnt.Fill(typename BoundingBoxType::PointType::ValueType{});
typename BoundingBoxType::PointType pnt{};
m_FamilyBoundingBoxInObjectSpace->SetMinimum(pnt);
m_FamilyBoundingBoxInObjectSpace->SetMaximum(pnt);
m_FamilyBoundingBoxInWorldSpace->SetMinimum(pnt);
Expand Down Expand Up @@ -601,8 +600,7 @@ template <unsigned int TDimension>
void
SpatialObject<TDimension>::ComputeMyBoundingBox()
{
typename BoundingBoxType::PointType pnt;
pnt.Fill(typename BoundingBoxType::PointType::ValueType{});
typename BoundingBoxType::PointType pnt{};
if (m_MyBoundingBoxInObjectSpace->GetMinimum() != pnt || m_MyBoundingBoxInObjectSpace->GetMaximum() != pnt)
{
m_MyBoundingBoxInObjectSpace->SetMinimum(pnt);
Expand Down Expand Up @@ -638,8 +636,7 @@ SpatialObject<TDimension>::ComputeFamilyBoundingBox(unsigned int depth, const st
{
itkDebugMacro("Computing Bounding Box");

typename BoundingBoxType::PointType zeroPnt;
zeroPnt.Fill(typename BoundingBoxType::PointType::ValueType{});
typename BoundingBoxType::PointType zeroPnt{};
m_FamilyBoundingBoxInObjectSpace->SetMinimum(zeroPnt);
m_FamilyBoundingBoxInObjectSpace->SetMaximum(zeroPnt);
bool bbDefined = false;
Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ TubeSpatialObject<TDimension, TTubePointType>::ComputeMyBoundingBox()

if (it == end)
{
typename BoundingBoxType::PointType pnt;
pnt.Fill(typename BoundingBoxType::PointType::ValueType{});
typename BoundingBoxType::PointType pnt{};
this->GetModifiableMyBoundingBoxInObjectSpace()->SetMinimum(pnt);
this->GetModifiableMyBoundingBoxInObjectSpace()->SetMaximum(pnt);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ LabelMapContourOverlayImageFilter<TLabelMap, TFeatureImage, TOutputImage>::Befor
using SliceErodeType = BinaryErodeImageFilter<SliceInternalImageType, SliceInternalImageType, SliceKernelType>;
auto serode = SliceErodeType::New();
using RadiusType = typename SliceKernelType::RadiusType;
RadiusType srad;
srad.Fill(typename RadiusType::SizeValueType{});
RadiusType srad{};
for (unsigned int i = 0, j = 0; i < ImageDimension; ++i)
{
if (j != static_cast<unsigned int>(m_SliceDimension) && (j < (ImageDimension - 1)))
Expand Down
21 changes: 7 additions & 14 deletions Modules/Nonunit/Review/include/itkLabelGeometryImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetCentroid(LabelPixelTy
if (mapIt == m_LabelGeometryMapper.end())
{
// label does not exist, return a default value
LabelPointType emptyCentroid;
emptyCentroid.Fill(typename LabelPointType::ValueType{});
LabelPointType emptyCentroid{};
return emptyCentroid;
}
else
Expand All @@ -652,8 +651,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetWeightedCentroid(Labe
if (mapIt == m_LabelGeometryMapper.end())
{
// label does not exist, return a default value
LabelPointType emptyCentroid;
emptyCentroid.Fill(typename LabelPointType::ValueType{});
LabelPointType emptyCentroid{};
return emptyCentroid;
}
else
Expand Down Expand Up @@ -710,8 +708,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetAxesLength(LabelPixel
if (mapIt == m_LabelGeometryMapper.end())
{
// label does not exist, return a default value
LabelPointType emptyAxesLength;
emptyAxesLength.Fill(typename AxesLengthType::ValueType{});
LabelPointType emptyAxesLength{};
return emptyAxesLength;
}
else
Expand Down Expand Up @@ -801,8 +798,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetBoundingBox(LabelPixe
mapIt = m_LabelGeometryMapper.find(label);
if (mapIt == m_LabelGeometryMapper.end())
{
BoundingBoxType emptyBox;
emptyBox.Fill(typename BoundingBoxType::ValueType{});
BoundingBoxType emptyBox{};
// label does not exist, return a default value
return emptyBox;
}
Expand Down Expand Up @@ -840,8 +836,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetBoundingBoxSize(Label
if (mapIt == m_LabelGeometryMapper.end())
{
// label does not exist, return a default value
LabelSizeType emptySize;
emptySize.Fill(typename LabelSizeType::SizeValueType{});
LabelSizeType emptySize{};
return emptySize;
}
else
Expand Down Expand Up @@ -904,8 +899,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetOrientedBoundingBoxSi
// LabelSizeType emptySize;
// emptySize.Fill( LabelSizeType::SizeValueType{});
// return emptySize;
LabelPointType emptySize;
emptySize.Fill(typename LabelPointType::ValueType{});
LabelPointType emptySize{};
return emptySize;
}
else
Expand All @@ -925,8 +919,7 @@ LabelGeometryImageFilter<TLabelImage, TIntensityImage>::GetOrientedBoundingBoxOr
if (mapIt == m_LabelGeometryMapper.end())
{
// label does not exist, return a default value
LabelPointType emptySize;
emptySize.Fill(typename LabelPointType::ValueType{});
LabelPointType emptySize{};
return emptySize;
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,7 @@ ObjectToObjectMetric<TFixedDimension, TMovingDimension, TVirtualImage, TParamete
}
else
{
VirtualOriginType origin;
origin.Fill(typename VirtualOriginType::ValueType{});
VirtualOriginType origin{};
return origin;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,7 @@ RGBGibbsPriorFilter<TInputImage, TClassifiedImage>::ApplyGibbsLabeller()
InputImagePixelType originPixelVec;

// Variable to store the modified pixel vector value.
InputImagePixelType changedPixelVec;
changedPixelVec.Fill(typename InputImagePixelType::ValueType{});
InputImagePixelType changedPixelVec{};

// Set a variable to store the offset index.
LabelledImageIndexType offsetIndex3D{};
Expand Down

0 comments on commit d905400

Please sign in to comment.