Merge different labels in a unique image

Hi, I have 7 different labels in each 7 different binary images. All of these images are 3D images provided by CT scan, they have a number of slices and 512x512 number of pixels for each slices. I want to merge these seven labels, that respectively represent the main chambers of the heart including aorta, in a single image having also different number of labels for each segmented area. Can someone can help me using sitk library?


You may find this notebook example useful:

One approach is to run the connected components filter, followed by the label shape statistics filter. The statistics produced can be used to create a map to relabel or remove unwanted labels/regions with an arbitrary criteria based on the computed stats. Then the ChangeLabelImageFilter can be used to apply the mapping of the components.

Alternatively classic binary morphology filters can be used too.

1 Like