Skip to content

Commit

Permalink
ENH: Fixes to allow ITKImageProcessing to compile against ITK 5.3.0 (#…
Browse files Browse the repository at this point in the history
…784)

* Code changes to allow ITKImageProcessing filters to compile against ITK 5.3.0
* Prepare for Anaconda packaging by removing specific ITK filters that will not compile against an Anaconda build ITK 5.3.0 due to compile errors in actual the ITK headers.
* Ensure COMPLEX_CONDA_BUILD is set and exported correctly

---------

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson authored Dec 6, 2023
1 parent 87026e5 commit b43f1da
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 66 deletions.
3 changes: 2 additions & 1 deletion cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ OSInformation()
message(STATUS "* -------------- Dependent Libraries -------------------------------------------")
message(STATUS "* Eigen (${Eigen3_VERSION}) ${Eigen3_DIR}")
message(STATUS "* HDF5 (${HDF5_VERSION}) ${HDF5_INSTALL}")
message(STATUS "* ITK (${ITK_VERSION}) ${ITK_DIR}")
# message(STATUS "* ITK (${ITK_VERSION}) ${ITK_DIR}")
message(STATUS "* Pybind11 (${pybind11_VERSION}) ${pybind11_DIR}")
message(STATUS "* TBB (${TBB_VERSION}) ${TBB_DIR}")
message(STATUS "* fmt (${fmt_VERSION}) ${fmt_DIR}")
Expand Down Expand Up @@ -77,6 +77,7 @@ message(STATUS "* Python3_EXECUTABLE: ${Python3_EXECUTABLE}")
message(STATUS "* COMPLEX_BUILD_PYTHON: ${COMPLEX_BUILD_PYTHON}")
message(STATUS "* COMPLEX_EMBED_PYTHON: ${COMPLEX_EMBED_PYTHON}")
message(STATUS "* COMPLEX_ENABLE_SPHINX_DOCS: ${COMPLEX_ENABLE_SPHINX_DOCS}")
message(STATUS "* COMPLEX_CONDA_BUILD: ${COMPLEX_CONDA_BUILD}")

# message(STATUS "* -------------- Known Plugins ------------------------------------------------------")
# foreach(plugin ${COMPLEX_PLUGIN_LIST})
Expand Down
38 changes: 23 additions & 15 deletions src/Plugins/ITKImageProcessing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ if(NOT GENERATOR_IS_MULTI_CONFIG)
set_property(GLOBAL PROPERTY COMPLEX_EXTRA_LIBRARY_DIRS ${COMPLEX_EXTRA_LIBRARY_DIRS} ${ITK_LIB_DIR})
endif()

message(STATUS "* ITK (${ITK_VERSION}) ${ITK_DIR}")

include("${complex_SOURCE_DIR}/cmake/Plugin.cmake")

