35 #ifndef AIMS_HISTOGRAM_EQUALIZEDHISTO_H
36 #define AIMS_HISTOGRAM_EQUALIZEDHISTO_H
64 template <
class T>
inline
72 int min = int(thing->min()),
max = int(thing->max()),
73 nb_tot = thing->getSizeX() * thing->getSizeY() * thing->getSizeZ();
85 carto::AllocatorContext::fast() );
87 for(it = thing->
begin(); it != thing->
end(); ++it)
89 tmp = ( int32_t ) *it;
90 ++myHisto( tmp -
min );
94 carto::AllocatorContext::fast() );
95 cumul( 0 ) = myHisto( 0 );
98 float * it2 = &*cumul.
begin() + 1;
100 for( it1 = myHisto.
begin(), ++it1; it1 != myHisto.
end(); ++it1, ++it2 )
101 *it2 = *it1 + *( it2 - 1 );
104 for (it4 = cumul.
begin(); it4 != cumul.
end(); ++it4 )
105 *it4 /= (
float) nb_tot;
111 carto::AllocatorContext::fast() );
113 it2 = &*cumul.
begin();
114 for (it1 = roundcumul.
begin(); it1 != roundcumul.
end(); ++it1 , ++it2)
116 fraction = *it2 *
max;
117 *it1 += int32_t(fraction + 0.5);
125 for ( it3 = res.
begin(); it3 != res.
end(); ++it3, ++it)
126 *it3 =
static_cast<T
> ( roundcumul( int32_t(*it3) ) - roundcumul(0) );
Classical histogram container class.
virtual ~Equalizer()
destructor.
carto::VolumeRef< T > doit(const carto::rc_ptr< carto::Volume< T > > &thing)
Equalizer()
constructor. Does nothing.
VolumeRef< T > deepcopy() const
blitz::Array< T, Volume< T >::DIM_MAX >::const_iterator const_iterator
blitz::Array< T, Volume< T >::DIM_MAX >::iterator iterator
float min(float x, float y)
float max(float x, float y)