Hello,
I am trying to combine multiple images (same spacing, dimensions, etc.) Each image contains a 1 for object and 0 for background and these are 3D volumes.
this is my code:
def labels_to_binary_image(image_list):
"""Creates a new image that contains all the labels"""
arr_union = None
for image in image_list:
if arr_union is None:
arr_union = sitk.GetArrayFromImage(image)
else:
arr_union += sitk.GetArrayFromImage(image)
ima_union = sitk.GetImageFromArray(arr_union)
_filter = sitk.LabelMapToBinaryImageFilter()
return _filter.Execute(ima_union)
When I run it I obtain this error:
File "/Users/odin/anaconda/lib/python2.7/site-packages/SimpleITK/SimpleITK.py", line 41239, in Execute
return _SimpleITK.LabelMapToBinaryImageFilter_Execute(self, *args)
RuntimeError: Exception thrown in SimpleITK LabelMapToBinaryImageFilter_Execute: /scratch/dashboards/SimpleITK-OSX10.6-intel-pkg/SimpleITK/Code/Common/include/sitkMemberFunctionFactory.hxx:196:
sitk::ERROR: Pixel type: 8-bit unsigned integer is not supported in 3D byN3itk6simple27LabelMapToBinaryImageFilterE
What am I doing wrong?
Thanks,
Diego