Using OrientScalarVolume module in a python script

Dear all
Is there a way to avoid console calls in OrientScalarVolume such as

OrientImage
   --orientation Axial 
   ${MRML_DATA}/fixed.nrrd 
   ${TEMP}/OrientImageTestAxial.nrrd

as defined in the documentation?

I want to use some kind of logic from it to generate a temporary node to be exported in the preferred coordinate system (in a python function). I know I can create a temporary directory, save the file there, execute the command line and copy the new file to the desired location, but thats awful. I would like more the “logic” way, generating a temporary node and save only one time.

My current script saves the nodes in RAS orientation, I like them in RAI which is the orientation Gate is expecting to perform the simulations.

Ok I found the solution
The OrientScalarVolume is a cli module, so the way is

def reorientNode(node, orientation):
    parameters = {'inputVolume1':node, 'outputVolume':node, 'orientation':orientation}
    slicer.cli.run(slicer.modules.orientscalarvolume, None, parameters, True)

This was pure luck as none of these parameters are documented. Just in case anyone need this.

Documentation is the XML file. You can also find a convenience script here that lists all parameter names.

This XML file? So I assume for all cli modules is the same, right? OK that is a better way than try and test :wink: Thanks for the hint!

Yes, that’s the XML file. Command-line arguments and GUI is documented in the Slicer wiki, too, but the parameter names are only described in the XML file (or you can list them using the script linked above).

A post was split to a new topic: How to get parameters of Segment Editor effects