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 21, 2024
1 parent c35278c commit edb7b08
Show file tree
Hide file tree
Showing 52 changed files with 79 additions and 170 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
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
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 @@ -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
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
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 @@ -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 @@ -646,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 @@ -404,8 +404,7 @@ MinMaxCurvatureFlowFunction<TImage>::ComputeUpdate(const NeighborhoodType & it,
return update;
}

PixelType threshold;
threshold = this->ComputeThreshold(Dispatch<ImageDimension>(), it);
PixelType threshold = this->ComputeThreshold(Dispatch<ImageDimension>(), it);

NeighborhoodInnerProduct<ImageType> innerProduct;
PixelType avgValue = innerProduct(it, m_StencilOperator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ PatchBasedDenoisingBaseImageFilter<TInputImage, TOutputImage>::GetPatchRadiusInV
thisPtr->m_InputImage = this->GetInput();
}
const typename InputImageType::SpacingType & spacing = this->m_InputImage->GetSpacing();
typename InputImageType::SpacingValueType maxSpacing;
maxSpacing = spacing[0];
typename InputImageType::SpacingValueType maxSpacing = spacing[0];
for (unsigned int dim = 1; dim < ImageDimension; ++dim)
{
if (spacing[dim] > maxSpacing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ FastMarchingImageFilter<TLevelSet, TSpeedImage>::Initialize(LevelSetImageType *
// set all output value to infinity
using OutputIterator = ImageRegionIterator<LevelSetImageType>;

PixelType outputPixel;
outputPixel = m_LargeValue;
PixelType outputPixel = m_LargeValue;

for (OutputIterator outIt(output, output->GetBufferedRegion()); !outIt.IsAtEnd(); ++outIt)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Hessian3DToVesselnessMeasureImageFilter<TPixel>::GenerateData()

// walk the region of eigen values and get the vesselness measure
EigenValueArrayType eigenValue;
ImageRegionConstIterator<EigenValueOutputImageType> it;
it = ImageRegionConstIterator<EigenValueOutputImageType>(eigenImage, eigenImage->GetRequestedRegion());
ImageRegionConstIterator<EigenValueOutputImageType> it =
ImageRegionConstIterator<EigenValueOutputImageType>(eigenImage, eigenImage->GetRequestedRegion());
ImageRegionIterator<OutputImageType> oit;
this->AllocateOutputs();
oit = ImageRegionIterator<OutputImageType>(output, output->GetRequestedRegion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ class ITK_TEMPLATE_EXPORT VectorGradientMagnitudeImageFilter : public ImageToIma
NonPCEvaluateAtNeighborhood(const ConstNeighborhoodIteratorType & it) const
{
unsigned int i, j;
TRealType dx, sum, accum;

accum = TRealType{};
TRealType dx, sum, accum = TRealType{};
for (i = 0; i < ImageDimension; ++i)
{
sum = TRealType{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ BSplineControlPointImageFilter<TInputImage, TOutputImage>::SetSplineOrder(ArrayT

if (this->m_DoMultilevel)
{
typename KernelType::MatrixType C;
C = this->m_Kernel[i]->GetShapeFunctionsInZeroToOneInterval();
typename KernelType::MatrixType C = this->m_Kernel[i]->GetShapeFunctionsInZeroToOneInterval();

vnl_matrix<RealType> R;
vnl_matrix<RealType> S;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ BSplineResampleImageFilterBase<TInputImage, TOutputImage>::ReduceNDImage(OutputI
* OutputImage for direct writing into the final variable. */

// The first time through the loop our input image is inputPtr
typename TInputImage::ConstPointer workingImage;
workingImage = inputPtr;
typename TInputImage::ConstPointer workingImage = inputPtr;

unsigned int count = scratchRegion.GetNumberOfPixels() * ImageDimension;
ProgressReporter progress(this, 0, count, 10);
Expand Down Expand Up @@ -491,8 +490,7 @@ BSplineResampleImageFilterBase<TInputImage, TOutputImage>::ExpandNDImage(OutputI
**/

// The first time through the loop our input image is m_Image
typename TInputImage::ConstPointer workingImage;
workingImage = inputPtr;
typename TInputImage::ConstPointer workingImage = inputPtr;

RegionType workingRegion = validRegion;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ BSplineScatteredDataPointSetToImageFilter<TInputPointSet, TOutputImage>::SetSpli

if (this->m_DoMultilevel)
{
typename KernelType::MatrixType C;
C = this->m_Kernel[i]->GetShapeFunctionsInZeroToOneInterval();
typename KernelType::MatrixType C = this->m_Kernel[i]->GetShapeFunctionsInZeroToOneInterval();

vnl_matrix<RealType> R;
vnl_matrix<RealType> S;
Expand Down
3 changes: 1 addition & 2 deletions Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ ShrinkImageFilter<TInputImage, TOutputImage>::GenerateOutputInformation()
outputPtr->TransformContinuousIndexToPhysicalPoint(outputCenterIndex, outputCenterPoint);

const typename TOutputImage::PointType & inputOrigin = inputPtr->GetOrigin();
typename TOutputImage::PointType outputOrigin;
outputOrigin = inputOrigin + (inputCenterPoint - outputCenterPoint);
typename TOutputImage::PointType outputOrigin = inputOrigin + (inputCenterPoint - outputCenterPoint);
outputPtr->SetOrigin(outputOrigin);

// Set region
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ class AdaptImageFilter
void
SetAccessor(AccessorType & accessor)
{
FunctorType functor;

functor = this->GetFunctor();
FunctorType functor = this->GetFunctor();
if (accessor != functor.GetAccessor())
{
functor.SetAccessor(accessor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,14 @@ PolylineMaskImageFilter<TInputImage, TPolyline, TVector, TOutputImage>::Generate
itkDebugMacro("Normalized View vector" << nViewVector);

// Orthogonalize nUpVector and nViewVector
TVector nOrthogonalVector;

nOrthogonalVector = nUpVector - (nViewVector * (nUpVector * nViewVector));
TVector nOrthogonalVector = nUpVector - (nViewVector * (nUpVector * nViewVector));

itkDebugMacro("Up vector component orthogonal to View vector " << nOrthogonalVector);

// Perform the cross product and determine a third coordinate axis
// orthogonal to both nOrthogonalVector and nViewVector.

TVector nThirdAxis;
nThirdAxis = itk::CrossProduct(nOrthogonalVector, nViewVector);
TVector nThirdAxis = itk::CrossProduct(nOrthogonalVector, nViewVector);

itkDebugMacro("Third basis vector" << nThirdAxis);

Expand Down Expand Up @@ -298,9 +295,7 @@ PolylineMaskImageFilter<TInputImage, TPolyline, TVector, TOutputImage>::Generate
projectionStart[1] = 0;

ProjectionImageSizeType projectionSize;
IndexValueType pad;

pad = 5;
IndexValueType pad = 5;

projectionSize[0] = (IndexValueType)(bounds[1] - bounds[0]) + pad;
projectionSize[1] = (IndexValueType)(bounds[3] - bounds[2]) + pad;
Expand Down
Loading

0 comments on commit edb7b08

Please sign in to comment.