Relabeling components with regard to minimum physical object size

Hi,

I would like to relabel components with regard to physical size rather than the number of voxels. So a hypothetical SetMinimumObjectPhysicalSize rather than SetMinimumObjectSize. What would be the most efficient way to do that?

Thank you!

Hello,

Thank you for reposted in a new topic:)

In an ITK image all voxel have the size physical size defined by the “spacing” attribute. So if the components are sorted by number of voxels they are also sorted by the physical size.

The number of voxel can be converted to the physical size with the following formula:

number\_of\_pixel * \sum_{i=0}^n spacing[i]
1 Like

Thanks! You’re right. However, when working with a dataset of scans and masks with varying spacing, a fixed number of voxels corresponds to different physical sizes.

My goal is to process each case in my dataset, which may have different spacings, and remove islands smaller than, for example, 1 mmÂł in the masks.

You can accomplish that by converting 1mmÂł into number of voxels by taking into account image spacing, and call SetMinimumObjectSize() with the converted limit.

Of course, if the spacing varies from case to case, the conversion computation will need to be done per case.

Ah, makes perfect sense, thank you! I was overthinking this one :sweat_smile:

1 Like