Class Text

All Implemented Interfaces:
RegularROI, RotatableROI

public class Text extends Marker
A Class for putting text on an image.
  • Constructor Details

    • Text

      public Text(org.jogamp.vecmath.Point2d pt)
      Creates a new Text ROI at the given point.
      Parameters:
      pt - the location of the Text ROI.
    • Text

      public Text(double x, double y)
      Creates a new Text roi at the given (x, y) coordinate.
      Parameters:
      x - the x location of the text.
      y - the y location of the text.
    • Text

      public Text(double x, double y, ROIState state)
      Creates a new Text ROI at the given (x, y) coordinate, and sets the state of the ROI.
      Parameters:
      x - the x location of the text.
      y - the y location of the text.
      state - the ROIState of the text.
  • Method Details

    • getCreateInteractionType

      public static InteractionType getCreateInteractionType()
      Returns the type of interaction needed to create a Text ROI.
      Returns:
      type of interaction needed to create a Text ROI - InteractionType.CLICK_TYPE.
    • getInstance

      public static ROI getInstance(Point2D point, boolean pixelSnap, int nCols, int nRows, float pixelXSize, float pixelYSize, byte userColour, ROIState state)
      Create a Text ROI at a point on an image.
      Parameters:
      point - the point on the image in pixel coordinates.
      pixelSnap - true if pixel snap is turned on.
      nCols - the number of columns in the image.
      nRows - the number of rows in the image.
      pixelXSize - the width of an image pixel in mm.
      pixelYSize - the height of an image pixel in mm.
      userColour - the colour of the text. A value of 0 indicates that the text will be drawn with the default colour for Text ROIs if unselected.
      state - the ROIState of this ROI on creation.
      Returns:
      a Text ROI.
    • intersect

      public List<ROI> intersect(ROI roi, IndeterminateProgressMonitor progressMonitor)
      Description copied from class: ROI
      Performs an intersection operation on the shape of this ROI with another ROI.
      Overrides:
      intersect in class Marker
      Parameters:
      roi - the ROI with which to perform the intersection operation.
      progressMonitor - if non-null, the IndeterminateProgressMonitor that can be used to cancel the operation.
      Returns:
      a List<ROI> of ROIs that result from the operation.
    • draw

      public boolean draw(Graphics g, Rectangle visibleRectangle, int imageDrawCols, int imageDrawRows, int xOffset, int yOffset, int nCols, int nRows, float pixelXSize, float pixelYSize, boolean drawAnnotation)
      Description copied from class: Marker
      Draws this ROI if it needs to be be drawn on screen. Marker ROIs are a special case, since we can't use the Bounding Rectangle to decide whether a Marker is on screen, since the zero-area bounding rectangle never intersects anything.
      Overrides:
      draw in class Marker
      Parameters:
      g - the graphics context for the drawing operation.
      visibleRectangle - the part of the image that can be seen on-screen.
      imageDrawCols - width of the area in which this portion of the image is to be drawn.
      imageDrawRows - height of the area in which this portion of the image is to be drawn.
      xOffset - a horizontal offset for drawing operations.
      yOffset - a vertical offset for drawing operations.
      nCols - the number of columns in the image on which this ROI is defined.
      nRows - the number of rows in the image on which this ROI is defined.
      pixelXSize - pixel width for the image on which this ROI is defined.
      pixelYSize - pixel height for the image on which this ROI is defined.
      drawAnnotation - a flag to indicate whether annotation should be drawn.
      Returns:
      true if the ROI is visible and been drawn on screen; false otherwise.
    • drawInOrthoView

      public void drawInOrthoView(Image orthoView, org.jogamp.vecmath.Point3f orthoViewPosition, org.jogamp.java3d.Transform3D imageToViewTx, int offsetX, int offsetY, int nCols, int nRows, int nSlices, float pixelXSize, float pixelYSize, boolean filled)
      Description copied from class: ROI
      Draws this ROI on top of an orthogonal view of an image.
      Overrides:
      drawInOrthoView in class Marker
      Parameters:
      orthoView - the Image into which the ROI is to be drawn.
      orthoViewPosition - the coordinates (col, row, slice position) of the orthogonal view in the original image.
      imageToViewTx - the Transform3D that maps original image pixel coordinates to pixel coordinates in the orthogonal view.
      offsetX - the offset in the horizontal direction of the orthoView image, relative to the JPanel into which it will be drawn.
      offsetY - the offset in the vertical direction of the orthoView image, relative to the JPanel into which it will be drawn.
      nCols - the number of columns in the original image.
      nRows - the number of rows in the original image.
      nSlices - the number of slices in the original image.
      pixelXSize - the pixel width in the original image.
      pixelYSize - the pixel height in the original image.
      filled - whether the ROI should be drawn filled (effective only for ROIs that enclose an area).
    • selectDeselect

      public boolean selectDeselect(Point point, boolean editMode, boolean showDeleted, int nAlreadySelected)
      Description copied from class: ROI
      Selects or deselects an ROI after a user click at the point.
      Overrides:
      selectDeselect in class Marker
      Parameters:
      point - the Point at which the user has clicked.
      editMode - true if the tool working with ROIs is in edit mode; false if it is in view mode.
      showDeleted - true if the tool working with ROIs is set to show deleted ROIs; false if it is not.
      nAlreadySelected - the number of ROIs already selected. This determines the exact selection/deselection behaviour.
      Returns:
      true if the selection was changed.
    • getColor

      public Color getColor()
      Returns the Color in which this Text ROI should be drawn.
      Overrides:
      getColor in class ROI
      Returns:
      the Color with which this Text ROI should be drawn.
    • dilate

      public List<ROI> dilate(double radius, AtomicInteger opCounter, CancellableThread.Flag cancelFlag)
      Dilation of a Text ROI has no effect. The List of ROIs returned contains just a copy of this Text ROI.
      Parameters:
      radius - the radius of dilation.
      opCounter - a counter for the number of sub-operations that was performed to execute the dilation operation.
      cancelFlag - a flag that, if set externally, cancels the operation.
      Returns:
      a List containing a copy of this Text ROI.
    • getCreateDialog

      public static ROICreateDialog getCreateDialog(CanAddROIToFrame listener)
      Returns a JDialog that can be used to create Text ROIs.
      Parameters:
      listener - the CanAddROIToFrame to which the ROI will be added when the Add button of the Dialog is clicked.
      Returns:
      a JDialog that can be used to create Text ROIs.
    • equals

      public boolean equals(Object obj)
      Description copied from class: ROI
      Indicates whether some Object is equal to this ROI. To be equal, the Object must be an ROI of the same type, and of the same shape and location as this ROI.
      Overrides:
      equals in class Marker
      Parameters:
      obj - the Object to be tested for equality to this ROI.
      Returns:
      true if the supplied Object is an ROI of the same type, shape and location as this ROI; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this Marker ROI.
      Overrides:
      hashCode in class Marker
      Returns:
      a hash code value for this Marker ROI.
    • getCopy

      public Text getCopy()
      Description copied from class: ROI
      Returns a copy of this ROI. The copy will be identical in shape and annotation as the original ROI, but with a history of that of a newly-created ROI.
      Overrides:
      getCopy in class Marker
      Returns:
      a copy of this ROI.
    • getDescription

      public String getDescription()
      Description copied from class: ROI
      Return a description of this type of ROI.
      Overrides:
      getDescription in class Marker
      Returns:
      a String describing the type of this ROI.
    • getName

      public static String getName()
      Returns a descriptive name for this type of ROI.
      Returns:
      a String describing this type of ROI.
    • getButtonIcon

      public static Icon getButtonIcon()
      Returns an Icon that can be used for a button to create this type of ROI.
      Returns:
      an Icon that can be used to represent this type of ROI.