Making 2D measurements of a segmentation on an individual slice

Hi everybody,

I am currently developing an extension for 3D Slicer. As part of this extension, I need to programatically make measurements of a segmentation on each individual layer of my volume (ie. vertical/horizontal diameter). I can do this for a single layer manually by placing a ruler across the segmentation, but that is obviously not a good solution for the entire segmentation. Can anyone show me a better way forward?

This is my first time posting on this forum. If there is any more information that you need to help me, please ask and I’ll edit my post.

Thanks

Would knowing the bounding box size (its axes aligned with segmentation axes) be enough for you? Or you would need bounding box size for each slice?

I’m trying to find the minimum and maximum diameters. Eventually I’d also like to find other statistics like the area of each slice. I tried using bounding box size for the whole segment, but it introduced too much error to be really useful.

If you need number of voxels (cross-section area by slice) then you can find a readily usable solution here: Using numpy reslice to get slices of segment. With small modifications of the script, you can compute extents, diameters, etc. for each slice.

This is exactly what I’m looking for. Thanks for your help!

1 Like