Bug in the OpenIGTLink plugin

Dear ImFusion team,

I hope that you are doing well.

I am using the OpenIGTLink plugin to get an image stream from my python server. In the beginning, ImFusion Suite can get the data and visualize it correctly. However, once I import a tracking stream and click it in the Data window, the imagestream is empty. To show this problem, please check this video

I also found if I have 2 data in the Data window (one ImageStream from OpenIGTLink, and one any other data), once I click the other data, the ImageStream data is empty. But the bug does not exit if I use a normal ImageStream (e.g. Fake ImageStream).

Due to this problem, I could not do the US calibration wizard since US ImageStream is not available in the wizard.

Could you please provide some help? This problem exists in Suite v2.42 and v2.47

Best,
Luohong

The following is my Python server code:

“”"

Image sending server

Simple application that starts a server that provides an image stream with a bright circle moving

“”"

import pyigtl # pylint: disable=import-error
import cv2
from time import sleep
import numpy as np
from math import sin

server = pyigtl.OpenIGTLinkServer(port=18944)

image_size = [500, 300]
radius = 60

timestep = 0
while True:

if not server.is_connected():
    # Wait for client to connect
    sleep(0.1)
    continue
timestep += 1
voxels=cv2.imread(f"***/UltrasoundImages/{timestep%40}.png")

voxels = np.transpose(voxels, axes=(2, 0, 1))

# Send image
image_message = pyigtl.ImageMessage(voxels, device_name="Image")
server.send_message(image_message, wait=True)
print(f"sent out image: {timestep}")

Hello Luohong,

I could reproduce this issue by using your Python script as server. It doesn’t seem to occur when using a second instance of the ImFusion Suite as server, though. We will investigate and will get back to you.

Best,
Steffen

Hi Steffen,

Thanks for your help. : )

Hi Luohong,

The problem seems to be caused by the order of axes in voxels.
When sending a 2D image, the input to pyigtl.ImageMessage() must be a 3D array with the second and third axis corresponding to y and x, respectively. So the array must have the shape (1, height, width).

This Python code works for me with Suite v2.47:

import pyigtl
import imageio.v3 as iio
from time import sleep
import numpy as np

server = pyigtl.OpenIGTLinkServer(port=18944)
timestep = 0

while True:
voxels = iio.imread(f"path/{timestep % 100}.png")
voxels = voxels[np.newaxis, :, :]
#print(voxels.shape)

image_message = pyigtl.ImageMessage(voxels, device_name="Image")
server.send_message(image_message, wait=True)

timestep += 1
sleep(0.1)

Note that we currently only support streaming of 2D images via OpenIGTLink, but I believe this is sufficient for your use case?

Hope this helps!

Best,
Steffen

Hi Steffen,

Thanks a lot for your help. Yeah, this is enough. I could use the method to stream Ultrasound images from un-supported device to ImFusion Suite. Have a nice day : )
Best,
Luohong