Stream Your Data in PhysioLabXR¶
If you have a data source, you can start streaming in PhysioLabXR by following the steps below:
Stream LSL Data¶
Open PhysioLabXR (download the App here if you haven’t already).
Type in the name of the stream you created in the script (e.g.
python_lsl_my_stream_nameorunity_lsl_my_stream_namein the LSL examples ) inAdd Stream Widget.Select
LSLas the stream type in the dropdown just right where you put in the stream name.Click on the
Addbutton or hit enter, a stream widget will be added to the main window. The widget will have |stream_available| icon on the bottom. This means that the stream is available on the network. But we are not receiving and plotting any data yet.Click on the |ico6| button to start streaming the data.
You will be prompted to auto-set the number of channels to what’s being streamed from your script above. This is because the default number of channels is 1 for newly added stream widget. Click on
Yesto auto-set the number of channels.The |stream_available| icon will change to |stream_active| icon. You will see the data being plotted in line chart (explore other visualization method).
Stream ZMQ Data¶
In both Python and C# scripts, we created an ZMQ publisher socket that sends a random frames with 400 × 400 × 3 (480000) channels, as if it is a video stream that has a height of 400, width of 400, and 3 color channels. The publisher sends 15 frames per second. The Python script sends random images while the Unity script sends images from a Unity camera.
Important
A ZMQ frame must have data in the following order: topic, timestamp, data. The topic must be a string, and the timestamp must be a 8-byte (64-bit) double or 4-byte (32-bit) float. The data can be one of the supported types listed here.
Now return to PhysioLabXR (download the App here if you haven’t already). In the
Add Streamline edit, type in the name of the stream you created in the script (e.g.python_zmq_my_stream_nameorunity_zmq_my_stream_namein the example above).Select
ZMQas the stream type in the dropdown just right where you put in the stream name.After
ZMQis selected, theport numberline edit will show up. Type in the port number you used in the script (5557in the example above).Click on the
Addbutton. A stream widget will be added to the main window. Unlike LSL stream, ZMQ stream will not have |stream_available| icon on the bottom. This is because ZMQ does not have a mechanism to check if the stream is available on the network.Now click on the |ico6| button.
You will be prompted to auto-set the number of channels to what’s being streamed from your script above. This is because the default number of channels is 1 for newly added stream widget. Click on
Yesto auto-set the number of channels.Because the number of channels we set is 12288, greater than the maximum number of channels that can be plotted in a line chart. It will automatically switch to image plot (explore other visualization method). You need to set the
heightandwidthand other image meta info in its to see the image.Click on
...button to open the plot settings. Set thewidthandheightto 64, andImageto “rgb”.Return to the plot widget, move your cursor to the lower left of the plot, click the [A] button that shows up to have the image auto-scale to fit the window.
Note
Check this page for how to choose ZMQ port so that it does not conflict with other applications.