How to load volume in the subprocess in python?

i have tryed to use SlicerParallelProcessing
SlicerParallelProcessing can’t import slicer.util package

The examples use PythonSlicer, which is just the python interpreter part of Slicer, not the full app. In the examples I use the stdin/stdout of PythonSlicer to pass data back and forth, which fits some processing workflows. It would be possible to use the same process management techniques to run the Slicer app, perhaps with --no-main-window and then exchange data using other channels, like tempfiles or the WebServer, but there are no examples of that right now.

thank you pieper
now i run a Slicer main App,and i want to use some feather of Slicer to Run SlicerParallelProcessing , so i need to start a second and third Slicer Sub App to do that. and pass data with stdin/stdout

Unfortunately you can’t communicate with the Slicer app via stdin/stdout, but you can have several instances running at the same time.

if i want to use some feather of slicer in multi thread or multi process , can i write multithread in C++ function, and invoke the function use python script?

If you are building Slicer from source you can add C++ code. We typically use Qt, VTK or ITK for implementing C++ features.

If you want to use a slicer binary, you could compile a separate executable and run it from Slicer and pass data, either with the ParallelProcessing extension or with the Slicer CLI Execution Model (see, for example, this page).

1 Like

thank you very much @pieper