Package qupath.ext.braian
Class ChannelHistogram
java.lang.Object
qupath.ext.braian.ChannelHistogram
-
Constructor Summary
ConstructorDescriptionChannelHistogram
(String channelName, ij.process.ImageStatistics stats) Constructs the channel histogram from theImageStatistics
object -
Method Summary
Modifier and TypeMethodDescriptionint[]
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 moststatic int[]
findPeaks
(double[] x, double prominence) Finds the local maxima that peak above the nearby dataint
boolean
is16bit()
boolean
is8bit()
static double[]
zeroPhaseFilter
(double[] f, double[] xs) Applies Applies a linear digital filter twice, once forward and once backwards.
-
Constructor Details
-
ChannelHistogram
Constructs the channel histogram from theImageStatistics
object- Parameters:
channelName
- the name of the QuPath channel associated to this histogramstats
- the statistics representing a given image channel
-
-
Method Details
-
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)
withwindowSize=15
andprominence=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 histogramprominence
- 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 filterxs
- 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 dataprominence
- the threshold above which a local maximum is considered a peak- Returns:
- the positions of the peaks inside x
-