classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view


This post has NOT been accepted by the mailing list yet.
Dear slicer users,

I'm trying to execute a python script which load a few .nii files and saves the whole scene as single mrb file. This is done because other users will remotely download from the XNAT server using the xnat gateway.

 If I use slicer --no-main-window --phython-script inputFile1.nii inputFile2.nii ROI.nii output.mrb > log.txt. Nothing happens and two processes (slicer.exe and slicerApp-real.exe) remain alive even when the commandline exited from the execution.

If I don't use --no-main-window I can see the nifti loaded. But the script does not finishes its execution because neither mrml file + Data folder appears nor mrb file are created.

If I execute the script step by step in the python interactor it seems to work properly.

This is the script:

# -*- coding: utf-8 -*-
import sys
import vtk
import slicer
import os
import shutil

#Create tree
mrml = slicer.vtkMRMLScene()
vl = slicer.vtkSlicerVolumesLogic()

#Load volumes/ROI
for argument in range(3,len(sys.argv)-1):
        if sys.argv[argument]=='ROI.nii':
                print(sys.argv[argument] + ' as labelmap')
                print(sys.argv[argument] + ' as volume')

#Create folder
tempDir =os.path.join(os.getcwd(), 'sceneData')

#Save scene
l =

print('Compressing' + tempDir)[len(sys.argv)-1], str(tempDir))


Does any of you have an idea about why it does not work when I run it from commandline?