From 14c914d8037fb3648deed50012975dc7b1574274 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Tue, 22 Jun 2021 17:10:33 +0200 Subject: [PATCH] STYLE: Remove ITK 5.1/5.2 `itk::Experimental` namespace workaround With ITK 5.2.0, `ImageRegionRange` and `ImageBufferRange` moved from `itk::Experimental` namespace to the root `itk` namespace. Follow-up to pull request https://github.com/SuperElastix/elastix/pull/475 commit 6803b26a73aea270cf7b75e0febc4d53ea21053e "COMP: Upgrade ITK from v5.1.1 to v5.2.0" --- Core/Main/GTesting/elxCoreMainGTestUtilities.h | 18 ++---------------- .../itkElastixRegistrationMethodGTest.cxx | 15 +++------------ .../GTesting/itkTransformixFilterGTest.cxx | 6 +----- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/Core/Main/GTesting/elxCoreMainGTestUtilities.h b/Core/Main/GTesting/elxCoreMainGTestUtilities.h index 7365a489b..a1f8dc825 100644 --- a/Core/Main/GTesting/elxCoreMainGTestUtilities.h +++ b/Core/Main/GTesting/elxCoreMainGTestUtilities.h @@ -34,15 +34,6 @@ #include -namespace itk -{ -namespace Experimental -{ -// Workaround to allow using things that may be either in itk or in itk::Experimental. -} -} // namespace itk - - namespace elastix { namespace CoreMainGTestUtilities @@ -100,13 +91,8 @@ FillImageRegion(itk::Image & image, const itk::Index & regionIndex, const itk::Size & regionSize) { - // ImageRegionRange is to be moved from namespace itk::Experimental - // to namespace itk with ITK version 5.2. - using namespace itk; - using namespace itk::Experimental; - - const ImageRegionRange> imageRegionRange{ - image, ImageRegion{ regionIndex, regionSize } + const itk::ImageRegionRange> imageRegionRange{ + image, itk::ImageRegion{ regionIndex, regionSize } }; std::fill(std::begin(imageRegionRange), std::end(imageRegionRange), 1); } diff --git a/Core/Main/GTesting/itkElastixRegistrationMethodGTest.cxx b/Core/Main/GTesting/itkElastixRegistrationMethodGTest.cxx index 26d42c9b4..e1991b8e6 100644 --- a/Core/Main/GTesting/itkElastixRegistrationMethodGTest.cxx +++ b/Core/Main/GTesting/itkElastixRegistrationMethodGTest.cxx @@ -167,11 +167,6 @@ GTEST_TEST(itkElastixRegistrationMethod, WriteResultImageFalse) GTEST_TEST(itkElastixRegistrationMethod, InitialTransformParameterFile) { - // IndexRange is to be moved from namespace itk::Experimental - // to namespace itk with ITK version 5.2. - using namespace itk; - using namespace itk::Experimental; - constexpr auto ImageDimension = 2U; using ImageType = itk::Image; using SizeType = itk::Size; @@ -209,7 +204,8 @@ GTEST_TEST(itkElastixRegistrationMethod, InitialTransformParameterFile) const auto toOffset = [](const IndexType & index) { return index - IndexType(); }; - for (const auto index : ImageRegionIndexRange(itk::ImageRegion({ 0, -2 }, { 2, 3 }))) + for (const auto index : + itk::ImageRegionIndexRange(itk::ImageRegion({ 0, -2 }, { 2, 3 }))) { movingImage->FillBuffer(0); elx::CoreMainGTestUtilities::FillImageRegion(*movingImage, fixedImageRegionIndex + toOffset(index), regionSize); @@ -238,11 +234,6 @@ GTEST_TEST(itkElastixRegistrationMethod, InitialTransformParameterFile) GTEST_TEST(itkElastixRegistrationMethod, InitialTransformParameterFileLinkToTransformFile) { - // IndexRange is to be moved from namespace itk::Experimental - // to namespace itk with ITK version 5.2. - using namespace itk; - using namespace itk::Experimental; - constexpr auto ImageDimension = 2U; using ImageType = itk::Image; using SizeType = itk::Size; @@ -294,7 +285,7 @@ GTEST_TEST(itkElastixRegistrationMethod, InitialTransformParameterFileLinkToTran const auto filter2 = createFilter(transformParameterFileName); for (const auto index : - ImageRegionIndexRange(itk::ImageRegion({ 0, -2 }, { 2, 3 }))) + itk::ImageRegionIndexRange(itk::ImageRegion({ 0, -2 }, { 2, 3 }))) { movingImage->FillBuffer(0); elx::CoreMainGTestUtilities::FillImageRegion(*movingImage, fixedImageRegionIndex + toOffset(index), regionSize); diff --git a/Core/Main/GTesting/itkTransformixFilterGTest.cxx b/Core/Main/GTesting/itkTransformixFilterGTest.cxx index e6d62959f..470985cbe 100644 --- a/Core/Main/GTesting/itkTransformixFilterGTest.cxx +++ b/Core/Main/GTesting/itkTransformixFilterGTest.cxx @@ -160,11 +160,7 @@ template void ExpectAlmostEqualPixelValues(const TImage & actualImage, const TImage & expectedImage, const double tolerance) { - // ImageBufferRange is to be moved from namespace itk::Experimental - // to namespace itk with ITK version 5.2. - using namespace itk; - using namespace itk::Experimental; - using ImageBufferRangeType = ImageBufferRange; + using ImageBufferRangeType = itk::ImageBufferRange; const ImageBufferRangeType actualImageBufferRange(actualImage); const ImageBufferRangeType expectedImageBufferRange(expectedImage);