Plus applications user manual  2.7.0.7ac5b43
Software library for tracked ultrasound image acquisition, calibration, and processing.
Generic serial device

This device communicates with external hardware using serial (RS-232) connection It does not collect tracking or image data, only allows sending and receiving data using OpenIGTLink commands (see PlusServer commands).

A (customizable) newline string is appended after each sent command and the device listens for reponse that is terminated by the same newline string.

Supported hardware devices

Supported platforms

Installation

Device configuration settings

Example configuration file PlusDeviceSet_Server_GenericSerial.xml

<PlusConfiguration version="2.1">
<DataCollection StartupDelaySec="1.0">
<DeviceSet
Name="PlusServer: Generic serial device"
Description="Send text and receive response through OpenIGTLink"
/>
<Device
Id="SerialDevice"
Type="GenericSerialDevice"
SerialPort="5"
BaudRate="9600"
LineEnding="0d"
>
<DataSources>
<DataSource Id="SerialData" Type="FieldData"/>
</DataSources>
<OutputChannels>
<OutputChannel Id="FieldChannel">
<DataSource Id="SerialData"/>
</OutputChannel>
</OutputChannels>
</Device>
</DataCollection>
<PlusOpenIGTLinkServer
MaxNumberOfIgtlMessagesToSend="1"
MaxTimeSpentWithProcessingMs="50"
ListeningPort="18944"
LogWarningOnNoDataAvailable="false"
OutputChannelId="FieldChannel" >
<DefaultClientInfo>
<MessageTypes>
<Message Type="STRING" />
</MessageTypes>
<StringNames>
<String Name="SerialData" />
</StringNames>
</DefaultClientInfo>
</PlusOpenIGTLinkServer>
</PlusConfiguration>

Example script for sending command from 3D Slicer

connectorNode = slicer.vtkMRMLIGTLConnectorNode() connectorNode.SetTypeClient('127.0.0.1', 18944) slicer.mrmlScene.AddNode(connectorNode) connectorNode.Start()

arduinoCmd = slicer.vtkSlicerOpenIGTLinkCommand() arduinoCmd.SetCommandName('SendText') arduinoCmd.SetCommandAttribute('DeviceId','SerialDevice') arduinoCmd.SetCommandTimeoutSec(1.0)

arduinoCmd.SetCommandAttribute('Text', "123456") slicer.modules.openigtlinkremote.logic().SendCommand(arduinoCmd, connectorNode.GetID())

def onArduinoCmdCompleted(observer, eventid): print("Command completed with status: " + arduinoCmd.StatusToString(arduinoCmd.GetStatus())) print("Response message: " + arduinoCmd.GetResponseMessage()) print("Full response: " + arduinoCmd.GetResponseText())

arduinoCmd.AddObserver(arduinoCmd.CommandCompletedEvent, onArduinoCmdCompleted)