open_iA 2024.7
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
iAHistogramData Class Reference

Computes and stores histogram data, which can be used in plots. More...

#include <iAHistogramData.h>

Inheritance diagram for iAHistogramData:
[legend]
Collaboration diagram for iAHistogramData:
[legend]

Public Member Functions

 iAHistogramData (QString const &name, iAValueType type, DataType minX, DataType maxX, size_t numBin)
 Create an empty histogram (with numBin bins, initialized to 0).
 
 iAHistogramData (QString const &name, iAValueType type, DataType minX, DataType maxX, size_t numBin, DataType *histoData)
 Create with the given, already computed histogram data.
 
 ~iAHistogramData ()
 
void clear ()
 Sets all histogram frequencies back to 0.
 
void setBin (size_t binIdx, DataType value)
 Set the value for a given bin index.
 
void setSpacing (DataType spacing)
 Sets custom spacing.
 
void setYBounds (DataType yMin, DataType yMax)
 Sets custom y bounds.
 
iAPlotData::DataType spacing () const
 Get the spacing (the witdh of a bin)
 
DataType yValue (size_t idx) const override
 overriden from iAPlotData, check description there!
 
DataType xValue (size_t idx) const override
 Value on the x axis for a datum with given index.
 
DataType const * xBounds () const override
 The range of values for x; i.e. xBounds()[0] is the minimum of all xValue(...), xBounds()[1] is the maximum.
 
DataType const * yBounds () const override
 The range of values for y; i.e. yBounds()[0] is the minimum of all yValue(...), yBounds()[1] is the maximum.
 
size_t valueCount () const override
 The number of available data elements (i.e. in xValue/yValue, idx can go from 0 to valueCount()-1).
 
size_t nearestIdx (DataType dataX) const override
 Retrieve the index closest to the given x data value.
 
QString toolTipText (DataType dataX) const override
 The tooltip text for this data when the user is currently hovering over the given x position.
 
- Public Member Functions inherited from iAPlotData
 iAPlotData (QString const &name, iAValueType type)
 Construct a plot data object.
 
virtual ~iAPlotData ()
 
QString const & name () const
 The name of the data series that this object holds.
 
virtual iAValueType valueType () const
 The type of the values held by this data object.
 

Static Public Member Functions

static std::shared_ptr< iAHistogramDatacreate (QString const &name, iAValueType type, const std::vector< DataType > &data, size_t numBin, DataType minValue=std::numeric_limits< DataType >::infinity(), DataType maxValue=std::numeric_limits< DataType >::infinity())
 create a histogram for the given (raw) data vector.
 
static std::shared_ptr< iAHistogramDatacreate (QString const &name, iAValueType type, DataType minX, DataType maxX, QVector< DataType > const &histoData)
 Create from already computed histogram data in a QVector.
 
static std::shared_ptr< iAHistogramDatacreate (QString const &name, iAValueType type, DataType minX, DataType maxX, size_t numBin)
 Create an empty histogram.
 
static std::shared_ptr< iAHistogramDatacreate (QString const &name, iAValueType type, DataType minX, DataType maxX, size_t numBin, DataType *histoData)
 Create from already computed histogram data.
 
static std::shared_ptr< iAHistogramDatacreate (QString const &name, iAValueType type, DataType minX, DataType maxX, std::vector< DataType > const &histoData)
 Create from already computed histogram data in a std::vector.
 
static std::shared_ptr< iAHistogramDatacreate (QString const &name, vtkImageData *img, size_t desiredNumBin, iAImageStatistics *imgStatistics=nullptr, int component=0)
 create a histogram for a vtk image.
 
static size_t finalNumBin (vtkImageData *img, size_t desiredNumBin)
 compute the final bin count for a given image and desired bin count
 

Additional Inherited Members

- Public Types inherited from iAPlotData
using DataType = double
 Data type used for x and y values.
 

Detailed Description

Computes and stores histogram data, which can be used in plots.

Constructor & Destructor Documentation

◆ iAHistogramData() [1/2]

iAHistogramData::iAHistogramData ( QString const & name,
iAValueType type,
DataType minX,
DataType maxX,
size_t numBin )

Create an empty histogram (with numBin bins, initialized to 0).

◆ iAHistogramData() [2/2]

iAHistogramData::iAHistogramData ( QString const & name,
iAValueType type,
DataType minX,
DataType maxX,
size_t numBin,
DataType * histoData )

Create with the given, already computed histogram data.

◆ ~iAHistogramData()

iAHistogramData::~iAHistogramData ( )

Member Function Documentation

◆ clear()

void iAHistogramData::clear ( )

Sets all histogram frequencies back to 0.

◆ create() [1/6]

std::shared_ptr< iAHistogramData > iAHistogramData::create ( QString const & name,
iAValueType type,
const std::vector< DataType > & data,
size_t numBin,
DataType minValue = std::numeric_limits<DataType>::infinity(),
DataType maxValue = std::numeric_limits<DataType>::infinity() )
static

create a histogram for the given (raw) data vector.

Parameters
namethe name of the plot
typethe type of the data values (continuous or discrete)
datathe vector containing the raw data values
numBinthe number of bins the data will be split into
minValuethe minimum value in the data values (performance improvement if both minValue and maxValue are given; if left out, it is determined automatically)
maxValuethe maximum value in the data values (performance improvement if both minValue and maxValue are given; if left out, it is determined automatically)

◆ create() [2/6]

