From 59b941f86130f8b1ad7f81d5fc9f06412b5ff838 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Wed, 22 Nov 2023 21:35:40 +0100 Subject: [PATCH] STYLE: Remove unused local `ImageRegion` variables Fixed ITK.macOS/Darwin/Xcode_13.2.1/clang-1300.0.29.30 warnings that appear when `ImageRegion` is made trivially copyable, saying: > warning: unused variable 'requestRegion' [-Wunused-variable] --- .../Common/include/itkZeroFluxNeumannBoundaryCondition.hxx | 5 ++--- .../test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx | 3 +-- .../include/itkBinaryDilateImageFilter.hxx | 1 - .../include/itkBinaryErodeImageFilter.hxx | 1 - .../Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx | 3 --- Modules/Filtering/ImageGrid/test/itkResampleImageTest8.cxx | 5 ++--- .../ImageStatistics/include/itkProjectionImageFilter.hxx | 3 +-- .../include/itkUniformRandomSpatialNeighborSubsampler.hxx | 5 ++--- .../Common/include/itkCompareHistogramImageToImageMetric.hxx | 5 ++--- .../Segmentation/SuperPixel/include/itkSLICImageFilter.hxx | 3 +-- .../Watersheds/include/itkWatershedSegmenter.hxx | 1 - Modules/Video/Core/test/itkImageToVideoFilterTest.cxx | 1 - Modules/Video/Core/test/itkVectorImageToVideoTest.cxx | 1 - 13 files changed, 11 insertions(+), 26 deletions(-) diff --git a/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx b/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx index f276eda96281..b2f07b1ed1d3 100644 --- a/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx +++ b/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx @@ -92,9 +92,8 @@ ZeroFluxNeumannBoundaryCondition::GetInputRequestedRe IndexType outputIndex = outputRequestedRegion.GetIndex(); SizeType outputSize = outputRequestedRegion.GetSize(); - IndexType requestIndex; - SizeType requestSize; - RegionType requestRegion; + IndexType requestIndex; + SizeType requestSize; for (unsigned int i = 0; i < ImageDimension; ++i) { diff --git a/Modules/Core/SpatialObjects/test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx b/Modules/Core/SpatialObjects/test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx index b9b141c9f09f..fb8ade4a406e 100644 --- a/Modules/Core/SpatialObjects/test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx +++ b/Modules/Core/SpatialObjects/test/itkSpatialObjectToImageStatisticsCalculatorTest.cxx @@ -31,8 +31,7 @@ itkSpatialObjectToImageStatisticsCalculatorTest(int, char *[]) using EllipseType = itk::EllipseSpatialObject<2>; // Image Definition - ImageType::RegionType region; - ImageType::SizeType size; + ImageType::SizeType size; size.Fill(50); ImageType::SpacingType spacing; spacing.Fill(1); diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryDilateImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryDilateImageFilter.hxx index d9507d5fb0b4..9d6e3ed1df7b 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryDilateImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryDilateImageFilter.hxx @@ -53,7 +53,6 @@ BinaryDilateImageFilter::GenerateData() KernelType kernel = this->GetKernel(); InputSizeType radius; radius.Fill(1); - typename TInputImage::RegionType inputRegion = input->GetBufferedRegion(); typename TOutputImage::RegionType outputRegion = output->GetBufferedRegion(); // compute the size of the temp image. It is needed to create the progress diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryErodeImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryErodeImageFilter.hxx index d86ca952a3b3..969cf7280874 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryErodeImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryErodeImageFilter.hxx @@ -53,7 +53,6 @@ BinaryErodeImageFilter::GenerateData() KernelType kernel = this->GetKernel(); InputSizeType radius; radius.Fill(1); - typename TInputImage::RegionType inputRegion = input->GetBufferedRegion(); typename TOutputImage::RegionType outputRegion = output->GetBufferedRegion(); // compute the size of the temp image. It is needed to create the progress diff --git a/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx index 22df164ef6da..5a6748f4f8de 100644 --- a/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx @@ -485,9 +485,6 @@ MirrorPadImageFilter::GenerateInputRequestedRegion() OutputImageSizeType outputSize = outputPtr->GetRequestedRegion().GetSize(); InputImageSizeType inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); - OutputImageRegionType outputRegion; - InputImageRegionType inputRegion; - // For n dimensions, there are k^n combinations of before, between, and // after on these regions. We are keeping this flexible so that we // can handle other blockings imposed by the mirror and wrap algorithms. diff --git a/Modules/Filtering/ImageGrid/test/itkResampleImageTest8.cxx b/Modules/Filtering/ImageGrid/test/itkResampleImageTest8.cxx index 53aefc5174d1..62d8720de302 100644 --- a/Modules/Filtering/ImageGrid/test/itkResampleImageTest8.cxx +++ b/Modules/Filtering/ImageGrid/test/itkResampleImageTest8.cxx @@ -166,9 +166,8 @@ itkResampleImageTest8(int, char *[]) auto tform = TransformType::New(); // OutputImagePointerType outputImage = OutputImageType::New(); - OutputImageIndexType outputIndex = { { 0, 0, 0 } }; - OutputImageSizeType outputSize = { { 18, 12, 5 } }; - OutputImageRegionType outputRegion; + OutputImageIndexType outputIndex = { { 0, 0, 0 } }; + OutputImageSizeType outputSize = { { 18, 12, 5 } }; // Create a linear interpolation image function auto interp = InterpolatorType::New(); diff --git a/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx b/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx index 5ce0515155a5..506f4ca7fdc5 100644 --- a/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx @@ -220,8 +220,7 @@ ProjectionImageFilter::DynamicThreadedG typename TInputImage::SizeType inputSize = inputRegion.GetSize(); typename TInputImage::IndexType inputIndex = inputRegion.GetIndex(); - typename TOutputImage::Pointer outputImage = this->GetOutput(); - typename TOutputImage::RegionType outputRegion = outputImage->GetLargestPossibleRegion(); + typename TOutputImage::Pointer outputImage = this->GetOutput(); typename TOutputImage::SizeType outputSizeForThread = outputRegionForThread.GetSize(); typename TOutputImage::IndexType outputIndexForThread = outputRegionForThread.GetIndex(); diff --git a/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx b/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx index f875a0bfc1e6..b76f73b74a04 100644 --- a/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx +++ b/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx @@ -72,9 +72,8 @@ UniformRandomSpatialNeighborSubsampler::Search(const InstanceI results->Clear(); results->SetSample(this->m_Sample); - RegionType searchRegion; - IndexType searchStartIndex; - IndexType searchEndIndex; + IndexType searchStartIndex; + IndexType searchEndIndex; IndexType constraintIndex = this->m_RegionConstraint.GetIndex(); SizeType constraintSize = this->m_RegionConstraint.GetSize(); diff --git a/Modules/Registration/Common/include/itkCompareHistogramImageToImageMetric.hxx b/Modules/Registration/Common/include/itkCompareHistogramImageToImageMetric.hxx index 367dee9b9687..ce129085de09 100644 --- a/Modules/Registration/Common/include/itkCompareHistogramImageToImageMetric.hxx +++ b/Modules/Registration/Common/include/itkCompareHistogramImageToImageMetric.hxx @@ -96,9 +96,8 @@ CompareHistogramImageToImageMetric::FormTrainingHisto this->m_TrainingHistogram->Initialize( this->Superclass::m_HistogramSize, this->Superclass::m_LowerBound, this->Superclass::m_UpperBound); using TrainingFixedIteratorType = itk::ImageRegionConstIteratorWithIndex; - typename FixedImageType::IndexType index; - typename FixedImageType::RegionType fixedRegion; - typename HistogramType::IndexType hIndex; + typename FixedImageType::IndexType index; + typename HistogramType::IndexType hIndex; TrainingFixedIteratorType ti(this->m_TrainingFixedImage, this->m_TrainingFixedImageRegion); diff --git a/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx b/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx index c9a89011fa9b..de25b1e7784d 100644 --- a/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx +++ b/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx @@ -457,8 +457,7 @@ SLICImageFilter::ThreadedConnectivity ClusterType cluster(numberOfClusterComponents, &m_Clusters[clusterIndex * numberOfClusterComponents]); - typename InputImageType::RegionType localRegion; - IndexType idx; + IndexType idx; for (unsigned int d = 0; d < ImageDimension; ++d) { diff --git a/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx b/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx index d70351a8c3c1..fd9e28eeb793 100644 --- a/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx +++ b/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx @@ -1325,7 +1325,6 @@ Segmenter::GenerateOutputRequestedRegion(DataObject * output) ImageBase * imgData; ImageBase * op; imgData = dynamic_cast *>(output); - typename TInputImage::RegionType c_reg; if (imgData) { diff --git a/Modules/Video/Core/test/itkImageToVideoFilterTest.cxx b/Modules/Video/Core/test/itkImageToVideoFilterTest.cxx index 06cdc261006a..7bc90d35cbff 100644 --- a/Modules/Video/Core/test/itkImageToVideoFilterTest.cxx +++ b/Modules/Video/Core/test/itkImageToVideoFilterTest.cxx @@ -75,7 +75,6 @@ itkImageToVideoFilterTest(int argc, char * argv[]) ITK_TRY_EXPECT_NO_EXCEPTION(videoFilter->Update()); auto videoOutput = videoFilter->GetOutput(); - auto imageRegion = inputImage->GetLargestPossibleRegion(); // Verify start frame and frame duration in output match size of designated temporal axis in input ITK_TEST_EXPECT_EQUAL( diff --git a/Modules/Video/Core/test/itkVectorImageToVideoTest.cxx b/Modules/Video/Core/test/itkVectorImageToVideoTest.cxx index d2ff9a7f20dd..38c041fb2f2b 100644 --- a/Modules/Video/Core/test/itkVectorImageToVideoTest.cxx +++ b/Modules/Video/Core/test/itkVectorImageToVideoTest.cxx @@ -61,7 +61,6 @@ itkVectorImageToVideoTest(int argc, char * argv[]) ITK_TRY_EXPECT_NO_EXCEPTION(videoFilter->Update()); auto videoOutput = videoFilter->GetOutput(); - auto imageRegion = inputImage->GetLargestPossibleRegion(); // Verify start frame and frame duration in output match size of designated temporal axis in input ITK_TEST_EXPECT_EQUAL(