How to run cast scalar volume module from command line

Hi community,

I’m trying to run the Cast Scalar Volume module from the command line to convert a nifti brain mask into a uchar nrrd file format. I can successfully run the command from the Slicer GUI, and when I click on the red X button to see the commands Slicer ran, I get the following:

Found CommandLine Module, target is  C:/Users/User/AppData/Local/NA-MIC/Slicer_4.11.20200930/bin/../lib/Slicer-4.11/cli-modules/CastScalarVolume.exe
ModuleType: CommandLineModule
Cast Scalar Volume command line: 

C:/Users/User/AppData/Local/NA-MIC/Slicer_4.11.20200930/bin/../lib/Slicer-4.11/cli-modules/CastScalarVolume.exe --type UnsignedChar C:/Users/User/AppData/Local/Temp/Slicer/BAHDC_vtkMRMLScalarVolumeNodeB.nrrd C:/Users/User/AppData/Local/Temp/Slicer/BAHDC_vtkMRMLScalarVolumeNodeB.nrrd 

Cast Scalar Volume completed without errors

I’m working on a 64bit Windows 10 machine, and using powershell for the command line. So if my path to the executable is path/to/exectuable/CastScalarVolume.exe, my input file is path/to/input/input.nii, and my desired output uchar file is path/to/output/output.nrrd, what should I run from the command line?

Thanks so much everyone!!

Check out this example running CastScalarVolume from the command line. You can also get the parameter names for CLI modules using a few lines of Python in the Python interactor.

Hi Sara,

Worked like a charm! Thanks so much.


1 Like