Skip to content

Commit 5169b16

Browse files
authored
Merge pull request #96 from dzenanz/master
2 parents 9785d03 + 539da4f commit 5169b16

File tree

5 files changed

+42
-7
lines changed

5 files changed

+42
-7
lines changed

.github/workflows/build-test-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ jobs:
108108
endif()
109109
set(dashboard_cache "
110110
ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-b
111+
Module_MorphologicalContourInterpolation_BUILD_EXAMPLES:BOOL=ON
111112
BUILD_TESTING:BOOL=ON
112113
")
113114
string(TIMESTAMP build_date "%Y-%m-%d")

CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
cmake_minimum_required(VERSION 3.10.2)
2+
3+
if(CMAKE_CXX_STANDARD EQUAL "98" )
4+
message(FATAL_ERROR "CMAKE_CXX_STANDARD:STRING=98 is not supported in ITK version 5 and greater.")
5+
endif()
6+
7+
if(NOT CMAKE_CXX_STANDARD)
8+
set(CMAKE_CXX_STANDARD 11) # Supported values are ``11``, ``14``, and ``17``.
9+
endif()
10+
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
11+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
12+
endif()
13+
if(NOT CMAKE_CXX_EXTENSIONS)
14+
set(CMAKE_CXX_EXTENSIONS OFF)
15+
endif()
16+
217
project(MorphologicalContourInterpolation)
318

419
if(NOT ITK_SOURCE_DIR)
520
find_package(ITK 4.9 REQUIRED)
621
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
722
include(ITKModuleExternal)
823
else()
24+
set(ITK_DIR ${CMAKE_BINARY_DIR})
925
itk_module_impl()
1026
endif()
1127

examples/CMakeLists.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,30 @@ cmake_minimum_required(VERSION 3.10.2)
22

33
project(MorphologicalContourInterpolation_Examples CXX)
44

5-
find_package(ITK REQUIRED
6-
COMPONENTS
7-
MorphologicalContourInterpolation
8-
ITKSmoothing
9-
ITKIOImageBase
10-
ITKIONRRD
11-
)
5+
if(NOT ITK_SOURCE_DIR)
6+
find_package(ITK 5.2 REQUIRED COMPONENTS MorphologicalContourInterpolation ITKSmoothing ITKImageIO ITKTestKernel)
7+
else()
8+
# when being built as part of ITK, ITKImageIO and ITKTransformIO
9+
# lists of modules are not yet ready, causing a configure error
10+
find_package(ITK REQUIRED COMPONENTS MorphologicalContourInterpolation ITKSmoothing ITKIOImageBase ITKIONRRD ITKTestKernel)
11+
endif()
1212
include(${ITK_USE_FILE})
1313

1414
add_executable(mciExample mciExample.cxx)
1515
target_link_libraries(mciExample ${ITK_LIBRARIES})
1616

1717

18+
# add some regression tests
1819
enable_testing()
1920

2021
add_test(NAME mciExample_SevenLabels_3
2122
COMMAND mciExample ${CMAKE_CURRENT_SOURCE_DIR}/SevenLabels.nrrd
2223
${CMAKE_CURRENT_BINARY_DIR}/SevenLabels_interpolated.nrrd
2324
3)
25+
26+
if(ITK_WRAP_PYTHON)
27+
add_test(NAME mciExample_ManyToMany
28+
COMMAND python ${CMAKE_CURRENT_LIST_DIR}/mciExample.py
29+
${CMAKE_CURRENT_SOURCE_DIR}/ManyToMany.nrrd
30+
${CMAKE_CURRENT_BINARY_DIR}/ManyToMany_interpolated.nrrd)
31+
endif()

examples/ManyToMany.nrrd

1.42 KB
Binary file not shown.

examples/mciExample.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import itk
2+
import sys
3+
4+
if len (sys.argv) < 3:
5+
print( "Usage: %s <input> <output>" % (sys.argv[0]) )
6+
sys.exit(1)
7+
8+
image = itk.imread(sys.argv[1], itk.UC)
9+
filled = itk.morphological_contour_interpolator(image)
10+
itk.imwrite(filled, sys.argv[2], compression=True)

0 commit comments

Comments
 (0)