Skip to content

Commit

Permalink
STYLE: Replace T::Pointer with auto when initializing variables by New()
Browse files Browse the repository at this point in the history
Using Notepad++, Replace in Files, doing:

    Find what: ^( [ ]+)(typename )?([^ ].+)::Pointer[ ]+(\w+[ ]+= \3::New\(\);)
    Find what: ^( [ ]+)(typename )?([^ ].+)::Pointer[ ]+(\w+[ ]+=\r\n\1  \3::New\(\);)
    Replace with: $1auto $4
    Filters: itk*.* !+\test
    Directory: D:\src\ITK\Modules
    [v] Match case
    (*) Regular expression

Manually excluded the initialization of `m_ConvolutionImageFilter` (in
"itkFFTDiscreteGaussianImageFilter.h") as it is not a local variable.

Follow-up to pull request InsightSoftwareConsortium#2826
commit 5ab79bc
"STYLE: Use `auto` for declaration of variables initialized by `New()`"
  • Loading branch information
N-Dekker committed Nov 20, 2024
1 parent b67b7bd commit bb10ea8
Show file tree
Hide file tree
Showing 88 changed files with 138 additions and 226 deletions.
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkMetaDataObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ template <typename T>
inline void
EncapsulateMetaData(MetaDataDictionary & Dictionary, const std::string & key, const T & invalue)
{
typename MetaDataObject<T>::Pointer temp = MetaDataObject<T>::New();
auto temp = MetaDataObject<T>::New();
temp->SetMetaDataObjectValue(invalue);
Dictionary[key] = temp;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MetaConverterBase<VDimension>::MetaObjectToSpatialObjectBase(const MetaObjectTyp
{
rval->SetId(mo->ID());
rval->SetParentId(mo->ParentID());
typename SpatialObject<VDimension>::TransformType::Pointer tfm = SpatialObject<VDimension>::TransformType::New();
auto tfm = SpatialObject<VDimension>::TransformType::New();
typename SpatialObject<VDimension>::TransformType::OffsetType off;
typename SpatialObject<VDimension>::TransformType::MatrixType mat;
typename SpatialObject<VDimension>::TransformType::CenterType cen;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Core/TestKernel/src/itkTestDriverInclude.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ void
GetImageType(const char * fileName, itk::IOPixelEnum & pixelType, itk::IOComponentEnum & componentType)
{
using ImageType = itk::Image<unsigned char, 3>;
itk::ImageFileReader<ImageType>::Pointer imageReader = itk::ImageFileReader<ImageType>::New();
auto imageReader = itk::ImageFileReader<ImageType>::New();
imageReader->SetFileName(fileName);
imageReader->UpdateOutputInformation();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ class ITK_TEMPLATE_EXPORT CurvatureAnisotropicDiffusionImageFilter
protected:
CurvatureAnisotropicDiffusionImageFilter()
{
typename CurvatureNDAnisotropicDiffusionFunction<UpdateBufferType>::Pointer q =
CurvatureNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
auto q = CurvatureNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
this->SetDifferenceFunction(q);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ class ITK_TEMPLATE_EXPORT GradientAnisotropicDiffusionImageFilter
protected:
GradientAnisotropicDiffusionImageFilter()
{
typename GradientNDAnisotropicDiffusionFunction<UpdateBufferType>::Pointer p =
GradientNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
auto p = GradientNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
this->SetDifferenceFunction(p);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ class ITK_TEMPLATE_EXPORT VectorCurvatureAnisotropicDiffusionImageFilter
protected:
VectorCurvatureAnisotropicDiffusionImageFilter()
{
typename VectorCurvatureNDAnisotropicDiffusionFunction<UpdateBufferType>::Pointer q =
VectorCurvatureNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
auto q = VectorCurvatureNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
this->SetDifferenceFunction(q);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ class ITK_TEMPLATE_EXPORT VectorGradientAnisotropicDiffusionImageFilter
protected:
VectorGradientAnisotropicDiffusionImageFilter()
{
typename VectorGradientNDAnisotropicDiffusionFunction<UpdateBufferType>::Pointer p =
VectorGradientNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
auto p = VectorGradientNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
this->SetDifferenceFunction(p);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ AntiAliasBinaryImageFilter<TInputImage, TOutputImage>::GenerateData()
// Find the minimum and maximum of the input image and use these values to
// set m_UpperBinaryValue, m_LowerBinaryValue, and m_IsoSurfaceValue in the
// parent class.
typename itk::MinimumMaximumImageCalculator<InputImageType>::Pointer minmax =
itk::MinimumMaximumImageCalculator<InputImageType>::New();
auto minmax = itk::MinimumMaximumImageCalculator<InputImageType>::New();
minmax->SetImage(m_InputImage);
minmax->ComputeMinimum();
minmax->ComputeMaximum();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ MRIBiasFieldCorrectionFilter<TInputImage, TOutputImage, TMaskImage>::GenerateDat
{
itkDebugMacro("Searching slabs...");

typename MRASlabIdentifier<InputImageType>::Pointer identifier = MRASlabIdentifier<InputImageType>::New();
auto identifier = MRASlabIdentifier<InputImageType>::New();
// Find slabs
identifier->SetImage(this->GetInput());
identifier->SetNumberOfSamples(m_SlabNumberOfSamples);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ N4BiasFieldCorrectionImageFilter<TInputImage, TMaskImage, TOutputImage>::UpdateB
auto & pointDataSTLContainer = fieldPoints->GetPointData()->CastToSTLContainer();
pointDataSTLContainer.reserve(numberOfIncludedPixels);

typename BSplineFilterType::WeightsContainerType::Pointer weights = BSplineFilterType::WeightsContainerType::New();
auto weights = BSplineFilterType::WeightsContainerType::New();
weights->Initialize();
auto & weightSTLContainer = weights->CastToSTLContainer();
weightSTLContainer.reserve(numberOfIncludedPixels);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ BinaryClosingByReconstructionImageFilter<TInputImage, TKernel>::GenerateData()
}

/** set up erosion and dilation methods */
typename BinaryDilateImageFilter<TInputImage, TInputImage, TKernel>::Pointer dilate =
BinaryDilateImageFilter<TInputImage, TInputImage, TKernel>::New();
auto dilate = BinaryDilateImageFilter<TInputImage, TInputImage, TKernel>::New();

typename BinaryReconstructionByErosionImageFilter<OutputImageType>::Pointer erode =
BinaryReconstructionByErosionImageFilter<OutputImageType>::New();
auto erode = BinaryReconstructionByErosionImageFilter<OutputImageType>::New();

// create the pipeline without input and output image
dilate->ReleaseDataFlagOn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ BinaryMorphologicalClosingImageFilter<TInputImage, TOutputImage, TKernel>::Gener
}

/** set up erosion and dilation methods */
typename BinaryDilateImageFilter<TInputImage, TInputImage, TKernel>::Pointer dilate =
BinaryDilateImageFilter<TInputImage, TInputImage, TKernel>::New();
auto dilate = BinaryDilateImageFilter<TInputImage, TInputImage, TKernel>::New();

typename BinaryErodeImageFilter<TInputImage, TOutputImage, TKernel>::Pointer erode =
BinaryErodeImageFilter<TInputImage, TOutputImage, TKernel>::New();
auto erode = BinaryErodeImageFilter<TInputImage, TOutputImage, TKernel>::New();

// create the pipeline without input and output image
dilate->ReleaseDataFlagOn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ BinaryMorphologicalOpeningImageFilter<TInputImage, TOutputImage, TKernel>::Gener
this->AllocateOutputs();

/** set up erosion and dilation methods */
typename BinaryDilateImageFilter<TInputImage, TOutputImage, TKernel>::Pointer dilate =
BinaryDilateImageFilter<TInputImage, TOutputImage, TKernel>::New();
auto dilate = BinaryDilateImageFilter<TInputImage, TOutputImage, TKernel>::New();

typename BinaryErodeImageFilter<TInputImage, TInputImage, TKernel>::Pointer erode =
BinaryErodeImageFilter<TInputImage, TInputImage, TKernel>::New();
auto erode = BinaryErodeImageFilter<TInputImage, TInputImage, TKernel>::New();

dilate->SetKernel(this->GetKernel());
dilate->ReleaseDataFlagOn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@ BinaryOpeningByReconstructionImageFilter<TInputImage, TKernel>::GenerateData()
this->AllocateOutputs();

/** set up erosion and dilation methods */
typename BinaryErodeImageFilter<InputImageType, OutputImageType, TKernel>::Pointer erode =
BinaryErodeImageFilter<InputImageType, OutputImageType, TKernel>::New();
auto erode = BinaryErodeImageFilter<InputImageType, OutputImageType, TKernel>::New();
erode->SetForegroundValue(m_ForegroundValue); // Intensity value to erode
erode->SetBackgroundValue(m_BackgroundValue); // Replacement value of eroded voxels
erode->SetKernel(this->GetKernel());
erode->SetInput(this->GetInput());
erode->ReleaseDataFlagOn();
erode->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits());

typename BinaryReconstructionByDilationImageFilter<OutputImageType>::Pointer dilate =
BinaryReconstructionByDilationImageFilter<OutputImageType>::New();
auto dilate = BinaryReconstructionByDilationImageFilter<OutputImageType>::New();
dilate->SetForegroundValue(m_ForegroundValue);
dilate->SetBackgroundValue(m_BackgroundValue);
dilate->SetMarkerImage(erode->GetOutput());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ BinaryMinMaxCurvatureFlowImageFilter<TInputImage, TOutputImage>::BinaryMinMaxCur
{
m_Threshold = 0.0;

typename BinaryMinMaxCurvatureFlowFunctionType::Pointer cffp = BinaryMinMaxCurvatureFlowFunctionType::New();
auto cffp = BinaryMinMaxCurvatureFlowFunctionType::New();

this->SetDifferenceFunction(static_cast<FiniteDifferenceFunctionType *>(cffp.GetPointer()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CurvatureFlowImageFilter<TInputImage, TOutputImage>::CurvatureFlowImageFilter()
this->SetNumberOfIterations(0);
m_TimeStep = 0.05f;

typename CurvatureFlowFunctionType::Pointer cffp = CurvatureFlowFunctionType::New();
auto cffp = CurvatureFlowFunctionType::New();

this->SetDifferenceFunction(static_cast<FiniteDifferenceFunctionType *>(cffp.GetPointer()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MinMaxCurvatureFlowImageFilter<TInputImage, TOutputImage>::MinMaxCurvatureFlowIm
{
m_StencilRadius = 2;

typename MinMaxCurvatureFlowFunctionType::Pointer cffp = MinMaxCurvatureFlowFunctionType::New();
auto cffp = MinMaxCurvatureFlowFunctionType::New();

this->SetDifferenceFunction(static_cast<FiniteDifferenceFunctionType *>(cffp.GetPointer()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ DiffusionTensor3DReconstructionImageFilter<TReferenceImagePixelType,
TTensorPixelType,
TMaskImageType>::SetMaskImage(MaskImageType * maskImage)
{
typename ImageMaskSpatialObject<3>::Pointer maskSpatialObject = ImageMaskSpatialObject<3>::New();
auto maskSpatialObject = ImageMaskSpatialObject<3>::New();
maskSpatialObject->SetImage(maskImage);
this->SetMaskSpatialObject(maskSpatialObject);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ DisplacementFieldJacobianDeterminantFilter<TInputImage, TRealType, TOutputImage>
//
// cast might not be necessary, but CastImageFilter is optimized for
// the case where the InputImageType == OutputImageType
typename CastImageFilter<TInputImage, RealVectorImageType>::Pointer caster =
CastImageFilter<TInputImage, RealVectorImageType>::New();
auto caster = CastImageFilter<TInputImage, RealVectorImageType>::New();
caster->SetInput(this->GetInput());
caster->Update();
m_RealValuedInputImage = caster->GetOutput();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ TimeVaryingVelocityFieldIntegrationImageFilter<TTimeVaryingVelocityField,
using DefaultVelocityFieldInterpolatorType =
VectorLinearInterpolateImageFunction<TimeVaryingVelocityFieldType, ScalarType>;

typename DefaultVelocityFieldInterpolatorType::Pointer velocityFieldInterpolator =
DefaultVelocityFieldInterpolatorType::New();
auto velocityFieldInterpolator = DefaultVelocityFieldInterpolatorType::New();

this->m_VelocityFieldInterpolator = velocityFieldInterpolator;

using DefaultDisplacementFieldInterpolatorType =
VectorLinearInterpolateImageFunction<DisplacementFieldType, ScalarType>;

typename DefaultDisplacementFieldInterpolatorType::Pointer deformationFieldInterpolator =
DefaultDisplacementFieldInterpolatorType::New();
auto deformationFieldInterpolator = DefaultDisplacementFieldInterpolatorType::New();

this->m_DisplacementFieldInterpolator = deformationFieldInterpolator;
this->DynamicMultiThreadingOn();
Expand Down
2 changes: 1 addition & 1 deletion Modules/Filtering/FFT/include/itkFFTImageFilterFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class FFTImageFilterFactory : public itk::ObjectFactoryBase
static void
RegisterOneFactory()
{
FFTImageFilterFactory::Pointer factory = FFTImageFilterFactory::New();
auto factory = FFTImageFilterFactory::New();

ObjectFactoryBase::RegisterFactoryInternal(factory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ class GPUGradientAnisotropicDiffusionImageFilter
GPUGradientAnisotropicDiffusionImageFilter()
{
// Set DiffusionFunction
typename GPUGradientNDAnisotropicDiffusionFunction<UpdateBufferType>::Pointer p =
GPUGradientNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
auto p = GPUGradientNDAnisotropicDiffusionFunction<UpdateBufferType>::New();
this->SetDifferenceFunction(p);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class GPUGradientAnisotropicDiffusionImageFilterFactory : public ObjectFactoryBa
static void
RegisterOneFactory()
{
GPUGradientAnisotropicDiffusionImageFilterFactory::Pointer factory =
GPUGradientAnisotropicDiffusionImageFilterFactory::New();
auto factory = GPUGradientAnisotropicDiffusionImageFilterFactory::New();

itk::ObjectFactoryBase::RegisterFactory(factory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ BilateralImageFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData()
localInput->Graft(this->GetInput());

// First, determine the min and max intensity range
typename StatisticsImageFilter<TInputImage>::Pointer statistics = StatisticsImageFilter<TInputImage>::New();
auto statistics = StatisticsImageFilter<TInputImage>::New();

statistics->SetInput(localInput);
statistics->Update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>::GenerateData()
output->Graft(this->GetOutput());
this->m_OutputImage = output;

typename ZeroCrossingImageFilter<TOutputImage, TOutputImage>::Pointer zeroCrossFilter =
ZeroCrossingImageFilter<TOutputImage, TOutputImage>::New();
auto zeroCrossFilter = ZeroCrossingImageFilter<TOutputImage, TOutputImage>::New();

this->AllocateUpdateBuffer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ DerivativeImageFilter<TInputImage, TOutputImage>::GenerateData()
}
}

typename NeighborhoodOperatorImageFilter<InputImageType, OutputImageType, OperatorValueType>::Pointer filter =
NeighborhoodOperatorImageFilter<InputImageType, OutputImageType, OperatorValueType>::New();
auto filter = NeighborhoodOperatorImageFilter<InputImageType, OutputImageType, OperatorValueType>::New();

// Create a process accumulator for tracking the progress of this minipipeline
auto progress = ProgressAccumulator::New();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ LaplacianSharpeningImageFilter<TInputImage, TOutputImage>::GenerateData()

// Calculate the needed input image statistics

typename StatisticsImageFilter<InputImageType>::Pointer inputCalculator =
StatisticsImageFilter<InputImageType>::New();
auto inputCalculator = StatisticsImageFilter<InputImageType>::New();

inputCalculator->SetInput(localInput);
inputCalculator->Update();
Expand Down Expand Up @@ -129,8 +128,7 @@ LaplacianSharpeningImageFilter<TInputImage, TOutputImage>::GenerateData()
binaryFilter->Update();

// Calculate needed combined image statistics
typename StatisticsImageFilter<RealImageType>::Pointer enhancedCalculator =
StatisticsImageFilter<RealImageType>::New();
auto enhancedCalculator = StatisticsImageFilter<RealImageType>::New();

enhancedCalculator->SetInput(binaryFilter->GetOutput());
enhancedCalculator->Update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,9 @@ ZeroCrossingBasedEdgeDetectionImageFilter<TInputImage, TOutputImage>::GenerateDa
typename InputImageType::ConstPointer input = this->GetInput();

// Create the filters that are needed
typename DiscreteGaussianImageFilter<TInputImage, TOutputImage>::Pointer gaussianFilter =
DiscreteGaussianImageFilter<TInputImage, TOutputImage>::New();
typename LaplacianImageFilter<TInputImage, TOutputImage>::Pointer laplacianFilter =
LaplacianImageFilter<TInputImage, TOutputImage>::New();
typename ZeroCrossingImageFilter<TInputImage, TOutputImage>::Pointer zerocrossingFilter =
ZeroCrossingImageFilter<TInputImage, TOutputImage>::New();
auto gaussianFilter = DiscreteGaussianImageFilter<TInputImage, TOutputImage>::New();
auto laplacianFilter = LaplacianImageFilter<TInputImage, TOutputImage>::New();
auto zerocrossingFilter = ZeroCrossingImageFilter<TInputImage, TOutputImage>::New();

// Create a process accumulator for tracking the progress of this minipipeline
auto progress = ProgressAccumulator::New();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ VectorGradientMagnitudeImageFilter<TInputImage, TRealType, TOutputImage>::Before
//
// cast might not be necessary, but CastImageFilter is optimized for
// the case where the InputImageType == OutputImageType
typename CastImageFilter<TInputImage, RealVectorImageType>::Pointer caster =
CastImageFilter<TInputImage, RealVectorImageType>::New();
auto caster = CastImageFilter<TInputImage, RealVectorImageType>::New();
caster->SetInput(this->GetInput());
caster->GetOutput()->SetRequestedRegion(this->GetInput()->GetRequestedRegion());
caster->Update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ BSplineResampleImageFilterBase<TInputImage, TOutputImage>::ReduceNDImage(OutputI

// Initialize scratchImage space and allocate memory
InitializeScratch(startSize);
typename TOutputImage::Pointer scratchImage = TOutputImage::New();
auto scratchImage = TOutputImage::New();
scratchImage->CopyInformation(inputPtr);
RegionType scratchRegion = inputPtr->GetBufferedRegion();
currentSize = startSize;
Expand Down Expand Up @@ -461,7 +461,7 @@ BSplineResampleImageFilterBase<TInputImage, TOutputImage>::ExpandNDImage(OutputI

// Initialize scratchImage space and allocate memory
InitializeScratch(startSize);
typename TOutputImage::Pointer scratchImage = TOutputImage::New();
auto scratchImage = TOutputImage::New();
scratchImage->CopyInformation(inputPtr);
RegionType scratchRegion = inputPtr->GetBufferedRegion();
currentSize = startSize;
Expand Down
3 changes: 1 addition & 2 deletions Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ TileImageFilter<TInputImage, TOutputImage>::GenerateData()
{
if (it.Get().m_ImageNumber >= 0)
{
typename PasteImageFilter<TOutputImage, TempImageType>::Pointer paste =
PasteImageFilter<TOutputImage, TempImageType>::New();
auto paste = PasteImageFilter<TOutputImage, TempImageType>::New();
paste->SetDestinationImage(output);
paste->InPlaceOn();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ class ScanlineFilterCommon
using PretendIndexType = typename PretendImageType::RegionType::IndexType;
using LineNeighborhoodType = ConstShapedNeighborhoodIterator<PretendImageType>;

typename PretendImageType::Pointer fakeImage = PretendImageType::New();
auto fakeImage = PretendImageType::New();

typename PretendImageType::RegionType LineRegion;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ AdditiveGaussianNoiseImageFilter<TInputImage, TOutputImage>::ThreadedGenerateDat
{
indSeed += outputRegionForThread.GetIndex(d);
}
typename Statistics::NormalVariateGenerator::Pointer randn = Statistics::NormalVariateGenerator::New();
const uint32_t seed = Self::Hash(this->GetSeed(), uint32_t(indSeed));
auto randn = Statistics::NormalVariateGenerator::New();
const uint32_t seed = Self::Hash(this->GetSeed(), uint32_t(indSeed));
// Convert the seed bit for bit to int32_t
randn->Initialize(bit_cast<int32_t>(seed));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ SaltAndPepperNoiseImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
{
indSeed += outputRegionForThread.GetIndex(d);
}
typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer rand =
Statistics::MersenneTwisterRandomVariateGenerator::New();
auto rand = Statistics::MersenneTwisterRandomVariateGenerator::New();
const uint32_t seed = Self::Hash(this->GetSeed(), uint32_t(indSeed));
rand->Initialize(seed);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ ShotNoiseImageFilter<TInputImage, TOutputImage>::ThreadedGenerateData(
{
indSeed += outputRegionForThread.GetIndex(d);
}
typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer rand =
Statistics::MersenneTwisterRandomVariateGenerator::New();
auto rand = Statistics::MersenneTwisterRandomVariateGenerator::New();
const uint32_t seed = Self::Hash(this->GetSeed(), uint32_t(indSeed));
rand->Initialize(seed);
typename Statistics::NormalVariateGenerator::Pointer randn = Statistics::NormalVariateGenerator::New();
auto randn = Statistics::NormalVariateGenerator::New();
randn->Initialize(bit_cast<int32_t>(seed));

// Define the portion of the input to walk for this thread, using
Expand Down
Loading

0 comments on commit bb10ea8

Please sign in to comment.