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
  • Loading branch information
N-Dekker committed Nov 23, 2024
1 parent 5fe285e commit 4e22843
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 26 deletions.
7 changes: 3 additions & 4 deletions Components/Optimizers/AdaGrad/elxAdaGrad.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,9 @@ AdaGrad<TElastix>::AutomaticPreconditionerEstimation()
}
#endif
/** Construct computeJacobianTerms to initialize the parameter estimation. */
double jacg = 0.0;
double maxJJ = 0.0;
typename ComputeDisplacementDistributionType::Pointer computeDisplacementDistribution =
ComputeDisplacementDistributionType::New();
double jacg = 0.0;
double maxJJ = 0.0;
auto computeDisplacementDistribution = ComputeDisplacementDistributionType::New();
computeDisplacementDistribution->SetFixedImage(testPtr->GetFixedImage());
computeDisplacementDistribution->SetFixedImageRegion(testPtr->GetFixedImageRegion());
computeDisplacementDistribution->SetFixedImageMask(testPtr->GetFixedImageMask());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,7 @@ AdaptiveStochasticGradientDescent<TElastix>::AutomaticParameterEstimationUsingDi
}

/** Construct computeJacobianTerms to initialize the parameter estimation. */
typename ComputeDisplacementDistributionType::Pointer computeDisplacementDistribution =
ComputeDisplacementDistributionType::New();
auto computeDisplacementDistribution = ComputeDisplacementDistributionType::New();
computeDisplacementDistribution->SetFixedImage(testPtr->GetFixedImage());
computeDisplacementDistribution->SetFixedImageRegion(testPtr->GetFixedImageRegion());
computeDisplacementDistribution->SetFixedImageMask(testPtr->GetFixedImageMask());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1069,8 +1069,7 @@ AdaptiveStochasticLBFGS<TElastix>::AutomaticParameterEstimationUsingDisplacement
}

/** Construct computeJacobianTerms to initialize the parameter estimation. */
typename ComputeDisplacementDistributionType::Pointer computeDisplacementDistribution =
ComputeDisplacementDistributionType::New();
auto computeDisplacementDistribution = ComputeDisplacementDistributionType::New();
computeDisplacementDistribution->SetFixedImage(testPtr->GetFixedImage());
computeDisplacementDistribution->SetFixedImageRegion(testPtr->GetFixedImageRegion());
computeDisplacementDistribution->SetFixedImageMask(testPtr->GetFixedImageMask());
Expand Down Expand Up @@ -1181,8 +1180,7 @@ AdaptiveStochasticLBFGS<TElastix>::AutomaticLBFGSStepsizeEstimation()
}

/** Construct computeJacobianTerms to initialize the parameter estimation. */
typename ComputeDisplacementDistributionType::Pointer computeDisplacementDistribution =
ComputeDisplacementDistributionType::New();
auto computeDisplacementDistribution = ComputeDisplacementDistributionType::New();
computeDisplacementDistribution->SetFixedImage(testPtr->GetFixedImage());
computeDisplacementDistribution->SetFixedImageRegion(testPtr->GetFixedImageRegion());
computeDisplacementDistribution->SetFixedImageMask(testPtr->GetFixedImageMask());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -927,8 +927,7 @@ AdaptiveStochasticVarianceReducedGradient<TElastix>::AutomaticParameterEstimatio
}

/** Construct computeJacobianTerms to initialize the parameter estimation. */
typename ComputeDisplacementDistributionType::Pointer computeDisplacementDistribution =
ComputeDisplacementDistributionType::New();
auto computeDisplacementDistribution = ComputeDisplacementDistributionType::New();
computeDisplacementDistribution->SetFixedImage(testPtr->GetFixedImage());
computeDisplacementDistribution->SetFixedImageRegion(testPtr->GetFixedImageRegion());
computeDisplacementDistribution->SetFixedImageMask(testPtr->GetFixedImageMask());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,7 @@ PreconditionedStochasticGradientDescent<TElastix>::AutomaticPreconditionerEstima
{
itk::TimeProbe timer4;
/** Construct computeJacobianTerms to initialize the parameter estimation. */
typename ComputeDisplacementDistributionType::Pointer computeDisplacementDistribution =
ComputeDisplacementDistributionType::New();
auto computeDisplacementDistribution = ComputeDisplacementDistributionType::New();
computeDisplacementDistribution->SetFixedImage(testPtr->GetFixedImage());
computeDisplacementDistribution->SetFixedImageRegion(testPtr->GetFixedImageRegion());
computeDisplacementDistribution->SetFixedImageMask(testPtr->GetFixedImageMask());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,7 @@ MultiBSplineTransformWithNormal<TElastix>::IncreaseScale()
const BaseContainer & new_bases = *new_Bases->GetPixelContainer();

typename ImageLabelType::Pointer labels1 = this->m_MultiBSplineTransformWithNormal->GetLabels();
typename itk::ResampleImageFilter<ImageLabelType, ImageLabelType>::Pointer filter =
itk::ResampleImageFilter<ImageLabelType, ImageLabelType>::New();
auto filter = itk::ResampleImageFilter<ImageLabelType, ImageLabelType>::New();
filter->SetInterpolator(itk::NearestNeighborInterpolateImageFunction<ImageLabelType, double>::New());
filter->SetInput(labels1);
filter->SetOutputParametersFromImage(new_Bases);
Expand Down
4 changes: 2 additions & 2 deletions Core/Main/itkElastixRegistrationMethod.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ ElastixRegistrationMethod<TFixedImage, TMovingImage>::GenerateData()
}

