I have a python pipeline that utilizes several functions, such as ExtractCenterline and ClipVessel, from the SlicerExtension-VMTK (GitHub - vmtk/SlicerExtension-VMTK) for analyzing vessel segmentation. Since I need to process each segment in the segmentation, I am interested in using multiprocessing to speed up the analysis.
Is there any suggestion or other method to implement multiprocessing in this context?
BTW, I am working with SlicerJupyter and the Slicer 5.6 environment.
By default the SlicerParallelProcessing just launches PythonSlicer which is the same python shell as Slicer but without the modules or extensions.
You should be able to create a subshell that has all the paths defined so that VMTK logic libraries are included and can be used. Perhaps lauchConsoleProcess, but I haven’t tried.
I’m encountering an issue (which I believe is related to the environment) when trying to use launchConsoleProcess.
Here is the command
command = [
‘PythonSlicer’, ‘test_script.py’, # The Python interpreter and the script name
‘–segmentationName’, ‘segment_merge.nii.gz’,
‘–segmentName’, ‘Segment_1’,
‘–centerlineName’, ‘test’,
‘–point’, ‘145.66666666666666, 315.3333333333333, 301.6666666666667’ # Second 3D coordinate
]
process = slicer.util.launchConsoleProcess(command)
slicer.util.logProcessOutput(process)
When I use ‘python3’ as the executable, I get the error: ModuleNotFoundError: No module named numpy
Additionally, all the SlicerExtension-VMTK modules seem to be missing.
On the other hand, if I use ‘PythonSlicer’, I encounter this error: FileNotFoundError: [Errno 2] No such file or directory: ‘PythonSlicer’
Do you have any suggestions for resolving these issues?
If you need any further information, please let me know.
Thanks a lot.
PythonSlicer is more just a python shell and not a full instance of Slicer. Maybe for what you want you can use Slicer --no-main-window. Since it runs the application you’ll need to explicitly exit() when you are done processing.
Dear Steve Pieper,
My writing is not belong to this conversation. Could you kindly review and approve my post request? I am new to the community and currently seeking assistance. Thank you for your time and understanding.