Previously, using the ‘Add data’ menu, we would check the ‘Centre’ widget so that the loaded volume (DICOM series) was centered. The ‘Add data’ menu is no longer maintained for this use, and I’m using the DICOM module instead.
I could not find an option to centre a loaded volume in the DICOM module. I can always go the Volumes module to do that. I’m looking for an automated way however. This is because I have to CROP the volumes after loading them, using fixed ROIs (saved on storage) as templates. Studies from different OEMs have different centre point.
I tried this to no avail in slicerrc.py :
@vtk.calldata_type(vtk.VTK_OBJECT) def onNodeAdded(caller, event, calldata): node = calldata if isinstance(node, slicer.vtkMRMLVolumeNode): volumesLogic = slicer.modules.volumes.logic() volumesLogic.CenterVolume(node) slicer.mrmlScene.AddObserver(slicer.vtkMRMLScene.NodeAddedEvent, onNodeAdded)
I could not find more useful code in the repository. (There’s a code snippet to centre the 3D view, but that’s not what I need to do.)
I’m asking for some help here for this task.