Woolz Image Processing
Version 1.7.5
|
Files | |
file | WlzHistogram.c |
Functions for computing and transforming Woolz histograms domains. | |
Data Structures | |
struct | _WlzHistogramDomain |
Histograms are Woolz domains and not values as might be expected. Typedef: WlzHistogramDomain. More... | |
Enumerations | |
enum | _WlzHistFeature { WLZ_HIST_FEATURE_NONE = (0), WLZ_HIST_FEATURE_PEAK = (1<<0), WLZ_HIST_FEATURE_TROUGH = (1<<1) } |
Features of histograms. Typedef: WlzHistFeature. More... | |
Functions | |
WlzObject * | WlzHistogramObj (WlzObject *srcObj, int nBins, double binOrigin, double binSize, WlzErrorNum *dstErrNum) |
Creates a woolz histogram object (with an int histogram domain) using the given 2D or 3D woolz domain object and histogram parameters. If the requested number of bins is zero then the number of bins, the origin and the bin size will be computed as follows: More... | |
WlzObject * | WlzHistogramCopy (WlzObject *srcHistObj, WlzObjectType dstType, WlzErrorNum *dstErrNum) |
Copies the given Woolz histogram object to a new one of the required type. More... | |
WlzObject * | WlzHistogramRebin (WlzObject *srcHistObj, WlzObjectType dstType, int dstMaxBins, int dstNBins, double dstOrigin, double dstBinSize, WlzErrorNum *dstErrNum) |
Re-bins the given Woolz histogram object to a new one of the required type, number of bins, origin and bin size. More... | |
WlzErrorNum | WlzHistogramRsvFilter (WlzObject *histObj, WlzRsvFilter *flt) |
Applies an infinite impulse response (IIR) filter to the histogram object'c bin values. More... | |
WlzErrorNum | WlzHistogramConvolve (WlzObject *histObj, int krnSz, double *krn) |
Convolves the given Woolz histogram object's histogram bin values with the given convolution kernel. More... | |
WlzErrorNum | WlzHistogramCnvGauss (WlzObject *histObj, double sigma, int deriv) |
Convolves the given Woolz histogram object's histogram bin values with a Gaussian, 1st derivative of Gaussian or 2nd derivative of Gaussian convolution kernel. More... | |
WlzErrorNum | WlzHistogramRsvGauss (WlzObject *histObj, double sigma, int deriv) |
Uses an infinite impulse response (IIR) filter to convolve the given Woolz histogram object's bin values with a Gaussian, 1st derivative of Gaussian or 2nd derivative of Gaussian. More... | |
WlzErrorNum | WlzHistogramSmooth (WlzObject *histObj, int width) |
Low pass filters the given Woolz histogram object's histogram bin values by convolving them in the space domain with a Gaussian kernel of the given half height full width. More... | |
WlzErrorNum | WlzHistogramCummulative (WlzObject *srcHist) |
Modifies the given histogram so that its values are cummulative. More... | |
WlzErrorNum | WlzHistogramMapValues (WlzObject *srcObj, WlzObject *mapHistObj, int dither) |
Uses the given mapping histogram with integral bin values to remap the grey values of the given 2D or 3D domain object. The mapping histogram MUST have integral bin values and bins appropriate for all domain object values. More... | |
WlzErrorNum | WlzHistogramFindPeaks (WlzObject *histObj, double sigma, double thresh, int *dstFeatSz, int **dstFeat, WlzHistFeature feat) |
Find the peaks and/or troughs of the given histogram. Peaks are found by searching through the 1st derivative (h') of the histogram bin values (h). For a peak. More... | |
WlzErrorNum | WlzHistogramFitPeaks (WlzObject *histObj, int numDbn, double smooth, double thresh, double tol, int *dstNumMu, double **dstMu, int *dstNumSigma, double **dstSigma, int *dstNumAlpha, double **dstAlpha, double *dstLL) |
Fit the given Woolz histogram object's histogram bin values using a mixture of Gaussian distributions. More... | |
WlzErrorNum | WlzHistogramNorm (WlzObject *histObj, double maxVal) |
Normalise the given Woolz histogram object's histogram bin values to the given range [0-maxVal]. If the given maximum value is 0.0 then the histogram bin values are normalised so that maxVal is equal to the number of bins. More... | |
int | WlzHistogramBinMax (WlzHistogramDomain *histDom) |
Finds the bin of the histogram domain which has the greatest occupancy. More... | |
double | WlzHistogramDistance (WlzObject *histObj0, WlzObject *histObj1, WlzErrorNum *dstErrNum) |
Calculates a distance measure for comparing two histograms. The histogram distance is in the range [0.0 - 1.0] with 1.0 being a perfect match between histograms. The given histograms are not modified. More... | |
WlzErrorNum | WlzHistogramMatchObj (WlzObject *srcObj, WlzObject *targetHist, int independentPlanes, int smoothing, double minDist, double maxDist, int dither) |
Modifies the grey values of the given Woolz 2D or 3D domain object so that the resulting object's histogram matches the target histogram object. More... | |
WlzErrorNum | WlzHistogramEqualiseObj (WlzObject *srcObj, int smoothing, int dither) |
Modifies the grey values of the given Woolz 2D or 3D domain object so that the resulting object's histogram approximates a uniform histogram. If the specified smoothing is non-zero then the objects histogram is smoothed by WlzHistogramSmooth(). More... | |
enum _WlzHistFeature |
Features of histograms. Typedef: WlzHistFeature.
Enumerator | |
---|---|
WLZ_HIST_FEATURE_NONE |
No feature. |
WLZ_HIST_FEATURE_PEAK |
Histogram peak. |
WLZ_HIST_FEATURE_TROUGH |
Histogram trough. |
WlzObject* WlzHistogramObj | ( | WlzObject * | srcObj, |
int | nBins, | ||
double | binOrigin, | ||
double | binSize, | ||
WlzErrorNum * | dstErrNum | ||
) |
Creates a woolz histogram object (with an int histogram domain) using the given 2D or 3D woolz domain object and histogram parameters. If the requested number of bins is zero then the number of bins, the origin and the bin size will be computed as follows:
nBins = ceil(max(g) - min(g) + 1.0) binOrigin = min(g) binSize = 1.0
Where min(g) and max(g) are the minimum and maximum grey values in the source object.
srcObj | Given source object. |
nBins | Required number of histogram bins. |
binOrigin | Lowest grey value in first histogram bin. |
binSize | Grey value range for each histogram bin. |
dstErrNum | Destination error pointer. |
References _WlzHistogramDomain::binSize, _WlzHistogramDomain::binValues, _WlzValues::core, _WlzDomain::core, _WlzGreyV::dbv, _WlzObject::domain, _WlzPlaneDomain::domains, _WlzDomain::hist, _WlzGreyP::inp, _WlzPlaneDomain::lastpl, _WlzHistogramDomain::maxBins, _WlzHistogramDomain::nBins, _WlzValues::obj, _WlzHistogramDomain::origin, _WlzDomain::p, _WlzPlaneDomain::plane1, _WlzObject::type, _WlzPixelV::v, _WlzObject::values, _WlzVoxelValues::values, _WlzValues::vox, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_EMPTY_OBJ, WLZ_ERR_GREY_TYPE, WLZ_ERR_NONE, WLZ_ERR_OBJECT_NULL, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_PARAM_DATA, WLZ_ERR_UNSPECIFIED, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_RGBA, WLZ_GREY_SHORT, WLZ_GREY_UBYTE, WLZ_HISTOGRAMDOMAIN_INT, WLZ_TRANS_OBJ, WlzFreeObj(), WlzGreyRange(), WlzMakeEmpty(), WlzMakeHistogram(), WlzMakeMain(), WlzValueConvertPixel(), and WlzValueSetInt().
Referenced by WlzHistogramEqualiseObj(), WlzHistogramMatchObj(), and WlzSplitObj().
WlzObject* WlzHistogramCopy | ( | WlzObject * | srcHistObj, |
WlzObjectType | dstType, | ||
WlzErrorNum * | dstErrNum | ||
) |
Copies the given Woolz histogram object to a new one of the required type.
srcHistObj | Given histogram object. |
dstType | Required type of histogram domain values. |
dstErrNum | Destination error pointer, may be NULL. |
References _WlzHistogramDomain::binSize, _WlzHistogramDomain::binValues, _WlzObject::domain, _WlzDomain::hist, _WlzHistogramDomain::maxBins, _WlzHistogramDomain::nBins, _WlzHistogramDomain::origin, _WlzHistogramDomain::type, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_NONE, WLZ_GREY_DOUBLE, WLZ_GREY_INT, WLZ_HISTOGRAMDOMAIN_INT, WlzMakeHistogram(), and WlzValueCopyGreyToGrey().
Referenced by WlzHistogramMatchObj().
WlzObject* WlzHistogramRebin | ( | WlzObject * | srcHistObj, |
WlzObjectType | dstType, | ||
int | dstMaxBins, | ||
int | dstNBins, | ||
double | dstOrigin, | ||
double | dstBinSize, | ||
WlzErrorNum * | dstErrNum | ||
) |
Re-bins the given Woolz histogram object to a new one of the required type, number of bins, origin and bin size.
srcHistObj | Given histogram object. |
dstType | Required type of histogram domain values. |
dstMaxBins | Total number of bins to be allocated. |
dstNBins | Number of bins to be used in new histogram. |
dstOrigin | New histogram origin. |
dstBinSize | New histogram bin size. |
dstErrNum | Destination error pointer, may be NULL. |
References _WlzHistogramDomain::binSize, _WlzHistogramDomain::binValues, _WlzGreyP::dbp, _WlzObject::domain, _WlzDomain::hist, _WlzGreyP::inp, _WlzHistogramDomain::maxBins, _WlzHistogramDomain::nBins, _WlzHistogramDomain::origin, _WlzHistogramDomain::type, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_NONE, WLZ_HISTOGRAMDOMAIN_INT, WLZ_NINT, and WlzMakeHistogram().
Referenced by WlzHistogramMatchObj().
WlzErrorNum WlzHistogramRsvFilter | ( | WlzObject * | histObj, |
WlzRsvFilter * | flt | ||
) |
Applies an infinite impulse response (IIR) filter to the histogram object'c bin values.
histObj | Given histogram object. |
flt | IIR filter. |
References AlcFree(), AlcMalloc(), _WlzHistogramDomain::binValues, _WlzGreyP::dbp, _WlzObject::domain, _WlzDomain::hist, _WlzGreyP::inp, _WlzHistogramDomain::nBins, _WlzHistogramDomain::type, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_NULL, WLZ_HISTOGRAMDOMAIN_INT, WlzRsvFilterBuffer(), WlzValueCopyDoubleToDouble(), WlzValueCopyDoubleToInt(), and WlzValueCopyIntToDouble().
Referenced by WlzHistogramRsvGauss().
WlzErrorNum WlzHistogramConvolve | ( | WlzObject * | histObj, |
int | krnSz, | ||
double * | krn | ||
) |
Convolves the given Woolz histogram object's histogram bin values with the given convolution kernel.
histObj | Given histogram object. |
krnSz | Kernel size, must be odd. |
krn | The convolution kernel. |
References AlcFree(), AlcMalloc(), ALG_ERR_NONE, ALG_PAD_END, AlgConvolveD(), _WlzHistogramDomain::binValues, _WlzGreyP::dbp, _WlzObject::domain, _WlzDomain::hist, _WlzGreyP::inp, _WlzHistogramDomain::nBins, _WlzHistogramDomain::type, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_HISTOGRAMDOMAIN_INT, WlzErrorFromAlg(), WlzValueCopyDoubleToDouble(), WlzValueCopyDoubleToInt(), and WlzValueCopyIntToDouble().
Referenced by WlzHistogramCnvGauss().
WlzErrorNum WlzHistogramCnvGauss | ( | WlzObject * | histObj, |
double | sigma, | ||
int | deriv | ||
) |
Convolves the given Woolz histogram object's histogram bin values with a Gaussian, 1st derivative of Gaussian or 2nd derivative of Gaussian convolution kernel.
histObj | Given histogram object. |
sigma | Sigma value of the Gaussian which is scaled within this function to account for the histogram bin size. |
deriv | Derivative must be in range [0-2]. |
References AlcFree(), AlcMalloc(), _WlzHistogramDomain::binSize, _WlzObject::domain, _WlzDomain::hist, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, and WlzHistogramConvolve().
Referenced by WlzHistogramFindPeaks(), WlzHistogramFitPeaks(), and WlzSplitObj().
WlzErrorNum WlzHistogramRsvGauss | ( | WlzObject * | histObj, |
double | sigma, | ||
int | deriv | ||
) |
Uses an infinite impulse response (IIR) filter to convolve the given Woolz histogram object's bin values with a Gaussian, 1st derivative of Gaussian or 2nd derivative of Gaussian.
histObj | Given histogram object. |
sigma | Sigma value of the Gaussian which is scaled within this function to account for the histogram bin size. |
deriv | Derivative must be in range [0-2]. |
References WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_RSVFILTER_NAME_GAUSS_0, WLZ_RSVFILTER_NAME_GAUSS_1, WLZ_RSVFILTER_NAME_GAUSS_2, WlzHistogramRsvFilter(), WlzRsvFilterFreeFilter(), and WlzRsvFilterMakeFilter().
Referenced by WlzHistogramSmooth().
WlzErrorNum WlzHistogramSmooth | ( | WlzObject * | histObj, |
int | width | ||
) |
Low pass filters the given Woolz histogram object's histogram bin values by convolving them in the space domain with a Gaussian kernel of the given half height full width.
histObj | Given histogram object. |
width | Gaussian kernel half height full width. |
References WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_NONE, and WlzHistogramRsvGauss().
Referenced by WlzCompThreshold(), WlzHistogramEqualiseObj(), and WlzHistogramMatchObj().
WlzErrorNum WlzHistogramCummulative | ( | WlzObject * | srcHist | ) |
Modifies the given histogram so that its values are cummulative.
srcHist | Given histogram object. |
References _WlzHistogramDomain::binValues, _WlzGreyP::dbp, _WlzObject::domain, _WlzDomain::hist, _WlzGreyP::inp, _WlzHistogramDomain::nBins, _WlzHistogramDomain::type, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_NONE, and WLZ_HISTOGRAMDOMAIN_INT.
Referenced by WlzHistogramEqualiseObj(), and WlzHistogramMatchObj().
WlzErrorNum WlzHistogramMapValues | ( | WlzObject * | srcObj, |
WlzObject * | mapHistObj, | ||
int | dither | ||
) |
Uses the given mapping histogram with integral bin values to remap the grey values of the given 2D or 3D domain object. The mapping histogram MUST have integral bin values and bins appropriate for all domain object values.
srcObj | Given 2D or 3D domain object. |
mapHistObj | Mapping histogram. |
dither | If non zero then dither mapped values to avoid generating a histogram with a comb appearence. |
References _WlzHistogramDomain::binSize, _WlzHistogramDomain::binValues, _WlzValues::core, _WlzDomain::core, _WlzGreyP::dbp, _WlzObject::domain, _WlzPlaneDomain::domains, _WlzGreyP::flp, _WlzDomain::hist, _WlzGreyP::inp, _WlzPlaneDomain::lastpl, _WlzIntervalWSpace::lftpos, _WlzHistogramDomain::nBins, _WlzValues::obj, _WlzHistogramDomain::origin, _WlzDomain::p, _WlzGreyWSpace::pixeltype, _WlzPlaneDomain::plane1, _WlzIntervalWSpace::rgtpos, _WlzGreyP::shp, _WlzObject::type, _WlzCoreValues::type, _WlzHistogramDomain::type, _WlzGreyWSpace::u_grintptr, _WlzGreyP::ubp, _WlzObject::values, _WlzVoxelValues::values, _WlzValues::vox, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_EMPTY_OBJ, WLZ_ERR_DOMAIN_DATA, WLZ_ERR_EOO, WLZ_ERR_GREY_TYPE, WLZ_ERR_NONE, WLZ_ERR_UNSPECIFIED, WLZ_ERR_VALUES_TYPE, WLZ_GREY_DOUBLE, WLZ_GREY_FLOAT, WLZ_GREY_INT, WLZ_GREY_SHORT, WLZ_GREY_UBYTE, WLZ_HISTOGRAMDOMAIN_INT, WLZ_TRANS_OBJ, WlzEndGreyScan(), WlzFreeObj(), WlzInitGreyScan(), WlzMakeMain(), and WlzNextGreyInterval().
Referenced by WlzHistogramEqualiseObj().
WlzErrorNum WlzHistogramFindPeaks | ( | WlzObject * | histObj, |
double | sigma, | ||
double | thresh, | ||
int * | dstFeatSz, | ||
int ** | dstFeat, | ||
WlzHistFeature | feat | ||
) |
Find the peaks and/or troughs of the given histogram. Peaks are found by searching through the 1st derivative (h') of the histogram bin values (h). For a peak.
(h'[i - 1] > 0) && (h'[i + 1] < 0) && (h[i] > thresh).
If the first or last histogram bin has the maximum bin occupancy of the histogram it is classified as a peak too.
histObj | Given histogram object. |
sigma | Gaussian sigma smooth histogram and compute 1st derivative. |
thresh | Minimum (smoothed) histogram value at peak, not used for troughs. |
dstFeatSz | Destination ptr for the number of peaks/troughs found. |
dstFeat | Destination ptr for the array of peak/trough positions (indicies into the histogram bin values). May have *dstFeat == NULL on return if *dstFeatSz == 0. |
feat | Features to find: peaks, troughs or both. |
References AlcFree(), AlcMalloc(), _WlzHistogramDomain::binValues, _WlzGreyP::dbp, _WlzObject::domain, _WlzDomain::hist, _WlzGreyP::inp, _WlzHistogramDomain::nBins, _WlzHistogramDomain::type, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_HIST_FEATURE_PEAK, WLZ_HIST_FEATURE_TROUGH, WLZ_HISTOGRAMDOMAIN_FLOAT, WLZ_HISTOGRAMDOMAIN_INT, WlzCopyObject(), WlzFreeObj(), WlzHistogramBinMax(), and WlzHistogramCnvGauss().
Referenced by WlzCompThreshold(), and WlzHistogramFitPeaks().
WlzErrorNum WlzHistogramFitPeaks | ( | WlzObject * | histObj, |
int | numDbn, | ||
double | smooth, | ||
double | thresh, | ||
double | tol, | ||
int * | dstNumMu, | ||
double ** | dstMu, | ||
int * | dstNumSigma, | ||
double ** | dstSigma, | ||
int * | dstNumAlpha, | ||
double ** | dstAlpha, | ||
double * | dstLL | ||
) |
Fit the given Woolz histogram object's histogram bin values using a mixture of Gaussian distributions.
First guess at peak positions, the method of guessing depends on the parameter numDbn. If (numDbn > 0) guess numDbn equally spaced Gaussians, else use the function WlzHistogramFindPeaks(). After initial guess use the function AlgMixture() to find the maximum liklihood mixture of Gaussian distributions which best fit the histogram
\[ h(x) = \sum_{i=0}^k {\alpha_i g_i(x)} \]
where\[ \sum_{i=0}^k {\alpha_i} = 1.0 \]
\(g_i(x)\) are the gaussians defined by standard deviation \(sigma_i\) and mean \(mu_i\).histObj | Given histogram object. |
numDbn | If greater than zero the number of Gaussians to fit. If less than or equal to zero then the Gaussians are fitted to peaks found by WlzHistogramFindPeaks(). |
smooth | Gaussian \(sigma\) smooth histogram and compute 1st derivative. |
thresh | Mimimum bin count for a peak. |
tol | Log-likihood tolerance value for terminating the iteration. |
dstNumMu | Destination ptr for the number of Gaussian mean values. |
dstMu | Destination ptr for \(mu\), the Gaussian mean values. |
dstNumSigma | Destination ptr for the number of Gaussian \(sigma\) values. |
dstSigma | Destination ptr for the Gaussian \(sigma\) values. |
dstNumAlpha | Destination ptr for the Gaussian \(alpha\) values. |
dstAlpha | Destination ptr for the log-liklihood, may be NULL. |
dstLL |
References AlcFree(), AlcMalloc(), ALG_ERR_NONE, AlgMixtureMLG(), _WlzObject::domain, _WlzDomain::hist, _WlzHistogramDomain::nBins, WLZ_ERR_DOMAIN_DATA, WLZ_ERR_MEM_ALLOC, WLZ_ERR_NONE, WLZ_ERR_PARAM_DATA, WLZ_ERR_PARAM_NULL, WLZ_HIST_FEATURE_PEAK, WLZ_HISTOGRAMDOMAIN_FLOAT, WLZ_HISTOGRAMDOMAIN_INT, WlzCopyObject(), WlzErrorFromAlg(), WlzFreeObj(), WlzHistogramCnvGauss(), and WlzHistogramFindPeaks().
WlzErrorNum WlzHistogramNorm | ( | WlzObject * | histObj, |
double | maxVal | ||
) |
Normalise the given Woolz histogram object's histogram bin values to the given range [0-maxVal]. If the given maximum value is 0.0 then the histogram bin values are normalised so that maxVal is equal to the number of bins.
histObj | Given histogram object. |
maxVal | Given maximum value. |
References _WlzHistogramDomain::binSize, _WlzHistogramDomain::binValues, _WlzGreyP::dbp, _WlzObject::domain, _WlzDomain::hist, _WlzGreyP::inp, _WlzHistogramDomain::nBins, _WlzHistogramDomain::origin, _WlzHistogramDomain::type, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_NONE, WLZ_HISTOGRAMDOMAIN_INT, and WLZ_NINT.
int WlzHistogramBinMax | ( | WlzHistogramDomain * | histDom | ) |
Finds the bin of the histogram domain which has the greatest occupancy.
histDom | Given histogram domain. |
References _WlzHistogramDomain::binValues, _WlzGreyP::dbp, _WlzGreyP::inp, _WlzHistogramDomain::nBins, _WlzHistogramDomain::type, WLZ_HISTOGRAMDOMAIN_FLOAT, and WLZ_HISTOGRAMDOMAIN_INT.
Referenced by WlzCompThreshold(), WlzCompThresholdVT(), and WlzHistogramFindPeaks().
double WlzHistogramDistance | ( | WlzObject * | histObj0, |
WlzObject * | histObj1, | ||
WlzErrorNum * | dstErrNum | ||
) |
Calculates a distance measure for comparing two histograms. The histogram distance is in the range [0.0 - 1.0] with 1.0 being a perfect match between histograms. The given histograms are not modified.
histObj0 | First histogram object. |
histObj1 | Second histogram object. |
dstErrNum | Destination error pointer, may be NULL. |
References _WlzHistogramDomain::binSize, _WlzHistogramDomain::binValues, _WlzGreyP::dbp, _WlzObject::domain, _WlzDomain::hist, _WlzGreyP::inp, _WlzHistogramDomain::nBins, _WlzHistogramDomain::origin, _WlzHistogramDomain::type, WLZ_ABS, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_ERR_NONE, WLZ_HISTOGRAMDOMAIN_INT, WLZ_MAX, WLZ_MIN, and WLZ_NINT.
Referenced by WlzHistogramMatchObj().
WlzErrorNum WlzHistogramMatchObj | ( | WlzObject * | srcObj, |
WlzObject * | targetHist, | ||
int | independentPlanes, | ||
int | smoothing, | ||
double | minDist, | ||
double | maxDist, | ||
int | dither | ||
) |
Modifies the grey values of the given Woolz 2D or 3D domain object so that the resulting object's histogram matches the target histogram object.
If the given domain object is a 3D object and the independentPlanes flag is set then each of the 3D object's planes is matched independently. A domain object or plane will only be matched to the given histogram if the distance between it's histogram and the given histogram is within the given distance range. If the specified smoothing is non-zero then the source objects histogram is smoothed by WlzHistogramSmooth(). The histogram distance is in the range [0.0 - 1.0] with 1.0 being a perfect match between histograms. If the given minimum distance is <= 0.0 and the maximum distance is >= 1.0 then matching will always be done. The given histogram is not modified.
srcObj | Given domain object. |
targetHist | Target histogram object. |
independentPlanes | If srcObj is a 3D domain object and independentPlanes is set (non-zero) then the domain objects planes are matched independently. |
smoothing | Gaussian smoothing of the source object histogram before matching. |
minDist | Minimum distance between the histograms. |
maxDist | Maximum distance between the histograms. |
dither | If non zero then dither mapped values to avoid generating a histogram with a comb appearence. |
References _WlzHistogramDomain::binSize, _WlzValues::core, _WlzDomain::core, _WlzObject::domain, _WlzPlaneDomain::domains, _WlzDomain::hist, _WlzPlaneDomain::lastpl, _WlzHistogramDomain::nBins, _WlzValues::obj, _WlzHistogramDomain::origin, _WlzDomain::p, _WlzPlaneDomain::plane1, _WlzObject::type, _WlzHistogramDomain::type, _WlzObject::values, _WlzVoxelValues::values, _WlzValues::vox, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_EMPTY_OBJ, WLZ_ERR_NONE, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_UNSPECIFIED, WLZ_ERR_VALUES_TYPE, WLZ_HISTOGRAMDOMAIN_INT, WLZ_TRANS_OBJ, WlzFreeObj(), WlzHistogramCopy(), WlzHistogramCummulative(), WlzHistogramDistance(), WlzHistogramObj(), WlzHistogramRebin(), WlzHistogramSmooth(), and WlzMakeMain().
WlzErrorNum WlzHistogramEqualiseObj | ( | WlzObject * | srcObj, |
int | smoothing, | ||
int | dither | ||
) |
Modifies the grey values of the given Woolz 2D or 3D domain object so that the resulting object's histogram approximates a uniform histogram. If the specified smoothing is non-zero then the objects histogram is smoothed by WlzHistogramSmooth().
srcObj | Given domain object. |
smoothing | Gaussian smoothing of the histogram before equalisation. |
dither | If non zero then dither mapped values to avoid generating a histogram with a comb appearence. |
References _WlzHistogramDomain::binValues, _WlzObject::domain, _WlzDomain::hist, _WlzGreyP::inp, _WlzHistogramDomain::nBins, _WlzValues::obj, _WlzObject::type, _WlzObject::values, WLZ_2D_DOMAINOBJ, WLZ_3D_DOMAINOBJ, WLZ_DBG, WLZ_DBG_LVL_1, WLZ_DBG_LVL_FN, WLZ_EMPTY_OBJ, WLZ_ERR_NONE, WLZ_ERR_OBJECT_TYPE, WLZ_ERR_VALUES_TYPE, WLZ_NINT, WLZ_TRANS_OBJ, WlzHistogramCummulative(), WlzHistogramMapValues(), WlzHistogramObj(), and WlzHistogramSmooth().