From 3b3a3129b37b0d54e0eabd3748bf3a26a3b7495e Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Wed, 6 Nov 2024 22:21:26 +0100 Subject: [PATCH] STYLE: Replace `T * p; p = x` with `T * p = x`, initializing pointers Using Notepad++, Replace in Files, doing: Find what: ^( [ ]+)([^ ].*\*)([ ]+)(\w+);[\r\n]+\1\4\ = Replace with: $1$2$3$4 = Filters: itk*.* Directory: D:\src\ITK\Modules [v] Match case (*) Regular expression Excluded an unrelated case from "itkMINCImageIO.cxx" (`_sep = -_sep`), which accidentally matched the regular expression. - Follow-up to pull request https://github.com/InsightSoftwareConsortium/ITK/pull/4932 commit 5b121f493f17d61c52c197b0c5df530fe01c4f8c "STYLE: Replace `T var; var = x` with `T var = x` for arithmetic types" --- Modules/Core/Common/test/itkLoggerManagerTest.cxx | 3 +-- Modules/Core/Common/test/itkSmartPointerGTest.cxx | 8 ++------ Modules/Core/GPUCommon/src/itkGPUKernelManager.cxx | 6 ++---- .../include/itkBSplineDecompositionImageFilter.hxx | 4 +--- .../Core/Mesh/include/itkBinaryMask3DMeshSource.hxx | 10 +++++----- Modules/Core/Mesh/include/itkSimplexMesh.hxx | 4 +--- .../Core/SpatialObjects/include/itkSpatialObject.hxx | 3 +-- .../SpatialObjects/include/itkTubeSpatialObject.hxx | 3 +-- .../Core/TestKernel/include/itkRandomImageSource.hxx | 3 +-- .../include/itkTestingExtractSliceImageFilter.hxx | 5 ++--- .../include/itkCurvatureFlowImageFilter.hxx | 4 +--- .../include/itkIsoContourDistanceImageFilter.hxx | 4 +--- .../include/itkFastMarchingImageFilter.hxx | 4 +--- .../include/itkJoinSeriesImageFilter.hxx | 5 ++--- .../include/itkBSplineDownsampleImageFilter.hxx | 4 +--- .../include/itkBSplineUpsampleImageFilter.hxx | 4 +--- .../test/itkBSplineResampleImageFilterTest.cxx | 12 ++++-------- Modules/IO/GDCM/src/itkGDCMImageIO.cxx | 3 +-- Modules/IO/Stimulate/src/itkStimulateImageIO.cxx | 6 ++---- .../Review/test/itkLabelGeometryImageFilterTest.cxx | 3 +-- .../FEM/src/itkFEMLinearSystemWrapperDenseVNL.cxx | 6 ++---- .../FEM/src/itkFEMLinearSystemWrapperVNL.cxx | 9 +++------ .../itkScalarImageToRunLengthFeaturesFilter.hxx | 4 +--- .../itkScalarImageToTextureFeaturesFilter.hxx | 4 +--- .../test/itkGPUDemonsRegistrationFilterTest2.cxx | 3 +-- .../itkMultiResolutionPDEDeformableRegistration.hxx | 3 +-- .../test/itkCurvatureRegistrationFilterTest.cxx | 3 +-- .../itkDiffeomorphicDemonsRegistrationFilterTest.cxx | 3 +-- ...itkDiffeomorphicDemonsRegistrationFilterTest2.cxx | 3 +-- ...stSymmetricForcesDemonsRegistrationFilterTest.cxx | 3 +-- .../include/itkKLMRegionGrowImageFilter.hxx | 4 +--- .../include/itkReinitializeLevelSetImageFilter.hxx | 4 +--- .../include/itkMRFImageFilter.hxx | 4 +--- .../test/itkOpenCVImageBridgeGrayScaleTest.cxx | 3 +-- Modules/Video/Core/src/itkTemporalDataObject.cxx | 11 +++-------- 35 files changed, 52 insertions(+), 113 deletions(-) diff --git a/Modules/Core/Common/test/itkLoggerManagerTest.cxx b/Modules/Core/Common/test/itkLoggerManagerTest.cxx index 758c10e6de5d..8707778c72de 100644 --- a/Modules/Core/Common/test/itkLoggerManagerTest.cxx +++ b/Modules/Core/Common/test/itkLoggerManagerTest.cxx @@ -83,8 +83,7 @@ itkLoggerManagerTest(int argc, char * argv[]) manager->Write(itk::Logger::PriorityLevelEnum::FATAL, "This is the FATAL message.\n"); manager->Write(itk::LoggerBase::PriorityLevelEnum::MUSTFLUSH, "This is the MUSTFLUSH message.\n"); std::cout << " Message #3" << std::endl; - itk::Logger * pLogger; - pLogger = manager->GetLogger("org.itk.logTester.logger"); + itk::Logger * pLogger = manager->GetLogger("org.itk.logTester.logger"); if (pLogger == nullptr) { throw "LoggerManager::GetLogger() failed"; diff --git a/Modules/Core/Common/test/itkSmartPointerGTest.cxx b/Modules/Core/Common/test/itkSmartPointerGTest.cxx index c2de0daa0e1b..78c5d187f0b9 100644 --- a/Modules/Core/Common/test/itkSmartPointerGTest.cxx +++ b/Modules/Core/Common/test/itkSmartPointerGTest.cxx @@ -278,9 +278,7 @@ TEST(SmartPointer, ConvertingRegisterCount) Derived1Pointer d1ptr = Derived1::New(); EXPECT_EQ(1, d1ptr->GetRegisterCount()); - Derived1 * rptr; - - rptr = d1ptr; + Derived1 * rptr = d1ptr; EXPECT_EQ(1, d1ptr->GetRegisterCount()); EXPECT_TRUE(rptr != nullptr); } @@ -290,9 +288,7 @@ TEST(SmartPointer, ConvertingRegisterCount) Derived1Pointer d1ptr = Derived1::New(); EXPECT_EQ(1, d1ptr->GetRegisterCount()); - const Derived1 * rptr; - - rptr = d1ptr; + const Derived1 * rptr = d1ptr; EXPECT_EQ(1, d1ptr->GetRegisterCount()); EXPECT_TRUE(rptr != nullptr); } diff --git a/Modules/Core/GPUCommon/src/itkGPUKernelManager.cxx b/Modules/Core/GPUCommon/src/itkGPUKernelManager.cxx index 1df11cc54da2..e55249abf618 100644 --- a/Modules/Core/GPUCommon/src/itkGPUKernelManager.cxx +++ b/Modules/Core/GPUCommon/src/itkGPUKernelManager.cxx @@ -130,8 +130,7 @@ GPUKernelManager::LoadProgramFromFile(const char * filename, const char * cPream // get error message size clGetProgramBuildInfo(m_Program, m_Manager->GetDeviceId(0), CL_PROGRAM_BUILD_LOG, 0, nullptr, ¶mValueSize); - char * paramValue; - paramValue = (char *)malloc(paramValueSize); + char * paramValue = (char *)malloc(paramValueSize); // get error message clGetProgramBuildInfo( @@ -208,8 +207,7 @@ GPUKernelManager::LoadProgramFromString(const char * cSource, const char * cPrea // get error message size clGetProgramBuildInfo(m_Program, m_Manager->GetDeviceId(0), CL_PROGRAM_BUILD_LOG, 0, nullptr, ¶mValueSize); - char * paramValue; - paramValue = (char *)malloc(paramValueSize); + char * paramValue = (char *)malloc(paramValueSize); // get error message clGetProgramBuildInfo( diff --git a/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx b/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx index ebb265165f64..b88f87c9c1c2 100644 --- a/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx +++ b/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx @@ -328,9 +328,7 @@ void BSplineDecompositionImageFilter::EnlargeOutputRequestedRegion(DataObject * output) { // This filter requires all of the input image to be in the buffer - TOutputImage * imgData; - - imgData = dynamic_cast(output); + TOutputImage * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); diff --git a/Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx b/Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx index bc597c06735d..6b0954616279 100644 --- a/Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx +++ b/Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx @@ -431,7 +431,9 @@ template void BinaryMask3DMeshSource::inverse(unsigned char * x) { - unsigned char tmp = x[2]; + unsigned char tmp; + + tmp = x[2]; x[2] = x[1]; x[1] = tmp; } @@ -1378,11 +1380,9 @@ BinaryMask3DMeshSource::AddCells(unsigned char celltyp typename TriCell::CellAutoPointer insertCell; typename OutputMeshType::PointIdentifier tripoints[3]; - unsigned char * tp; - tp = (unsigned char *)malloc(3 * sizeof(unsigned char)); + unsigned char * tp = (unsigned char *)malloc(3 * sizeof(unsigned char)); - IdentifierType * tpl; - tpl = (IdentifierType *)malloc(3 * sizeof(IdentifierType)); + IdentifierType * tpl = (IdentifierType *)malloc(3 * sizeof(IdentifierType)); switch (static_cast(celltype)) { diff --git a/Modules/Core/Mesh/include/itkSimplexMesh.hxx b/Modules/Core/Mesh/include/itkSimplexMesh.hxx index 111914e5ead8..e07e93088950 100644 --- a/Modules/Core/Mesh/include/itkSimplexMesh.hxx +++ b/Modules/Core/Mesh/include/itkSimplexMesh.hxx @@ -59,9 +59,7 @@ template void SimplexMesh::CopyInformation(const DataObject * data) { - const Superclass * mesh; - - mesh = dynamic_cast(data); + const Superclass * mesh = dynamic_cast(data); if (mesh == nullptr) { diff --git a/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx index 7eea31c09f0a..b901da9611f8 100644 --- a/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx @@ -1211,8 +1211,7 @@ SpatialObject::CopyInformation(const DataObject * data) Superclass::CopyInformation(data); // Attempt to cast data to an ImageBase - const SpatialObject * soData; - soData = dynamic_cast *>(data); + const SpatialObject * soData = dynamic_cast *>(data); if (soData == nullptr) { diff --git a/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx index 8aa85e3ef16d..294d65b50d11 100644 --- a/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx @@ -60,8 +60,7 @@ TubeSpatialObject::CopyInformation(const DataObject Superclass::CopyInformation(data); // Attempt to cast data to an ImageBase - const TubeSpatialObject * soData; - soData = dynamic_cast *>(data); + const TubeSpatialObject * soData = dynamic_cast *>(data); if (soData == nullptr) { diff --git a/Modules/Core/TestKernel/include/itkRandomImageSource.hxx b/Modules/Core/TestKernel/include/itkRandomImageSource.hxx index ed017d290ee3..a7e2a79bece4 100644 --- a/Modules/Core/TestKernel/include/itkRandomImageSource.hxx +++ b/Modules/Core/TestKernel/include/itkRandomImageSource.hxx @@ -197,8 +197,7 @@ template void RandomImageSource::GenerateOutputInformation() { - TOutputImage * output; - output = this->GetOutput(0); + TOutputImage * output = this->GetOutput(0); const typename TOutputImage::RegionType largestPossibleRegion(this->m_Size); output->SetLargestPossibleRegion(largestPossibleRegion); diff --git a/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx b/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx index 0d732d086eb4..985df90e8b1d 100644 --- a/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx +++ b/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx @@ -122,9 +122,8 @@ ExtractSliceImageFilter::GenerateOutputInformation() outputPtr->SetLargestPossibleRegion(m_OutputImageRegion); // Set the output spacing and origin - const ImageBase * phyData; - - phyData = dynamic_cast *>(this->GetInput()); + const ImageBase * phyData = + dynamic_cast *>(this->GetInput()); if (phyData == nullptr) { diff --git a/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowImageFilter.hxx b/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowImageFilter.hxx index ee4577962233..70f6f7353ee6 100644 --- a/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowImageFilter.hxx +++ b/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowImageFilter.hxx @@ -95,9 +95,7 @@ void CurvatureFlowImageFilter::EnlargeOutputRequestedRegion(DataObject * ptr) { // convert DataObject pointer to OutputImageType pointer - OutputImageType * outputPtr; - - outputPtr = dynamic_cast(ptr); + OutputImageType * outputPtr = dynamic_cast(ptr); // get input image pointer typename Superclass::InputImagePointer inputPtr = const_cast(this->GetInput()); diff --git a/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx index 7a0bab5a7487..922e5de2e0af 100644 --- a/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx @@ -80,9 +80,7 @@ IsoContourDistanceImageFilter::EnlargeOutputRequested { // this filter requires the all of the output image to be in // the buffer - TOutputImage * imgData; - - imgData = dynamic_cast(output); + TOutputImage * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx index 93ae15b59f62..5998c00474ae 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx @@ -99,9 +99,7 @@ FastMarchingImageFilter::EnlargeOutputRequestedRegion(Da { // enlarge the requested region of the output // to the whole data set - TLevelSet * imgData; - - imgData = dynamic_cast(output); + TLevelSet * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); diff --git a/Modules/Filtering/ImageCompose/include/itkJoinSeriesImageFilter.hxx b/Modules/Filtering/ImageCompose/include/itkJoinSeriesImageFilter.hxx index cb6c16237ddc..1de99bc03f7a 100644 --- a/Modules/Filtering/ImageCompose/include/itkJoinSeriesImageFilter.hxx +++ b/Modules/Filtering/ImageCompose/include/itkJoinSeriesImageFilter.hxx @@ -101,9 +101,8 @@ JoinSeriesImageFilter::GenerateOutputInformation() outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); // Set the output spacing and origin - const ImageBase * phyData; - - phyData = dynamic_cast *>(this->GetInput()); + const ImageBase * phyData = + dynamic_cast *>(this->GetInput()); if (phyData) { diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx index 42cb269989e1..a5ac08196278 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx @@ -153,9 +153,7 @@ BSplineDownsampleImageFilter::EnlargeO { // this filter requires the all of the output image to be in // the buffer - TOutputImage * imgData; - - imgData = dynamic_cast(output); + TOutputImage * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx index ce3c28cc9656..53e5f1506e35 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx @@ -160,9 +160,7 @@ BSplineUpsampleImageFilter::EnlargeOut { // this filter requires the all of the output image to be in // the buffer - TOutputImage * imgData; - - imgData = dynamic_cast(output); + TOutputImage * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); diff --git a/Modules/Filtering/ImageGrid/test/itkBSplineResampleImageFilterTest.cxx b/Modules/Filtering/ImageGrid/test/itkBSplineResampleImageFilterTest.cxx index 24ea05b7e1f2..20e3f38fa402 100644 --- a/Modules/Filtering/ImageGrid/test/itkBSplineResampleImageFilterTest.cxx +++ b/Modules/Filtering/ImageGrid/test/itkBSplineResampleImageFilterTest.cxx @@ -152,8 +152,7 @@ setInt2DData(IntImageType2D::Pointer imgPtr) bool VerifyResultsHigherOrderSpline(ImageTypePtr2D ActualResults, double * ExpectedResults) { - double * ERptr; - ERptr = ExpectedResults; + double * ERptr = ExpectedResults; InputIterator ActualResultsIter(ActualResults, ActualResults->GetLargestPossibleRegion()); double percentErr = 0; @@ -180,8 +179,7 @@ VerifyResultsHigherOrderSpline(ImageTypePtr2D ActualResults, double * ExpectedRe bool VerifyResults3rdOrderSpline(ImageTypePtr2D ActualResults, double * ExpectedResults) { - double * ERptr; - ERptr = ExpectedResults; + double * ERptr = ExpectedResults; InputIterator ActualResultsIter(ActualResults, ActualResults->GetLargestPossibleRegion()); @@ -202,8 +200,7 @@ VerifyResults3rdOrderSpline(ImageTypePtr2D ActualResults, double * ExpectedResul bool VerifyResults2ndOrderSpline(ImageTypePtr2D ActualResults, double * ExpectedResults) { - double * ERptr; - ERptr = ExpectedResults; + double * ERptr = ExpectedResults; InputIterator ActualResultsIter(ActualResults, ActualResults->GetLargestPossibleRegion()); double percentErr = 0; @@ -231,8 +228,7 @@ VerifyResults2ndOrderSpline(ImageTypePtr2D ActualResults, double * ExpectedResul bool VerifyResultsLowerOrderSpline(ImageTypePtr2D ActualResults, double * ExpectedResults) { - double * ERptr; - ERptr = ExpectedResults; + double * ERptr = ExpectedResults; InputIterator ActualResultsIter(ActualResults, ActualResults->GetLargestPossibleRegion()); double percentErr = 0; diff --git a/Modules/IO/GDCM/src/itkGDCMImageIO.cxx b/Modules/IO/GDCM/src/itkGDCMImageIO.cxx index c633a8190960..e36269033941 100644 --- a/Modules/IO/GDCM/src/itkGDCMImageIO.cxx +++ b/Modules/IO/GDCM/src/itkGDCMImageIO.cxx @@ -678,8 +678,7 @@ GDCMImageIO::InternalReadImageInformation() break; default: { - const double * sp; - sp = image.GetSpacing(); + const double * sp = image.GetSpacing(); spacing[0] = sp[0]; spacing[1] = sp[1]; spacing[2] = sp[2]; diff --git a/Modules/IO/Stimulate/src/itkStimulateImageIO.cxx b/Modules/IO/Stimulate/src/itkStimulateImageIO.cxx index d21726b61aeb..6be326cbbe41 100644 --- a/Modules/IO/Stimulate/src/itkStimulateImageIO.cxx +++ b/Modules/IO/Stimulate/src/itkStimulateImageIO.cxx @@ -364,8 +364,7 @@ StimulateImageIO::InternalReadImageInformation(std::ifstream & file) // This is a bit tricky to get the value as there is sometime no white // space // only a ':' separate field from value, we assume there is no other ':' - char * pch; - pch = strchr(line, ':'); + char * pch = strchr(line, ':'); sscanf(++pch, "%s", m_FidName); // delete any white space left itkDebugMacro("fidName was specified"); } @@ -376,8 +375,7 @@ StimulateImageIO::InternalReadImageInformation(std::ifstream & file) // This is a bit tricky to get the value as there is sometime no white // space // only a ':' separate field from value, we assume there is no other ':' - char * pch; - pch = strchr(line, ':'); + char * pch = strchr(line, ':'); sscanf(++pch, "%s", m_SdtOrient); // delete any white space left itkDebugMacro("Orientation was specified"); } diff --git a/Modules/Nonunit/Review/test/itkLabelGeometryImageFilterTest.cxx b/Modules/Nonunit/Review/test/itkLabelGeometryImageFilterTest.cxx index be13f0533bc9..1f0905eee4d8 100644 --- a/Modules/Nonunit/Review/test/itkLabelGeometryImageFilterTest.cxx +++ b/Modules/Nonunit/Review/test/itkLabelGeometryImageFilterTest.cxx @@ -219,8 +219,7 @@ LabelGeometryImageFilterTest(std::string labelImageName, writer->SetFileName(outputFileName); writer->SetInput(&matrix); writer->SetColumnHeaders(columnName); - MatrixType * matrixPointer; - matrixPointer = new MatrixType(matrix.data_block(), numberOfLabels, numberOfColumns); + MatrixType * matrixPointer = new MatrixType(matrix.data_block(), numberOfLabels, numberOfColumns); writer->SetInput(matrixPointer); ITK_TRY_EXPECT_NO_EXCEPTION(writer->Write()); diff --git a/Modules/Numerics/FEM/src/itkFEMLinearSystemWrapperDenseVNL.cxx b/Modules/Numerics/FEM/src/itkFEMLinearSystemWrapperDenseVNL.cxx index 94fa652232a5..10b701299397 100644 --- a/Modules/Numerics/FEM/src/itkFEMLinearSystemWrapperDenseVNL.cxx +++ b/Modules/Numerics/FEM/src/itkFEMLinearSystemWrapperDenseVNL.cxx @@ -191,8 +191,7 @@ LinearSystemWrapperDenseVNL::Solve() void LinearSystemWrapperDenseVNL::SwapMatrices(unsigned int MatrixIndex1, unsigned int MatrixIndex2) { - vnl_matrix * tmp; - tmp = (*m_Matrices)[MatrixIndex1]; + vnl_matrix * tmp = (*m_Matrices)[MatrixIndex1]; (*m_Matrices)[MatrixIndex1] = (*m_Matrices)[MatrixIndex2]; (*m_Matrices)[MatrixIndex2] = tmp; } @@ -209,8 +208,7 @@ LinearSystemWrapperDenseVNL::SwapVectors(unsigned int VectorIndex1, unsigned int void LinearSystemWrapperDenseVNL::SwapSolutions(unsigned int SolutionIndex1, unsigned int SolutionIndex2) { - vnl_vector * tmp; - tmp = (*m_Solutions)[SolutionIndex1]; + vnl_vector * tmp = (*m_Solutions)[SolutionIndex1]; (*m_Solutions)[SolutionIndex1] = (*m_Solutions)[SolutionIndex2]; (*m_Solutions)[SolutionIndex2] = tmp; } diff --git a/Modules/Numerics/FEM/src/itkFEMLinearSystemWrapperVNL.cxx b/Modules/Numerics/FEM/src/itkFEMLinearSystemWrapperVNL.cxx index 625e26dca50c..a9d6aab85c21 100644 --- a/Modules/Numerics/FEM/src/itkFEMLinearSystemWrapperVNL.cxx +++ b/Modules/Numerics/FEM/src/itkFEMLinearSystemWrapperVNL.cxx @@ -224,8 +224,7 @@ LinearSystemWrapperVNL::Solve() void LinearSystemWrapperVNL::SwapMatrices(unsigned int MatrixIndex1, unsigned int MatrixIndex2) { - vnl_sparse_matrix * tmp; - tmp = (*m_Matrices)[MatrixIndex1]; + vnl_sparse_matrix * tmp = (*m_Matrices)[MatrixIndex1]; (*m_Matrices)[MatrixIndex1] = (*m_Matrices)[MatrixIndex2]; (*m_Matrices)[MatrixIndex2] = tmp; } @@ -233,8 +232,7 @@ LinearSystemWrapperVNL::SwapMatrices(unsigned int MatrixIndex1, unsigned int Mat void LinearSystemWrapperVNL::SwapVectors(unsigned int VectorIndex1, unsigned int VectorIndex2) { - vnl_vector * tmp; - tmp = (*m_Vectors)[VectorIndex1]; + vnl_vector * tmp = (*m_Vectors)[VectorIndex1]; (*m_Vectors)[VectorIndex1] = (*m_Vectors)[VectorIndex2]; (*m_Vectors)[VectorIndex2] = tmp; } @@ -242,8 +240,7 @@ LinearSystemWrapperVNL::SwapVectors(unsigned int VectorIndex1, unsigned int Vect void LinearSystemWrapperVNL::SwapSolutions(unsigned int SolutionIndex1, unsigned int SolutionIndex2) { - vnl_vector * tmp; - tmp = (*m_Solutions)[SolutionIndex1]; + vnl_vector * tmp = (*m_Solutions)[SolutionIndex1]; (*m_Solutions)[SolutionIndex1] = (*m_Solutions)[SolutionIndex2]; (*m_Solutions)[SolutionIndex2] = tmp; } diff --git a/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.hxx b/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.hxx index aef7840fe21a..9aab10aff9a6 100644 --- a/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.hxx @@ -112,9 +112,7 @@ ScalarImageToRunLengthFeaturesFilter::Full { size_t numOffsets = this->m_Offsets->size(); size_t numFeatures = this->m_RequestedFeatures->size(); - double ** features; - - features = new double *[numOffsets]; + double ** features = new double *[numOffsets]; for (size_t i = 0; i < numOffsets; ++i) { features[i] = new double[numFeatures]; diff --git a/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx b/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx index 00acdc29a9e9..0329f079e675 100644 --- a/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx +++ b/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx @@ -112,9 +112,7 @@ ScalarImageToTextureFeaturesFiltersize(); size_t numFeatures = m_RequestedFeatures->size(); - double ** features; - - features = new double *[numOffsets]; + double ** features = new double *[numOffsets]; for (size_t i = 0; i < numOffsets; ++i) { features[i] = new double[numFeatures]; diff --git a/Modules/Registration/GPUPDEDeformable/test/itkGPUDemonsRegistrationFilterTest2.cxx b/Modules/Registration/GPUPDEDeformable/test/itkGPUDemonsRegistrationFilterTest2.cxx index cc843d91fee5..4819beed714a 100644 --- a/Modules/Registration/GPUPDEDeformable/test/itkGPUDemonsRegistrationFilterTest2.cxx +++ b/Modules/Registration/GPUPDEDeformable/test/itkGPUDemonsRegistrationFilterTest2.cxx @@ -202,8 +202,7 @@ itkGPUDemonsRegistrationFilterTest2(int argc, char * argv[]) registrator->UseMovingImageGradientOff(); using FunctionType = RegistrationType::GPUDemonsRegistrationFunctionType; - FunctionType * fptr; - fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); if (!fptr) { std::cout << "Invalid demons registration function ptr" << std::endl; diff --git a/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx b/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx index f608d79fdb64..7d87ae98c50c 100644 --- a/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx +++ b/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx @@ -638,8 +638,7 @@ MultiResolutionPDEDeformableRegistration(ptr); + DisplacementFieldType * outputPtr = dynamic_cast(ptr); if (outputPtr) { diff --git a/Modules/Registration/PDEDeformable/test/itkCurvatureRegistrationFilterTest.cxx b/Modules/Registration/PDEDeformable/test/itkCurvatureRegistrationFilterTest.cxx index fd48c238311d..53edc6ce9c24 100644 --- a/Modules/Registration/PDEDeformable/test/itkCurvatureRegistrationFilterTest.cxx +++ b/Modules/Registration/PDEDeformable/test/itkCurvatureRegistrationFilterTest.cxx @@ -182,8 +182,7 @@ itkCurvatureRegistrationFilterTest(int, char *[]) std::cout << "\n\n\nPrinting function" << std::endl; using FunctionType = RegistrationType::RegistrationFunctionType; - FunctionType * fptr; - fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); fptr->Print(std::cout); // exercise other member variables diff --git a/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest.cxx b/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest.cxx index 6378eb303ee7..1ab2a62eac3b 100644 --- a/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest.cxx +++ b/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest.cxx @@ -249,8 +249,7 @@ itkDiffeomorphicDemonsRegistrationFilterTest(int argc, char * argv[]) registrator->InPlaceOn(); - FunctionType * fptr; - fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); fptr->Print(std::cout); // exercise other member variables diff --git a/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest2.cxx b/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest2.cxx index 82e1e17f061a..4ab392712f8a 100644 --- a/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest2.cxx +++ b/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest2.cxx @@ -154,8 +154,7 @@ itkDiffeomorphicDemonsRegistrationFilterTest2(int argc, char * argv[]) registrator->InPlaceOn(); - FunctionType * fptr; - fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); fptr->Print(std::cout); // exercise other member variables diff --git a/Modules/Registration/PDEDeformable/test/itkFastSymmetricForcesDemonsRegistrationFilterTest.cxx b/Modules/Registration/PDEDeformable/test/itkFastSymmetricForcesDemonsRegistrationFilterTest.cxx index b565fccbd667..8b3c24bad7b4 100644 --- a/Modules/Registration/PDEDeformable/test/itkFastSymmetricForcesDemonsRegistrationFilterTest.cxx +++ b/Modules/Registration/PDEDeformable/test/itkFastSymmetricForcesDemonsRegistrationFilterTest.cxx @@ -230,8 +230,7 @@ itkFastSymmetricForcesDemonsRegistrationFilterTest(int, char *[]) ITK_TEST_SET_GET_BOOLEAN(registrator, InPlace, inPlace); using FunctionType = RegistrationType::DemonsRegistrationFunctionType; - FunctionType * fptr; - fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); fptr->Print(std::cout); using ProgressType = ShowProgressObject; diff --git a/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx b/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx index 525cb03ef02f..2e2f363ae97b 100644 --- a/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx +++ b/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx @@ -61,9 +61,7 @@ void KLMRegionGrowImageFilter::EnlargeOutputRequestedRegion(DataObject * output) { // This filter requires all of the output image to be in the buffer - TOutputImage * imgData; - - imgData = dynamic_cast(output); + TOutputImage * imgData = dynamic_cast(output); imgData->SetRequestedRegionToLargestPossibleRegion(); } diff --git a/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx index 886306fa3b5e..fc005931ea95 100644 --- a/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx @@ -83,9 +83,7 @@ ReinitializeLevelSetImageFilter::EnlargeOutputRequestedRegion(DataObj { // this filter requires the all of the output image to be in // the buffer - TLevelSet * imgData; - - imgData = dynamic_cast(output); + TLevelSet * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); diff --git a/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx b/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx index 71e460fb1134..13aca5c596b8 100644 --- a/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx +++ b/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx @@ -107,9 +107,7 @@ MRFImageFilter::EnlargeOutputRequestedRegion(Data { // this filter requires that all of the output images // are in the buffer - TClassifiedImage * imgData; - - imgData = dynamic_cast(output); + TClassifiedImage * imgData = dynamic_cast(output); imgData->SetRequestedRegionToLargestPossibleRegion(); } diff --git a/Modules/Video/BridgeOpenCV/test/itkOpenCVImageBridgeGrayScaleTest.cxx b/Modules/Video/BridgeOpenCV/test/itkOpenCVImageBridgeGrayScaleTest.cxx index 16b65830ec53..87decda11484 100644 --- a/Modules/Video/BridgeOpenCV/test/itkOpenCVImageBridgeGrayScaleTest.cxx +++ b/Modules/Video/BridgeOpenCV/test/itkOpenCVImageBridgeGrayScaleTest.cxx @@ -104,8 +104,7 @@ itkOpenCVImageBridgeTestTemplatedScalar(char * argv) << std::endl; std::cout << "Test IplImage -> itk::Image..." << std::endl; - IplImage * inIpl; - inIpl = cvLoadImage(argv, CV_LOAD_IMAGE_ANYDEPTH); + IplImage * inIpl = cvLoadImage(argv, CV_LOAD_IMAGE_ANYDEPTH); if (!inIpl) { std::cerr << "Could not load input as IplImage" << std::endl; diff --git a/Modules/Video/Core/src/itkTemporalDataObject.cxx b/Modules/Video/Core/src/itkTemporalDataObject.cxx index a9199610dcc1..a63c32db0e3a 100644 --- a/Modules/Video/Core/src/itkTemporalDataObject.cxx +++ b/Modules/Video/Core/src/itkTemporalDataObject.cxx @@ -264,8 +264,7 @@ TemporalDataObject::CopyInformation(const DataObject * data) // Standard call to the superclass' method Superclass::CopyInformation(data); - const TemporalDataObject * temporalData; - temporalData = dynamic_cast(data); + const TemporalDataObject * temporalData = dynamic_cast(data); if (temporalData) { @@ -292,9 +291,7 @@ TemporalDataObject::CopyInformation(const DataObject * data) void TemporalDataObject::Graft(const DataObject * data) { - const TemporalDataObject * temporalData; - - temporalData = dynamic_cast(data); + const TemporalDataObject * temporalData = dynamic_cast(data); if (temporalData) { @@ -324,9 +321,7 @@ TemporalDataObject::Graft(const DataObject * data) void TemporalDataObject::SetRequestedRegion(const DataObject * data) { - const TemporalDataObject * temporalData; - - temporalData = dynamic_cast(data); + const TemporalDataObject * temporalData = dynamic_cast(data); if (temporalData) {