I’ve installed Slicer on an Ubuntu cloud instance (AWS/GCP) and I want to run it with a self-made extension and no GUI… Is there documentation on the slicer site that I’m missing to be able to do this? I’ve found info about using Python to do things, but I want to essentially go: Slicer, do this task, using this folder, and put the output in this location.
Is docker an option for you? Here’s an example of a command line tool based on Slicer and this is another one. If you don’t use docker you would need a different way of having a desktop to access all of Slicer. If you don’t need graphics you might be able to get by with PythonSlicer and access just logic classes.
Maybe you can describe your processing task in more detail if you need more explicit suggestions.
I have dicom images I want to turn into OBJ models using an extension that’s already made. My idea was to use a form to upload the images to AWS/GCP and there have Slicer take them as input with the extension and then output the obj. The extension segments the file to create a 3D render.
I’ve never worked with docker, but I can check it out as well as PythonSlicer.
You can use standard IPython widgets for file upload/download/display. Voila takes care of selectively locking down the notebook, so users can still interact with widgets but they will not see or able to modify code in the notebook.
See a number of example web applications here:
They are all hosted on the free binder service and a new container is created for each user from scratch, so initial loading of the page may take a minute, but of if you set up your own server then page loading should be instantaneous.
From my recent experience on headless Slicer on Ubuntu, I think something like the following on the command line could be one way to go:
xvfb-run -a /slicer_path/Slicer --no-splash --python-script mycode.py
here “xvfb” is a package you need to install on your Ubuntu instance. Running “xvfb-run program” will start “program” with a dummy graphical interface, otherwise it complains that it can’t connect to X server.
If it works for you, you can put everything you want in mycode.py.