Send customized data over OpenIGTLink

Hi

Is it possible to send a customized polydata over OpenIGTLink. In an earlier version, I was able to send the data by setting the igtl::PolyDataMessage::Pointer and then sending the data by directly calling vtkMRMLIGTLConnectorNode::SendData to send the polydata message.

It looks like in the new version of OpenIGTLink, SendData method has been removed. Do I need to set the polydata to a vtkMRMLModelNode and then push the node over OpenIGTLink? Can you let me know how if there is an easier way of sending the customized polydata message.

Thanks
Priya

You can send the model by setting it as an output node and calling Modified() on it.

@Sunderlandkyl is there a way for one-time sending of a node (without setting it as an output node) in latest SlicerOpenIGTLink?

No, the only method that I can see currently is to call:

connectorNode.RegisterOutgoingMRMLNode(node)
connectorNode.PushNode(node)
connectorNode.UnregisterOutgoingMRMLNode(node)

I’ll take a look to see if I can add some additional methods to simplify one-off messages:

  • Send OpenIGTLink message directly
  • Send message from node without having to register/unregister the node
1 Like

I may be missing something here since it doesn’t look like it works. As a toy example, I tried to extract the polydata from a model and then send it over OpenIGTLink by creating a vtkMRMLModelNode and pushing the node. The code snippet is included below:

//Creating some dummy polydata
vtkPolyData* polyData = modelNode->GetPolyData();


// send the data
vtkSmartPointer<vtkMRMLModelNode> modelClientNode = vtkSmartPointer<vtkMRMLModelNode>::New();
modelClientNode->SetAndObservePolyData(polyData);
modelClientNode->Modified();
connectorNode->RegisterOutgoingMRMLNode(modelClientNode);
connectorNode->PushNode(modelClientNode);
connectorNode->UnregisterOutgoingMRMLNode(modelClientNode);

I don’t receive the polydata on the server side. Please let me know your suggestions.

Thanks
Priya

The model node needs to be added to the scene so that a node reference can be added to the connector node.

Thanks for your suggestion. I still seem to be getting the following error:

Unable to create vtkPolyData from incoming POLYDATA message. Failed to unpack the message

Interesting, I just tested with the latest stable and I was able to send a polydata between them.

What version of Slicer are you using?
Could you send me a “.vtk” for the polydata that gave the error.

I am using Slicer 4.13.0-2021-01-13. It occurs with every vtk model that I try to send. Not sure where the problem is.

In fact, even if I try to send the model from the OpenIGTLink module in Slicer (not programmatically), I run into the same problem with the following error:

Unable to create vtkPolyData from incoming POLYDATA message. Failed to unpack the message