Jerome Piovano

Research in Medical Imaging and Computer Vision

Histogram Class Template Reference

1D histogram of scalar regions More...

#include <Histogram.h>

List of all members.


Public Types

typedef BaseImage< DIM, int > base
typedef base::Shape Shape
typedef base::Index Index
typedef Index< DIM, ElementType > Element

Public Member Functions

Constructors - Destructor


 Histogram (Pixel _min=0, Pixel _max=256, bool _adaptive=true, int *_data=NULL)
 Default constructor.
template<typename Pixel2>
 Histogram (const Histogram< Pixel2 > &_hist)
 Copy constructor.
Histogramoperator= (int *_data)
 Operator=.
virtual ~Histogram ()
Access the Histogram datas


Pixel min ()
 Minimum of the histogram.
Pixel max ()
 Maximum of the histogram.
int size ()
 size of the histogram
int * data () const
 Array representing the histogram.
int nb_pixels ()
 Number of pixel inside the region.
int get_index (Pixel _val)
 Return the index in the array of the value _val, bounded by min and max.
int operator[] (Pixel _val)
 Number of pixels of value _val.
Modify the Histogram


bool & adaptative ()
 True if the histogram is adaptative.
void clear ()
 Clear the histogram, if adaptative=true.
void resize (Pixel _min, Pixel _max)
 Resize the histogram, if adaptative=true.
void add_pixel (Pixel _val)
 Add a pixel of value _val, if adaptative=true.
void remove_pixel (Pixel _val)
 Remove a pixel of value _val, if adaptative=true.
Statistics computation


void compute_statistics (float &mean, float &var, bool compute_variance=false)
 compute the mean, and the variance if compute_variance=true
Constructors - Destructor


 Histogram ()
 Default constructor.
 Histogram (const Element &_br, const Element &_tl, bool _adaptive=true, const Element &_quant_step=1)
 Constructor from a given shape.
template<typename ElementType2>
 Histogram (const Histogram< DIM, ElementType2 > &hist)
 Copy constructor.
void resize (const Shape &s)
Modify the Histogram


Elementquantification_step ()
 return the quantification step
bool & adaptative ()
 true if the histogram is adaptative
int nb_elements ()
 number of element inside the region
void add_element (const Element &_elt)
 add a element of value _val, if adaptative=true
void remove_element (const Element &_elt)
 remove a element of value _val, if adaptative=true
void clear ()
 clear the histogram, if adaptative=true
Statistics computation


void compute_statistics (float &mean, float &var, bool compute_variance=false)
 compute the mean, and the variance if compute_variance=true

Public Attributes

Member data


int * m_hist
 Histogram.
bool m_adaptive
 Adaptive statistics.
Pixel m_min
 Minimum of the histogram.
Pixel m_max
 Maximum of the histogram.
int m_nb_pix
 Number of pixel inside the histogram region.
Member data


int m_nb_elt
 Number of element in the histogram.
Element m_quant_step
 quantification step of the histogram

Detailed Description

template<typename Pixel = float>
class segmentation::Histogram< Pixel >

1D histogram of scalar regions

Author:
Jerome Piovano

Definition at line 21 of file Histogram.h.


Constructor & Destructor Documentation

Histogram ( Pixel  _min = 0,
Pixel  _max = 256,
bool  _adaptive = true,
int *  _data = NULL 
) [inline]

Default constructor.

Parameters:
_min  minimum value of the histogram
_max  maximum value of the histogram
_adaptive  if the histogram is adaptive
_data  datas of the histogram, of size (_max - _min)

Definition at line 111 of file Histogram.h.

References Histogram::m_hist, Histogram::m_max, Histogram::m_min, and Histogram::m_nb_pix.

00112                 :m_min(_min), m_max(_max), m_adaptive(_adaptive), m_nb_pix(0)
00113         {
00114                 m_hist = new int[static_cast<int>(m_max - m_min)];
00115 
00116                 if (_data == NULL)
00117                         for (int i = 0; i < static_cast<int>(m_max-m_min) ; i++)
00118                                 m_hist[i] = 0;
00119                 else
00120                         for (int i = 0; i < static_cast<int>(m_max-m_min) ; i++){
00121                                 m_hist[i] = _data[i];
00122                                 m_nb_pix += _data[i];
00123                         }
00124         }

Histogram ( const Element _br,
const Element _tl,
bool  _adaptive = true,
const Element _quant_step = 1 
)

Constructor from a given shape.

Parameters:
_br  Element of lowest possible component (bottom-right in 2D)
_tl  Element of highest possible component (top-left in 2D)
_adaptive  True if the histogram is adaptive
_quant_step  Quantifications step of the histogram (bins of size _quant_step)


The documentation for this class was generated from the following files:

For further information, please contact Jerome Piovano - Last update 2008-02-08