Class RadialDivider

java.lang.Object
com.xinapse.multisliceimage.roi.ROI
com.xinapse.multisliceimage.roi.RadialDivider
All Implemented Interfaces:
Cloneable

public class RadialDivider extends ROI implements Cloneable
A radial divider, for cardiac segental analysis.
  • Field Details

    • THETA_TOKEN

      public static final String THETA_TOKEN
      The token written to ROI output files to represent the insertion point angle (in degrees).
      See Also:
    • NSEG_TOKEN

      public static final String NSEG_TOKEN
      The token written to ROI output files to represent the number of segments.
      See Also:
  • Constructor Details

    • RadialDivider

      public RadialDivider(int physicalSlice, int nSegments, double theta, Integer endoEpicardiumSplitPercent)
      Creates a RadialDivider to be applied to one physical slice of a (possibly) multi-slice, multiple time-point dataset. The RadialDivider will apply at all time points for the given physical slice.
      Parameters:
      physicalSlice - the hysical slice to which this RadialDivider is to be applied.
      nSegments - the number of segments for this RadialDivider.
      theta - the initial insertion point angle.
      endoEpicardiumSplitPercent - if non-null, the split percentage between endocardium and epicardium. The value refers to the percentage of endocardium.
  • Method Details

    • setNSegments

      public void setNSegments(int nSegments)
      Sets the number of segments.
      Parameters:
      nSegments - the number of segments.
    • getNSegments

      public int getNSegments()
      Returns the number of segments.
      Returns:
      the number of segments.
    • setTheta

      public void setTheta(double theta)
      Sets the insertion point angle.
      Parameters:
      theta - the insertion point angle.
    • setTheta

      public void setTheta(Point mousePoint, int movieFrame)
      Sets the insertion point angle, using the mouse location.
      Parameters:
      mousePoint - the location of the mouse on screen.
      movieFrame - the cine frame number on which the insertion is being manipulated.
    • getCentre

      public org.jogamp.vecmath.Point2d getCentre(int movieFrame)
      Returns the centre position for this RadialDivider for the given movie frame number.
      Parameters:
      movieFrame - the cine movie frame number.
      Returns:
      the position of the RadialDivider in the given movie frame.
    • getTheta

      public double getTheta()
      Returns the insertion point angle.
      Returns:
      the insertion point angle.
    • setEndoEpicardiumSplitPercent

      public void setEndoEpicardiumSplitPercent(Integer endoEpicardiumSplitPercent)
      Sets the endo- epi-cardium split percentage.
      Parameters:
      endoEpicardiumSplitPercent - the split percentage, with zero being no endocardium, and 100 being no endocardium. A null value indicates that there should be no split.
    • getHollowROI

      public HollowROI getHollowROI(ROI[] rois, int movieFrame) throws ROIException
      Returns the HollowROI that is formed from a pair of ROIs.
      Parameters:
      rois - the array of ROIs, of length at least 2.
      movieFrame - the cine movie frame to which the ROIs apply.
      Returns:
      a HollowROI formed from a pair of ROIs.
      Throws:
      ROIException - if a HollowROI cannot be formed.
    • removeROIsUsed

      public void removeROIsUsed(List<ROI> rois) throws ROIException
      From a List of ROIs, remove those used to create a HollowROI forming an annulus, which can then be used for segmental analysis using this RadialDivider.
      Parameters:
      rois - the ROIs that include those used to create the annulus. The ROIs used will be removed from the List by this method.
      Throws:
      ROIException - if an ROI-related error occurs.
    • getStats

      public ROIStats[] getStats(ROI[] rois, int movieFrame, Object pix, PixelDataType dataType, int nCols, int nRows, int offset, float pixelXSize, float pixelYSize, ComplexMode complexMode) throws ROIException
      Returns an array of ROIStats - one for each segment, or two for each segment if there is an endo- epi-cardial split.
      Parameters:
      rois - the ROIs from which an annulus will be formed.
      movieFrame - the cine frame.
      pix - the image pixels.
      dataType - the data type of the image pixels.
      nCols - the number of columns in the array of pixels.
      nRows - the number of columns in the array of pixels.
      offset - the ofset into the array of pixels at which to get the slice pixel values.
      pixelXSize - the pixel width.
      pixelYSize - the pixel height.
      complexMode - if non-null, the complex calculation mode for complex images.
      Returns:
      an array of ROIStats for the segments. If there is an endo- epi-cardial split, then the endocardial stats are the first in the array, followed by the epicardial stats.
      Throws:
      ROIException - if an ROI-related error occurs.
    • getAnnularThickness

      public double[] getAnnularThickness(ROI[] rois, int nMeasuresPerSegment) throws ROIException
      Returns an array of annular thicknesses - one for each segment of this RadialDivider.
      Parameters:
      rois - an array of length 2 - the ROIs from which an annulus will be formed.
      nMeasuresPerSegment - the numbers of measures of thickness that will be measured for each segment.
      Returns:
      an array of annular thicknesses - one element for each of the segments.
      Throws:
      ROIException - if an ROI-related error occurs.
    • set

      public void set(ROI roi) throws ClassCastException
      Description copied from class: ROI
      Sets the shape of this ROI to the shape of the supplied argument ROI.
      Specified by:
      set in class ROI
      Parameters:
      roi - the ROI from which the shape is set.
      Throws:
      ClassCastException - if the sub-class of the argument ROI is not the same as this ROI.
    • getCopy

      public ROI 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.
      Specified by:
      getCopy in class ROI
      Returns:
      a copy of this ROI.
    • clone

      public RadialDivider clone()
      Description copied from class: ROI
      Returns a clone of this ROI. The copy will be identical in shape and annotation as the original ROI, and with a history identical to the cloned ROI.
      Overrides:
      clone in class ROI
      Returns:
      a clone of this ROI, cast to an Object.
    • toString

      public String toString()
      Description copied from class: ROI
      Returns a String describing this ROI.
      Specified by:
      toString in class ROI
      Returns:
      a String describing this ROI.
    • getDescription

      public String getDescription()
      Description copied from class: ROI
      Return a description of this type of ROI.
      Specified by:
      getDescription in class ROI
      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.
    • getFeret

      public Feret getFeret()
      Returns zero.
      Specified by:
      getFeret in class ROI
      Returns:
      zero.
    • getPerimeter

      public double getPerimeter()
      Returns zero.
      Specified by:
      getPerimeter in class ROI
      Returns:
      zero.
    • getCentroid

      public org.jogamp.vecmath.Point2d getCentroid()
      Returns null.
      Specified by:
      getCentroid in class ROI
      Returns:
      null.
    • getDividerColor

      public static Color getDividerColor()
      Returns the Color to be used for drawing the end/epicardium divider.
      Returns:
      the Color of the end/epicardium divider.
    • isVisible

      public boolean isVisible(int movieFrame, List<ROI> rois)
      Returns whether this RadialDivider is visible on screen.
      Parameters:
      movieFrame - the cine frame number.
      rois - a List of ROIs that this RadialDivider divides.
      Returns:
      whether this RadialDivider is visible on screen.
    • draw

      public void draw(Graphics g, int imageSlice, int movieFrame, Rectangle visibleRectangle, int imageDrawCols, int imageDrawRows, int xOffset, int yOffset, int nCols, int nRows, float pixelXSize, float pixelYSize, List<ROI> rois) throws ROIException
      Draws this RadialDivider if it needs to be be drawn on screen.
      Parameters:
      g - the graphics context for the drawing operation.
      imageSlice - the image physical slice number.
      movieFrame - the cine frame number.
      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.
      rois - a List of ROIs that this RadialDivider divides.
      Throws:
      ROIException - if an ROI-related error occurs.
    • drawInOrthoView

      public void drawInOrthoView(Image orthoView, org.jogamp.vecmath.Point3f viewPosition, org.jogamp.java3d.Transform3D imageToViewTx, 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.
      Specified by:
      drawInOrthoView in class ROI
      Parameters:
      orthoView - the Image into which the ROI is to be drawn.
      viewPosition - 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.
      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).
    • getHandleUnder

      public InsertionPointHandle getHandleUnder(Point mousePoint, int movieFrame)
      If the mouse is over the InsertionPointHandle, returns the InsertionPointHandle.
      Parameters:
      mousePoint - the location of the mouse.
      movieFrame - the cine frame number.
      Returns:
      the InsertionPointHandle over which the mouse is positioned, or null.
    • 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 ROI
      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.
    • flipVertical

      public void flipVertical(Point2D flipPoint)
      This method does nothing.
      Specified by:
      flipVertical in class ROI
      Parameters:
      flipPoint - the point about which the ROI will be flipped.
    • flipHorizontal

      public void flipHorizontal(Point2D flipPoint)
      This method does nothing.
      Specified by:
      flipHorizontal in class ROI
      Parameters:
      flipPoint - the point about which the ROI will be flipped.
    • move

      public void move(double dx, double dy)
      This method does nothing.
      Specified by:
      move in class ROI
      Parameters:
      dx - the distance to move in the x-direction.
      dy - the distance to move in the y-direction.
    • dilate

      public List<ROI> dilate(double radius, AtomicInteger opCounter, CancellableThread.Flag cancelFlag)
      Dilation of a RadialDivider has no effect. The List of ROIs returned contains a copy of this RadialDivider.
      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 clone of this Text ROI.
    • contains

      public boolean contains(ROI roi)
      Indicates whether this RadialDivider ROI contains another ROI entirely within its borders.
      Specified by:
      contains in class ROI
      Parameters:
      roi - the ROI to be tested for containment within this ROI.
      Returns:
      false always.
    • equals

      public boolean equals(Object o)
      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.
      Specified by:
      equals in class ROI
      Parameters:
      o - 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.