std::shared_ptr< iAHistogramData > iAHistogramData::create ( QString const & name,
iAValueType type,
DataType minX,
DataType maxX,
QVector< DataType > const & histoData )
static

Create from already computed histogram data in a QVector.

Parameters
namethe name of the plot
typethe type of the data values (continuous or discrete)
minXminimum value in the data values
maxXminimum value in the data values
histoDatathe histogram frequencies

◆ create() [3/6]

std::shared_ptr< iAHistogramData > iAHistogramData::create ( QString const & name,
iAValueType type,
DataType minX,
DataType maxX,
size_t numBin )
static

Create an empty histogram.

Useful if you need a custom way of creating a histogram; use setBin to populate the values.

Parameters
namethe name of the plot
typethe type of the data values (continuous or discrete)
minXminimum value in the data values
maxXminimum value in the data values
numBinthe number of bins in the new histogram data (all initialized to 0).

◆ create() [4/6]

std::shared_ptr< iAHistogramData > iAHistogramData::create ( QString const & name,
iAValueType type,
DataType minX,
DataType maxX,
size_t numBin,
DataType * histoData )
static

Create from already computed histogram data.

Deprecated
(because of data ownership issues, see notes for histoData parameter)
Parameters
namethe name of the plot
typethe type of the data values (continuous or discrete)
minXminimum value in the data values
maxXminimum value in the data values
numBinthe number of bins - the number of items contained in histoData
histoDatathe histogram frequencies. note that the class DOES NOT take ownership of the given array: you have to delete the array manually!

◆ create() [5/6]

std::shared_ptr< iAHistogramData > iAHistogramData::create ( QString const & name,
iAValueType type,
DataType minX,
DataType maxX,
std::vector< DataType > const & histoData )
static

Create from already computed histogram data in a std::vector.

Parameters
namethe name of the plot
typethe type of the data values (continuous or discrete)
minXminimum value in the data values
maxXminimum value in the data values
histoDatathe histogram frequencies

◆ create() [6/6]

std::shared_ptr< iAHistogramData > iAHistogramData::create ( QString const & name,
vtkImageData * img,
size_t desiredNumBin,
iAImageStatistics * imgStatistics = nullptr,
int component = 0 )
static

create a histogram for a vtk image.

Parameters
namethe name of the plot
imga pointer to the vtk image for which to create the histogram
desiredNumBinthe desired number of bins the data will be split into; can be adapted, depending on the actual number of different values in image
imgStatisticsoptional iAImageStatistics struct that will be filled with the statistical information determined while computing the histogram
componentwhich component of the image the histogram should be created for (in case it has multiple components)

◆ finalNumBin()

size_t iAHistogramData::finalNumBin ( vtkImageData * img,
size_t desiredNumBin )
static

compute the final bin count for a given image and desired bin count

◆ nearestIdx()

size_t iAHistogramData::nearestIdx ( DataType dataX) const
overridevirtual

Retrieve the index closest to the given x data value.

Parameters
dataXthe value (on the x axis) for which to search the closest datapoint in this data object.
Returns
the index (such as can be passed to xValue/yValue) of the datapoint closest to dataX calling xValue on the returned index will always give a value lower than or equal to dataX.

Implements iAPlotData.

◆ setBin()

void iAHistogramData::setBin ( size_t binIdx,
DataType value )

Set the value for a given bin index.

Also updates y bounds

Parameters
binIdxthe index of the bin that should be changed
valuethe new value for the bin

◆ setSpacing()

void iAHistogramData::setSpacing ( DataType spacing)

Sets custom spacing.

Deprecated
should be set automatically - if not it's a bug that needs to be fixed inside the class, not by setting it from externally

◆ setYBounds()

void iAHistogramData::setYBounds ( DataType yMin,
DataType yMax )

Sets custom y bounds.

Deprecated
should be set automatically - if not it's a bug that needs to be fixed inside the class, not by setting it from externally

◆ spacing()

iAPlotData::DataType iAHistogramData::spacing ( ) const

Get the spacing (the witdh of a bin)

◆ toolTipText()

QString iAHistogramData::toolTipText ( DataType dataX) const
overridevirtual

The tooltip text for this data when the user is currently hovering over the given x position.

Note that currently only the x axis position of the user is considered.

Parameters
dataXthe value (on the x axis) the user currently is hovering over.
Returns
a description of the datapoint that the user currrently is over/closest to.

Implements iAPlotData.

◆ valueCount()

size_t iAHistogramData::valueCount ( ) const
overridevirtual

The number of available data elements (i.e. in xValue/yValue, idx can go from 0 to valueCount()-1).

Implements iAPlotData.

◆ xBounds()

iAPlotData::DataType const * iAHistogramData::xBounds ( ) const
overridevirtual

The range of values for x; i.e. xBounds()[0] is the minimum of all xValue(...), xBounds()[1] is the maximum.

Implements iAPlotData.

◆ xValue()

iAPlotData::DataType iAHistogramData::xValue ( size_t idx) const
overridevirtual

Value on the x axis for a datum with given index.

Parameters
idxdata index

Implements iAPlotData.

◆ yBounds()

iAPlotData::DataType const * iAHistogramData::yBounds ( ) const
overridevirtual

The range of values for y; i.e. yBounds()[0] is the minimum of all yValue(...), yBounds()[1] is the maximum.

Implements iAPlotData.

◆ yValue()

iAPlotData::DataType iAHistogramData::yValue ( size_t idx) const
overridevirtual

overriden from iAPlotData, check description there!

Implements iAPlotData.


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