Skip to content

Commit

Permalink
ENH: Wrap LabelSetMeasures in LabelOverlapMeasuresImageFilter
Browse files Browse the repository at this point in the history
This exposes the return value from
itk::LabelOverlapMeasuresImageFilter::GetLabelSetMeasures()
as a Python dictionary instead of
<Swig Object of type 'std::unordered_map< unsigned char,itkLabelOverlapMeasuresImageFilterIUC3::LabelSetMeasures > *'>
This is needed for convenient use of the class from Python.
  • Loading branch information
dzenanz committed Sep 19, 2023
1 parent 0150e46 commit 76a9429
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Modules/Filtering/ImageStatistics/wrapping/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
itk_wrap_module(ITKImageStatistics)
if(ITK_WRAP_PYTHON)
set(WRAPPER_SUBMODULE_ORDER itkLabelOverlapMeasuresImageFilter_LabelSetMeasures)
list(APPEND WRAPPER_SWIG_LIBRARY_FILES "${CMAKE_CURRENT_LIST_DIR}/itkLabelOverlapMeasuresImageFilter.i")
endif()
itk_auto_load_and_end_wrap_submodules()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
%include <std_unordered_map.i>

%template(hashmapUCLOMIFLSM) std::unordered_map< unsigned char, itk::LabelOverlapMeasuresImageFilter::LabelSetMeasures >;
%template(hashmapSCLOMIFLSM) std::unordered_map< signed char, itk::LabelOverlapMeasuresImageFilter::LabelSetMeasures >;
%template(hashmapUSLOMIFLSM) std::unordered_map< unsigned short, itk::LabelOverlapMeasuresImageFilter::LabelSetMeasures >;
%template(hashmapSSLOMIFLSM) std::unordered_map< signed short, itk::LabelOverlapMeasuresImageFilter::LabelSetMeasures >;
%template(hashmapULLOMIFLSM) std::unordered_map< unsigned long, itk::LabelOverlapMeasuresImageFilter::LabelSetMeasures >;
%template(hashmapSLLOMIFLSM) std::unordered_map< signed long, itk::LabelOverlapMeasuresImageFilter::LabelSetMeasures >;
%template(hashmapULLLOMIFLSM) std::unordered_map< unsigned long long, itk::LabelOverlapMeasuresImageFilter::LabelSetMeasures >;
%template(hashmapSLLLOMIFLSM) std::unordered_map< signed long long, itk::LabelOverlapMeasuresImageFilter::LabelSetMeasures >;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set(WRAPPER_AUTO_INCLUDE_HEADERS OFF)
itk_wrap_include("itkLabelOverlapMeasuresImageFilter.h")
itk_wrap_simple_class("itk::LabelOverlapMeasuresImageFilter<itk::Image<unsigned short, 2> >::LabelSetMeasures")
set(WRAPPER_AUTO_INCLUDE_HEADERS ON)
1 change: 1 addition & 0 deletions Wrapping/Generators/Python/PyBase/pyBase.i
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ from . import _ITKCommonPython
%include <std_pair.i>
%include <std_vector.i>
%include <std_map.i>
%include <std_unordered_map.i>
%include <std_list.i>
%include <std_set.i>

Expand Down

0 comments on commit 76a9429

Please sign in to comment.