Skip to content

Commit

Permalink
Merge pull request #1911 from thewtex/ul-casting
Browse files Browse the repository at this point in the history
BUG: Support casting unsigned long pixel types in Python
  • Loading branch information
thewtex authored Jul 10, 2020
2 parents a8ba768 + 530e61e commit 2121eed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Modules/Core/Common/wrapping/itkImageToImageFilterA.wrap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
itk_wrap_class("itk::ImageToImageFilter" POINTER)
# Wrap from each scalar type to each other, and also to uchar (for 8-bit saving)
# and to ulong (for watershed).
UNIQUE(from_types "UC;${ITKM_IT};ULL;${WRAP_ITK_SCALAR}")
UNIQUE(from_types "UC;UL;${ITKM_IT};ULL;${WRAP_ITK_SCALAR}")
UNIQUE(to_types "UC;UL;${ITKM_IT};${WRAP_ITK_SCALAR}")
itk_wrap_image_filter_combinations("${from_types}" "${to_types}")

Expand Down
11 changes: 3 additions & 8 deletions Modules/Core/Common/wrapping/itkInPlaceImageFilterA.wrap
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
itk_wrap_class("itk::InPlaceImageFilter" POINTER)
# Wrap from each scalar type to each other, and also to uchar (for 8-bit
# saving), UL for label images
UNIQUE(types "UC;UL;${WRAP_ITK_SCALAR}")
itk_wrap_image_filter_combinations("${types}" "${types}")

# Wrap from ulong to other integral types, even if ulong isn't wrapped. This
# is needed for the relabel components image filter.
if(NOT ITK_WRAP_unsigned_long)
itk_wrap_image_filter_combinations("${ITKM_IT}" "${WRAP_ITK_INT}")
endif()
UNIQUE(from_types "UC;UL;${ITKM_IT};ULL;${WRAP_ITK_SCALAR}")
UNIQUE(to_types "UC;UL;${ITKM_IT};${WRAP_ITK_SCALAR}")
itk_wrap_image_filter_combinations("${from_types}" "${to_types}")

# Vector types
itk_wrap_image_filter_combinations("${WRAP_ITK_VECTOR}" "${WRAP_ITK_VECTOR}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
itk_wrap_class("itk::CastImageFilter" POINTER_WITH_SUPERCLASS)
# Create cast filters between all scalar types. Also force that cast-to-uchar
# filters are created for all scalar types.
UNIQUE(types "${WRAP_ITK_SCALAR};UC")
# filters are created for all scalar types, and unsigned long for
# segmentation output casting.
UNIQUE(types "${WRAP_ITK_SCALAR};UC;UL")
itk_wrap_image_filter_combinations("${types}" "${types}")

# vector <-> vector
Expand All @@ -15,12 +16,6 @@ itk_wrap_class("itk::CastImageFilter" POINTER_WITH_SUPERCLASS)
# itk_wrap_image_filter_combinations("${WRAP_ITK_VECTOR}" "${WRAP_ITK_RGB}" 3)
# itk_wrap_image_filter_combinations("${WRAP_ITK_RGB}" "${WRAP_ITK_VECTOR}" 3)

# Wrap from ulong to other integral types, even if ulong isn't wrapped. This
# is needed for the relabel components image filter output.
if(NOT ITK_WRAP_unsigned_long)
itk_wrap_image_filter_combinations("${ITKM_IT}" "${WRAP_ITK_INT}")
endif()

# Enable casting 64 bit unsigned int to smaller integer types
if(ITK_WRAP_unsigned_long OR NOT ${ITKM_IT} STREQUAL "ULL")
itk_wrap_image_filter_combinations("ULL" "${WRAP_ITK_INT}")
Expand Down

0 comments on commit 2121eed

Please sign in to comment.