set(PLUGIN_NAME "ITKImageProcessing")
Expand All @@ -76,6 +78,27 @@ set(FilterList
set(AlgorithmList
)

if(NOT COMPLEX_CONDA_BUILD AND NOT ITKIMAGEPROCESSING_LEAN_AND_MEAN)
list(APPEND FilterList
ITKBinaryContourImage
ITKBinaryOpeningByReconstructionImage
ITKClosingByReconstructionImage
ITKGrayscaleFillholeImage
ITKGrayscaleGrindPeakImage
ITKHConvexImage
ITKHMaximaImage
ITKHMinimaImage
ITKLabelContourImage
ITKMorphologicalGradientImage
ITKMorphologicalWatershedImage
ITKOpeningByReconstructionImage
ITKSignedMaurerDistanceMapImage
ITKValuedRegionalMaximaImage
ITKValuedRegionalMinimaImage
)
endif()


# ------------------------------------------------------------------------------
# These are all extra filters that are built if we have enabled all the filters
#
Expand All @@ -86,17 +109,14 @@ if(NOT ITKIMAGEPROCESSING_LEAN_AND_MEAN)
ITKAdaptiveHistogramEqualizationImage
ITKAsinImage
ITKAtanImage
ITKBinaryContourImage
ITKBinaryDilateImage
ITKBinaryErodeImage
ITKBinaryMorphologicalClosingImage
ITKBinaryMorphologicalOpeningImage
ITKBinaryOpeningByReconstructionImage
ITKBinaryProjectionImage
ITKBinaryThinningImage
ITKBinaryThresholdImage
ITKBlackTopHatImage
ITKClosingByReconstructionImage
ITKCosImage
ITKDilateObjectMorphologyImage
ITKErodeObjectMorphologyImage
Expand All @@ -105,36 +125,24 @@ if(NOT ITKIMAGEPROCESSING_LEAN_AND_MEAN)
ITKGradientMagnitudeImage
ITKGrayscaleDilateImage
ITKGrayscaleErodeImage
ITKGrayscaleFillholeImage
ITKGrayscaleGrindPeakImage
ITKGrayscaleMorphologicalClosingImage
ITKGrayscaleMorphologicalOpeningImage
ITKHConvexImage
ITKHMaximaImage
ITKHMinimaImage
ITKIntensityWindowingImage
ITKInvertIntensityImage
ITKImportFijiMontageFilter
ITKLabelContourImage
ITKLog10Image
ITKLogImage
ITKMaskImage
ITKMorphologicalGradientImage
ITKMorphologicalWatershedImage
ITKNormalizeImage
ITKNotImage
ITKOpeningByReconstructionImage
ITKOtsuMultipleThresholdsImage
ITKRelabelComponentImage
ITKSigmoidImage
ITKSignedMaurerDistanceMapImage
ITKSinImage
ITKSqrtImage
ITKSquareImage
ITKTanImage
ITKThresholdImage
ITKValuedRegionalMaximaImage
ITKValuedRegionalMinimaImage
ITKWhiteTopHatImage

# -----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#cmakedefine ITKIMAGEPROCESSING_LEAN_AND_MEAN

#cmakedefine COMPLEX_CONDA_BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace itk
class Dream3DFilterInterruption : public Command
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(Dream3DFilterInterruption);
ITK_DISALLOW_COPY_AND_MOVE(Dream3DFilterInterruption);

/** Standard class type aliases. */
using Self = Dream3DFilterInterruption;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Result<OutputActions> ReadImagePreflight(const std::string& fileName, DataPath i

try
{
itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(fileName.c_str(), itk::ImageIOFactory::ReadMode);
itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(fileName.c_str(), itk::CommonEnums::IOFileMode::ReadMode);
if(imageIO == nullptr)
{
return MakeErrorResult<OutputActions>(-5, fmt::format("ITK could not read the given file \"{}\". Format is likely unsupported.", fileName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Result<> ReadImageExecute(const std::string& fileName, ArgsT&&... args)
{
try
{
itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(fileName.c_str(), itk::ImageIOFactory::ReadMode);
itk::ImageIOBase::Pointer imageIO = itk::ImageIOFactory::CreateImageIO(fileName.c_str(), itk::CommonEnums::IOFileMode::ReadMode);
if(imageIO == nullptr)
{
return MakeErrorResult(-5, fmt::format("ITK could not read the given file \"{}\". Format is likely unsupported.", fileName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ itk::FlatStructuringElement<Dimension> CreateKernel(KernelEnum kernelType, const
{
size.push_back(static_cast<uint32_t>(f));
}
typedef itk::FlatStructuringElement<Dimension> StructuringElementType;
typedef typename StructuringElementType::RadiusType RadiusType;
using StructuringElementType = itk::FlatStructuringElement<Dimension>;
using RadiusType = typename StructuringElementType::RadiusType;
RadiusType elementRadius;
if(RadiusType::Dimension > 0)
{
Expand Down
Loading

0 comments on commit b43f1da

Please sign in to comment.