# 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.

Hi,

I have come across this section because I need to use a circle as well in 2D (with a central point, because I want to be able to calculate the radius) and your first suggestion works perfectly for that. However, I have problems removing the circle from my image, if I remove the control points the circle stays and I can not move it anymore. Is there any solution for that?

Also, is there an option to view the radius of the created circle? That way I don’t have to go and measure it for every circle I make.

Thanks a lot,
from a medical student

If you can build Slicer, you may build this extension. It has a custom markups that will do what you want. (It’s somehow funny because it is this very opening post that prompted me to write this extension). If you can’t build software, it’s not the right tool for you.

I don’t know almost anything about coding or building software so I am not sure. The provided code is actually already perfectly what I need, it’s just annoying sometimes that the yellow circle stays in all my 2D planes when I don’t need it anymore.

@chir.set This looks useful, particularly the label one. Is there a reason why you are not making this part of the extension catalog (like the surface markup add on is)?

1. It did not trigger much interest on previous evaluation requests.

2. Bureaucracy is significant when submitting an extension. We have to interact with robots and it’s not an easy one. But it’s not a hard blocker as such.

It seems that there is some interest, so you may reconsider now.

This is the checklist you need to complete:

As I see, you can check out almost all the boxes, so it should not be a lot of extra work.

Slicer extensions submission process is not very automated, so dealing with robots should not be a big issue. Usually the main challenge is availability of reviewers, but we do our best.

I don’t have any doubt about that.

I’ll start preparing the work for the extension catalog ASAP.

2 Likes

The PR is here in the extension index. I don’t know how it is further processed, wait and see.

1 Like