open_iA  2020.04
A tool for the visual analysis and processing of volumetric datasets, with a focus on industrial computed tomography.
Public Types | Public Slots | Signals | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
iAChartWithFunctionsWidget Class Reference

A chart widget that can also show functions overlaid over the chart area (transfer function, Gaussian and Bezier curves) More...

#include <iAChartWithFunctionsWidget.h>

Inheritance diagram for iAChartWithFunctionsWidget:
Collaboration diagram for iAChartWithFunctionsWidget:

Public Types

enum  AdditionalMode { MOVE_NEW_POINT_MODE =Y_ZOOM_MODE+1, MOVE_POINT_MODE }
 
- Public Types inherited from iAChartWidget
enum  AxisMappingType { Linear, Logarithmic }
 
enum  Mode { NO_MODE, MOVE_VIEW_MODE, X_ZOOM_MODE, Y_ZOOM_MODE }
 
enum  SelectionMode { SelectionDisabled, SelectPlot }
 

Public Slots

void addBezierFunction ()
 
void addGaussianFunction ()
 
void applyTransferFunctionForAll ()
 
void changeColor (QMouseEvent *event=nullptr)
 
int deletePoint ()
 
void loadFunctions ()
 
void loadTransferFunction ()
 
void loadTransferFunction (QDomNode functionsNode)
 
void removeFunction ()
 
void resetTrf ()
 
void saveFunctions ()
 
void saveTransferFunction ()
 
void showTFTable ()
 
void tfTableIsFinished ()
 
void updateTrf ()
 
- Public Slots inherited from iAChartWidget
void resetView ()
 Reset view (zoom and shift in x and y direction) such that all plots are fully visible. More...
 
void setDrawXAxisAtZero (bool enable)
 Determines whether the x axis is drawn at location of zero in the data, or at the bottom of the chart region. More...
 

Signals

void active ()
 
void applyTFForAll ()
 
void endPointSelected ()
 
void noPointSelected ()
 
void pointSelected ()
 
void updateTFTable ()
 
void updateViews ()
 
- Signals inherited from iAChartWidget
void dblClicked ()
 Fires whenever the user double-clicks on the chart. More...
 
void plotsSelected (std::vector< size_t > const &plotIDs)
 Fires whenever one or more plots are selected. More...
 
