I am trying to automate parts of my workflow in Slicer, ( my mental model wants something like VMTK or the CLI where I can break the operations into smaller steps and add and rearrange as needed)
I have figured out how to read in a .h5 transform and and image volume with python commands but it is not clear how to apply the transform to the image volume and save or “harden” transformed image to be subsequently processed with Brainsfit.
[success, dsa] = slicer.util.loadVolume(r’./image_vols/DSA.nrrd’, returnNode=True) #relative paths seem to not work with transforms, filed on a bug on that.
[success, dss2post_trans] = slicer.util.loadTransform(r’/home/sansomk/caseFiles/mri/VWI_proj/case4/registration/dsa2post_man_LT.h5’, returnNode=True)
dsa.SetAndObserveTransformNodeID(dsa2post_trans.GetID())
slicer.vtkSlicerTransformLogic().hardenTransform(dsa)
slicer.util.saveNode(dsa, “./registration/dsa2post_man_trans.nrrd”)
I haven’t tried this outside of the python interactor, but ideally I would be able to execute this without the slicer gui, I assume this is possible but I am don’t know how.