Package inputOutput
Class OpenIGTLinkConnection
java.lang.Object
inputOutput.OpenIGTLinkConnection
- All Implemented Interfaces:
IOpenIgtPacketListener
builds a connection based on OpenIGTLink for tracking data and image data.
As a prerequisite MITK v2016.11 has to run in the background.
The connection is established by using the online stream.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionThis constructor establishes a connection to a OpenIGTLink server using the default ip-address and port.OpenIGTLinkConnection
(String ip, int port) An IP-address and a port number is needed for the connection. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
This method is for getting the current image data.This method is for getting the current ImageMessage.getTxTransform
(String name) The methods below are not used during a connection over MITKboolean
This method is for checking the connection while the application is running.onGetStatus
(String name) Request for status from IGT/Slicervoid
onRxDataArray
(String name, Matrix3D data) This is the handler for an array of raw data in an arrayvoid
onRxImage
(String name, ImageMessage image) This method is receiving an image as ImageMessage from the server, while it is running in the background during the connection.void
onRxNDArray
(String name, float[] data) THis is a request for an array of datavoid
onRxString
(String name, String body) This is the handler for a String packetvoid
onRxTransform
(String name, TransformNR t) This method will be called by the IGT server when a transform is received.double[]
onTxDataArray
(String name) THis is a request for an array of datavoid
onTxNDArray
(String name) THis is a request for an array of dataonTxString
(String name) This is the request handler for a String packetstatic void
void
setImageDataByte
(byte[] imgData) This method is for setting an image data in the form of a byte.void
This method is for setting an ImageMessage.void
void
setPort
(int port) boolean
stop()
This method is for stopping the connection (the client).
-
Field Details
-
fps
public long fps
-
-
Constructor Details
-
OpenIGTLinkConnection
public OpenIGTLinkConnection()This constructor establishes a connection to a OpenIGTLink server using the default ip-address and port. -
OpenIGTLinkConnection
An IP-address and a port number is needed for the connection. Here both are set through the constructor.- Parameters:
ip
-port
-
-
-
Method Details
-
setIp
-
setPort
public void setPort(int port) -
onRxImage
This method is receiving an image as ImageMessage from the server, while it is running in the background during the connection. After getting an ImageMessage, thesetImageMessage(ImageMessage img)
method is called in order to set the received ImageMessage and the body of ImageMessage is unpacked in order to get the image data, which is also set by callingsetImageData(byte[] imgData)
. The framerate is also determined here.- Specified by:
onRxImage
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of data to getimage
- the image
-
getImageMessage
This method is for getting the current ImageMessage.- Returns:
- ImageMessage
-
setImageMessage
This method is for setting an ImageMessage. -
setImageDataByte
public void setImageDataByte(byte[] imgData) This method is for setting an image data in the form of a byte. -
getImageDataByte
public byte[] getImageDataByte()This method is for getting the current image data.- Returns:
- It returns the image data as a byte[]
-
stop
public boolean stop()This method is for stopping the connection (the client).- Returns:
client.isInterrupted()
is true if closing the connection was successful
-
isConnected
public boolean isConnected()This method is for checking the connection while the application is running.- Returns:
isConnected
-
onRxTransform
Description copied from interface:IOpenIgtPacketListener
This method will be called by the IGT server when a transform is received. Supports: TRANSFORM QTRANS QTRANSFORM POSITION- Specified by:
onRxTransform
in interfaceIOpenIgtPacketListener
- Parameters:
name
- The string in the 'NAME' field of the IGT packett
-
-
getToolDataList
-
parseXMLStringMessage
-
getTxTransform
The methods below are not used during a connection over MITK- Specified by:
getTxTransform
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of transform to get- Returns:
- the requested transform
-
onGetStatus
Description copied from interface:IOpenIgtPacketListener
Request for status from IGT/Slicer- Specified by:
onGetStatus
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of transform to get- Returns:
- the requested status
-
onRxString
Description copied from interface:IOpenIgtPacketListener
This is the handler for a String packet- Specified by:
onRxString
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of data to getbody
- A string of the content
-
onTxString
Description copied from interface:IOpenIgtPacketListener
This is the request handler for a String packet- Specified by:
onTxString
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of transform to get
-
onRxDataArray
Description copied from interface:IOpenIgtPacketListener
This is the handler for an array of raw data in an array- Specified by:
onRxDataArray
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of data to getdata
- An array of data
-
onTxDataArray
Description copied from interface:IOpenIgtPacketListener
THis is a request for an array of data- Specified by:
onTxDataArray
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of data to get- Returns:
- an array of data
-
onTxNDArray
Description copied from interface:IOpenIgtPacketListener
THis is a request for an array of data- Specified by:
onTxNDArray
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of data to get returns an array of data
-
onRxNDArray
Description copied from interface:IOpenIgtPacketListener
THis is a request for an array of data- Specified by:
onRxNDArray
in interfaceIOpenIgtPacketListener
- Parameters:
name
- A string of what type of data to get returns an array of data
-