void xAxisChanged ()
 Fires whenever the displayed x axis has changed (i.e. More...
 

Public Member Functions

void addGaussianFunction (double mean, double sigma, double multiplier)
 Add a Gaussian function with the given parameters. More...
 
int chartHeight () const
 The height of the chart area itself (in pixels), without bottom margin (where the x axis, captions and labels are drawn). More...
 
std::vector< iAChartFunction * > & functions ()
 Get all functions currently defined in this chart. More...
 
 iAChartWithFunctionsWidget (QWidget *parent, MdiChild *mdiChild, QString const &label="Greyvalue", QString const &yLabel="")
 
bool isFuncEndPoint (int index) const
 
bool loadProbabilityFunctions (iAXmlSettings &xml)
 
void saveProbabilityFunctions (iAXmlSettings &xml)
 
int selectedFuncPoint () const
 Get the index of the selected point in the selected function. More...
 
iAChartFunctionselectedFunction ()
 Get the currently selected function. More...
 
void setAllowTrfReset (bool allow)
 Set whether the user is allowed to reset the transfer function. More...
 
void setEnableAdditionalFunctions (bool enable)
 Set whether the user can add additional functions (Bezier and Gaussian curves), in addition to the standard transfer function. More...
 
void setTransferFunctions (vtkColorTransferFunction *ctf, vtkPiecewiseFunction *pwf)
 Set the transfer functions to be displayed on top of the chart. More...
 
virtual ~iAChartWithFunctionsWidget ()
 
bool isTFTableCreated () const
 Transfer Function Table dialog related. More...
 
void closeTFTable ()
 
QPoint getTFTablePos () const
 
void setTFTablePos (QPoint pos)
 
- Public Member Functions inherited from iAChartWidget
virtual int activeHeight () const
 Retrieve height of active region of the chart. More...
 
virtual int activeWidth () const
 Retrieve width of active region of the chart. More...
 
void addImageOverlay (QSharedPointer< QImage > imgOverlay)
 Add an image overlay to the chart. More...
 
void addPlot (QSharedPointer< iAPlot > plot)
 Add a plot to the chart. More...
 
void addXMarker (double xPos, QColor const &color)
 Adds a marker at a specific x position (in data space, see screenX2DataBin for details) in the given color. More...
 
virtual int bottomMargin () const
 Retrieve bottom margin (in pixels). More...
 
bool categoricalAxis () const
 Whether the axis of this chart is categorical type (as determined by the first plot). More...
 
void clearMarkers ()
 Remove all markers. More...
 
void clearPlots ()
 Remove all plots from the chart. More...
 
QPoint contextMenuPos () const
 Get the position where the context menu was last shown. More...
 
int dataBin2ScreenX (long x) const
 Convert a bin number to a screen coordinate. More...
 
QImage drawOffscreen ()
 Draws the chart off screen and returns an image of the result. More...
 
 iAChartWidget (QWidget *parent, QString const &xLabel, QString const &yLabel)
 
bool isContextMenuVisible () const
 Check whether currently a context menu is shown. More...
 
bool isDrawnDiscrete () const
 Check whether all plots currently in the chart have discrete (categorical also counts as discrete for this purpose). More...
 
bool isTooltipShown () const
 Check whether currently tooltips are enabled. More...
 
virtual int leftMargin () const
 Retrieve left margin (in pixels). More...
 
double maxXZoom () const
 Get the maximum zoom factor in x direction that can be in use. More...
 
std::vector< QSharedPointer< iAPlot > > const & plots ()
 Retrieve all plots currently in the chart. More...
 
void removeImageOverlay (QImage *imgOverlay)
 Remove an image overlay from the chart. More...
 
void removePlot (QSharedPointer< iAPlot > plot)
 Remove a plot from the chart. More...
 
void removeXMarker (double xPos)
 Remove the marker at the given x position (in data space, see screenX2DataBin for details). More...
 
void resetYBounds ()
 Reset y bounds to the range specified by the current plots. More...
 
long screenX2DataBin (int x) const
 Convert an x screen coordinate to a bin space index; Note that there are three different spaces to consider: More...
 
void setBackgroundColor (QColor const &color)
 Sets the background color of the whole chart. More...
 
void setCaptionPosition (QFlags< Qt::AlignmentFlag >)
 Set position of x axis caption (Center/Left, Bottom/Top, via Qt::Align... flags). More...
 
void setSelectionMode (SelectionMode mode)
 Determine how a selection works; see SelectionMode: either disable selection, or allow selection of single plots. More...
 
void setShowXAxisLabel (bool show)
 Set whether x axis caption should be shown or not. More...
 
void setXBounds (double minVal, double maxVal)
 Set custom x bounds (the interval the x axis covers). More...
 
void setXCaption (QString const &caption)
 Set the caption shown along the x axis. More...
 
void setYBounds (iAPlotData::DataType minVal, iAPlotData::DataType maxVal)
 Set custom y bounds (the interval the y axis covers). More...
 
void setYCaption (QString const &caption)
 Set the caption shown along the y axis. More...
 
void setYMappingMode (AxisMappingType drawMode)
 Set either linear or logarithmic mapping mode. More...
 
void updateBounds (size_t startPlot=0)
 Update all bounds such that all current plots are in the visible area of the chart. More...
 
void updateXBounds (size_t startPlot=0)
 Update x bounds of the chart such that the x bounds of all current plots are in the visible area of the chart. More...
 
void updateYBounds (size_t startPlot=0)
 Update y bounds of the chart such that the y bounds of all current plots are in the visible area of the chart. More...
 
double xRange () const
 Get the range in x direction (i.e. maximum - minimum of x bounds) More...
 
 ~iAChartWidget ()
 
double xZoom () const
 Get x/y zoom and shift. More...
 
double yZoom () const
 
int xShift () const
 
int yShift () const
 
iAPlotData::DataType minYDataValue (size_t startPlot=0) const
 Retrieve minimum/maximum y data value. More...
 
iAPlotData::DataType maxYDataValue (size_t startPlot=0) const
 
iAMapper const & xMapper () const
 Get mapper for x/y coordinates. More...
 
iAMapper const & yMapper () const
 
virtual iAPlotData::DataType const * yBounds () const
 Get x/y bounds as array of size 2 (minimum, maximum) More...
 
virtual double const * xBounds () const
 

Static Public Attributes

static const int POINT_RADIUS = 6
 
static const int POINT_SIZE = 2*POINT_RADIUS
 
static const int SELECTED_POINT_RADIUS = 10
 
static const int SELECTED_POINT_SIZE = 2*SELECTED_POINT_RADIUS
 
- Static Public Attributes inherited from iAChartWidget
static const size_t MaxPossiblePlot = std::numeric_limits<size_t>::max()
 

Protected Member Functions

virtual void drawFunctions (QPainter &painter)
 
void mousePressEvent (QMouseEvent *event) override
 Events overrided from Qt. More...
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void enterEvent (QEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void addContextMenuEntries (QMenu *contextMenu) override
 Methods overrided from iAChartWidget. More...
 
void changeMode (int newMode, QMouseEvent *event) override
 
void drawAfterPlots (QPainter &painter) override
 
- Protected Member Functions inherited from iAChartWidget
virtual void drawAxes (QPainter &painter)
 
virtual void drawBackground (QPainter &painter)
 
virtual void drawPlots (QPainter &painter)
 
virtual void showDataTooltip (QHelpEvent *event)
 
virtual QString xAxisTickMarkLabel (double value, double stepWidth)
 
void zoomAlongX (double value, int x, bool deltaMode)
 
void zoomAlongY (double value, bool deltaMode)
 
void mouseMoveEvent (QMouseEvent *event) override
 Overriden Qt events. More...
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void wheelEvent (QWheelEvent *event) override
 
void leaveEvent (QEvent *event) override
 
void paintGL () override
 
void contextMenuEvent (QContextMenuEvent *event) override
 
void keyReleaseEvent (QKeyEvent *event) override
 
bool event (QEvent *event) override
 

Protected Attributes

MdiChildm_activeChild
 
std::vector< iAChartFunction * > m_functions
 
size_t m_selectedFunction
 
bool m_showFunctions
 
- Protected Attributes inherited from iAChartWidget
bool m_contextMenuVisible
 
int m_dragStartPosX
 
int m_dragStartPosY
 
int m_mode
 
int m_translationStartX
 
int m_translationStartY
 
int m_translationX
 
int m_translationY
 
QString m_xCaption
 
QSharedPointer< iAMapperm_xMapper
 Main mappers from diagram coordinates to pixel coordinates, for each axis: More...
 
double m_xZoom
 
double m_xZoomStart
 
QString m_yCaption
 
QSharedPointer< iAMapperm_yMapper
 
AxisMappingType m_yMappingMode
 
double m_yZoom
 
double m_yZoomStart
 
int m_zoomXPos
 
int m_zoomYPos
 

Detailed Description

A chart widget that can also show functions overlaid over the chart area (transfer function, Gaussian and Bezier curves)

Member Enumeration Documentation

◆ AdditionalMode

Enumerator
MOVE_NEW_POINT_MODE 
MOVE_POINT_MODE 

Constructor & Destructor Documentation

◆ iAChartWithFunctionsWidget()

iAChartWithFunctionsWidget::iAChartWithFunctionsWidget ( QWidget *  parent,
MdiChild mdiChild,
QString const &  label = "Greyvalue",
QString const &  yLabel = "" 
)

◆ ~iAChartWithFunctionsWidget()

iAChartWithFunctionsWidget::~iAChartWithFunctionsWidget ( )
virtual

Member Function Documentation

◆ active

void iAChartWithFunctionsWidget::active ( )
signal

◆ addBezierFunction

void iAChartWithFunctionsWidget::addBezierFunction ( )
slot

◆ addContextMenuEntries()

void iAChartWithFunctionsWidget::addContextMenuEntries ( QMenu *  contextMenu)
overrideprotectedvirtual

Methods overrided from iAChartWidget.

Reimplemented from iAChartWidget.

◆ addGaussianFunction [1/2]

void iAChartWithFunctionsWidget::addGaussianFunction ( )
slot

◆ addGaussianFunction() [2/2]

void iAChartWithFunctionsWidget::addGaussianFunction ( double  mean,
double  sigma,
double  multiplier 
)

Add a Gaussian function with the given parameters.

◆ applyTFForAll

void iAChartWithFunctionsWidget::applyTFForAll ( )
signal

◆ applyTransferFunctionForAll

void iAChartWithFunctionsWidget::applyTransferFunctionForAll ( )
slot

◆ changeColor

void iAChartWithFunctionsWidget::changeColor ( QMouseEvent *  event = nullptr)
slot

◆ changeMode()

void iAChartWithFunctionsWidget::changeMode ( int  newMode,
QMouseEvent *  event 
)
overrideprotectedvirtual

Reimplemented from iAChartWidget.

◆ chartHeight()

int iAChartWithFunctionsWidget::chartHeight ( ) const

The height of the chart area itself (in pixels), without bottom margin (where the x axis, captions and labels are drawn).

◆ closeTFTable()

void iAChartWithFunctionsWidget::closeTFTable ( )

◆ deletePoint

int iAChartWithFunctionsWidget::deletePoint ( )
slot

◆ drawAfterPlots()

void iAChartWithFunctionsWidget::drawAfterPlots ( QPainter &  painter)
overrideprotectedvirtual

Reimplemented from iAChartWidget.

◆ drawFunctions()

void iAChartWithFunctionsWidget::drawFunctions ( QPainter &  painter)
protectedvirtual

◆ endPointSelected

void iAChartWithFunctionsWidget::endPointSelected ( )
signal

◆ enterEvent()

void iAChartWithFunctionsWidget::enterEvent ( QEvent *  event)
overrideprotected

◆ functions()

std::vector< iAChartFunction * > & iAChartWithFunctionsWidget::functions ( )

Get all functions currently defined in this chart.

◆ getTFTablePos()

QPoint iAChartWithFunctionsWidget::getTFTablePos ( ) const

◆ isFuncEndPoint()

bool iAChartWithFunctionsWidget::isFuncEndPoint ( int  index) const

◆ isTFTableCreated()

bool iAChartWithFunctionsWidget::isTFTableCreated ( ) const

Transfer Function Table dialog related.

◆ keyPressEvent()

void iAChartWithFunctionsWidget::keyPressEvent ( QKeyEvent *  event)
overrideprotected

◆ loadFunctions

void iAChartWithFunctionsWidget::loadFunctions ( )
slot

◆ loadProbabilityFunctions()

bool iAChartWithFunctionsWidget::loadProbabilityFunctions ( iAXmlSettings xml)

◆ loadTransferFunction [1/2]

void iAChartWithFunctionsWidget::loadTransferFunction ( )
slot

◆ loadTransferFunction [2/2]

void iAChartWithFunctionsWidget::loadTransferFunction ( QDomNode  functionsNode)
slot

◆ mouseDoubleClickEvent()

void iAChartWithFunctionsWidget::mouseDoubleClickEvent ( QMouseEvent *  event)
overrideprotected

◆ mouseMoveEvent()

void iAChartWithFunctionsWidget::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

◆ mousePressEvent()

void iAChartWithFunctionsWidget::mousePressEvent ( QMouseEvent *  event)
overrideprotected

Events overrided from Qt.

◆ mouseReleaseEvent()

void iAChartWithFunctionsWidget::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

◆ noPointSelected

void iAChartWithFunctionsWidget::noPointSelected ( )
signal

◆ pointSelected

void iAChartWithFunctionsWidget::pointSelected ( )
signal

◆ removeFunction

void iAChartWithFunctionsWidget::removeFunction ( )
slot

◆ resetTrf

void iAChartWithFunctionsWidget::resetTrf ( )
slot

◆ saveFunctions

void iAChartWithFunctionsWidget::saveFunctions ( )
slot

◆ saveProbabilityFunctions()

void iAChartWithFunctionsWidget::saveProbabilityFunctions ( iAXmlSettings xml)

◆ saveTransferFunction

void iAChartWithFunctionsWidget::saveTransferFunction ( )
slot

◆ selectedFuncPoint()

int iAChartWithFunctionsWidget::selectedFuncPoint ( ) const

Get the index of the selected point in the selected function.

◆ selectedFunction()

iAChartFunction * iAChartWithFunctionsWidget::selectedFunction ( )

Get the currently selected function.

◆ setAllowTrfReset()

void iAChartWithFunctionsWidget::setAllowTrfReset ( bool  allow)

Set whether the user is allowed to reset the transfer function.

◆ setEnableAdditionalFunctions()

void iAChartWithFunctionsWidget::setEnableAdditionalFunctions ( bool  enable)

Set whether the user can add additional functions (Bezier and Gaussian curves), in addition to the standard transfer function.

◆ setTFTablePos()

void iAChartWithFunctionsWidget::setTFTablePos ( QPoint  pos)

◆ setTransferFunctions()

void iAChartWithFunctionsWidget::setTransferFunctions ( vtkColorTransferFunction *  ctf,
vtkPiecewiseFunction *  pwf 
)

Set the transfer functions to be displayed on top of the chart.

◆ showTFTable

void iAChartWithFunctionsWidget::showTFTable ( )
slot

◆ tfTableIsFinished

void iAChartWithFunctionsWidget::tfTableIsFinished ( )
slot

◆ updateTFTable

void iAChartWithFunctionsWidget::updateTFTable ( )
signal

◆ updateTrf

void iAChartWithFunctionsWidget::updateTrf ( )
slot

◆ updateViews

void iAChartWithFunctionsWidget::updateViews ( )
signal

Member Data Documentation

◆ m_activeChild

MdiChild* iAChartWithFunctionsWidget::m_activeChild
protected

◆ m_functions

std::vector<iAChartFunction*> iAChartWithFunctionsWidget::m_functions
protected

◆ m_selectedFunction

size_t iAChartWithFunctionsWidget::m_selectedFunction
protected

◆ m_showFunctions

bool iAChartWithFunctionsWidget::m_showFunctions
protected

◆ POINT_RADIUS

const int iAChartWithFunctionsWidget::POINT_RADIUS = 6
static

◆ POINT_SIZE

const int iAChartWithFunctionsWidget::POINT_SIZE = 2*POINT_RADIUS
static

◆ SELECTED_POINT_RADIUS

const int iAChartWithFunctionsWidget::SELECTED_POINT_RADIUS = 10
static

◆ SELECTED_POINT_SIZE

const int iAChartWithFunctionsWidget::SELECTED_POINT_SIZE = 2*SELECTED_POINT_RADIUS
static

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