How to measure minimun diameter?

Hi everyone!

Slicer version: 4.11.0-2020-07-04 r29204 Win

I want to measure the minimun diameter of a pseudotube segment



image

I´ve tryed Extract Centerline Module and Segment Statistics Module but I think radius data in output table is the mean value.

You can use Segment Cross Section Area module (in Sandbox extension) to get cross section area along the segment, look up the minimum value, and compute the equivalent diameter (sqrt(4*a/pi)).

Segment Cross Section Area module is pretty near to what I need. I´ve been trying some code but i have a trouble with labelmap data.

# a.- Create labelmap node
LabelmapVolumeNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLLabelMapVolumeNode', "SegmentLabelmap")

# b.- Export Segment to Labelmap volume
slicer.modules.segmentations.logic().ExportVisibleSegmentsToLabelmapNode(segmentationNode, LabelmapVolumeNode, None)

# c.- Export Labelmap to numpy array
voxels = slicer.util.arrayFromVolume(LabelmapVolumeNode)

# d.- Get all slices of the volume as numpy array
for i in range(voxels.shape[0]):
  slice = voxels[i,:,:]  

Images I get are like this:
image

Expected image:
image

I thought i was a problem related with labelmap reference (although ExportVisibleSegmentsToLabelmapNode(segmentationNode, LabelmapVolumeNode, None)) so I get the inverted segment transform to move it to RAS and harden it to force resample.

Code between b and c steps:

invSegTransform = slicer.mrmlScene.GetFirstNodeByName("SegTransform (-)")    
LabelmapVolumeNode.SetAndObserveTransformNodeID(invSegTransform.GetID())
LabelmapVolumeNode.HardenTransform()

Labelmap Volume Rendering shows like this:

For my surprice, slice images didn´t change at all, numpy array values from labelmap can´t be changed by this method. Even resampling a new copied labelmap volumen, images are still the same.

Could you help me with this issue?
Thanks on advance.

Can you give some idea about this @lassoan, please?

You need to choose an axis that is aligned with the axis of the object. the object is not aligned with any of the image axes then you can create an ROI that is aligned with the principal axes (or oriented bounding box) of the segmented object and then crop the volume with that ROI.

Alternatively, the cross section analysis module could be enhanced to take an arbitrary line as input and it would resample the image along that direction.

1 Like

Crop Labelmap with a transformed ROI for resampling works perfect.
Thanks so much

1 Like