I’m using MultiLabelSTAPLEImageFilter
to combine several annotations. However, this filter introduce new label value. Here is my script:
import SimpleITK as sitk
import numpy as np
import os
import os.path as osp
if __name__ == '__main__':
dirname = 'testmasks'
imgs = [sitk.ReadImage(osp.join(dirname, item)) for item in os.listdir(dirname)]
for img in imgs:
print(np.unique(sitk.GetArrayFromImage(img)))
filter = sitk.MultiLabelSTAPLEImageFilter()
filter.SetLabelForUndecidedPixels(255)
result = filter.Execute(*imgs)
print(np.unique(sitk.GetArrayFromImage(result)))
The label value range from 0 to 6, but I got 7 in the result. According to the doc, this filter set label for undecided pixel to the maximum of the label value plus 1. It seems that the SetLabelForUndecidedPixels
method not working?
I’m using SimpleITK 1.2.4. The files are in attachement. testmasks.tar.gz (133.8 KB)