Batch co-registration using BRAINSfit (script)

For those looking for a script for Batch co-reg. You still have to add the string “FIXED” (case sensitive) to the name of the volume you want to use as the reference/fixed volume for co-registration.

PoolOfVolumes = getNodesByClass('vtkMRMLScalarVolumeNode')
FixedVol = getNode('*FIXED*')
for MovingVol in PoolOfVolumes:
    brainsFit = slicer.modules.brainsfit   
    parametersRigid = {}
    parametersRigid["fixedVolume"] = FixedVol.GetID()
    parametersRigid["movingVolume"] = MovingVol.GetID()
    parametersRigid["outputVolume"] = MovingVol.GetID()
    parametersRigid["useRigid"] = True
    parametersRigid["initializeTransformMode"] = "useGeometryAlign"
    parametersRigid["samplingPercentage"] = 0.02
    cliBrainsFitRigidNode =, None, parametersRigid)

Tested and works on Slicer 5.0.2 r30822 / a4420c3 on MacOS 12.4 using brain MRIs.



1 Like