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
ConstructorsConstructorDescriptionThis constructor is used when the user doesn't enter an ip address or a port number. -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method is for checking the connection while the application is running by calling theisConnected()method from OpenIGTConnection.booleanThis method is for closing the connection.intgetFPS()This method returns the frames per second.This method is getting the current ImageMessage if it's needed.longThis method returns information about the type of ImageMessage.org.opencv.core.MatThis method is getting theimgDataas 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.booleanThis 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. Aipaddress andportnumber is necessary.Thread.sleepis 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 thegetDimensionsmethod from the OpenIGT library. The parameter 0 returns the width, 1 returns the height and 2 returns the type.- Specified by:
openConnectionin 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:
closeConnectionin classAbstractImageSource- Returns:
exitis 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 theimgDataas 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:
getNextMatin 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:
fpsas a int
-