OpenWalnut
1.5.0dev
|
Uniform two dimensional histogram for double values. More...
#include <WHistogram2D.h>
Public Types | |
typedef std::shared_ptr< WHistogram2D > | SPtr |
Convenience type for a shared_ptr on this type. More... | |
Public Types inherited from WHistogramND< 2 > | |
typedef boost::array< size_t, N > | SizeArray |
Shorthand for N-dimensional indices, counter, etc. More... | |
typedef boost::array< double, N > | TArray |
Shorthand for N-dimensional values of type T. More... | |
Public Member Functions | |
WHistogram2D (double minX, double maxX, double minY, double maxY, size_t bucketsX, size_t bucketsY) | |
Creates a two dimensional histogram field, bounded by the given limits, containing the demanded number of buckets in each dimension. More... | |
~WHistogram2D () | |
Cleans up! More... | |
WHistogram2D (const WHistogram2D &other) | |
Copy constructor, performing a deep copy. More... | |
virtual size_t | operator() (SizeArray index) const |
Get the count of the specified bucket. More... | |
virtual size_t | operator() (size_t i, size_t j) const |
Convenience function to easier access the buckets for 2D. More... | |
virtual double | getBucketSize (SizeArray index) const |
Return the measure of one specific bucket. More... | |
virtual boost::array< std::pair< double, double >, 2 > | getIntervalForIndex (SizeArray index) const |
Returns the actual (right-open) interval in each dimension associated with the given index. More... | |
void | insert (TArray values) |
Given a value the corresponding bucket is determined and incremented by one. More... | |
void | insert (double x, double y) |
Shorthand to overloaded insert function where each dimension can be overhanded separately. More... | |
WGETexture2D::RPtr | getTexture () |
Copy-convert this into a texture. More... | |
WGETexture2D::RPtr | getSphereTexture () |
Copy-convert this into a spherical texture. More... | |
Public Member Functions inherited from WHistogramND< 2 > | |
WHistogramND (TArray min, TArray max, SizeArray buckets) | |
Default constructor. More... | |
WHistogramND (const WHistogramND &hist) | |
Copy constructor. More... | |
virtual | ~WHistogramND () |
Default destructor. More... | |
virtual size_t | operator() (SizeArray index) const=0 |
Get the count of the specified bucket. More... | |
virtual size_t | size () const |
Returns the number of buckets in the HistogramND with the actual mapping. More... | |
virtual TArray | getMinima () const |
Returns the minimum value(s). More... | |
virtual TArray | getMaxima () const |
Returns the maximum value(s). More... | |
virtual double | getBucketSize (SizeArray index) const=0 |
Return the measure of one specific bucket. More... | |
virtual boost::array< std::pair< double, double >, N > | getIntervalForIndex (SizeArray index) const=0 |
Returns the actual (right-open) interval in each dimension associated with the given index. More... | |
Private Types | |
typedef Eigen::Matrix< size_t, Eigen::Dynamic, Eigen::Dynamic > | BinType |
Shorthand for data structure storing bucket information. More... | |
Private Attributes | |
BinType | m_bins |
Storing the bucket counts, how often a value occurs. More... | |
TArray | m_intervalWidth |
For each dimension this stores the uniform interval width. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from WHistogramND< 2 > | |
WHistogramND () | |
Default constructor is protected to allow subclassing constructors not to use initialization lists which would imply C++11 or GNU++11 style initializers for boost::array members. More... | |
void | reset (TArray min, TArray max, SizeArray buckets) |
Initializes all members. More... | |
Protected Attributes inherited from WHistogramND< 2 > | |
TArray | m_min |
The smallest value in each dimension. More... | |
TArray | m_max |
The biggest value in each dimension. More... | |
SizeArray | m_buckets |
The number of buckets. More... | |
size_t | m_nbBuckets |
Total number of buckets. More... | |
Uniform two dimensional histogram for double values.
The terms bin and bucket are interchangeable. For the first dimensional part often the analouge X-dimension is used and for the second, Y-dimension.
Definition at line 41 of file WHistogram2D.h.
|
private |
Shorthand for data structure storing bucket information.
In 2D this is a matrix.
Definition at line 145 of file WHistogram2D.h.
typedef std::shared_ptr< WHistogram2D > WHistogram2D::SPtr |
Convenience type for a shared_ptr on this type.
Definition at line 47 of file WHistogram2D.h.
WHistogram2D::WHistogram2D | ( | double | minX, |
double | maxX, | ||
double | minY, | ||
double | maxY, | ||
size_t | bucketsX, | ||
size_t | bucketsY | ||
) |
Creates a two dimensional histogram field, bounded by the given limits, containing the demanded number of buckets in each dimension.
minX | Minimal bound for X-values. |
maxX | Maximal bound for X-values. |
minY | Minimal bound for Y-values. |
maxY | Maximal bound for Y-values. |
bucketsX | Number of buckets in X direction. |
bucketsY | Number of buckets in Y direction. |
Definition at line 34 of file WHistogram2D.cpp.
References m_bins, m_intervalWidth, and WHistogramND< 2 >::reset().
WHistogram2D::~WHistogram2D | ( | ) |
Cleans up!
Definition at line 47 of file WHistogram2D.cpp.
WHistogram2D::WHistogram2D | ( | const WHistogram2D & | other | ) |
Copy constructor, performing a deep copy.
other | The other instance to copy from. |
Definition at line 51 of file WHistogram2D.cpp.
References m_bins.
|
virtual |
Return the measure of one specific bucket.
For one dimensional Histograms this is the width of the bucket, for two dimensions this is the area, for three dims this is the volume, etc.
index | the measure for this bucket is queried. |
Definition at line 68 of file WHistogram2D.cpp.
References m_intervalWidth.
|
virtual |
Returns the actual (right-open) interval in each dimension associated with the given index.
index | for this bucket the intervals will be returned |
Definition at line 73 of file WHistogram2D.cpp.
References m_intervalWidth, and WHistogramND< 2 >::m_min.
WGETexture2D::RPtr WHistogram2D::getSphereTexture | ( | ) |
Copy-convert this into a spherical texture.
Spherical means hereby, that buckets representing areas near the poles have scaled counters.
osg::ref_ptr
to the two-dimensional spherical texture. Definition at line 168 of file WHistogram2D.cpp.
References m_bins, and WHistogramND< 2 >::m_buckets.
WGETexture2D::RPtr WHistogram2D::getTexture | ( | ) |
Copy-convert this into a texture.
osg::ref_ptr
to the two-dimensional texture. Definition at line 123 of file WHistogram2D.cpp.
References m_bins, and WHistogramND< 2 >::m_buckets.
void WHistogram2D::insert | ( | double | x, |
double | y | ||
) |
Shorthand to overloaded insert function where each dimension can be overhanded separately.
x | value for the first dimension. |
y | value for the second dimension. |
Definition at line 117 of file WHistogram2D.cpp.
References insert().
void WHistogram2D::insert | ( | TArray | values | ) |
Given a value the corresponding bucket is determined and incremented by one.
values | The value to count into specific bucket. |
Definition at line 86 of file WHistogram2D.cpp.
References wlimits::DBL_EPS, m_bins, WHistogramND< 2 >::m_buckets, m_intervalWidth, WHistogramND< 2 >::m_max, WHistogramND< 2 >::m_min, and wlog::warn().
Referenced by insert(), WHistogram2DTest::testInsert(), WHistogram2DTest::testInsertAlmostMax(), WHistogram2DTest::testInsertMax(), WHistogram2DTest::testInsertMin(), WHistogram2DTest::testInsertOnIntervalBorder(), and WHistogram2DTest::testInsertOutOfBounds().
|
virtual |
Convenience function to easier access the buckets for 2D.
i | X-index |
j | Y-index |
Definition at line 62 of file WHistogram2D.cpp.
References operator()().
|
virtual |
Get the count of the specified bucket.
index | in each dimension |
Definition at line 57 of file WHistogram2D.cpp.
References m_bins.
Referenced by operator()().
|
private |
Storing the bucket counts, how often a value occurs.
Definition at line 150 of file WHistogram2D.h.
Referenced by getSphereTexture(), getTexture(), insert(), operator()(), and WHistogram2D().
|
private |
For each dimension this stores the uniform interval width.
Definition at line 155 of file WHistogram2D.h.
Referenced by getBucketSize(), getIntervalForIndex(), insert(), and WHistogram2D().