# Using OrientScalarVolume module in a python script

**URL:** <https://discourse.slicer.org/t/using-orientscalarvolume-module-in-a-python-script/10658>\
**Category:** Development\
**Tags:** python\
**Created:** [March 12, 2020, 12:47pm UTC](https://discourse.slicer.org/t/using-orientscalarvolume-module-in-a-python-script/10658 "2020-03-12T12:47:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [March 12, 2020, 12:47pm UTC](https://discourse.slicer.org/t/using-orientscalarvolume-module-in-a-python-script/10658/1 "2020-03-12T12:47:44Z")

</div>

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

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

```

as defined in the [documentation](https://www.slicer.org/wiki/Documentation/4.0/Modules/OrientScalarVolume)?

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](http://opengatecollaboration.org/) is expecting to perform the simulations.

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [March 12, 2020, 1:07pm UTC](https://discourse.slicer.org/t/using-orientscalarvolume-module-in-a-python-script/10658/2 "2020-03-12T13:07:49Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 12, 2020, 1:47pm UTC](https://discourse.slicer.org/t/using-orientscalarvolume-module-in-a-python-script/10658/3 "2020-03-12T13:47:47Z")

</div>

> [@Alex\_Vergara](#):
>
> This was pure luck as none of these parameters are documented

Documentation is the XML file. You can also find a convenience script [here](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Running_a_CLI_from_Python) that lists all parameter names.

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [March 12, 2020, 1:53pm UTC](https://discourse.slicer.org/t/using-orientscalarvolume-module-in-a-python-script/10658/4 "2020-03-12T13:53:16Z")

</div>

> [@lassoan](#):
>
> Documentation is the XML file.

This [XML file](https://github.com/Slicer/SlicerGitSVNArchive/blob/master/Modules/CLI/OrientScalarVolume/OrientScalarVolume.xml)? So I assume for all cli modules is the same, right? OK that is a better way than try and test 😉 Thanks for the hint!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [March 12, 2020, 2:08pm UTC](https://discourse.slicer.org/t/using-orientscalarvolume-module-in-a-python-script/10658/5 "2020-03-12T14:08:14Z")

</div>

Yes, that’s the XML file. Command-line arguments and GUI is documented in the [Slicer wiki](https://www.slicer.org/wiki/Documentation/Nightly/Modules/OrientScalarVolume), too, but the parameter names are only described in the XML file (or you can list them using the script linked above).

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 7, 2021, 5:55am UTC](https://discourse.slicer.org/t/using-orientscalarvolume-module-in-a-python-script/10658/6 "2021-10-07T05:55:34Z")

</div>

A post was split to a new topic: [How to get parameters of Segment Editor effects](https://discourse.slicer.org/t/how-to-get-parameters-of-segment-editor-effects/20046)
