Threading CLI commands

Hi there,

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?

Thanks,

Purav

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:

1 Like