@ALDParametrizedClass
public class MTBImageHistogram
extends de.unihalle.informatik.Alida.operator.ALDData
MTBImage
.Modifier and Type | Field and Description |
---|---|
private double[] |
data
Array holding the histogram data
|
private double |
highBound
upper boundary of the last bin
|
private int |
largestNonEmptyBin
largest intensity value contained in the input image
|
private double |
lowBound
lower boundary of the first bin.
|
private double |
numEntries
number of histogram entries
|
private int |
size
number of bins
|
private int |
smallestNonEmptyBin
smallest intensity value contained in the input image
|
private double |
sum
sum of all histogram entries
|
Constructor and Description |
---|
MTBImageHistogram()
Default constructor.
|
MTBImageHistogram(double[] values,
double lowBoundary,
double binWidth)
construct a MTBImageHistogram from histogram data contained in an array
|
MTBImageHistogram(double[] vals,
int bins,
double lowBoundary,
double highBoundary)
Construct new histogram from array of values.
|
MTBImageHistogram(MTBImage img)
construct a new MTBHistogram object from the given MTBImage
number of bins is 256 and the histogram ranges from the smallest image value to the largest image value |
MTBImageHistogram(MTBImage img,
int bins)
construct a new MTBHistogram object from the given MTBImage
the histogram ranges from the smallest image value to the largest image value |
MTBImageHistogram(MTBImage img,
int bins,
double lowBoundary,
double highBoundary)
construct a histogram for the given input image
with specification of binning and value range
all MTBImage types except RGB type are supported
|
MTBImageHistogram(MTBImage img,
MTBImage mask,
int bins)
construct a new MTBHistogram object from the given MTBImage
the histogram ranges from the smallest image value to the largest image value |
MTBImageHistogram(MTBImage img,
MTBImage mask,
int bins,
double lowBoundary,
double highBoundary)
construct a histogram for the given input image only for the pixels specified by a binary mask
all MTBImage types except RGB type are supported
with specification of binning and value range
|
Modifier and Type | Method and Description |
---|---|
void |
add(MTBImageHistogram h)
add histogram data to this MTBHistogram object.
|
void |
binning(int bins)
change the binning of the histogram
|
void |
cumulate()
calculate the cumulative histogram
|
void |
cumulateOnly()
calculate the cumulative histogram without changing the sum of absolute
frequencies (normalizing factor), because cumulate() calls initialize() and
thus destroys this normalizing factor
|
MTBImageHistogram |
duplicate() |
int |
getBinIndex(double value)
determines the index of the histogram bin, to which a value is assigned, if
histogram value range and binning were specified at creation
|
double |
getBinMidpoint(int binIndex)
determines the value midpoint of a histogram bin for given bin index, if
histogram value range and binning were specified at creation |
double |
getBinValue(int i) |
double[] |
getData() |
int |
getLargestNonEmptyBin() |
double |
getMaxValue() |
double |
getMaxValueBin() |
double |
getMean() |
double |
getNumEntries() |
int |
getSize() |
int |
getSmallestNonEmptyBin() |
double |
getStdDev() |
double |
getSum() |
double |
getVariance() |
private void |
initialize()
initialize histogram, i.e. determine smallest non empty bin, largest non
empty bin, number of histogram entries and sum of the histogram |
void |
logarithmize()
calculate the logarithmic (base e) histogram; entries smaller than one become zero!
|
double |
mapIndexToValue(int index) |
void |
normalize()
Normalize the histogram.
|
void |
save(String fileName)
write the histogram data into a text file
|
void |
setBinValue(int i,
double val)
set the bin value at i-th position
|
String |
toString() |
void |
truncate(int l,
int r)
truncate the histogram to the specified interval
|
@ALDClassParameter(label="Histogram Data") private double[] data
@ALDClassParameter(label="Number of Bins") private int size
@ALDClassParameter(label="Smallest non-empty Bin.") private int smallestNonEmptyBin
@ALDClassParameter(label="Largest non-empty Bin.") private int largestNonEmptyBin
@ALDClassParameter(label="Sum of all entries") private double sum
@ALDClassParameter(label="Number of entries") private double numEntries
@ALDClassParameter(label="Lower bound of first bin") private double lowBound
@ALDClassParameter(label="Upper bound of last bin") private double highBound
public MTBImageHistogram()
public MTBImageHistogram(MTBImage img, int bins, double lowBoundary, double highBoundary) throws IllegalArgumentException
img
- input image for which the histogram is calculatedbins
- number of histogram binslowBoundary
- determines the lower boundary of the first binhighBoundary
- determines the upper boundary of the last binIllegalArgumentException
- if an RGB image is given as inputpublic MTBImageHistogram(MTBImage img, MTBImage mask, int bins, double lowBoundary, double highBoundary) throws IllegalArgumentException
img
- input image for which the histogram is calculatedmask
- binary mask specifying which pixels are considered for the creation of the histogram.
A value of zeor in the mask image indicates this pixel not to be consideredbins
- number of histogram binslowBoundary
- determines the lower boundary of the first binhighBoundary
- determines the upper boundary of the last binIllegalArgumentException
- if an RGB image is given as inputpublic MTBImageHistogram(MTBImage img, MTBImage mask, int bins)
img
- MTBImagemask
- binary mask specifying which pixels are considered for the creation of the histogrambins
- number of binspublic MTBImageHistogram(MTBImage img, int bins)
img
- MTBImagebins
- number of binspublic MTBImageHistogram(MTBImage img)
img
- MTBImagepublic MTBImageHistogram(double[] vals, int bins, double lowBoundary, double highBoundary)
vals
- Valuesbins
- Number of bins.lowBoundary
- Lower boundary of first bin.highBoundary
- Upper boundary of last bin.public MTBImageHistogram(double[] values, double lowBoundary, double binWidth)
values
- histogram datalowBoundary
- the lower boundary of the first binbinWidth
- the width of the binsprivate void initialize()
h
- initializing values in a double arraypublic int getBinIndex(double value)
value
- image valuepublic double getBinMidpoint(int binIndex)
binIndex
- bin indexpublic double getBinValue(int i)
i
- positionpublic double mapIndexToValue(int index)
index
- public void setBinValue(int i, double val)
i
- positionval
- bin valuepublic double getMaxValue()
public double getMaxValueBin()
public double getMean()
public double getVariance()
public double getStdDev()
public void add(MTBImageHistogram h) throws IllegalArgumentException
h
- MTBHistogram to addIllegalArgumentException
public void normalize()
Attention! Note that due to accuracy issues in the internal calculations the re-normalization of an already normalized histogram may cause histogram entries to change again which usually must not happen!
public void truncate(int l, int r)
l
- left borderr
- right borderpublic void binning(int bins)
bins
- number of binspublic void logarithmize()
public void cumulate()
public void cumulateOnly()
public double[] getData()
public int getSize()
public int getSmallestNonEmptyBin()
public int getLargestNonEmptyBin()
public double getSum()
public double getNumEntries()
public void save(String fileName)
fileName
- file name for histogram datapublic MTBImageHistogram duplicate()
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.