I am running into an error when trying to merge several label maps/masks into one label map. The basics of my code are:
import SimpleITK as sitk map_files = ['label_map1.nrrd', 'label_map2.nrrd'] map_imgs = [sitk.ReadImage(map) for map in map_files] combiner = sitk.MergeLabelMapFilter() combiner.SetMethod(2) combiner.Execute(*map_imgs)
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/hunglab/mwarkent/.virtualenvs/torch/lib64/python3.6/site-packages/SimpleITK/SimpleITK.py", line 49075, in Execute return _SimpleITK.MergeLabelMapFilter_Execute(self, *args) RuntimeError: Exception thrown in SimpleITK MergeLabelMapFilter_Execute: /tmp/SimpleITK/Code/Common/include/sitkMemberFunctionFactory.hxx:196: sitk::ERROR: Pixel type: 16-bit unsigned integer is not supported in 3D byN3itk6simple19MergeLabelMapFilterE
I have tried forcing different pixel types when reading in the image with
sitk.ReadImage() but the exception is thrown every time. Any idea what the issue is?