Using LabelIntensityStatisticsImageFilter in SimpleITK

Hi!

I am looking for an example of how to use LabelIntensityStatisticsImageFilter, to get stats from my connected components.

I have this code:

cc = sitk.ConnectedComponentsImageFilter()
im_cc = cc.Execute(image)

stats = sitk.LabelIntensityStatisticsImageFilter()
results = stats.Execute(im_cc)

but I am getting this error:

TypeError: Execute() missing 1 required positional argument: 'featureImage'

I don’t know what the additional parameter featureImage should be.

Thanks!

results = stats.Execute(image, im_cc)
1 Like

Hi @zivy

I see, so the stats are taken on the original image.
I just wanted to get the sizes of my connected components withouth caring too much about the original image. How can I do this?

Thanks,

Diego

Can you please define what you mean by “size”?

Hi @Diego_C ,

So you’re not interested in the intensity statistics under each label, you are interested in the physical size of the region the label occupies? If yes, then the relevant filter is LabelShapeStatisticsImageFilter and not LabelIntensityStatisticsImageFilter.

2 Likes

The number of voxels for each connected component in the label image obtained as the result of the ConnectedComponentsImageFilter

1 Like

That’s it @zivy thank you very much :pray:

1 Like