Skip to content

Commit

Permalink
Merge pull request #96 from dzenanz/master
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex authored Jan 28, 2021
2 parents 9785d03 + 539da4f commit 5169b16
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
endif()
set(dashboard_cache "
ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-b
Module_MorphologicalContourInterpolation_BUILD_EXAMPLES:BOOL=ON
BUILD_TESTING:BOOL=ON
")
string(TIMESTAMP build_date "%Y-%m-%d")
Expand Down
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
cmake_minimum_required(VERSION 3.10.2)

if(CMAKE_CXX_STANDARD EQUAL "98" )
message(FATAL_ERROR "CMAKE_CXX_STANDARD:STRING=98 is not supported in ITK version 5 and greater.")
endif()

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11) # Supported values are ``11``, ``14``, and ``17``.
endif()
if(NOT CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(NOT CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

project(MorphologicalContourInterpolation)

if(NOT ITK_SOURCE_DIR)
find_package(ITK 4.9 REQUIRED)
list(APPEND CMAKE_MODULE_PATH ${ITK_CMAKE_DIR})
include(ITKModuleExternal)
else()
set(ITK_DIR ${CMAKE_BINARY_DIR})
itk_module_impl()
endif()

Expand Down
22 changes: 15 additions & 7 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,30 @@ cmake_minimum_required(VERSION 3.10.2)

project(MorphologicalContourInterpolation_Examples CXX)

find_package(ITK REQUIRED
COMPONENTS
MorphologicalContourInterpolation
ITKSmoothing
ITKIOImageBase
ITKIONRRD
)
if(NOT ITK_SOURCE_DIR)
find_package(ITK 5.2 REQUIRED COMPONENTS MorphologicalContourInterpolation ITKSmoothing ITKImageIO ITKTestKernel)
else()
# when being built as part of ITK, ITKImageIO and ITKTransformIO
# lists of modules are not yet ready, causing a configure error
find_package(ITK REQUIRED COMPONENTS MorphologicalContourInterpolation ITKSmoothing ITKIOImageBase ITKIONRRD ITKTestKernel)
endif()
include(${ITK_USE_FILE})

add_executable(mciExample mciExample.cxx)
target_link_libraries(mciExample ${ITK_LIBRARIES})


# add some regression tests
enable_testing()

add_test(NAME mciExample_SevenLabels_3
COMMAND mciExample ${CMAKE_CURRENT_SOURCE_DIR}/SevenLabels.nrrd
${CMAKE_CURRENT_BINARY_DIR}/SevenLabels_interpolated.nrrd
3)

if(ITK_WRAP_PYTHON)
add_test(NAME mciExample_ManyToMany
COMMAND python ${CMAKE_CURRENT_LIST_DIR}/mciExample.py
${CMAKE_CURRENT_SOURCE_DIR}/ManyToMany.nrrd
${CMAKE_CURRENT_BINARY_DIR}/ManyToMany_interpolated.nrrd)
endif()
Binary file added examples/ManyToMany.nrrd
Binary file not shown.
10 changes: 10 additions & 0 deletions examples/mciExample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import itk
import sys

if len (sys.argv) < 3:
print( "Usage: %s <input> <output>" % (sys.argv[0]) )
sys.exit(1)

image = itk.imread(sys.argv[1], itk.UC)
filled = itk.morphological_contour_interpolator(image)
itk.imwrite(filled, sys.argv[2], compression=True)

0 comments on commit 5169b16

Please sign in to comment.