Drawing Circle on CT Image

Is it possible to draw a circle (markup) on a CT image? I initially tried using the Closed Curve Markup, but I do not know how to make or adjust it into a circle. I need to be able to align the perimeter of the circle with the cortices of the bone, while having a visible midpoint to determine the bone’s midline (as shown).

In Slicer we focus on 3D operations and don’t have much support for drawing 2D shapes like circles. Instead you could use a 3D fiducial (point with radius) to fit the 3D shape of the bone. Then you could use a 3D line for the bone axis. See the Markups module.

You can also use 2 points of a markups fiducial node to specify a circle by copy-pasting a few lines of code to into the Python console as shown in this example.

I’ve created a modified script that allows you to place 2 circles by specifying 6 points on the circumference: Compute bone axis in 3D Slicer by specifying two circles. · GitHub

You can use this by placing one fiducial list containing 6 points then copy-pasting into the Python console:

1 Like

With this approach, I have managed to get a circular region of interest. However, I am not able to get a separate circle when I run the code again with a new set of fiducial points.

With this approach, I am running into a similar issue. I am able to get the first set of two circles, but I am not able to get the second set of two circles on a different bone. (I need two circles to define each bone axis, as well as two bone axes to measure joint flexion angle).

Yes, sure, based on the workflow you want to implement you need to tune the script.

For example, you can add a keyboard shortcut to call a function that adds measurement results to a table node and clears the fiducial points so that you can place the points again. This is a quick solution if you are the only person who performs these measurements.

You can also write a Slicer Python scripted module that observes markups fiducial lists that the module adds to the scene and add the model nodes as needed. See the Baffle Planner module in SlicerHeart extension as an example. This requires more work than just crafting a python script in the Python console, but it is worth it if you want to create user-friendly tool that other people can use, too.

The most sophisticated level is to create a custom widget representation, which renders the fiducial list as two circles and a line. This should be quite simple to do in C++ (you can define a new markup type by deriving from an existing type and override anything in it), but we have not made the classes customizable in Python yet.