Performance drop in slicer while receiving openigtlink messages as server

Operating system: Windows 10
Slicer version: 4.8.1
Expected behavior: No significant performance drop (at least in 3D view) while receiving messages.
Actual behavior: significant performance drop

When using openigtlink module in slicer in server mode, if the received message rate exceeds 10 message/second there’s visible frame rate drop in the 3D view drops. I’ve been using a matlab script to connect to the server and send messages. (not sure if this extends to whole slicer performance or only the 3D view; I assume it’s the former). To reproduce this:

  1. Create an IGTLink server node in slicer and set check for CRC off with:
getNode("IGTLCon*").SetCheckCRC(0)
  1. You can use this script to rotate the 3D scene. The jitters can be seen while rotating with the mouse as well.
layoutManager = slicer.app.layoutManager()
layoutManager.setLayout(4)  # 3D only

threeDWidget = layoutManager.threeDWidget(0)
threeDView = threeDWidget.threeDView()
threeDView.resetFocalPoint()

threeDController = threeDWidget.threeDController()
threeDController.spinView(True)
threeDView.setAnimationIntervalMs(5)
threeDView.setSpinIncrement(1)
  1. Run the performance_drop_test_slicer.m script in this repo or any other openigtlink client to send messages to the slicer server.

There’s an FPS drop in the 3D viewer while the messages are being sent. As you can see here:

slicer-performance-drop

On a side note, the SetCheckCRC function doesn’t work in the current nightly build (4.9.0-2018-06-05), is there a substitute for it?

A related issue has been recently fixed. Could you please try the latest nightly version?

A problem that I have with running this with the nightly is that I can’t turn off the CRC check of the IGTLink node. SetCheckCRC(0) doesn’t work in the nightly version. ( I get an error saying the node doesn’t have a SetCRCCheck attribute).
The node type seems to be different in nightly (vtkSlicerOpenIGTLinkIFModuleMRMLPython.vtkMRMLIGTLConnectorNode) vs stable (vtkCommonCorePython.vtkMRMLIGTLConnectorNode)

I’ve checked the code and indeed, as a result of some recent refactoring, CRC check is not exposed in the MRML node interface. I’ve submitted a pull request that adds back this feature: https://github.com/openigtlink/SlicerOpenIGTLink/pull/37. It’ll be probably integrated within a few days.

2 Likes

@roozbehshams
Thanks for your report
pull request merged, you could check the nightly build tomorrow

1 Like

Thanks @lassoan @leochan2009 . I tested the nightly, SetCheckCRC is exposed now but slicer crashes when it receives a message. There’s no error message, it’s just closed. I assume it can be reproduced with any openIGTLInk, but you can use the matlab script in my original post. It can be found here: github.com/roozbehshams/MatlabOpenIGTLink/tree/NativeMatlabTCPIP/src , the performance_drop_test_slicer script.

Thanks for reporting, i will debug immediately

1 Like

Hi,
I tested the OpenIGTLinkIF module using the TrackerServer program in OpenIGTLink library.
The receiving message is working well and Set/GetCheceCRC functions are working as well.
Unfortunately i don’t have Matlab, so i could not check your code.
Probably Andras could check this issue at the same time @lassoan

Best,
Longquan

Thanks for looking into it. The problem happens when slicer is used in server mode. I think you should be able to reproduce it if you use the TrackerClient.

Hi,

I just checked with TrackerClient, slicer doesn’t crash either.
When you use the trackerClient for testing, just add one line to set the device name.
transMsg-> SetDeviceName(“Tracker”);


otherwise, in slicer you will received bunch of transformation nodes.

Best,
Longquan

1 Like

I’ve managed to reproduce the crash, it was due to incorrect receiving of STRING message in OpenIGTLinkIF. I’ve pushed a fix (https://github.com/openigtlink/SlicerOpenIGTLink/pull/38).

1 Like

I could not reproduce the performance drop with latest nightly version of Slicer. Update rate of 3D view on my computer is about 150FPS - with and without continuously streaming messages from Matlab using your script (I’ve changed for t=0:0 to for t=0:1000 to send many messages).

1 Like

Thanks Longquan, Andras!
Out of curiosity, how can I check the fps of the 3D view ?

Click push-pin icon in the top-left corner of the 3D view, click the ... button, click Show/hide frames per second (FPS).

Thanks! I also checked with the latest nightly and the performance is as expected.

2 Likes