Skip to content

Commit

Permalink
STYLE: Replace T var; var = x with T var = x
Browse files Browse the repository at this point in the history
Using Notepad++, Replace in Files, doing:

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

Excluded ConceptChecking, ImageKmeansModelEstimator, MahalanobisDistanceThresholdImageFunction::SetCovariance, QuasiNewtonOptimizerv4Template, VariableSizeMatrix::operator*
  • Loading branch information
N-Dekker committed Nov 13, 2024
1 parent 7a485da commit 68e60ba
Show file tree
Hide file tree
Showing 109 changed files with 184 additions and 414 deletions.
4 changes: 1 addition & 3 deletions Modules/Core/Common/include/itkAnnulusOperator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ template <typename TPixel, unsigned int TDimension, typename TAllocator>
void
AnnulusOperator<TPixel, TDimension, TAllocator>::CreateOperator()
{
CoefficientVector coefficients;

coefficients = this->GenerateCoefficients();
CoefficientVector coefficients = this->GenerateCoefficients();

this->Fill(coefficients);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,7 @@ inline ConstNeighborhoodIteratorWithOnlyIndex<TImage>
operator+(const ConstNeighborhoodIteratorWithOnlyIndex<TImage> & it,
const typename ConstNeighborhoodIteratorWithOnlyIndex<TImage>::OffsetType & ind)
{
ConstNeighborhoodIteratorWithOnlyIndex<TImage> ret;
ret = it;
ConstNeighborhoodIteratorWithOnlyIndex<TImage> ret = it;
ret += ind;
return ret;
}
Expand All @@ -428,8 +427,7 @@ inline ConstNeighborhoodIteratorWithOnlyIndex<TImage>
operator-(const ConstNeighborhoodIteratorWithOnlyIndex<TImage> & it,
const typename ConstNeighborhoodIteratorWithOnlyIndex<TImage>::OffsetType & ind)
{
ConstNeighborhoodIteratorWithOnlyIndex<TImage> ret;
ret = it;
ConstNeighborhoodIteratorWithOnlyIndex<TImage> ret = it;
ret -= ind;
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ template <typename TImage>
void
ImageRegionExclusionConstIteratorWithIndex<TImage>::SetExclusionRegionToInsetRegion()
{
RegionType excludeRegion;

excludeRegion = this->m_Region;
RegionType excludeRegion = this->m_Region;
for (unsigned int i = 0; i < TImage::ImageDimension; ++i)
{
if (excludeRegion.GetSize()[i] >= 2)
Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/Common/include/itkLaplacianOperator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ template <typename TPixel, unsigned int VDimension, typename TAllocator>
void
LaplacianOperator<TPixel, VDimension, TAllocator>::CreateOperator()
{
CoefficientVector coefficients;

coefficients = this->GenerateCoefficients();
CoefficientVector coefficients = this->GenerateCoefficients();

this->Fill(coefficients);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ FiniteDifferenceImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRe

// get a copy of the input requested region (should equal the output
// requested region)
typename TInputImage::RegionType inputRequestedRegion;
inputRequestedRegion = inputPtr->GetRequestedRegion();
typename TInputImage::RegionType inputRequestedRegion = inputPtr->GetRequestedRegion();

// pad the input requested region by the operator radius
inputRequestedRegion.PadByRadius(radius);
Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/GPUCommon/include/itkGPUInPlaceImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ GPUInPlaceImageFilter<TInputImage, TOutputImage, TParentImageFilter>::AllocateOu
{
// if we cannot cast the input to an output type, then allocate
// an output usual.
OutputImagePointer outputPtr;

outputPtr = this->GetOutput(0);
OutputImagePointer outputPtr = this->GetOutput(0);
outputPtr->SetBufferedRegion(outputPtr->GetRequestedRegion());
outputPtr->Allocate();
}
Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/GPUCommon/include/itkGPUKernelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ class GPUKernelManager : public LightObject
return false;
}

cl_int errid;

errid = clSetKernelArg(m_KernelContainer[kernelIdx], argIdx, sizeof(cl_mem), manager->GetGPUBufferPointer());
cl_int errid = clSetKernelArg(m_KernelContainer[kernelIdx], argIdx, sizeof(cl_mem), manager->GetGPUBufferPointer());
OpenCLCheckError(errid, __FILE__, __LINE__, ITK_LOCATION);

m_KernelArgumentReady[kernelIdx][argIdx].m_IsReady = true;
Expand Down
27 changes: 11 additions & 16 deletions Modules/Core/GPUCommon/src/itkGPUKernelManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,7 @@ GPUKernelManager::SetKernelArg(int kernelIdx, cl_uint argIdx, size_t argSize, co
return false;
}

cl_int errid;

errid = clSetKernelArg(m_KernelContainer[kernelIdx], argIdx, argSize, argVal);
cl_int errid = clSetKernelArg(m_KernelContainer[kernelIdx], argIdx, argSize, argVal);
OpenCLCheckError(errid, __FILE__, __LINE__, ITK_LOCATION);

m_KernelArgumentReady[kernelIdx][argIdx].m_IsReady = true;
Expand Down Expand Up @@ -413,9 +411,7 @@ GPUKernelManager::SetKernelArgWithImage(int kernelIdx, cl_uint argIdx, GPUDataMa
return false;
}

cl_int errid;

errid = clSetKernelArg(m_KernelContainer[kernelIdx], argIdx, sizeof(cl_mem), manager->GetGPUBufferPointer());
cl_int errid = clSetKernelArg(m_KernelContainer[kernelIdx], argIdx, sizeof(cl_mem), manager->GetGPUBufferPointer());
OpenCLCheckError(errid, __FILE__, __LINE__, ITK_LOCATION);

m_KernelArgumentReady[kernelIdx][argIdx].m_IsReady = true;
Expand Down Expand Up @@ -624,16 +620,15 @@ GPUKernelManager::LaunchKernel(int kernelIdx, int dim, size_t * globalWorkSize,
// localWorkSize[0] = localWorkSize[1] = localWorkSize[2] = 1;
//

cl_int errid;
errid = clEnqueueNDRangeKernel(m_Manager->GetCommandQueue(m_CommandQueueId),
m_KernelContainer[kernelIdx],
(cl_uint)dim,
nullptr,
globalWorkSize,
localWorkSize,
0,
nullptr,
nullptr);
cl_int errid = clEnqueueNDRangeKernel(m_Manager->GetCommandQueue(m_CommandQueueId),
m_KernelContainer[kernelIdx],
(cl_uint)dim,
nullptr,
globalWorkSize,
localWorkSize,
0,
nullptr,
nullptr);
OpenCLCheckError(errid, __FILE__, __LINE__, ITK_LOCATION);

/*
Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/GPUCommon/src/itkOpenCLUtil.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ OpenCLGetAvailableDevices(cl_platform_id platform, cl_device_type devType, cl_ui
cl_uint totalNumDevices;

// get total # of devices
cl_int errid;

errid = clGetDeviceIDs(platform, devType, 0, nullptr, &totalNumDevices);
cl_int errid = clGetDeviceIDs(platform, devType, 0, nullptr, &totalNumDevices);
OpenCLCheckError(errid, __FILE__, __LINE__, ITK_LOCATION);

auto * totalDevices = (cl_device_id *)malloc(totalNumDevices * sizeof(cl_device_id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ GPUFiniteDifferenceImageFilter<TInputImage, TOutputImage, TParentImageFilter>::G

// get a copy of the input requested region (should equal the output
// requested region)
typename TInputImage::RegionType inputRequestedRegion;
inputRequestedRegion = inputPtr->GetRequestedRegion();
typename TInputImage::RegionType inputRequestedRegion = inputPtr->GetRequestedRegion();

// pad the input requested region by the operator radius
inputRequestedRegion.PadByRadius(radius);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ class NthElementPixelAccessor<TOutputPixelType, itk::VariableLengthVector<TPixel
inline ExternalType
Get(const ActualPixelType & input) const
{
ExternalType output;

output = static_cast<ExternalType>(input[m_ElementNumber]);
ExternalType output = static_cast<ExternalType>(input[m_ElementNumber]);
return output;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ class VectorImageToImagePixelAccessor : private DefaultVectorPixelAccessor<TType
inline ExternalType
Get(const ActualPixelType & input) const
{
ExternalType output;

output = input[m_ComponentIdx];
ExternalType output = input[m_ComponentIdx];
return output;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ GaussianBlurImageFunction<TInputImage, TOutput>::EvaluateAtIndex(const IndexType
}

// first direction
typename InternalImageType::IndexType ind;
ind = index;
typename InternalImageType::IndexType ind = index;

// Define the region of the iterator
typename InternalImageType::RegionType region;
Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/ImageFunction/include/itkMeanImageFunction.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ template <typename TInputImage, typename TCoordRep>
auto
MeanImageFunction<TInputImage, TCoordRep>::EvaluateAtIndex(const IndexType & index) const -> RealType
{
RealType sum;

sum = RealType{};
RealType sum = RealType{};

const InputImageType * const image = this->GetInputImage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperatorImageFunction : public ImageFuncti
Evaluate(const PointType &) const override
{
std::cout << "NeighborhoodOperatorImageFunction::Evaluate(): Not implemented!" << std::endl;
TOutput out;
out = 0;
TOutput out = 0;
return out;
}

Expand All @@ -105,8 +104,7 @@ class ITK_TEMPLATE_EXPORT NeighborhoodOperatorImageFunction : public ImageFuncti
EvaluateAtContinuousIndex(const ContinuousIndexType &) const override
{
std::cout << "NeighborhoodOperatorImageFunction::EvaluateAtContinuousIndex():Not implemented!" << std::endl;
TOutput out;
out = 0;
TOutput out = 0;
return out;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ template <typename TInputImage, typename TCoordRep>
auto
SumOfSquaresImageFunction<TInputImage, TCoordRep>::EvaluateAtIndex(const IndexType & index) const -> RealType
{
RealType sumOfSquares;

sumOfSquares = RealType{};
RealType sumOfSquares = RealType{};

const InputImageType * const image = this->GetInputImage();

Expand Down
3 changes: 1 addition & 2 deletions Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ ConnectedRegionsMeshFilter<TInputMesh, TOutputMesh>::GenerateData()
}

// get the cells using the closest point and use them as seeds
InputMeshCellLinksContainerConstPointer cellLinks;
cellLinks = input->GetCellLinks();
InputMeshCellLinksContainerConstPointer cellLinks = input->GetCellLinks();

auto links = cellLinks->ElementAt(minId);
for (auto citer = links.cbegin(); citer != links.cend(); ++citer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ ContourSpatialObject<TDimension>::SetControlPoints(const ContourPointListType &
{
m_ControlPoints.clear();

typename ContourPointListType::const_iterator it;
it = points.begin();
typename ContourPointListType::const_iterator it = points.begin();
while (it != points.end())
{
m_ControlPoints.push_back(*it);
Expand Down Expand Up @@ -219,8 +218,7 @@ ContourSpatialObject<TDimension>::Update()
newPoint[d] = pnt[d] + i * step[d];
}
}
typename Superclass::SpatialObjectPointType newSOPoint;
newSOPoint = (*it);
typename Superclass::SpatialObjectPointType newSOPoint = (*it);
newSOPoint.SetSpatialObject(this);
newSOPoint.SetPositionInObjectSpace(newPoint);
this->m_Points.push_back(newSOPoint);
Expand Down
9 changes: 3 additions & 6 deletions Modules/Core/TestKernel/src/itkTestDriverInclude.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,8 @@ RegressionTestHelper(const char * testImageFilename,
}

// The sizes of the baseline and test image must match
typename ImageType::SizeType baselineSize;
baselineSize = baselineReader->GetOutput()->GetLargestPossibleRegion().GetSize();
typename ImageType::SizeType testSize;
testSize = testReader->GetOutput()->GetLargestPossibleRegion().GetSize();
typename ImageType::SizeType baselineSize = baselineReader->GetOutput()->GetLargestPossibleRegion().GetSize();
typename ImageType::SizeType testSize = testReader->GetOutput()->GetLargestPossibleRegion().GetSize();

if (baselineSize != testSize)
{
Expand Down Expand Up @@ -907,8 +905,7 @@ HashTestImage(const char * testImageFilename, const std::vector<std::string> & b
reader->SetFileName(testImageFilename);
reader->UpdateLargestPossibleRegion();

ImageType::SizeType size;
size = reader->GetOutput()->GetLargestPossibleRegion().GetSize();
ImageType::SizeType size = reader->GetOutput()->GetLargestPossibleRegion().GetSize();

// Get the center slice of the image, In 3D, the first slice
// is often a black slice with little debugging information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ QuaternionRigidTransform<TParametersValueType>::ComputeMatrix()
VnlQuaternionType conjugateRotation = m_Rotation.conjugate();
// this is done to compensate for the transposed representation
// between VNL and ITK
MatrixType newMatrix;

newMatrix = conjugateRotation.rotation_matrix_transpose();
MatrixType newMatrix = conjugateRotation.rotation_matrix_transpose();
this->SetVarMatrix(newMatrix);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,7 @@ void
MRIBiasFieldCorrectionFilter<TInputImage, TOutputImage, TMaskImage>::Log1PImage(InternalImageType * source,
InternalImageType * target)
{
InternalImageRegionType region;

region = source->GetRequestedRegion();
InternalImageRegionType region = source->GetRequestedRegion();

ImageRegionIterator<InternalImageType> s_iter(source, region);
ImageRegionIterator<InternalImageType> t_iter(target, region);
Expand Down Expand Up @@ -816,9 +814,7 @@ void
MRIBiasFieldCorrectionFilter<TInputImage, TOutputImage, TMaskImage>::ExpImage(InternalImageType * source,
InternalImageType * target)
{
InternalImageRegionType region;

region = source->GetLargestPossibleRegion();
InternalImageRegionType region = source->GetLargestPossibleRegion();

ImageRegionIterator<InternalImageType> s_iter(source, region);
ImageRegionIterator<InternalImageType> t_iter(target, region);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ BinaryPruningImageFilter<TInputImage, TOutputImage>::ComputePruneImage()
{
if (ot.GetCenterPixel())
{
PixelType genus;
genus = ot.GetPixel(offset1) + ot.GetPixel(offset2);
PixelType genus = ot.GetPixel(offset1) + ot.GetPixel(offset2);
genus += ot.GetPixel(offset3) + ot.GetPixel(offset4);
genus += ot.GetPixel(offset5) + ot.GetPixel(offset6);
genus += ot.GetPixel(offset7) + ot.GetPixel(offset8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ ObjectMorphologyImageFilter<TInputImage, TOutputImage, TKernel>::GenerateInputRe

// get a copy of the input requested region (should equal the output
// requested region)
typename TInputImage::RegionType inputRequestedRegion;
inputRequestedRegion = inputPtr->GetRequestedRegion();
typename TInputImage::RegionType inputRequestedRegion = inputPtr->GetRequestedRegion();

// pad the input requested region by the operator radius
inputRequestedRegion.PadByRadius(m_Kernel.GetRadius());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ MaskedFFTNormalizedCorrelationImageFilter<TInputImage, TOutputImage, TMaskImage>
InputSizeType & FFTImageSize)
{
typename LocalInputImageType::PixelType constantPixel = 0;
typename LocalInputImageType::SizeType upperPad;
upperPad = FFTImageSize - inputImage->GetLargestPossibleRegion().GetSize();
typename LocalInputImageType::SizeType upperPad = FFTImageSize - inputImage->GetLargestPossibleRegion().GetSize();

using PadType = itk::ConstantPadImageFilter<LocalInputImageType, RealImageType>;
auto padder = PadType::New();
Expand Down Expand Up @@ -647,15 +646,13 @@ MaskedFFTNormalizedCorrelationImageFilter<TInputImage, TOutputImage, TMaskImage>
// is bigger than our input.

// Cast away the constness so we can set the requested region.
InputImagePointer inputPtr;
inputPtr = const_cast<InputImageType *>(this->GetFixedImage());
InputImagePointer inputPtr = const_cast<InputImageType *>(this->GetFixedImage());
inputPtr->SetRequestedRegion(this->GetFixedImage()->GetLargestPossibleRegion());

inputPtr = const_cast<InputImageType *>(this->GetMovingImage());
inputPtr->SetRequestedRegion(this->GetMovingImage()->GetLargestPossibleRegion());

MaskImagePointer maskPtr;
maskPtr = const_cast<MaskImageType *>(this->GetFixedImageMask());
MaskImagePointer maskPtr = const_cast<MaskImageType *>(this->GetFixedImageMask());
if (maskPtr)
{
maskPtr->SetRequestedRegion(this->GetFixedImageMask()->GetLargestPossibleRegion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ NormalizedCorrelationImageFilter<TInputImage, TMaskImage, TOutputImage, TOperato

// get a copy of the input requested region which was set up by the
// superclass (NeighborhoodOperatorImageFilter)
typename TInputImage::RegionType inputRequestedRegion;
inputRequestedRegion = inputPtr->GetRequestedRegion();
typename TInputImage::RegionType inputRequestedRegion = inputPtr->GetRequestedRegion();

// set the mask requested region to match the input requested region
if (maskPtr->GetLargestPossibleRegion().IsInside(inputRequestedRegion))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ BinaryMinMaxCurvatureFlowImageFilter<TInputImage, TOutputImage>::BinaryMinMaxCur
{
m_Threshold = 0.0;

typename BinaryMinMaxCurvatureFlowFunctionType::Pointer cffp;
cffp = BinaryMinMaxCurvatureFlowFunctionType::New();
typename BinaryMinMaxCurvatureFlowFunctionType::Pointer 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,8 +29,7 @@ CurvatureFlowImageFilter<TInputImage, TOutputImage>::CurvatureFlowImageFilter()
this->SetNumberOfIterations(0);
m_TimeStep = 0.05f;

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

this->SetDifferenceFunction(static_cast<FiniteDifferenceFunctionType *>(cffp.GetPointer()));
}
Expand Down
Loading

0 comments on commit 68e60ba

Please sign in to comment.