Package inputOutput

Class OIGTImageSource


public class OIGTImageSource extends AbstractImageSource
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

    Constructors
    Constructor
    Description
    This constructor is used when the user doesn't enter an ip address or a port number.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This method is for checking the connection while the application is running by calling the isConnected() method from OpenIGTConnection.
    boolean
    This method is for closing the connection.
    int
    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 the imgData as byte array (with a length of rows*cols), and then it is converted to a Mat object from OpenCV by using put(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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. A ip address and port 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 the getDimensions method from the OpenIGT library. The parameter 0 returns the width, 1 returns the height and 2 returns the type.
      Specified by:
      openConnection in class AbstractImageSource
      Returns:
      whether the connection was successful or not
    • closeConnection

      public boolean closeConnection()
      This method is for closing the connection. It calls the stop() method from OpenIGTConnection
      Specified by:
      closeConnection in class AbstractImageSource
      Returns:
      exit is true if closing the connection was successful
    • getImageMessage

      public ImageMessage 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 the imgData as byte array (with a length of rows*cols), and then it is converted to a Mat object from OpenCV by using put(int row, int col, byte[]).
      Specified by:
      getNextMat in class AbstractImageSource
      Returns:
      Mat (from the OpenCV library)
    • checkConnection

      public boolean checkConnection()
      This method is for checking the connection while the application is running by calling the isConnected() 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