i3dlib

Documentation

Histogram manipulation


Classes

class  i3d::HistFinder< T >

Functions

void i3d::IntensityHist (const Image3d< RGB > &img, Histogram &hist, int channel)
template<class T>
void i3d::IntensityHist (const Image3d< T > &img, Histogram &hist, const std::gslice &slc)
void i3d::ComputeHistInfo (const Histogram &hist, HistInfo &hi, double thres_factor)
void i3d::SmoothHist (const Histogram &in, Histogram &out)
void i3d::SmoothHist (const Histogram &in, Histogram &out, size_t diff)
int i3d::HistMax (const Histogram &h)
int i3d::HistMin (const Histogram &h)
int i3d::HistFirstNonZero (const Histogram &h)
size_t i3d::HistLastNonZero (const Histogram &h)
template<class T>
void i3d::MapLevels (const Histogram &h, std::vector< T > &map_func, int thres)
template<class T>
void i3d::MapPermileLevels (const Histogram &h, std::vector< T > &map_func, int perm)
void i3d::RecDilHist (const Histogram &mask, Histogram &out)
void i3d::RecEroHist (const Histogram &mask, Histogram &out)
void i3d::RegMaxHist (const Histogram &in, Histogram &out)
size_t i3d::FindUnimodalThreshold (const Histogram &hist)
size_t i3d::FindOtsuThreshold (const Histogram &hist)

Function Documentation

I3D_DLLEXPORT void i3d::ComputeHistInfo ( const Histogram &  hist,
HistInfo &  hi,
double  thres_factor 
)

Compute histogram description. threshold is shifted according to the thres_factor value.

I3D_DLLEXPORT size_t i3d::FindOtsuThreshold ( const Histogram &  hist  ) 

Otsu threshold finder

I3D_DLLEXPORT size_t i3d::FindUnimodalThreshold ( const Histogram &  hist  ) 

unimodal threshold finder

int i3d::HistFirstNonZero ( const Histogram &  h  )  [inline]

returns index of first non-zero element

size_t i3d::HistLastNonZero ( const Histogram &  h  )  [inline]

returns index of last non-zero element

int i3d::HistMax ( const Histogram &  h  )  [inline]

returns index of maximum element

int i3d::HistMin ( const Histogram &  h  )  [inline]

returns index of minimum element

template<class T>
I3D_DLLEXPORT void i3d::IntensityHist ( const Image3d< T > &  img,
Histogram &  hist,
const std::gslice &  slc 
)

Computes intensity histogram from voxels of image image img specified by gslice. Output is stored to the vector hist

I3D_DLLEXPORT void i3d::IntensityHist ( const Image3d< RGB > &  img,
Histogram &  hist,
int  channel 
)

Computes histogram from RGB image. channel specifies for which channels the histogram is computed (0 = red, 1 = green, 2 = blue)

template<class T>
I3D_DLLEXPORT void i3d::MapLevels ( const Histogram &  h,
std::vector< T > &  map_func,
int  thres = 0 
)

Create intensity mapping for intesity range improvement according to histogram. Let max_pos be the position of the histogram maximum Let last be the position of the first zero intesity from max_pos to the right Then

  • all intesities < max_pos + thres (= first) are set to zero
  • all intesities > last are set to h.size()
  • and every other intesity i is set to ((i-first)*h.size())/(last-first) It's suggested to used smoothed histograms as an input

template<class T>
I3D_DLLEXPORT void i3d::MapPermileLevels ( const Histogram &  h,
std::vector< T > &  map_func,
int  perm = 5 
)

Create intensity mapping for intesity range improvement according to histogram.

  • all intesities < left are set to zero
  • all intesities > right are set to h.size()
  • and every other intesity i is set to ((i-left)*h.size())/(right-left) left and right are limits found in histogram: sum(0..left) contains perm per miles of intensity levels, sum(left,right) contains 1000 - 2*perm per miles of intensity levels, sum(right,h.size()) ... perm

I3D_DLLEXPORT void i3d::RecDilHist ( const Histogram &  mask,
Histogram &  out 
)

Reconstruction of mask 1D signal from marker 1D signal out by dilation mask and out must have the same size and for all i the condition: mask[i] >= out[i] must be satisfied output is in written to out and the condition will hold

I3D_DLLEXPORT void i3d::RecEroHist ( const Histogram &  mask,
Histogram &  out 
)

Reconstruction of mask 1D signal from marker 1D signal out by erosion mask and out must have the same size and for all i the condition: mask[i] <= out[i] must be satisfied output is in written to out and the condition will hold

void i3d::RegMaxHist ( const Histogram &  in,
Histogram &  out 
) [inline]

find regional maxima in is input histogram, As a result out[i] == 1 if i is regional maximum out[i] == 0 otherwise

I3D_DLLEXPORT void i3d::SmoothHist ( const Histogram &  in,
Histogram &  out,
size_t  diff 
)

meaning: out[i] = (in[i-diff]+ ... +in[i+diff])/(2*diff+1)

I3D_DLLEXPORT void i3d::SmoothHist ( const Histogram &  in,
Histogram &  out 
)

out[i] = (in[i-1]+in[i]+in[i+1])/3