Cross Sectional Area of a Ring

I am looking to calculate the cross sectional area at multiple points around the ring (I tried to mark where I would like to slice the ring and measure the area using pairs of fiducials in the image below).

I am not sure what the best method is as the orientation of the slice is constantly changing, so I’m just looking for an idea of what add-on or method would be best. Thank you!

You can define a curved path and reslice the image along that path as shown in this video:

Once you have the slice views in correct orientation, you can use the ruler tool (available in the toolbar) to measure diameter.

Perfect that is exactly what I was looking for!

I want to loop through screen shots for each frame of a created path (~30). Is it possible to code a loop taking snapshots and labeling them in the Python interactor?

Thanks!

It’s easy to create screen captures from scripts, see examples in the script repository:
https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Capture

If you are interested in Python scripting, you could modify the Endoscopy module to save each timepoint’s transform into a Sequence module creates a sequence node and saves transforms into it). After that you can use the ScreenCapture module’s sequence animation mode to record a movie.

THe implementation would be probably about 20-30 lines of code in Endoscopy.py. You can have a look at SequenceRegistration module for an example how to create a sequence node and store transforms in it. I would be happy to help if you stuck at any point with the implementation.

1 Like

Thanks for the code links, they were very helpful! Although I’m sure that is a much more elegant way to accomplish what I need, I am very new to Python and Slicer so I wrote a basic script to take images (and slice location) at specified points of the transform:

lm = slicer.app.layoutManager()
yellow = lm.sliceWidget('Yellow')
yellowLogic = yellow.sliceLogic()
height = []

layoutName = 'Yellow'
imagePathPattern = 'C:/image-%d.png'
count = 25

slicer.modules.endoscopy.widgetRepresentation().self().frameSlider.value = 0
for step in range(count+1):
    image = qt.QPixmap.grabWidget(view).toImage()
    image.save(imagePathPattern % step)
    slicer.modules.endoscopy.widgetRepresentation().self().frameSlider.value = slicer.modules.endoscopy.widgetRepresentation().self().frameSlider.value + 1
    view.forceRender()
    height.append(yellowLogic.GetSliceOffset())

print height

I am sure it’s rough code but it gets the job done. Thanks again!

1 Like