# Send customized data over OpenIGTLink

**URL:** <https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163>\
**Category:** Support\
**Tags:** openigtlink\
**Created:** [February 23, 2021, 5:01pm UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163 "2021-02-23T17:01:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![priya.vada4](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@priya.vada4](https://discourse.slicer.org/u/priya.vada4)\
**Post date:** [February 23, 2021, 5:01pm UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163/1 "2021-02-23T17:01:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [February 23, 2021, 7:30pm UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163/2 "2021-02-23T19:30:32Z")

</div>

> [@priya.vada4](#):
>
> It looks like in the new version of OpenIGTLink, SendData method has been removed.

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?

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [February 23, 2021, 8:55pm UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163/3 "2021-02-23T20:55:48Z")

</div>

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

```auto
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

---

<div class="post-metadata">

**Author:** ![priya.vada4](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@priya.vada4](https://discourse.slicer.org/u/priya.vada4)\
**Post date:** [February 23, 2021, 11:54pm UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163/4 "2021-02-23T23:54:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [February 24, 2021, 12:35am UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163/5 "2021-02-24T00:35:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![priya.vada4](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@priya.vada4](https://discourse.slicer.org/u/priya.vada4)\
**Post date:** [February 24, 2021, 4:21am UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163/6 "2021-02-24T04:21:18Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![Sunderlandkyl](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/sunderlandkyl/32/79987_2.png) [@Sunderlandkyl](https://discourse.slicer.org/u/Sunderlandkyl)\
**Post date:** [February 24, 2021, 3:31pm UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163/7 "2021-02-24T15:31:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![priya.vada4](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@priya.vada4](https://discourse.slicer.org/u/priya.vada4)\
**Post date:** [February 24, 2021, 4:48pm UTC](https://discourse.slicer.org/t/send-customized-data-over-openigtlink/16163/8 "2021-02-24T16:48:56Z")

</div>

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`
