Skip to content

Commit

Permalink
STYLE: Replace Fill calls with auto var = MakeFilled<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Dekker committed Nov 15, 2024
1 parent 7400da3 commit f67d1f8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions Common/ImageSamplers/itkImageGridSampler.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,7 @@ ImageGridSampler<TInputImage>::SetNumberOfSamples(unsigned long nrofsamples)
* Do not use the SetSampleGridSpacing function because it calls
* SetNumberOfSamples(0) internally.
*/
SampleGridSpacingType gridSpacings;
gridSpacings.Fill(gridSpacing);
auto gridSpacings = MakeFilled<SampleGridSpacingType>(gridSpacing);
if (m_SampleGridSpacing != gridSpacings)
{
m_SampleGridSpacing = gridSpacings;
Expand Down
3 changes: 1 addition & 2 deletions Common/Transforms/itkGridScheduleComputer.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ GridScheduleComputer<TTransformScalarType, VImageDimension>::SetDefaultSchedule(
this->SetUpsamplingFactor(upsamplingFactor);

/** Initialize the schedule. */
GridSpacingFactorType factors;
factors.Fill(1.0);
auto factors = MakeFilled<GridSpacingFactorType>(1.0);
this->m_GridSpacingFactors.clear();
this->m_GridSpacingFactors.resize(levels, factors);

Expand Down
3 changes: 1 addition & 2 deletions Common/itkParabolicErodeDilateImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ template <typename TInputImage, bool doDilate, typename TOutputImage>
void
ParabolicErodeDilateImageFilter<TInputImage, doDilate, TOutputImage>::SetScale(ScalarRealType scale)
{
RadiusType s;
s.Fill(scale);
auto s = MakeFilled<RadiusType>(scale);
this->SetScale(s);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ DistancePreservingRigidityPenaltyTerm<TFixedImage, TScalarType>::GetValue(const
typename PenaltyGridImageType::PointType penaltyGridPoint, neighborPenaltyGridPoint, xn, xf;

using NeighborhoodIteratorType = itk::ConstNeighborhoodIterator<PenaltyGridImageType>;
typename NeighborhoodIteratorType::RadiusType radius;
radius.Fill(1);
auto radius = MakeFilled<typename NeighborhoodIteratorType::RadiusType>(1);
NeighborhoodIteratorType ni(radius, this->m_PenaltyGridImage, penaltyGridImageRegion);
unsigned int numberOfNeighborhood = ni.Size();

Expand Down Expand Up @@ -330,8 +329,7 @@ DistancePreservingRigidityPenaltyTerm<TFixedImage, TScalarType>::GetValueAndDeri

// neighborhood iterator
using NeighborhoodIteratorType = itk::ConstNeighborhoodIterator<PenaltyGridImageType>;
typename NeighborhoodIteratorType::RadiusType radius;
radius.Fill(1);
auto radius = MakeFilled<typename NeighborhoodIteratorType::RadiusType>(1);
NeighborhoodIteratorType ni(radius, this->m_PenaltyGridImage, penaltyGridImageRegion);
unsigned int numberOfNeighborhood = ni.Size();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1555,8 +1555,7 @@ TransformRigidityPenaltyTerm<TFixedImage, TScalarType>::GetValueAndDerivative(co
std::vector<std::vector<NeighborhoodIteratorType>> nitOCp(ImageDimension);
std::vector<std::vector<NeighborhoodIteratorType>> nitPCp(ImageDimension);
std::vector<std::vector<NeighborhoodIteratorType>> nitLCp(ImageDimension);
RadiusType radius;
radius.Fill(1);
auto radius = MakeFilled<RadiusType>(1);
for (unsigned int i = 0; i < ImageDimension; ++i)
{
nitOCp[i].resize(ImageDimension);
Expand Down

0 comments on commit f67d1f8

Please sign in to comment.