Hi All. I would like to build an extension that will automatically pick up MR-visible spheres and place a fiducial in the center of them. Would anyone be able to point me in the write direction for starting this project? I am familiar with python coding but new to developing extensions. Thanks!
There are many options, including some readily usable fully automatic solutions. To make recommendations, we would need to know a bit more about your application.
Do you need to register patient skin markers or markers embedded in a device? Do you really use sphere markers? (fluid filled tubes and donut shape are much more common) How many markers do you need to register? What is their size? What accuracy and time constraints do you have?
Thanks for replying. These would be skin markers that are truly spheres with a homogeneous material (no fluid). I need to register 8-10 and they are 4mm in diameter. I would like the markers to be as accurate as possible, of course, but I envisage .25mm of error to be ok. If you are referring to time constraints for detection, there aren’t any for now.
I’m not aware of any Slicer extension that would automatically detect spherical fiducials in a random configuration and determine their accurate positions, but it should not be difficult to implement.
First task is detection of fiducial candidates. You can probably do a quick first pass using thresholding, followed by splitting to islands (discarding islands that are much smaller or larger than the expected sphere volumes), then picking the ones with the highest intensity, closest volume, most spherical shape. You can use Segment Editor effects (or study scripts used in the effects and put it in your own script).
Second task is subpixel accuracy position estimation. For spherical markers, you should be able to get accurate position by performing intensity-based registration between expected image of the fiducial (bright sphere) with the MRI image cropped to a small region around the detected fiducial. You can use rigid transformation, with translation scale set to very high value (so essentially no rotation is attempted during registration). You can probably use “General Registration (BRAINS)” module for this.
Once you have a working script, you can convert it to a module as shown in Slicer programming tutorials.
Thank you for that, very helpful.