diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index e70da4e..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.16.3) -project(GenericLabelInterpolator) - -if(NOT ITK_SOURCE_DIR) - find_package(ITK 4.9 REQUIRED) - list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR}) - include(ITKModuleExternal) -else() - itk_module_impl() -endif() diff --git a/CTestConfig.cmake b/CTestConfig.cmake deleted file mode 100644 index 056c605..0000000 --- a/CTestConfig.cmake +++ /dev/null @@ -1,8 +0,0 @@ -set(CTEST_PROJECT_NAME "ITK") -set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC") - -set(CTEST_DROP_METHOD "https") -set(CTEST_DROP_SITE "open.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=Insight") -set(CTEST_DROP_SITE_CDASH TRUE) - diff --git a/MIGRATION_README.md b/MIGRATION_README.md new file mode 100644 index 0000000..168e07b --- /dev/null +++ b/MIGRATION_README.md @@ -0,0 +1,19 @@ +# Migrated to ITK main + +As of 2026-04-27, the `GenericLabelInterpolator` module has been +ingested into the main ITK source tree. The authoritative location is: + + https://github.com/InsightSoftwareConsortium/ITK/tree/main/Modules/Filtering/GenericLabelInterpolator + +See `Modules/Filtering/GenericLabelInterpolator/README.rst` (or any +in-tree documentation under that path) for details on what moved and +what remains in this archived repo. + +This repository is retained read-only for historical reference (deep +git history, paper material, example assets not migrated to ITK). It +will be marked ARCHIVED after this PR merges. + +Related: +- ITK ingest PR: InsightSoftwareConsortium/ITK#6135 +- ITK ingest merge commit: InsightSoftwareConsortium/ITK@d1eab72aa6 +- Consolidation issue: InsightSoftwareConsortium/ITK#6060 diff --git a/include/itkLabelImageGenericInterpolateImageFunction.h b/include/itkLabelImageGenericInterpolateImageFunction.h deleted file mode 100644 index 83782e3..0000000 --- a/include/itkLabelImageGenericInterpolateImageFunction.h +++ /dev/null @@ -1,133 +0,0 @@ -/*========================================================================= - * - * Copyright NumFOCUS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef itkLabelImageGenericInterpolateImageFunction_h -#define itkLabelImageGenericInterpolateImageFunction_h - -#include -#include "itkLabelSelectionImageAdaptor.h" -#include -#include - -namespace itk -{ - -/** \class LabelImageGenericInterpolateImageFunction - * \brief Interpolation function for multi-label images that implicitly interpolates each - * unique value in the image corresponding to each label set element and returns the - * corresponding label set element with the largest weight. - * - * This filter is an alternative to nearest neighbor interpolation for multi-label - * images. It can use almost any underlying interpolator. - * * \ingroup ITKImageFunction - * * \ingroup GenericLabelInterpolator - */ - -template class TInterpolator, - typename TCoordRep = double> -class ITK_EXPORT LabelImageGenericInterpolateImageFunction : public InterpolateImageFunction -{ -public: - ITK_DISALLOW_COPY_AND_MOVE(LabelImageGenericInterpolateImageFunction); - - /** Standard class type alias. */ - using Self = LabelImageGenericInterpolateImageFunction; - using Superclass = InterpolateImageFunction; - using Pointer = SmartPointer; - using ConstPointer = SmartPointer; - using InputPixelType = typename TInputImage::PixelType; - - /** Run-time type information (and related methods). */ - itkOverrideGetNameOfClassMacro(LabelImageGenericInterpolateImageFunction); - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** ImageDimension constant */ - static constexpr unsigned int ImageDimension = TInputImage::ImageDimension; - - /** OutputType type alias support. */ - using OutputType = typename Superclass::OutputType; - - /** InputImageType type alias support. */ - using InputImageType = typename Superclass::InputImageType; - - /** RealType type alias support. */ - using RealType = typename Superclass::RealType; - - /** Index type alias support. */ - using IndexType = typename Superclass::IndexType; - - /** Size type alias support. */ - using SizeType = typename Superclass::SizeType; - - /** ContinuousIndex type alias support. */ - using ContinuousIndexType = typename Superclass::ContinuousIndexType; - - using LabelSelectionAdaptorType = LabelSelectionImageAdaptor; - - // The interpolator used for individual binary masks corresponding to each label - using InternalInterpolatorType = TInterpolator; - - /** - * Evaluate at the given index - */ - OutputType - EvaluateAtContinuousIndex(const ContinuousIndexType & cindex) const override - { - return this->EvaluateAtContinuousIndex(cindex, nullptr); - } - - void - SetInputImage(const TInputImage * image) override; - - /** Get the radius required for interpolation. - * - * This defines the number of surrounding pixels required to interpolate at - * a given point. - */ - SizeType - GetRadius() const override - { - return SizeType::Filled(1); - } - -protected: - LabelImageGenericInterpolateImageFunction() = default; - ~LabelImageGenericInterpolateImageFunction() override = default; - - std::vector m_InternalInterpolators; - std::vector m_LabelSelectionAdaptors; - using LabelSetType = std::set; - LabelSetType m_Labels; - -private: - /** - * Evaluate function value at the given index - */ - virtual OutputType - EvaluateAtContinuousIndex(const ContinuousIndexType &, OutputType *) const; -}; - -} // end namespace itk - -#ifndef ITK_MANUAL_INSTANTIATION -# include "itkLabelImageGenericInterpolateImageFunction.hxx" -#endif - -#endif diff --git a/include/itkLabelImageGenericInterpolateImageFunction.hxx b/include/itkLabelImageGenericInterpolateImageFunction.hxx deleted file mode 100644 index 80e1a93..0000000 --- a/include/itkLabelImageGenericInterpolateImageFunction.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/*========================================================================= - * - * Copyright NumFOCUS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef itkLabelImageGenericInterpolateImageFunction_hxx -#define itkLabelImageGenericInterpolateImageFunction_hxx - -#include - -namespace itk -{ - -template class TInterpolator, - typename TCoordRep> -void -LabelImageGenericInterpolateImageFunction::SetInputImage( - const TInputImage * image) -{ - /* We have one adaptor and one interpolator per label to keep the class thread-safe: - * changing the adaptor's accepted value wouldn't work when called from a multi-threaded filter */ - using IteratorType = itk::ImageRegionConstIterator; - if (image) - { - m_Labels.clear(); - IteratorType it(image, image->GetLargestPossibleRegion()); - for (it.GoToBegin(); !it.IsAtEnd(); ++it) - { - m_Labels.insert(it.Get()); - } - m_InternalInterpolators.clear(); - m_LabelSelectionAdaptors.clear(); - for (auto i = m_Labels.begin(); i != m_Labels.end(); ++i) - { - typename LabelSelectionAdaptorType::Pointer adapt = LabelSelectionAdaptorType::New(); - // This adaptor doesn't implement Set() so this should be safe - adapt->SetImage(const_cast(image)); - adapt->SetAcceptedValue(*i); - m_LabelSelectionAdaptors.push_back(adapt); - typename InternalInterpolatorType::Pointer interp = InternalInterpolatorType::New(); - interp->SetInputImage(adapt); - m_InternalInterpolators.push_back(interp); - } - } - Superclass::SetInputImage(image); -} - -template class TInterpolator, - typename TCoordRep> -typename LabelImageGenericInterpolateImageFunction::OutputType -LabelImageGenericInterpolateImageFunction::EvaluateAtContinuousIndex( - const ContinuousIndexType & cindex, - OutputType * itkNotUsed(grad)) const -{ - /* Interpolate the binary mask corresponding to each label and return the label - * with the highest value */ - double value = 0; - InputPixelType best_label = itk::NumericTraits::ZeroValue(); - int i = 0; - for (auto it = m_Labels.begin(); it != m_Labels.end(); ++it) - { - double tmp = m_InternalInterpolators[i]->EvaluateAtContinuousIndex(cindex); - if (tmp > value) - { - value = tmp; - best_label = (*it); - } - ++i; - } - return best_label; -} - -} // namespace itk - -#endif diff --git a/include/itkLabelSelectionImageAdaptor.h b/include/itkLabelSelectionImageAdaptor.h deleted file mode 100644 index 4ebe6d6..0000000 --- a/include/itkLabelSelectionImageAdaptor.h +++ /dev/null @@ -1,68 +0,0 @@ -/*========================================================================= - * - * Copyright NumFOCUS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef itkLabelSelectionImageAdaptor_h -#define itkLabelSelectionImageAdaptor_h - -#include "itkLabelSelectionPixelAccessor.h" - -namespace itk -{ -/** \class LabelSelectionImageAdaptor - * \brief Presents a label image as a binary image of one label - * - * Additional casting is performed according to the input and output image - * types following C++ default casting rules. - * - * \ingroup ImageAdaptors - * \ingroup ITKImageAdaptors - * \ingroup GenericLabelInterpolator - */ -template -class ITK_EXPORT LabelSelectionImageAdaptor - : public ImageAdaptor> -{ -public: - ITK_DISALLOW_COPY_AND_MOVE(LabelSelectionImageAdaptor); - - /** Standard class type alias. */ - using Self = LabelSelectionImageAdaptor; - using Superclass = - ImageAdaptor>; - - using Pointer = SmartPointer; - using ConstPointer = SmartPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkOverrideGetNameOfClassMacro(LabelSelectionImageAdaptor); - - void - SetAcceptedValue(typename TImage::PixelType value) - { - this->GetPixelAccessor().SetAcceptedValue(value); - } - -protected: - LabelSelectionImageAdaptor() = default; - ~LabelSelectionImageAdaptor() override = default; -}; -} // end namespace itk - -#endif diff --git a/include/itkLabelSelectionPixelAccessor.h b/include/itkLabelSelectionPixelAccessor.h deleted file mode 100644 index 0c2ccf1..0000000 --- a/include/itkLabelSelectionPixelAccessor.h +++ /dev/null @@ -1,68 +0,0 @@ -/*========================================================================= - * - * Copyright NumFOCUS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef itkLabelSelectionPixelAccessor_h -#define itkLabelSelectionPixelAccessor_h - -#include "itkImageAdaptor.h" - -namespace itk -{ -namespace Accessor -{ -/** \class LabelSelectionPixelAccessor - * \brief Return a binary mask of the selected label - * - * LabelSelectionPixelAccessor is templated over an internal type and an - * external type representation. This class cast the input - * applies the function to it and cast the result according - * to the types defined as template parameters - * - * \ingroup ImageAdaptors - * \ingroup ITKImageAdaptors - * \ingroup GenericLabelInterpolator - */ -template -class ITK_EXPORT LabelSelectionPixelAccessor -{ -public: - /** External type alias. It defines the external aspect - * that this class will exhibit. */ - using ExternalType = TExternalType; - - /** Internal type alias. It defines the internal real - * representation of data. */ - using InternalType = TInternalType; - - void - SetAcceptedValue(TInternalType value) - { - m_AcceptedValue = value; - } - - inline TExternalType - Get(const TInternalType & input) const - { - return (TExternalType)((input == m_AcceptedValue) ? 1 : 0); - } - -protected: - TInternalType m_AcceptedValue; -}; -} // end namespace Accessor -} // end namespace itk -#endif diff --git a/itk-module.cmake b/itk-module.cmake deleted file mode 100644 index 9fc48a3..0000000 --- a/itk-module.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# the top-level README is used for describing this module, just -# re-used it for documentation here -get_filename_component(MY_CURENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -file(READ "${MY_CURENT_DIR}/README.rst" DOCUMENTATION) - -# itk_module() defines the module dependencies in GenericLabelInterpolator -# The testing module in GenericLabelInterpolator depends on ITKTestKernel -# By convention those modules outside of ITK are not prefixed with -# ITK - -# define the dependencies of the include module and the tests -itk_module(GenericLabelInterpolator - DEPENDS - ITKSmoothing - ITKImageAdaptors - TEST_DEPENDS - ITKTestKernel - ITKImageGrid - DESCRIPTION - "${DOCUMENTATION}" - EXCLUDE_FROM_DEFAULT - ENABLE_SHARED -) diff --git a/test/Baseline/gl_gaussian_3.mha.cid b/test/Baseline/gl_gaussian_3.mha.cid deleted file mode 100644 index a922548..0000000 --- a/test/Baseline/gl_gaussian_3.mha.cid +++ /dev/null @@ -1 +0,0 @@ -bafkreihi5ylz5qypvqfl3j4hglalh4cxxh64ooxi4bcqujvjbngys3wqlq diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 57ef5c7..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -itk_module_test() - -set(GenericLabelInterpolatorTests - RotateLabels.cxx - ) - -CreateTestDriver(GenericLabelInterpolator "${GenericLabelInterpolator-Test_LIBRARIES}" "${GenericLabelInterpolatorTests}") - -itk_add_test(NAME GenericLabelInterpolatorRotateLabelsTest - COMMAND GenericLabelInterpolatorTestDriver - --compare - ${ITK_TEST_OUTPUT_DIR}/gl_gaussian_3.mha - DATA{Baseline/gl_gaussian_3.mha} - RotateLabels - DATA{Input/classification_s4.mha} - ${ITK_TEST_OUTPUT_DIR}/ - 3 - ) diff --git a/test/Docker/Dockerfile b/test/Docker/Dockerfile deleted file mode 100644 index 081472b..0000000 --- a/test/Docker/Dockerfile +++ /dev/null @@ -1,46 +0,0 @@ -FROM debian:8 -MAINTAINER Insight Software Consortium - -RUN apt-get update && apt-get install -y \ - build-essential \ - curl \ - cmake \ - git \ - libexpat1-dev \ - libhdf5-dev \ - libjpeg-dev \ - libpng12-dev \ - libpython3-dev \ - libtiff5-dev \ - python \ - ninja-build \ - wget \ - vim \ - zlib1g-dev - -RUN mkdir -p /usr/src/GenericLabelInterpolator-build -WORKDIR /usr/src - -# v4.10rc02 (2016-05-18) -ENV ITK_GIT_TAG 417d6a36d01aa3b835855349cc481a9b3dca8506 -RUN git clone git://itk.org/ITK.git && \ - cd ITK && \ - git checkout ${ITK_GIT_TAG} && \ - cd ../ && \ - mkdir ITK-build && \ - cd ITK-build && \ - cmake \ - -G Ninja \ - -DCMAKE_INSTALL_PREFIX:PATH=/usr \ - -DBUILD_EXAMPLES:BOOL=OFF \ - -DBUILD_TESTING:BOOL=OFF \ - -DBUILD_SHARED_LIBS:BOOL=ON \ - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \ - -DITK_LEGACY_REMOVE:BOOL=ON \ - -DITK_WRAP_PYTHON:BOOL=OFF \ - -DITK_LEGACY_SILENT:BOOL=ON \ - -DITK_BUILD_DEFAULT_MODULES:BOOL=ON \ - -DITK_USE_SYSTEM_LIBRARIES:BOOL=OFF \ - ../ITK && \ - ninja && \ - find . -name '*.o' -delete diff --git a/test/Docker/build.sh b/test/Docker/build.sh deleted file mode 100755 index e2b19ad..0000000 --- a/test/Docker/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -script_dir="`cd $(dirname $0); pwd`" - -docker build -t insighttoolkit/genericlabelinterpolator-test $script_dir diff --git a/test/Docker/run.sh b/test/Docker/run.sh deleted file mode 100755 index 21bef6e..0000000 --- a/test/Docker/run.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -script_dir="`cd $(dirname $0); pwd`" - -docker run \ - --rm \ - -v $script_dir/../..:/usr/src/GenericLabelInterpolator \ - insighttoolkit/genericlabelinterpolator-test \ - /usr/src/GenericLabelInterpolator/test/Docker/test.sh diff --git a/test/Docker/test.sh b/test/Docker/test.sh deleted file mode 100755 index 1de44af..0000000 --- a/test/Docker/test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# This is a script to build the modules and run the test suite in the base -# Docker container. - -die() { - echo "Error: $@" 1>&2 - exit 1; -} - -cd /usr/src/GenericLabelInterpolator-build || die "Could not cd into the build directory" - -cmake \ - -G Ninja \ - -DITK_DIR:PATH=/usr/src/ITK-build \ - -DCMAKE_BUILD_TYPE:STRING=Release \ - /usr/src/GenericLabelInterpolator || die "CMake configuration failed" -ctest -VV -D Experimental || die "ctest failed" diff --git a/test/Input/classification_s4.mha.cid b/test/Input/classification_s4.mha.cid deleted file mode 100644 index a43f71a..0000000 --- a/test/Input/classification_s4.mha.cid +++ /dev/null @@ -1 +0,0 @@ -bafkreieknicyj6a22rizrcyfy4pzx5pskm4loi3m7h5gbi2qp2cc3ny3my diff --git a/test/RotateLabels.cxx b/test/RotateLabels.cxx deleted file mode 100644 index 39dbe52..0000000 --- a/test/RotateLabels.cxx +++ /dev/null @@ -1,211 +0,0 @@ -/*========================================================================= - * - * Copyright NumFOCUS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "itkLabelImageGenericInterpolateImageFunction.h" -#include "itkLabelSelectionImageAdaptor.h" -#include "itkLabelSelectionPixelAccessor.h" - -/* This demo is a torture test for interpolators: it takes an input label map, - * rotates it one full turn in ten steps, and writes the result */ - -template -void -RotateNTimes(typename ImageType::Pointer input, - typename itk::InterpolateImageFunction * interpolator, - unsigned int number_of_rotations, - std::string filename_prefix, - std::string output_directory) -{ - using TransformType = itk::VersorRigid3DTransform; - using ResampleFilterType = itk::ResampleImageFilter; - TransformType::AxisType axis; - axis[0] = 0; - axis[1] = 1; - axis[2] = 0; - // compute physical center of input image - itk::ContinuousIndex center; - - const auto inputSize = input->GetLargestPossibleRegion().GetSize(); - - for (unsigned int i = 0; i < ImageType::ImageDimension; ++i) - { - center[i] = inputSize[i] / 2.0; - } - // convert to physical coordinates - typename ImageType::PointType centerPhysical; - input->TransformContinuousIndexToPhysicalPoint(center, centerPhysical); - - TransformType::Pointer rot = TransformType::New(); - rot->SetCenter(centerPhysical); - rot->SetRotation(axis, 2. * itk::Math::pi / number_of_rotations); - - typename ResampleFilterType::Pointer rs = ResampleFilterType::New(); - rs->SetInput(input); - rs->SetReferenceImage(input); - rs->SetUseReferenceImage(true); - rs->SetTransform(rot); - rs->SetInterpolator(interpolator); - typename ImageType::Pointer out; - itk::TimeProbe timer; - timer.Start(); - for (unsigned i = 0; i < number_of_rotations; ++i) - { - rs->SetReferenceImage(input); - rs->SetUseReferenceImage(true); - rs->Update(); - out = rs->GetOutput(); - out->DisconnectPipeline(); - rs->SetInput(out); - rs->SetTransform(rot); - } - timer.Stop(); - using ComparisonFilterType = itk::Testing::ComparisonImageFilter; - typename ComparisonFilterType::Pointer compare = ComparisonFilterType::New(); - compare->SetValidInput(input); - compare->SetTestInput(out); - compare->Update(); - std::cout << "Pixels with differences: " << std::setw(8) << compare->GetNumberOfPixelsWithDifferences() << " ( " - << std::fixed << std::setprecision(2) - << static_cast(compare->GetNumberOfPixelsWithDifferences()) / - input->GetLargestPossibleRegion().GetNumberOfPixels() * 100. - << "% ) in " << timer.GetTotal() << "s" << std::endl; - using WriterType = itk::ImageFileWriter; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetUseCompression(true); - writer->SetInput(out); - std::ostringstream fname_stream; - fname_stream << output_directory << "/" << filename_prefix << "_" << number_of_rotations << ".mha"; - writer->SetFileName(fname_stream.str()); - writer->Write(); -} - - -// The BSpline interpolator has more arguments than other interpolators, so we set the additional parameter to the -// default value -template -class BSplineInterpolator : public itk::BSplineInterpolateImageFunction -{}; - -template -class FixedGaussianInterpolator : public itk::GaussianInterpolateImageFunction -{ -public: - using Self = FixedGaussianInterpolator; - using Superclass = itk::GaussianInterpolateImageFunction; - using Pointer = itk::SmartPointer; - using ConstPointer = itk::SmartPointer; - - /** Run-time type information (and related methods). */ - itkOverrideGetNameOfClassMacro(FixedGaussianInterpolator); - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - FixedGaussianInterpolator() - { - this->SetAlpha(1.0); - this->SetSigma(0.3); - } -}; - -int -RotateLabels(int argc, char * argv[]) -{ - if (argc != 4) - { - std::cout << "Usage: " << argv[0] << " inputImage outputDirectory numberOfRotation" << std::endl; - return EXIT_FAILURE; - } - std::string inputFileName = argv[1]; - std::string outputDirectory = argv[2]; - std::istringstream stream(argv[3]); - unsigned int numberOfRotations = 0; - stream >> numberOfRotations; - if (numberOfRotations < 1) - { - std::cout << "numberOfRotation must be strictly positive. Given value: " << numberOfRotations << std::endl; - return EXIT_FAILURE; - } - using PixelType = unsigned char; - constexpr unsigned int Dimension = 3; - using ImageType = itk::Image; - using ReaderType = itk::ImageFileReader; - ReaderType::Pointer r = ReaderType::New(); - r->SetFileName(inputFileName); - r->Update(); - - std::cout << "Testing with " << numberOfRotations << " rotations..." << std::endl << std::endl; - - std::cout << "Nearest neighbor interpolator... " << std::flush; - using NNInterpolatorType = itk::NearestNeighborInterpolateImageFunction; - NNInterpolatorType::Pointer nn_interp = NNInterpolatorType::New(); - RotateNTimes(r->GetOutput(), nn_interp, numberOfRotations, "nearest", outputDirectory); - - std::cout << "Linear interpolator... " << std::flush; - using LInterpolatorType = itk::LinearInterpolateImageFunction; - LInterpolatorType::Pointer l_interp = LInterpolatorType::New(); - RotateNTimes(r->GetOutput(), l_interp, numberOfRotations, "linear", outputDirectory); - - std::cout << "Label Gaussian interpolator type... " << std::flush; - using LGInterpolatorType = itk::LabelImageGaussianInterpolateImageFunction; - LGInterpolatorType::Pointer lg_interp = LGInterpolatorType::New(); - lg_interp->SetSigma(0.3); - RotateNTimes(r->GetOutput(), lg_interp, numberOfRotations, "label_gaussian", outputDirectory); - - std::cout << "Generic label interpolator with nearest neighbor... " << std::flush; - using GNNInterpolatorType = - itk::LabelImageGenericInterpolateImageFunction; - GNNInterpolatorType::Pointer gnn_interp = GNNInterpolatorType::New(); - RotateNTimes(r->GetOutput(), gnn_interp, numberOfRotations, "gl_nearest", outputDirectory); - - std::cout << "Generic label interpolator with linear interpolation... " << std::flush; - using GLInterpolatorType = - itk::LabelImageGenericInterpolateImageFunction; - GLInterpolatorType::Pointer gl_interp = GLInterpolatorType::New(); - RotateNTimes(r->GetOutput(), gl_interp, numberOfRotations, "gl_linear", outputDirectory); - - std::cout << "Generic label interpolator with B-Spline interpolation... " << std::flush; - using GBSInterpolatorType = itk::LabelImageGenericInterpolateImageFunction; - GBSInterpolatorType::Pointer gbs_interp = GBSInterpolatorType::New(); - RotateNTimes(r->GetOutput(), gbs_interp, numberOfRotations, "gl_bspline", outputDirectory); - - std::cout << "Generic label interpolator with Gaussian interpolation... " << std::flush; - using GGInterpolatorType = itk::LabelImageGenericInterpolateImageFunction; - GGInterpolatorType::Pointer gg_interp = GGInterpolatorType::New(); - RotateNTimes(r->GetOutput(), gg_interp, numberOfRotations, "gl_gaussian", outputDirectory); - - std::cout << std::endl; - - - return EXIT_SUCCESS; -} diff --git a/wrapping/CMakeLists.txt b/wrapping/CMakeLists.txt deleted file mode 100644 index c6fad17..0000000 --- a/wrapping/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -itk_wrap_module(GenericLabelInterpolator) -itk_auto_load_submodules() -itk_end_wrap_module() diff --git a/wrapping/itkLabelImageGenericInterpolateImageFunction.wrap b/wrapping/itkLabelImageGenericInterpolateImageFunction.wrap deleted file mode 100644 index 7e91766..0000000 --- a/wrapping/itkLabelImageGenericInterpolateImageFunction.wrap +++ /dev/null @@ -1,23 +0,0 @@ -itk_wrap_include("itkLinearInterpolateImageFunction.h") -itk_wrap_include("itkNearestNeighborInterpolateImageFunction.h") - -itk_wrap_class("itk::LabelImageGenericInterpolateImageFunction" POINTER) - foreach(d ${ITK_WRAP_IMAGE_DIMS}) - # UC is required for InterpolateImageFunction - UNIQUE(types "${WRAP_ITK_SCALAR};UC;${WRAP_ITK_COLOR}") - foreach(t ${types}) - itk_wrap_template("${ITKM_I${t}${d}}Linear" "${ITKT_I${t}${d}},itk::LinearInterpolateImageFunction") - itk_wrap_template("${ITKM_I${t}${d}}NearestNeighbor" "${ITKT_I${t}${d}},itk::NearestNeighborInterpolateImageFunction") - endforeach() - - # FIXME: Build fails with the following errors: - # error: no match for ‘operator<’ (operand types are ‘const itk::CovariantVector’ and ‘const itk::CovariantVector’) - # error: no match for ‘operator<’ (operand types are ‘const itk::Vector’ and ‘const itk::Vector’) - # error: no match for ‘operator<’ (operand types are ‘const itk::CovariantVector’ and ‘const itk::CovariantVector’) - # error: no match for ‘operator<’ (operand types are ‘const itk::Vector’ and ‘const itk::Vector’) - # foreach(t ${WRAP_ITK_VECTOR}) - # itk_wrap_template("${ITKM_I${t}${d}${d}}Linear" "${ITKT_I${t}${d}${d}},itk::LinearInterpolateImageFunction") - # endforeach() - - endforeach() -itk_end_wrap_class()