Class ChannelHistogram

java.lang.Object
qupath.ext.braian.ChannelHistogram

public class ChannelHistogram extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChannelHistogram(String channelName, ij.process.ImageStatistics stats)
    Constructs the channel histogram from the ImageStatistics object
  • Method Summary

    Modifier and Type
    Method
    Description
    int[]
    Smooths the ChannelHistogram and find the color values that appear the most.
    int[]
    findHistogramPeaks(int windowSize, double prominence)
    Smooths the ChannelHistogram and find the color values that appear the most
    static int[]
    findPeaks(double[] x, double prominence)
    Finds the local maxima that peak above the nearby data
     
    int
     
    boolean
     
    boolean
     
    static double[]
    zeroPhaseFilter(double[] f, double[] xs)
    Applies Applies a linear digital filter twice, once forward and once backwards.

    Methods inherited from class java.lang.Object

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

    • ChannelHistogram

      public ChannelHistogram(String channelName, ij.process.ImageStatistics stats)
      Constructs the channel histogram from the ImageStatistics object
      Parameters:
      channelName - the name of the QuPath channel associated to this histogram
      stats - the statistics representing a given image channel
  • Method Details

    • getChannelName

      public String getChannelName()
      Returns:
      the name of the channel from which this histogram was built
    • is8bit

      public boolean is8bit()
      Returns:
      true if the current histogram is built from a 8-bit image
    • is16bit

      public boolean is16bit()
      Returns:
      true if the current histogram is built from a 16-bit image
    • getMaxValue

      public int getMaxValue()
    • findHistogramPeaks

      public int[] findHistogramPeaks()
      Smooths the ChannelHistogram and find the color values that appear the most.

      It applies findHistogramPeaks(int, double) with windowSize=15 and prominence=100

      Returns:
      an array of the color values
    • findHistogramPeaks

      public int[] findHistogramPeaks(int windowSize, double prominence)
      Smooths the ChannelHistogram and find the color values that appear the most
      Parameters:
      windowSize - the size of the kernel used for smoothing the histogram
      prominence - the threshold used to define whether a local maximum is a peak or not
      Returns:
      an array of the color values
      See Also:
    • zeroPhaseFilter

      public static double[] zeroPhaseFilter(double[] f, double[] xs)
      Applies Applies a linear digital filter twice, once forward and once backwards. The combined filter has zero phase and a filter order twice that of the original. It handles the signal's edges by padding data with zeros.
      Parameters:
      f - the filter
      xs - the data to be filtered
      Returns:
      the filtered output with the same shape as x.
    • findPeaks

      public static int[] findPeaks(double[] x, double prominence)
      Finds the local maxima that peak above the nearby data
      Parameters:
      x - the data
      prominence - the threshold above which a local maximum is considered a peak
      Returns:
      the positions of the peaks inside x