Package inputOutput
Class OIGTImageSource
java.lang.Object
inputOutput.AbstractImageSource
inputOutput.OIGTImageSource
provides the basic functionalities for the application like opening and closing the connection, and an image converted to a Mat object from OpenCV.
The class OpenIGTLinkConnection is needed here for establishing the connection.
-
Field Summary
Fields inherited from class inputOutput.AbstractImageSource
exit, fps, frameMatrix, isConnected
-
Constructor Summary
ConstructorDescriptionThis constructor is used when the user doesn't enter an ip address or a port number. -
Method Summary
Modifier and TypeMethodDescriptionboolean
This method is for checking the connection while the application is running by calling theisConnected()
method from OpenIGTConnection.boolean
This method is for closing the connection.int
getFPS()
This method returns the frames per second.This method is getting the current ImageMessage if it's needed.long
This method returns information about the type of ImageMessage.org.opencv.core.Mat
This method is getting theimgData
as byte array (with a length of rows*cols), and then it is converted to a Mat object from OpenCV by usingput(int row, int col, byte[])
.double[]
This method returns information about the origin of ImageMessage.double[]
This method returns information about spacing of ImageMessage.boolean
This method is starting the connection by creating an object of OpenIGTConnection.
-
Constructor Details
-
OIGTImageSource
public OIGTImageSource()This constructor is used when the user doesn't enter an ip address or a port number. The default value are used then.
-
-
Method Details
-
openConnection
public boolean openConnection()This method is starting the connection by creating an object of OpenIGTConnection. Aip
address andport
number is necessary.Thread.sleep
is needed here to wait (2 seconds) for the connection to establish. The height and width of the image adapts here to the given dimensions from MITK by usig thegetDimensions
method from the OpenIGT library. The parameter 0 returns the width, 1 returns the height and 2 returns the type.- Specified by:
openConnection
in classAbstractImageSource
- Returns:
- whether the connection was successful or not
-
closeConnection
public boolean closeConnection()This method is for closing the connection. It calls thestop()
method from OpenIGTConnection- Specified by:
closeConnection
in classAbstractImageSource
- Returns:
exit
is true if closing the connection was successful
-
getImageMessage
This method is getting the current ImageMessage if it's needed.- Returns:
imgMsg
-
getNextMat
public org.opencv.core.Mat getNextMat()This method is getting theimgData
as byte array (with a length of rows*cols), and then it is converted to a Mat object from OpenCV by usingput(int row, int col, byte[])
.- Specified by:
getNextMat
in classAbstractImageSource
- Returns:
- Mat (from the OpenCV library)
-
checkConnection
public boolean checkConnection()This method is for checking the connection while the application is running by calling theisConnected()
method from OpenIGTConnection.- Returns:
isConnected
-
getImageScalarType
public long getImageScalarType()This method returns information about the type of ImageMessage.- Returns:
- the scalar type as a long
-
getSpacing
public double[] getSpacing()This method returns information about spacing of ImageMessage.- Returns:
- spacing as double[]
-
getOrigin
public double[] getOrigin()This method returns information about the origin of ImageMessage.- Returns:
- origin as double[]
-
getFPS
public int getFPS()This method returns the frames per second.- Returns:
fps
as a int
-