From 5afa15495c8c8a30d7a5afd1badd312a766d39a3 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Thu, 7 Nov 2024 11:29:17 +0100 Subject: [PATCH] STYLE: Use `auto *` to declare variables initialized by pointer cast Using Notepad++, Replace in Files, doing: Find what: ^( [ ]+const )([^ ].*\*)([ ]+)(\w+ = [a-z]+_cast) Find what: ^( [ ]+const )([^ ].*\*)([ ]+)(\w+ =\r\n [ ]+[a-z]+_cast) Find what: ^( [ ]+)([^ ].*\*)([ ]+)(\w+ = [a-z]+_cast<\2>) Replace with: $1auto *$3$4 Filters: itk*.* Directory: D:\src\ITK\Modules [v] Match case (*) Regular expression Equivalent to clang-tidy `modernize-use-auto`, for variables of a pointer type: https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-auto.html#cast-expressions --- Modules/Core/GPUCommon/include/itkGPUImage.hxx | 2 +- .../include/itkBSplineDecompositionImageFilter.hxx | 2 +- Modules/Core/Mesh/include/itkSimplexMesh.hxx | 2 +- .../Core/SpatialObjects/include/itkMetaImageConverter.hxx | 2 +- Modules/Core/SpatialObjects/include/itkSpatialObject.hxx | 2 +- .../Core/SpatialObjects/include/itkTubeSpatialObject.hxx | 2 +- .../include/itkTestingExtractSliceImageFilter.hxx | 3 +-- .../CurvatureFlow/include/itkCurvatureFlowImageFilter.hxx | 2 +- .../include/itkIsoContourDistanceImageFilter.hxx | 4 ++-- .../FFT/include/itkComplexToComplex1DFFTImageFilter.hxx | 2 +- .../Filtering/FFT/include/itkForward1DFFTImageFilter.hxx | 4 ++-- .../Filtering/FFT/include/itkInverse1DFFTImageFilter.hxx | 2 +- .../FastMarching/include/itkFastMarchingImageFilter.hxx | 2 +- .../ImageCompose/include/itkJoinSeriesImageFilter.hxx | 3 +-- .../ImageGrid/include/itkBSplineDownsampleImageFilter.hxx | 2 +- .../ImageGrid/include/itkBSplineUpsampleImageFilter.hxx | 2 +- .../Path/include/itkContourExtractor2DImageFilter.hxx | 2 +- Modules/IO/GDCM/src/itkGDCMImageIO.cxx | 6 +++--- Modules/IO/TIFF/src/itkTIFFImageIO.cxx | 2 +- .../test/itkGPUDemonsRegistrationFilterTest2.cxx | 2 +- .../include/itkMultiResolutionPDEDeformableRegistration.hxx | 2 +- .../test/itkCurvatureRegistrationFilterTest.cxx | 2 +- .../test/itkDiffeomorphicDemonsRegistrationFilterTest.cxx | 2 +- .../test/itkDiffeomorphicDemonsRegistrationFilterTest2.cxx | 2 +- .../itkFastSymmetricForcesDemonsRegistrationFilterTest.cxx | 2 +- .../include/itkKLMRegionGrowImageFilter.hxx | 2 +- .../include/itkReinitializeLevelSetImageFilter.hxx | 2 +- .../include/itkMRFImageFilter.hxx | 2 +- Modules/Video/BridgeOpenCV/include/itkOpenCVImageBridge.h | 6 +++--- Modules/Video/BridgeOpenCV/src/itkOpenCVVideoIO.cxx | 2 +- Modules/Video/Core/include/itkVideoStream.hxx | 2 +- Modules/Video/Core/src/itkTemporalDataObject.cxx | 6 +++--- 32 files changed, 40 insertions(+), 42 deletions(-) diff --git a/Modules/Core/GPUCommon/include/itkGPUImage.hxx b/Modules/Core/GPUCommon/include/itkGPUImage.hxx index a77719489a6..2db43fc0962 100644 --- a/Modules/Core/GPUCommon/include/itkGPUImage.hxx +++ b/Modules/Core/GPUCommon/include/itkGPUImage.hxx @@ -197,7 +197,7 @@ template void GPUImage::Graft(const DataObject * data) { - const Self * ptr = dynamic_cast(data); + const auto * ptr = dynamic_cast(data); if (ptr) { this->Graft(ptr); diff --git a/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx b/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx index b88f87c9c1c..e47c0eefa30 100644 --- a/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx +++ b/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx @@ -328,7 +328,7 @@ void BSplineDecompositionImageFilter::EnlargeOutputRequestedRegion(DataObject * output) { // This filter requires all of the input image to be in the buffer - TOutputImage * imgData = dynamic_cast(output); + auto * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); diff --git a/Modules/Core/Mesh/include/itkSimplexMesh.hxx b/Modules/Core/Mesh/include/itkSimplexMesh.hxx index e07e9308895..e8515f0ff00 100644 --- a/Modules/Core/Mesh/include/itkSimplexMesh.hxx +++ b/Modules/Core/Mesh/include/itkSimplexMesh.hxx @@ -59,7 +59,7 @@ template void SimplexMesh::CopyInformation(const DataObject * data) { - const Superclass * mesh = dynamic_cast(data); + const auto * mesh = dynamic_cast(data); if (mesh == nullptr) { diff --git a/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx b/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx index 561eba721b7..f60935049d1 100644 --- a/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx +++ b/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx @@ -28,7 +28,7 @@ template ::CreateMetaObject() -> MetaObjectType * { - MetaObjectType * mo = dynamic_cast(new ImageMetaObjectType); + auto * mo = dynamic_cast(new ImageMetaObjectType); mo->APIVersion(1); mo->FileFormatVersion(1); return mo; diff --git a/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx index b901da9611f..02efcc6799f 100644 --- a/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx @@ -1211,7 +1211,7 @@ SpatialObject::CopyInformation(const DataObject * data) Superclass::CopyInformation(data); // Attempt to cast data to an ImageBase - const SpatialObject * soData = dynamic_cast *>(data); + const auto * soData = dynamic_cast *>(data); if (soData == nullptr) { diff --git a/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx b/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx index 294d65b50d1..4fef24fe7b9 100644 --- a/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx +++ b/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx @@ -60,7 +60,7 @@ TubeSpatialObject::CopyInformation(const DataObject Superclass::CopyInformation(data); // Attempt to cast data to an ImageBase - const TubeSpatialObject * soData = dynamic_cast *>(data); + const auto * soData = dynamic_cast *>(data); if (soData == nullptr) { diff --git a/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx b/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx index 985df90e8b1..1a8a33a060f 100644 --- a/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx +++ b/Modules/Core/TestKernel/include/itkTestingExtractSliceImageFilter.hxx @@ -122,8 +122,7 @@ ExtractSliceImageFilter::GenerateOutputInformation() outputPtr->SetLargestPossibleRegion(m_OutputImageRegion); // Set the output spacing and origin - const ImageBase * phyData = - dynamic_cast *>(this->GetInput()); + const auto * 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 70f6f7353ee..ec865c8946c 100644 --- a/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowImageFilter.hxx +++ b/Modules/Filtering/CurvatureFlow/include/itkCurvatureFlowImageFilter.hxx @@ -95,7 +95,7 @@ void CurvatureFlowImageFilter::EnlargeOutputRequestedRegion(DataObject * ptr) { // convert DataObject pointer to OutputImageType pointer - OutputImageType * outputPtr = dynamic_cast(ptr); + auto * 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 922e5de2e0a..ec099580bc1 100644 --- a/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx @@ -80,7 +80,7 @@ IsoContourDistanceImageFilter::EnlargeOutputRequested { // this filter requires the all of the output image to be in // the buffer - TOutputImage * imgData = dynamic_cast(output); + auto * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); @@ -126,7 +126,7 @@ IsoContourDistanceImageFilter::ThreaderFullCallback(v ThreadIdType workUnitCount = workUnitInfo->NumberOfWorkUnits; using FilterStruct = typename ImageSource::ThreadStruct; auto * str = (FilterStruct *)(workUnitInfo->UserData); - Self * filter = static_cast(str->Filter.GetPointer()); + auto * filter = static_cast(str->Filter.GetPointer()); // execute the actual method with appropriate output region // first find out how many pieces extent can be split into. diff --git a/Modules/Filtering/FFT/include/itkComplexToComplex1DFFTImageFilter.hxx b/Modules/Filtering/FFT/include/itkComplexToComplex1DFFTImageFilter.hxx index 9d350d21c10..2ffc8d58065 100644 --- a/Modules/Filtering/FFT/include/itkComplexToComplex1DFFTImageFilter.hxx +++ b/Modules/Filtering/FFT/include/itkComplexToComplex1DFFTImageFilter.hxx @@ -72,7 +72,7 @@ template void ComplexToComplex1DFFTImageFilter::EnlargeOutputRequestedRegion(DataObject * output) { - OutputImageType * outputPtr = dynamic_cast(output); + auto * outputPtr = dynamic_cast(output); // we need to enlarge the region in the fft direction to the // largest possible in that direction diff --git a/Modules/Filtering/FFT/include/itkForward1DFFTImageFilter.hxx b/Modules/Filtering/FFT/include/itkForward1DFFTImageFilter.hxx index f009e550785..c7393cc0ae0 100644 --- a/Modules/Filtering/FFT/include/itkForward1DFFTImageFilter.hxx +++ b/Modules/Filtering/FFT/include/itkForward1DFFTImageFilter.hxx @@ -37,7 +37,7 @@ Forward1DFFTImageFilter::GenerateInputRequestedRegion Superclass::GenerateInputRequestedRegion(); // get pointers to the inputs - InputImageType * input = const_cast(this->GetInput()); + auto * input = const_cast(this->GetInput()); OutputImageType * output = this->GetOutput(); // we need to compute the input requested region (size and start index) @@ -68,7 +68,7 @@ template void Forward1DFFTImageFilter::EnlargeOutputRequestedRegion(DataObject * out) { - OutputImageType * output = dynamic_cast(out); + auto * output = dynamic_cast(out); // we need to enlarge the region in the fft direction to the // largest possible in that direction diff --git a/Modules/Filtering/FFT/include/itkInverse1DFFTImageFilter.hxx b/Modules/Filtering/FFT/include/itkInverse1DFFTImageFilter.hxx index 18cc451a3d6..2ac5b90b3e6 100644 --- a/Modules/Filtering/FFT/include/itkInverse1DFFTImageFilter.hxx +++ b/Modules/Filtering/FFT/include/itkInverse1DFFTImageFilter.hxx @@ -73,7 +73,7 @@ template void Inverse1DFFTImageFilter::EnlargeOutputRequestedRegion(DataObject * out) { - OutputImageType * output = dynamic_cast(out); + auto * output = dynamic_cast(out); // we need to enlarge the region in the fft direction to the // largest possible in that direction diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx index 5998c00474a..754d5887248 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx @@ -99,7 +99,7 @@ FastMarchingImageFilter::EnlargeOutputRequestedRegion(Da { // enlarge the requested region of the output // to the whole data set - TLevelSet * imgData = dynamic_cast(output); + auto * 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 1de99bc03f7..6f5fc14000b 100644 --- a/Modules/Filtering/ImageCompose/include/itkJoinSeriesImageFilter.hxx +++ b/Modules/Filtering/ImageCompose/include/itkJoinSeriesImageFilter.hxx @@ -101,8 +101,7 @@ JoinSeriesImageFilter::GenerateOutputInformation() outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); // Set the output spacing and origin - const ImageBase * phyData = - dynamic_cast *>(this->GetInput()); + const auto * phyData = dynamic_cast *>(this->GetInput()); if (phyData) { diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx index a5ac0819627..3e5e9f87099 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx @@ -153,7 +153,7 @@ BSplineDownsampleImageFilter::EnlargeO { // this filter requires the all of the output image to be in // the buffer - TOutputImage * imgData = dynamic_cast(output); + auto * 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 53e5f1506e3..675aa65b483 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx @@ -160,7 +160,7 @@ BSplineUpsampleImageFilter::EnlargeOut { // this filter requires the all of the output image to be in // the buffer - TOutputImage * imgData = dynamic_cast(output); + auto * imgData = dynamic_cast(output); if (imgData) { imgData->SetRequestedRegionToLargestPossibleRegion(); diff --git a/Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx b/Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx index a08a642dfe9..d217035c9d2 100644 --- a/Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx +++ b/Modules/Filtering/Path/include/itkContourExtractor2DImageFilter.hxx @@ -640,7 +640,7 @@ template void ContourExtractor2DImageFilter::GenerateInputRequestedRegion() { - InputImageType * input = const_cast(this->GetInput()); + auto * input = const_cast(this->GetInput()); if (!input) { diff --git a/Modules/IO/GDCM/src/itkGDCMImageIO.cxx b/Modules/IO/GDCM/src/itkGDCMImageIO.cxx index e3626903394..b8f31090fee 100644 --- a/Modules/IO/GDCM/src/itkGDCMImageIO.cxx +++ b/Modules/IO/GDCM/src/itkGDCMImageIO.cxx @@ -367,9 +367,9 @@ GDCMImageIO::Read(void * pointer) if (m_SingleBit) { - const auto copy = make_unique_for_overwrite(len); - unsigned char * t = reinterpret_cast(pointer); - size_t j = 0; + const auto copy = make_unique_for_overwrite(len); + auto * t = reinterpret_cast(pointer); + size_t j = 0; for (size_t i = 0; i < len / 8; ++i) { const unsigned char c = t[i]; diff --git a/Modules/IO/TIFF/src/itkTIFFImageIO.cxx b/Modules/IO/TIFF/src/itkTIFFImageIO.cxx index f6bc627e147..e5ffc102a03 100644 --- a/Modules/IO/TIFF/src/itkTIFFImageIO.cxx +++ b/Modules/IO/TIFF/src/itkTIFFImageIO.cxx @@ -1267,7 +1267,7 @@ TIFFImageIO::ReadCurrentPage(void * buffer, size_t pixelOffset) itkExceptionMacro("Cannot read TIFF image as a TIFF RGBA image"); } - unsigned char * out = static_cast(buffer) + pixelOffset; + auto * out = static_cast(buffer) + pixelOffset; RGBAImageToBuffer(out, tempImage); } else diff --git a/Modules/Registration/GPUPDEDeformable/test/itkGPUDemonsRegistrationFilterTest2.cxx b/Modules/Registration/GPUPDEDeformable/test/itkGPUDemonsRegistrationFilterTest2.cxx index 4819beed714..03daf6aed09 100644 --- a/Modules/Registration/GPUPDEDeformable/test/itkGPUDemonsRegistrationFilterTest2.cxx +++ b/Modules/Registration/GPUPDEDeformable/test/itkGPUDemonsRegistrationFilterTest2.cxx @@ -202,7 +202,7 @@ itkGPUDemonsRegistrationFilterTest2(int argc, char * argv[]) registrator->UseMovingImageGradientOff(); using FunctionType = RegistrationType::GPUDemonsRegistrationFunctionType; - FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + auto * 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 7d87ae98c50..bbde585cbb8 100644 --- a/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx +++ b/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx @@ -638,7 +638,7 @@ MultiResolutionPDEDeformableRegistration(ptr); + auto * outputPtr = dynamic_cast(ptr); if (outputPtr) { diff --git a/Modules/Registration/PDEDeformable/test/itkCurvatureRegistrationFilterTest.cxx b/Modules/Registration/PDEDeformable/test/itkCurvatureRegistrationFilterTest.cxx index 53edc6ce9c2..5c68c49318f 100644 --- a/Modules/Registration/PDEDeformable/test/itkCurvatureRegistrationFilterTest.cxx +++ b/Modules/Registration/PDEDeformable/test/itkCurvatureRegistrationFilterTest.cxx @@ -182,7 +182,7 @@ itkCurvatureRegistrationFilterTest(int, char *[]) std::cout << "\n\n\nPrinting function" << std::endl; using FunctionType = RegistrationType::RegistrationFunctionType; - FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + auto * 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 1ab2a62eac3..ee103647500 100644 --- a/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest.cxx +++ b/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest.cxx @@ -249,7 +249,7 @@ itkDiffeomorphicDemonsRegistrationFilterTest(int argc, char * argv[]) registrator->InPlaceOn(); - FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + auto * 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 4ab392712f8..3fd8586026d 100644 --- a/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest2.cxx +++ b/Modules/Registration/PDEDeformable/test/itkDiffeomorphicDemonsRegistrationFilterTest2.cxx @@ -154,7 +154,7 @@ itkDiffeomorphicDemonsRegistrationFilterTest2(int argc, char * argv[]) registrator->InPlaceOn(); - FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + auto * 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 8b3c24bad7b..9c875632f8b 100644 --- a/Modules/Registration/PDEDeformable/test/itkFastSymmetricForcesDemonsRegistrationFilterTest.cxx +++ b/Modules/Registration/PDEDeformable/test/itkFastSymmetricForcesDemonsRegistrationFilterTest.cxx @@ -230,7 +230,7 @@ itkFastSymmetricForcesDemonsRegistrationFilterTest(int, char *[]) ITK_TEST_SET_GET_BOOLEAN(registrator, InPlace, inPlace); using FunctionType = RegistrationType::DemonsRegistrationFunctionType; - FunctionType * fptr = dynamic_cast(registrator->GetDifferenceFunction().GetPointer()); + auto * 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 2e2f363ae97..2a6f54943c0 100644 --- a/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx +++ b/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx @@ -61,7 +61,7 @@ void KLMRegionGrowImageFilter::EnlargeOutputRequestedRegion(DataObject * output) { // This filter requires all of the output image to be in the buffer - TOutputImage * imgData = dynamic_cast(output); + auto * imgData = dynamic_cast(output); imgData->SetRequestedRegionToLargestPossibleRegion(); } diff --git a/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx index fc005931ea9..a06a0d8fc04 100644 --- a/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx @@ -83,7 +83,7 @@ ReinitializeLevelSetImageFilter::EnlargeOutputRequestedRegion(DataObj { // this filter requires the all of the output image to be in // the buffer - TLevelSet * imgData = dynamic_cast(output); + auto * 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 13aca5c596b..b9730252cbc 100644 --- a/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx +++ b/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx @@ -107,7 +107,7 @@ MRFImageFilter::EnlargeOutputRequestedRegion(Data { // this filter requires that all of the output images // are in the buffer - TClassifiedImage * imgData = dynamic_cast(output); + auto * imgData = dynamic_cast(output); imgData->SetRequestedRegionToLargestPossibleRegion(); } diff --git a/Modules/Video/BridgeOpenCV/include/itkOpenCVImageBridge.h b/Modules/Video/BridgeOpenCV/include/itkOpenCVImageBridge.h index a8bab5e0432..189f83d088c 100644 --- a/Modules/Video/BridgeOpenCV/include/itkOpenCVImageBridge.h +++ b/Modules/Video/BridgeOpenCV/include/itkOpenCVImageBridge.h @@ -112,7 +112,7 @@ class OpenCVImageBridge checkMatchingTypes(outChannels); // We only change current if it no longer points at in, so this is safe - IplImage * current = const_cast(in); + auto * current = const_cast(in); bool freeCurrent = false; if (inChannels == 3 && outChannels == 1) @@ -248,7 +248,7 @@ class OpenCVImageBridge out->SetSpacing(spacing); out->Allocate(); size_t lineLength = imgWidth * inChannels * sizeof(TPixel); - void * unpaddedBuffer = reinterpret_cast(new TPixel[imgHeight * lineLength]); + auto * unpaddedBuffer = reinterpret_cast(new TPixel[imgHeight * lineLength]); unsigned int paddedBufPos = 0; unsigned int unpaddedBufPos = 0; @@ -301,7 +301,7 @@ class OpenCVImageBridge for (int r = 0; r < out->height; ++r) { - ValueType * ptr = reinterpret_cast(out->imageData + r * out->widthStep); + auto * ptr = reinterpret_cast(out->imageData + r * out->widthStep); for (int c = 0; c < out->width; ++c) { pixelIndex[0] = c; diff --git a/Modules/Video/BridgeOpenCV/src/itkOpenCVVideoIO.cxx b/Modules/Video/BridgeOpenCV/src/itkOpenCVVideoIO.cxx index 955930a7ccd..2ea5f1fc428 100644 --- a/Modules/Video/BridgeOpenCV/src/itkOpenCVVideoIO.cxx +++ b/Modules/Video/BridgeOpenCV/src/itkOpenCVVideoIO.cxx @@ -350,7 +350,7 @@ OpenCVVideoIO::Read(void * buffer) this->UpdateReaderProperties(); // Put the frame's buffer into the supplied output buffer - void * tempBuffer = reinterpret_cast(this->m_CVImage->imageData); + auto * tempBuffer = reinterpret_cast(this->m_CVImage->imageData); size_t bufferSize = this->m_CVImage->imageSize; memcpy(buffer, tempBuffer, bufferSize); } diff --git a/Modules/Video/Core/include/itkVideoStream.hxx b/Modules/Video/Core/include/itkVideoStream.hxx index e146615ffb6..ff19de36b7a 100644 --- a/Modules/Video/Core/include/itkVideoStream.hxx +++ b/Modules/Video/Core/include/itkVideoStream.hxx @@ -610,7 +610,7 @@ VideoStream::Allocate() << ". Call " "InitializeEmptyFrames to prepare the frame buffer correctly."); } - FrameType * frame = dynamic_cast(m_DataObjectBuffer->GetBufferContents(i).GetPointer()); + auto * frame = dynamic_cast(m_DataObjectBuffer->GetBufferContents(i).GetPointer()); if (!frame) { itkExceptionMacro("itk::VideoStream::SetAllLargestPossibleSpatialRegions " diff --git a/Modules/Video/Core/src/itkTemporalDataObject.cxx b/Modules/Video/Core/src/itkTemporalDataObject.cxx index a63c32db0e3..d30a52bbd83 100644 --- a/Modules/Video/Core/src/itkTemporalDataObject.cxx +++ b/Modules/Video/Core/src/itkTemporalDataObject.cxx @@ -264,7 +264,7 @@ TemporalDataObject::CopyInformation(const DataObject * data) // Standard call to the superclass' method Superclass::CopyInformation(data); - const TemporalDataObject * temporalData = dynamic_cast(data); + const auto * temporalData = dynamic_cast(data); if (temporalData) { @@ -291,7 +291,7 @@ TemporalDataObject::CopyInformation(const DataObject * data) void TemporalDataObject::Graft(const DataObject * data) { - const TemporalDataObject * temporalData = dynamic_cast(data); + const auto * temporalData = dynamic_cast(data); if (temporalData) { @@ -321,7 +321,7 @@ TemporalDataObject::Graft(const DataObject * data) void TemporalDataObject::SetRequestedRegion(const DataObject * data) { - const TemporalDataObject * temporalData = dynamic_cast(data); + const auto * temporalData = dynamic_cast(data); if (temporalData) {