I was wondering if the method slicer.cli.run() acted as a thread, thereby running the command asynchronously, versus the method slicer.cli.runSync().
I need to call on a cli run command several times, and because the dependencies of each command are independent of each other, would using slicer.cli.run parallelize their execution?
Yes, they can be run in parallel and you can monitor progress and end events. But also note that a lot of the ITK based CLI implementations already do image-level threading so you may overload your CPU by running them in parallel. Use top / Task Manager / Activity Monitor as needed.
This test should give you an idea:
This file has been truncated.
from __main__ import vtk, qt, ctk, slicer
from slicer.util import VTKObservationMixin
from slicer.ScriptedLoadableModule import *
def __init__(self, parent):
parent.title = "CLIEventTest" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = ["CLI4Test"]
parent.contributors = ["Johan Andruejol (Kitware)"]
parent.helpText = """
This is a self test that tests that CLI send all the event properly.