Automatic Fiducial Registration

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.