Skip to content

Commit

Permalink
ENH: Add ULL type to ConnectedComponentImageFilter wrapping
Browse files Browse the repository at this point in the history
Currently, by default, ConnectedComponentImageFilter can output:
US, SS, and UL pixel types, while RelabelComponentImageFilter
does not accept UL as input, and accepts US, SS, and ULL (IdentifierType).
Cast filter is also not wrapped for UL -> ULL conversion.
That makes the following code unworkable:

# components = itk.connected_component_image_filter(foreground, fully_connected=True)  # over 32K labels
ul_type = itk.Image[itk.UL, 3]
cc_filter = itk.ConnectedComponentImageFilter[type(foreground), ul_type].New(foreground)
cc_filter.SetFullyConnected(True)
cc_filter.Update()
components = cc_filter.GetOutput()
sorted_components = itk.relabel_component_image_filter(components.astype(itk.ULL))
  • Loading branch information
dzenanz committed Nov 8, 2023
1 parent f74950f commit 3b5f764
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
itk_wrap_class("itk::ConnectedComponentImageFilter" POINTER)
# Create wrappers from every selected integral (signed and un) type to every
# selected unsigned type. Also force ulong output for the watershed filter.
unique(to_types "UL;${WRAP_ITK_INT}")
unique(to_types "UL;${ITKM_IT};${WRAP_ITK_INT}")
# Supports too few labels.
list(REMOVE_ITEM to_types "UC")
itk_wrap_image_filter_combinations("${WRAP_ITK_INT}" "${to_types}" 2+)
Expand Down

0 comments on commit 3b5f764

Please sign in to comment.