High Slicer CPU usage while live streaming

I’ve been seeing high CPU usage by the Slicer process when viewing live stream images from PLUS. I’m not sure if the issue is the rendering changes between Slicer 4.8 and 4.10 or an issue with OpenIGTLinkIF.

Environment1: Windows 10, Slicer 4.8.1, with OpenIGTLinkIF core module
Environment2: Windows 10, Slicer 4.10.1 with latest SlicerOpenIGTLink extension to use OpenIGTLinkIF.

  • I streamed two mmf webcam devices and connected to them in Slicer as port 18944 and 18945.
  • AcqusitionRate was specified as “1” FPS for both mmf devices. Confirmed with Slicer node statistics module that each were streaming as 1 FPS.
  • Layout: SideBySide, viewing both streams at same time

Using Environment1:

  • CPU usage for Slicer process: ~3%
  • GPU usage for Slicer process: ~3%
  • If I disconnect one of the nodes, as though only streaming 1 device, CPU usage for the process doesn’t appear to change.

Using Environment2:

  • CPU usage for Slicer process: ~30%
  • GPU usage for Slicer process: ~3%
  • If I disconnect one of the nodes, as though only streaming 1 device, CPU usage for the process drops to half so about ~15%.

Tagging some knowledgeable users on topic:
@Sunderlandkyl, @lassoan, @jcfr

Can you do some profiling? You might get some results using VerySleepy tool or VisualStudio’s built-in profiler, even if Slicer is just built in Release mode (you get more reliable info if you build in RelWithDebInfo).

What graphics card do you have in your computer?

I’ve found indications to that on some systems, VTK’s texture update operations take much longer time with the OpenGL2 rendering backend than with the old OpenGL backend. Maybe your testing can confirm this.

There have been many changes, so it is also possible that the additional CPU load comes from the OpenIGTLink or some other layers. Profiling should help in figuring out where to look.

1 Like

Ok, I’ll try to do some additional profiling. Right now my Slicer build is a simple release mode version.

I have a GTX 960 in my system with nVidia driver 398.36 (I could update this to 419.35).

I was looking into the following PRs that might be related.

We did some profiling here.

It looks like the possible culprit may be some extremely fast loops in OpenIGTLinkIO (Possibly in igtlioConnector::ConnectionAcceptThreadFunction()).

I’m going to add some sleep statements to see if that reduces the apparent CPU load.

I’m not super familiar with profiling in visual studio, but here is what was shown after connecting the two streams into Slicer.


I think the issue should be fixed by: https://github.com/IGSIO/OpenIGTLinkIO/commit/51011693a627cc95db0eec181c450b4b9fa3f416

CPU usage for me went from ~15% to ~1%.

1 Like

Thanks for the quick fix! I built and confirmed the improvement to keep CPU usage lower. :tada:

For others to use the fix, will the SlicerOpenIGTLink extension get built and updated since the OpenIGTLinkIO dependency was updated? Should I expect the SlicerOpenIGTLink package in tomorrow’s builds to include the fix even though there was not a new commit to the SlicerOpenIGTLink repo?

It should be. I’ll double check tomorrow to make sure it’s included.

Hi Sunderland,

I have been facing the same issue but I am unable to locate above mentioned code to change it, where can I find it in the PlusApp code(OpenIGTLinkIO). I am using windows 10.
Can you please guide me with instructions, I am totally new to it.


The mentioned fix was integrated in OpenIGTLinkIO and is included in both Plus and the SlicerOpenIGTLink extension.
What is the issue that you are having?

So I will start from the beginning, We are using PlusApp and slicer for the navigation purpose, As soon as I launch server for the above method my system gets very slow and causes a lapse in the tracking after fiducial registration, before launching the server CPU usage is in between 5-10% and as soon as I launch and start tracking CPU usage goes to 100%
PC configuration - OS -Windows 10, RAM -16GB, Graphic Card-6GB Nvidia

I suppose PC configuration is fine, may be I need to change some settings in the PlusApp or IGTLinkIF, I don’t know exactly where the problem lies.
What should I change in the code to reduce my CPU usage and to minimize the lapse.

That would depend on the device. Could you create a discussion for this on the PlusLib Github page (Discussions · PlusToolkit/PlusLib · GitHub) with more info about your Plus version and config file?