Woolz Image Processing  Version 1.7.5
WlzHistogram

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

WlzObjectWlzHistogramObj (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...
 
WlzObjectWlzHistogramCopy (WlzObject *srcHistObj, WlzObjectType dstType, WlzErrorNum *dstErrNum)
 Copies the given Woolz histogram object to a new one of the required type. More...
 
WlzObjectWlzHistogramRebin (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...
 

Detailed Description

Enumeration Type Documentation

Features of histograms. Typedef: WlzHistFeature.

Enumerator
WLZ_HIST_FEATURE_NONE 

No feature.

WLZ_HIST_FEATURE_PEAK 

Histogram peak.

WLZ_HIST_FEATURE_TROUGH 

Histogram trough.

Function Documentation

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:

Returns
New woolz object with histogram domain.
                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.

Parameters
srcObjGiven source object.
nBinsRequired number of histogram bins.
binOriginLowest grey value in first histogram bin.
binSizeGrey value range for each histogram bin.
dstErrNumDestination 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.

Returns
Copied Woolz histogram object or NULL on error.
Parameters
srcHistObjGiven histogram object.
dstTypeRequired type of histogram domain values.
dstErrNumDestination 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.

Returns
Copied Woolz histogram object or NULL on error.
Parameters
srcHistObjGiven histogram object.
dstTypeRequired type of histogram domain values.
dstMaxBinsTotal number of bins to be allocated.
dstNBinsNumber of bins to be used in new histogram.
dstOriginNew histogram origin.
dstBinSizeNew histogram bin size.
dstErrNumDestination 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 
)
WlzErrorNum WlzHistogramConvolve ( WlzObject histObj,
int  krnSz,
double *  krn 
)

Convolves the given Woolz histogram object's histogram bin values with the given convolution kernel.

Returns
Woolz error code.
Parameters
histObjGiven histogram object.
krnSzKernel size, must be odd.
krnThe 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.

Returns
Woolz error code.
Parameters
histObjGiven histogram object.
sigmaSigma value of the Gaussian which is scaled within this function to account for the histogram bin size.
derivDerivative 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.

Returns
Woolz error code.
Parameters
histObjGiven histogram object.
sigmaSigma value of the Gaussian which is scaled within this function to account for the histogram bin size.
derivDerivative 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.

Returns
Woolz error code.
Parameters
histObjGiven histogram object.
widthGaussian 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.

Returns
Woolz error code.
Parameters
srcHistGiven 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.

Returns
Woolz error code.
Parameters
srcObjGiven 2D or 3D domain object.
mapHistObjMapping histogram.
ditherIf 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.

Returns
Woolz error code.
                (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.

Parameters
histObjGiven histogram object.
sigmaGaussian sigma smooth histogram and compute 1st derivative.
threshMinimum (smoothed) histogram value at peak, not used for troughs.
dstFeatSzDestination ptr for the number of peaks/troughs found.
dstFeatDestination ptr for the array of peak/trough positions (indicies into the histogram bin values). May have *dstFeat == NULL on return if *dstFeatSz == 0.
featFeatures 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.

Returns
Woolz error code.
          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\).
Parameters
histObjGiven histogram object.
numDbnIf 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().
smoothGaussian \(sigma\) smooth histogram and compute 1st derivative.
threshMimimum bin count for a peak.
tolLog-likihood tolerance value for terminating the iteration.
dstNumMuDestination ptr for the number of Gaussian mean values.
dstMuDestination ptr for \(mu\), the Gaussian mean values.
dstNumSigmaDestination ptr for the number of Gaussian \(sigma\) values.
dstSigmaDestination ptr for the Gaussian \(sigma\) values.
dstNumAlphaDestination ptr for the Gaussian \(alpha\) values.
dstAlphaDestination 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.

Returns
Woolz error code.
Parameters
histObjGiven histogram object.
maxValGiven 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.

Returns
Woolz error code.
Parameters
histDomGiven 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.

Returns
Histogram distance measure, range [0.0 - 1.0].
Parameters
histObj0First histogram object.
histObj1Second histogram object.
dstErrNumDestination 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.

Returns
Woolz error code.
          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.
Parameters
srcObjGiven domain object.
targetHistTarget histogram object.
independentPlanesIf srcObj is a 3D domain object and independentPlanes is set (non-zero) then the domain objects planes are matched independently.
smoothingGaussian smoothing of the source object histogram before matching.
minDistMinimum distance between the histograms.
maxDistMaximum distance between the histograms.
ditherIf 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().

Returns
Woolz error code.
Parameters
srcObjGiven domain object.
smoothingGaussian smoothing of the histogram before equalisation.
ditherIf 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().