open_iA 2021.08
A tool for the visual analysis and processing of volumetric datasets, with a focus on industrial computed tomography.
Public Member Functions | Static Public Member Functions | Protected 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 ()
 
void clear ()
 Sets all histogram frequencies back to 0. More...
 
void setBin (size_t binIdx, DataType value)
 Set the value for a given bin index. More...
 
void setSpacing (DataType spacing)
 Sets custom spacing. More...
 
void setYBounds (DataType yMin, DataType yMax)
 Sets custom y bounds. More...
 
iAPlotData::DataType spacing () const
 Get the spacing (the witdh of a bin) More...
 
DataType yValue (size_t idx) const override
 overriden from iAPlotData, check description there! More...
 
DataType xValue (size_t idx) const override
 Value on the x axis for a datum with given index. More...
 
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. More...
 
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. More...
 
size_t valueCount () const override
 The number of available data elements (i.e. in xValue/yValue, idx can go from 0 to valueCount()-1). More...
 
size_t nearestIdx (DataType dataX) const override
 Retrieve the index closest to the given x data value. More...
 
QString toolTipText (DataType dataX) const override
 The tooltip text for this data when the user is currently hovering over the given x position. More...
 
- Public Member Functions inherited from iAPlotData
 iAPlotData (QString const &name, iAValueType type)
 Construct a plot data object. More...
 
virtual ~iAPlotData ()
 
QString const & name () const
 The name of the data series that this object holds. More...
 
virtual iAValueType valueType () const
 The type of the values held by this data object. More...
 

Static Public Member Functions

static QSharedPointer< 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. More...
 
static QSharedPointer< iAHistogramDatacreate (QString const &name, iAValueType type, DataType minX, DataType maxX, QVector< DataType > const &histoData)
 Create from already computed histogram data in a QVector. More...
 
static QSharedPointer< iAHistogramDatacreate (QString const &name, iAValueType type, DataType minX, DataType maxX, size_t numBin)
 Create an empty histogram. More...
 
static QSharedPointer< iAHistogramDatacreate (QString const &name, iAValueType type, DataType minX, DataType maxX, size_t numBin, DataType *histoData)
 Create from already computed histogram data. More...
 
static QSharedPointer< 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. More...
 
static QSharedPointer< iAHistogramDatacreate (QString const &name, vtkImageData *img, size_t numBin, iAImageInfo *imageInfo=nullptr)
 create a histogram for a vtk image. More...
 

Protected 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). More...
 

Additional Inherited Members

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

Detailed Description

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

Constructor & Destructor Documentation

◆ ~iAHistogramData()

iAHistogramData::~iAHistogramData ( )

◆ iAHistogramData()

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

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

Member Function Documentation

◆ clear()

void iAHistogramData::clear ( )

Sets all histogram frequencies back to 0.

◆ create() [1/6]

QSharedPointer< 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]

QSharedPointer< 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]

QSharedPointer< 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]

QSharedPointer< 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]

QSharedPointer< 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]

QSharedPointer< iAHistogramData > iAHistogramData::create ( QString const &  name,
vtkImageData *  img,
size_t  numBin,
iAImageInfo imageInfo = nullptr 
)
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
numBinthe number of bins the data will be split into
imageInfooptional iAImageInfo struct that will be filled with the statistical information determined while computing the histogram

◆ 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: