Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Behavior in Slicer 4.10.1 #91

Open
adnanmunawar opened this issue Jun 11, 2019 · 7 comments
Open

Undefined Behavior in Slicer 4.10.1 #91

adnanmunawar opened this issue Jun 11, 2019 · 7 comments

Comments

@adnanmunawar
Copy link

For some reason the openIGTLink
for Slicer is not working as expected in Slicer 4.10.1. We are trying to
send a transform over from a client and then printing it at the host.
Even though the host is receiving a packet, it's empty when printed. The
same, however, works on Slicer 4.6.2 and 4.8.

@Sunderlandkyl
Copy link
Contributor

How are you printing it?

Can you attach a Slicer log file?

@adnanmunawar
Copy link
Author

adnanmunawar commented Jun 13, 2019

Just to confirm, does the OpenIGTLink module in slicer 4.10.* use OpenIGTLink Message Version 3?

If so, I think the issue is at our end, as we might be using the OpenIGTLink message version 1 to unpack the message on an ARM v7 processor. I am able to see the transforms using ROS OpenIGTLink so clearly the plugin is working but should I not still be able to unpack the message using OpenIGTLink Library (message) version 1 or 2?

@Sunderlandkyl
Copy link
Contributor

Sunderlandkyl commented Jun 14, 2019

SlicerOpenIGTLink uses the extended v2 header format from OpenIGTLink 3.0.
Messages with the extended header cannot be unpacked using OpenIGTLink 1.0 or 2.0.

From the documentation:

When the message structure was revised for Version 3, we redefined the Body Size as the total size of Extended Header, Content, and Metadata, because this new definition allows the old OpenIGTLink programs can still tell the size of the rest of the message, and skip reading the byte stream until the beginning of the next message. The size of the content can be computed as: BODY_SIZE - (EXT_HEADER_SIZE + METADAT_SIZE).

@tokjun
Copy link

tokjun commented Oct 22, 2019

Related to this thread, I also noticed that SlicerOpenIGTLink cannot receive transforms from a version 1 client. For example, if I push transforms from the TrackerClient example in OpenIGTLink library, SlicerOpenIGTLink module gives:

Warning: In /work/Stable/S-4102-E-b/SlicerOpenIGTLink/OpenIGTLinkIF/MRML/vtkMRMLIGTLConnectorNode.cxx, line 506
vtkMRMLIGTLConnectorNode (0xba752e0): Incoming TRANSFORM device has no device name!

Shouldn't the module be able to receive version 1 message?

@Sunderlandkyl
Copy link
Contributor

It should. TrackerServer sends messages to Slicer fine (to a client node), so I wonder if there is an issue with receiving messages on a server type connection.

@leochan2009
Copy link
Contributor

leochan2009 commented Oct 22, 2019

In the line of
https://github.com/openigtlink/OpenIGTLink/blob/1d6cd5ce750e3b4edba340646247d1b297ea43fa/Examples/Tracker/TrackerClient.cxx#L76
transMsg gets reinitialized, so the device name is empty. you can add this line after the reinitialization.
transMsg->SetDeviceName("Tracker");
same as the TrackerServer example:
https://github.com/openigtlink/OpenIGTLink/blob/1d6cd5ce750e3b4edba340646247d1b297ea43fa/Examples/Tracker/TrackerServer.cxx#L72

As for why we constantly call the InitPack() function in the loop, please see this issue:
openigtlink/OpenIGTLink#161

@tokjun
Copy link

tokjun commented Oct 23, 2019

Ah, I wasn't aware of the change in the library. Thanks for pointing this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants