Skip to content

Commit

Permalink
STYLE: Replace Fill(0) on local variables with {} initialization
Browse files Browse the repository at this point in the history
Replaced code of the form

    Type var;
    var.Fill(0);

and

    Type var;
    var.Fill(ElementType{});

with `Type var{};`

Using Notepad++, Replace in Files, doing:

    Find what: ^( [ ]+)([^ ].* )(\w+);[\r\n]+\1\3\.Fill\(0\.?0?\);
    Find what: ^( [ ]+)([^ ].* )(\w+);[\r\n]+\1\3\.Fill\(.*{}\);
    Replace with: $1$2$3{};
    [v] Match case
    (*) Regular expression

- Following ITK pull request InsightSoftwareConsortium/ITK#4897
commit InsightSoftwareConsortium/ITK@4733550
  • Loading branch information
N-Dekker committed Oct 26, 2024
1 parent 78f9051 commit feaeaa9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions Common/OpenCL/itkGPUKernelManagerHelperFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ SetKernelWithITKImage(OpenCLKernelManager::Pointer & kernelManager,
}
else
{
typename ImageType::DirectionType dir_null;
dir_null.Fill(0);
typename ImageType::DirectionType dir_null{};
SetKernelWithDirection<ImageType>(dir_null, imageBase1D.Direction, imageBase2D.Direction, imageBase3D.Direction);

SetKernelWithDirection<ImageType>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ RayCastInterpolator<TElastix>::BeforeRegistration()

this->SetTransform(this->m_CombinationTransform);

PointType focalPoint;
focalPoint.Fill(0.);
PointType focalPoint{};

for (unsigned int i = 0; i < TElastix::FixedDimension; ++i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ RayCastResampleInterpolator<TElastix>::InitializeRayCastInterpolator()
}
}

typename EulerTransformType::InputPointType centerofrotation;
centerofrotation.Fill(0.0);
typename EulerTransformType::InputPointType centerofrotation{};

for (unsigned int i = 0; i < TElastix::MovingDimension; ++i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ DeformationFieldRegulizer<TAnyITKTransform>::InitializeDeformationFields()

/** Set everything to zero. */
IteratorType it(intermediaryDeformationField, intermediaryDeformationField->GetLargestPossibleRegion());
VectorPixelType vec;
vec.Fill(ScalarType{});
VectorPixelType vec{};
while (!it.IsAtEnd())
{
it.Set(vec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ DeformationFieldInterpolatingTransform<TScalarType, NDimensions, TComponentType>
{
this->m_DeformationField = nullptr;
this->m_ZeroDeformationField = DeformationFieldType::New();
typename DeformationFieldType::SizeType dummySize;
dummySize.Fill(0);
typename DeformationFieldType::SizeType dummySize{};
this->m_ZeroDeformationField->SetRegions(dummySize);
this->SetIdentity();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,7 @@ template <typename TScalarType, unsigned int NDimensions>
auto
KernelTransform2<TScalarType, NDimensions>::TransformPoint(const InputPointType & thisPoint) const -> OutputPointType
{
OutputPointType opp;
opp.Fill(typename OutputPointType::ValueType{});
OutputPointType opp{};
this->ComputeDeformationContribution(thisPoint, opp);

// Add the rotational part of the Affine component
Expand Down

0 comments on commit feaeaa9

Please sign in to comment.