Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STYLE: Remove ITK 5.1/5.2 itk::Experimental namespace workaround #483

Merged
merged 1 commit into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions Core/Main/GTesting/elxCoreMainGTestUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@
#include <gtest/gtest.h>


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
Expand Down Expand Up @@ -100,13 +91,8 @@ FillImageRegion(itk::Image<TPixel, VImageDimension> & image,
const itk::Index<VImageDimension> & regionIndex,
const itk::Size<VImageDimension> & 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<Image<TPixel, VImageDimension>> imageRegionRange{
image, ImageRegion<VImageDimension>{ regionIndex, regionSize }
const itk::ImageRegionRange<itk::Image<TPixel, VImageDimension>> imageRegionRange{
image, itk::ImageRegion<VImageDimension>{ regionIndex, regionSize }
};
std::fill(std::begin(imageRegionRange), std::end(imageRegionRange), 1);
}
Expand Down
15 changes: 3 additions & 12 deletions Core/Main/GTesting/itkElastixRegistrationMethodGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<float, ImageDimension>;
using SizeType = itk::Size<ImageDimension>;
Expand Down Expand Up @@ -209,7 +204,8 @@ GTEST_TEST(itkElastixRegistrationMethod, InitialTransformParameterFile)

const auto toOffset = [](const IndexType & index) { return index - IndexType(); };

for (const auto index : ImageRegionIndexRange<ImageDimension>(itk::ImageRegion<ImageDimension>({ 0, -2 }, { 2, 3 })))
for (const auto index :
itk::ImageRegionIndexRange<ImageDimension>(itk::ImageRegion<ImageDimension>({ 0, -2 }, { 2, 3 })))
{
movingImage->FillBuffer(0);
elx::CoreMainGTestUtilities::FillImageRegion(*movingImage, fixedImageRegionIndex + toOffset(index), regionSize);
Expand Down Expand Up @@ -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<float, ImageDimension>;
using SizeType = itk::Size<ImageDimension>;
Expand Down Expand Up @@ -294,7 +285,7 @@ GTEST_TEST(itkElastixRegistrationMethod, InitialTransformParameterFileLinkToTran
const auto filter2 = createFilter(transformParameterFileName);

for (const auto index :
ImageRegionIndexRange<ImageDimension>(itk::ImageRegion<ImageDimension>({ 0, -2 }, { 2, 3 })))
itk::ImageRegionIndexRange<ImageDimension>(itk::ImageRegion<ImageDimension>({ 0, -2 }, { 2, 3 })))
{
movingImage->FillBuffer(0);
elx::CoreMainGTestUtilities::FillImageRegion(*movingImage, fixedImageRegionIndex + toOffset(index), regionSize);
Expand Down
6 changes: 1 addition & 5 deletions Core/Main/GTesting/itkTransformixFilterGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,7 @@ template <typename TImage>
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<const TImage>;
using ImageBufferRangeType = itk::ImageBufferRange<const TImage>;

const ImageBufferRangeType actualImageBufferRange(actualImage);
const ImageBufferRangeType expectedImageBufferRange(expectedImage);
Expand Down