// Save parameter map
elx::ParameterObject::Pointer transformParameterObject = elx::ParameterObject::New();
auto transformParameterObject = elx::ParameterObject::New();
transformParameterObject->SetParameterMaps(transformParameterMapVector);
this->SetNthOutput(1, transformParameterObject);
}
Expand Down Expand Up @@ -506,7 +506,7 @@ ElastixRegistrationMethod<TFixedImage, TMovingImage>::MakeOutput(DataObjectPoint
{
if (idx == 1)
{
elx::ParameterObject::Pointer transformParameterObject = elx::ParameterObject::New();
auto transformParameterObject = elx::ParameterObject::New();
return transformParameterObject.GetPointer();
}
return Superclass::MakeOutput(idx);
Expand Down
2 changes: 1 addition & 1 deletion Testing/elxComputeOverlap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int
main(int argc, char ** argv)
{
/** Create a command line argument parser. */
itk::CommandLineArgumentParser::Pointer parser = itk::CommandLineArgumentParser::New();
auto parser = itk::CommandLineArgumentParser::New();
parser->SetCommandLineArguments(argc, argv);
parser->SetProgramHelpText(GetHelpString());

Expand Down
2 changes: 1 addition & 1 deletion Testing/elxImageCompare.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static const unsigned int ITK_TEST_DIMENSION_MAX = 4;
int
main(int argc, char ** argv)
{
itk::CommandLineArgumentParser::Pointer parser = itk::CommandLineArgumentParser::New();
auto parser = itk::CommandLineArgumentParser::New();
parser->SetCommandLineArguments(argc, argv);
parser->SetProgramHelpText(GetHelpString());

Expand Down
2 changes: 1 addition & 1 deletion Testing/elxInvertTransform.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int
main(int argc, char * argv[])
{
/** Read the command line arguments. */
itk::CommandLineArgumentParser::Pointer clParser = itk::CommandLineArgumentParser::New();
auto clParser = itk::CommandLineArgumentParser::New();
clParser->SetCommandLineArguments(argc, argv);
clParser->SetProgramHelpText(GetHelpString());

Expand Down
2 changes: 1 addition & 1 deletion Testing/elxTransformParametersCompare.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ main(int argc, char ** argv)
using MaskIteratorType = itk::ImageRegionIteratorWithIndex<MaskImageType>;

/** Create command line argument parser. */
itk::CommandLineArgumentParser::Pointer parser = itk::CommandLineArgumentParser::New();
auto parser = itk::CommandLineArgumentParser::New();
parser->SetCommandLineArguments(argc, argv);
parser->SetProgramHelpText(GetHelpString());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ main(int argc, char * argv[])
gpuFilter->SetComputeOnlyForCurrentLevel(computeOnlyForCurrentLevel);

// GPU input image
GPUInputImageType::Pointer gpuInputImage = GPUInputImageType::New();
auto gpuInputImage = GPUInputImageType::New();
gpuInputImage->GraftITKImage(inputImage);
gpuInputImage->AllocateGPU();
gpuInputImage->GetGPUDataManager()->SetCPUBufferLock(true);
Expand Down
2 changes: 1 addition & 1 deletion Testing/itkGPUResampleImageFilterTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ main(int argc, char * argv[])
}

// Create a command line argument parser
itk::CommandLineArgumentParser::Pointer parser = itk::CommandLineArgumentParser::New();
auto parser = itk::CommandLineArgumentParser::New();
parser->SetCommandLineArguments(argc, argv);
parser->SetProgramHelpText(GetHelpString());

Expand Down
2 changes: 1 addition & 1 deletion Testing/itkOpenCLContextTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
int
main()
{
itk::OpenCLContext::Pointer contextNull = itk::OpenCLContext::New();
auto contextNull = itk::OpenCLContext::New();

if (contextNull->IsCreated())
{
Expand Down
2 changes: 1 addition & 1 deletion Testing/itkOpenCLKernelManagerTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ main()
return EXIT_FAILURE;
}

itk::OpenCLKernelManager::Pointer kernelManager = itk::OpenCLKernelManager::New();
auto kernelManager = itk::OpenCLKernelManager::New();
if (kernelManager.IsNull())
{
return EXIT_FAILURE;
Expand Down

0 comments on commit 4e22843

Please sign in to comment.