Class ColorData

java.lang.Object
noduledata.imagej.ColorData
Direct Known Subclasses:
MixedData

public class ColorData extends Object
This class handles the analysis of the segmented nodule Rois.
Author:
Brandin Farris
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int[]
     
    protected ij.ImagePlus
     
    int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ColorData(ij.plugin.frame.RoiManager manager, int[] color, int colorThreshold, ij.ImagePlus im)
    constructor method.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addRoi(ij.gui.ShapeRoi roi)
    add given roi to array of Rois
    double
    calculates average area of the singular nodules.
    ij.ImagePlus
    converts map to binary map.
    static ij.ImagePlus
    createImageWithRoi(ij.ImagePlus image, ij.gui.Roi[] rois)
    Generates a map given a background image and ROIs.
    static ij.process.ImageProcessor
    fillRect(Rectangle rect, ij.process.ImageProcessor ip)
    fills given rect with given color.
    int[][]
    areas[][[] is nx2 with n Rois.
    double
    getCircularity(int index)
    Returns the circularity of the roi at the given index.
    getClump(int index)
    Returns clump at given index.
     
    void
    getData(boolean mixed)
    Method that generates the ResultsTable, ROI's, int[] areas, and numNodules.
    Finds all ROIs using the measure method.
    Finds any rois with large enough measure, and fills them in.
    int
    getIndex(ij.gui.Roi roi)
    returns index of given roi or -1 if Roi is not found.
    ij.ImagePlus
    Returns the binary map for this ColorData object.
    int[]
    Returns the array of pixels that are nodule pixels of this type.
    ij.gui.ShapeRoi
    getRoi(int index)
    returns Roi at given index
    ij.gui.ShapeRoi[]
    returns array of all rois.
    ij.measure.ResultsTable
    Returns the given ResultsTable
    void
    removeArrayOfRois(int[] indices)
    removes the data for the given indices.
    boolean
    removeRoi(ij.gui.ShapeRoi roi)
     
    void
    Uses aspect ratio and area to locate and remove fluoresced roots caught in initial segmentation
    void
    save data as CSV file.
    void
    setMap(ij.ImagePlus map)
    Sets or updates the binary map.
    void
    setPixels(int[] pixels)
    Sets the pixels that are counted as nodule pixels of this type.
    void
    setRoi(int index, ij.gui.ShapeRoi roi)
    Replaces ROI at the given index with new ROI Does nothing if index is invalid.
    void
    setRois(ij.gui.ShapeRoi[] rois)
    updater method for the array of ROI's
    void
    setTable(ij.measure.ResultsTable table)
    Sets the ImageJ ResultsTable object.
    void
    Creates an annotated version of the map and displays it.
    void
    Show's the map using ImageJ API.
    void
    VisualizeRoi(ij.ImagePlus im, ij.gui.Roi roi, boolean boxRoi)
    Shows the RG color distribution graph for the given Roi

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • COLOR

      public final int[] COLOR
    • image

      protected ij.ImagePlus image
    • numNodules

      public int numNodules
  • Constructor Details

    • ColorData

      public ColorData(ij.plugin.frame.RoiManager manager, int[] color, int colorThreshold, ij.ImagePlus im)
      constructor method.
      Parameters:
      manager - : RoiManager object. It's best practice to not have multiple of this object.
      color - : the color of the class of roi's of interest.
      colorThreshold - : area threashold for a single nodule of this type.
      im - : image we're doing analysis on.
  • Method Details

    • getClump

      public NoduleClump getClump(int index)
      Returns clump at given index.
    • getClumps

      public NoduleClump[] getClumps()
      Returns:
      returns this object's array of clump objects.
    • showMap

      public void showMap()
      Show's the map using ImageJ API.
    • setRoi

      public void setRoi(int index, ij.gui.ShapeRoi roi)
      Replaces ROI at the given index with new ROI Does nothing if index is invalid.
    • setRois

      public void setRois(ij.gui.ShapeRoi[] rois)
      updater method for the array of ROI's
      Parameters:
      rois -
    • getRois

      public ij.gui.ShapeRoi[] getRois()
      returns array of all rois.
      Returns:
    • getRoi

      public ij.gui.ShapeRoi getRoi(int index)
      returns Roi at given index
    • getIndex

      public int getIndex(ij.gui.Roi roi)
      returns index of given roi or -1 if Roi is not found.
    • addRoi

      public void addRoi(ij.gui.ShapeRoi roi)
      add given roi to array of Rois
    • removeRoi

      public boolean removeRoi(ij.gui.ShapeRoi roi)
      Parameters:
      roi - removes the given ROI from list of rois.
    • removeArrayOfRois

      public void removeArrayOfRois(int[] indices)
      removes the data for the given indices.
    • setMap

      public void setMap(ij.ImagePlus map)
      Sets or updates the binary map.
      Parameters:
      map -
    • getArea

      public int[][] getArea()
      areas[][[] is nx2 with n Rois. For roi "i", [i][0] is numNodules in that Roi, [i][1] is total area of ROI.
    • getMap

      public ij.ImagePlus getMap()
      Returns the binary map for this ColorData object.
      Returns:
    • setTable

      public void setTable(ij.measure.ResultsTable table)
      Sets the ImageJ ResultsTable object. It's best practice to not have more than oen of these objects at a time.
      Parameters:
      table -
    • getTable

      public ij.measure.ResultsTable getTable()
      Returns the given ResultsTable
      Returns:
    • setPixels

      public void setPixels(int[] pixels)
      Sets the pixels that are counted as nodule pixels of this type.
      Parameters:
      pixels -
    • getPixels

      public int[] getPixels()
      Returns the array of pixels that are nodule pixels of this type.
      Returns:
    • showAnnotatedMap

      public void showAnnotatedMap()
      Creates an annotated version of the map and displays it.
    • fillRect

      public static ij.process.ImageProcessor fillRect(Rectangle rect, ij.process.ImageProcessor ip)
      fills given rect with given color.
      Parameters:
      rect - : rect object to fill in with white
      ip - : imageprocessor object to color onto.
      Returns:
      : imageprocessor with the the white square filled in.
    • createImageWithRoi

      public static ij.ImagePlus createImageWithRoi(ij.ImagePlus image, ij.gui.Roi[] rois)
      Generates a map given a background image and ROIs.
    • getData

      public void getData(boolean mixed)
      Method that generates the ResultsTable, ROI's, int[] areas, and numNodules.
      Finds all ROIs using the measure method.
      Finds any rois with large enough measure, and fills them in.
      measures again to account for filled in holes.
      removes noise from dataset
      splits mixed nodules
      Parameters:
      mixed - : true if this colordata object is for mixed nodules, false otherwise.
    • removeRoots

      public void removeRoots()
      Uses aspect ratio and area to locate and remove fluoresced roots caught in initial segmentation
    • saveTable

      public void saveTable()
      save data as CSV file.
    • convertToBinary

      public ij.ImagePlus convertToBinary()
      converts map to binary map.
    • getCircularity

      public double getCircularity(int index)
      Returns the circularity of the roi at the given index.
      Parameters:
      index -
      Returns:
    • averageArea

      public double averageArea()
      calculates average area of the singular nodules.
    • VisualizeRoi

      public void VisualizeRoi(ij.ImagePlus im, ij.gui.Roi roi, boolean boxRoi)
      Shows the RG color distribution graph for the given Roi
      Parameters:
      im - : a copy of the original image
      roi - : roi to graph
      boxRoi - : if true, will graph the pixels around the roi as well. If false, will only graph the pixels within the roi.