![]() |
open_iA 2021.08
A tool for the visual analysis and processing of volumetric datasets, with a focus on industrial computed tomography.
|
A scatter plot matrix (SPLOM) widget. More...
#include <iAQSplom.h>
Classes | |
| struct | Settings |
| All settings of the plot in one struct. More... | |
Public Types | |
| enum | ColorMode { cmAllPointsSame , cmByParameter , cmCustom } |
| < in what way the the dots should be colored. Order must match labels in m_settingsDlg->cbColorMode! More... | |
| enum | ColorParameterMode { pmContinuous , pmQualitative } |
| < How parameter colors should be applied. More... | |
| enum | ColorRangeMode { rmAutomatic , rmManual } |
| < How parameter range is determined if points are colored by parameter. Order must match labels in m_settingsDlg->cbColorRangeMode! More... | |
| enum | SPMMode { smUpperHalf , smAllPlots } |
| < two possible states of SPLOM: upper triangle with maximized plot or all possible combinations of scatter plots More... | |
Public Slots | |
| void | rangeFromParameter () |
| Call when color range should be determined from parameter. More... | |
| void | setColorTheme (QString const &themeName) |
| Call to adapt color theme used for coloring by a continuous parameter. More... | |
| void | setColorThemeQual (int index) |
| Call to adapt color theme used for coloring by a qualitative parameter. More... | |
| void | setFlipAxes (bool flip) |
| set whether to flip parameters in large scatterplot More... | |
| void | setHistogramBins (int bins) |
| set the number of histogram bins More... | |
| void | setHistogramVisible (bool visible) |
| set visibility of histograms More... | |
| void | setSelectionMode (int mode) |
| set selection mode to either rectangle or polygon mode More... | |
| void | showSettings () |
| Show the settings dialog. More... | |
Signals | |
| void | currentPointModified (size_t index) |
| Emitted when hovered over a new point. More... | |
| void | lookupTableChanged () |
| Emitted when the lookup table has changed. More... | |
| void | parameterVisibilityChanged (size_t paramIndex, bool visible) |
| Emitted when the visibility of a parameter has changed (from within SPLOM, not triggered if it was set from the outside via setParameterVisibility). More... | |
| void | selectionModified (iAScatterPlotViewData::SelectionType const &selInds) |
| Emitted when new data points are selected. Contains a list of selected data points. More... | |
Public Member Functions | |
| iAQSplom (QWidget *parent=nullptr) | |
| ~iAQSplom () | |
| void | addContextMenuAction (QAction *action) |
| add an additional option to the context menu More... | |
| size_t | colorLookupParam () const |
| parameter currently used for color lookup More... | |
| ColorMode | colorMode () const |
| get current coloring mode More... | |
| QSharedPointer< iASPLOMData > | data () |
| set SPLOM data directly. More... | |
| void | enableSelection (bool enable) |
| set whether selections are allowed or not More... | |
| void | getActivePlotIndices (int *inds_out) |
| Get X and Y parameter indices of currently active scatter plot. More... | |
| iAColorTheme const * | getBackgroundColorTheme () |
| retrieve the theme for background colors for the separated regions More... | |
| void | loadSettings (iASettings const &iniFile) |
| load settings from given object More... | |
| QSharedPointer< iALookupTable > | lookupTable () const |
| get lookup table More... | |
| void | saveSettings (QSettings &iniFile) const |
| store current settings into given object More... | |
| void | setBackgroundColorTheme (iAColorTheme const *theme) |
| define the color theme to use for coloring the different separated regions More... | |
| void | setColorParam (const QString ¶mName) |
| Set the parameter to color code, lookup table will be auto-determined (By Parameter) More... | |
| void | setColorParam (size_t colorLookupParam) |
| Set the parameter to color code, lookup table will be auto-determined (By Parameter) More... | |
| void | setData (QSharedPointer< iASPLOMData > data, std::vector< char > const &visibility) |
| void | setLookupTable (iALookupTable &lut, size_t paramIndex) |
| Set lookup table given the index of a parameter to color-code. More... | |
| void | setLookupTable (vtkLookupTable *lut, const QString ¶mName) |
| retrieve SPLOM data More... | |
| void | setParameterInverted (size_t paramIndex, bool isInverted) |
| whether to invert the axis for a given parameter's index. More... | |
| void | setParameterVisibility (const QString ¶mName, bool isVisible) |
| Show/hide scatter plots of a parameter given parameter's name. More... | |
| void | setParameterVisibility (size_t paramIndex, bool isVisible) |
| Show/hide scatter plots of a parameter given parameter's index. More... | |
| void | setParameterVisibility (std::vector< char > const &visibility) |
| Adapt visibility of all parameters at once. More... | |
| void | setPointColor (QColor const &color) |
| set the color for all data points More... | |
| void | setPointOpacity (double opacity) |
| set the opaci ty for all data points More... | |
| void | setPointRadius (double radius) |
| set the radius for scatter plot points More... | |
| void | setSelectionColor (QColor color) |
| set the color for selected points More... | |
| void | setSeparation (int idx) |
| define an index at which a separation margin is inserted More... | |
| void | showAllPlots (const bool enableAllPlotsVisible) |
| switch between showing all plots or only upper half More... | |
| void | showDefaultMaxizimedPlot () |
| maximize plot in upper left corner More... | |
| QSharedPointer< iAScatterPlotViewData > | viewData () |
| int | visibleParametersCount () const |
| Get the number of parameters currently displayed. More... | |
Public Attributes | |
| Settings | settings |
Protected Slots | |
| virtual void | currentPointUpdated (size_t index) |
| When hovered over a new point. More... | |
| void | setColorThemeFromComboBox (int index) |
| Called when color theme changed via combobox in settings dialog. More... | |
Protected Member Functions | |
| void | changeActivePlot (iAScatterPlot *s) |
| void | clear () |
| Clear all scatter plots in the SPLOM. More... | |
| void | drawPlotLabels (QPainter &painter, bool switchXY) |
| virtual bool | drawPopup (QPainter &painter) |
| Draws popup on the splom. More... | |
| void | drawTicks (QPainter &painter, QList< double > const &ticksX, QList< double > const &ticksY, QList< QString > const &textX, QList< QString > const &textY) |
| Draw ticks for X and Y axes of all plots in the SPLOM. More... | |
| void | drawVisibleParameters (QPainter &painter) |
| draws label for the whole scatter plot matrix More... | |
| QRect | getMaxRect () |
| int | getMaxTickLabelWidth (QList< QString > const &textX, QFontMetrics &fm) const |
| Get the width of the longest tick label width. More... | |
| QRect | getPlotRectByIndex (int x, int y) |
| Get a rectangle of a plot by its indices. More... | |
| iAScatterPlot * | getScatterplotAt (QPoint pos) |
| Get a scatter plot at mouse position. More... | |
| int | invert (int val) const |
| Inverts parameter index. Used for inverting SPLOM Y indexing order. More... | |
| void | maximizeSelectedPlot (iAScatterPlot *selectedPlot) |
| shows a maximized preview of the selected plot More... | |
| void | paintEvent (QPaintEvent *event) override |
| void | removeMaximizedPlot () |
| Removes maximized plot. More... | |
| void | removeMaxPlotIfHidden () |
| Removes maximized plot if any of his parameters is hidden. More... | |
| void | resetTransform () |
| Resets transform in all plots of the matrix. More... | |
| void | updateMaxPlotRect () |
| Updates the rectangle of the maximized scatter plot. More... | |
| void | updatePlotGridParams () |
| Updates some parameters used for the matrix grid layout calculations. More... | |
| void | updateSPLOMLayout () |
| Updates SPLOM layout: every plot in the matrix + maximized plot (if exists). More... | |
| void | updateVisiblePlots () |
| Updates matrix using only plots that are currently visible. More... | |
| void | wheelEvent (QWheelEvent *event) override |
| Overrides of Qt event handlers. More... | |
| void | resizeEvent (QResizeEvent *event) override |
| void | mousePressEvent (QMouseEvent *event) override |
| void | mouseReleaseEvent (QMouseEvent *event) override |
| void | mouseMoveEvent (QMouseEvent *event) override |
| void | keyPressEvent (QKeyEvent *event) override |
| void | mouseDoubleClickEvent (QMouseEvent *event) override |
| void | contextMenuEvent (QContextMenuEvent *event) override |
Protected Attributes | |
| iAScatterPlot * | m_activePlot |
| scatter plot that user currently interacts with More... | |
| iAColorTheme const * | m_bgColorTheme |
| background colors for regions in the scatterplot More... | |
| size_t | m_colorLookupParam |
| index of the column to use for color lookup (TODO: Move to settings?) More... | |
| QMenu * | m_columnPickMenu |
| sub-menu of the context menu for picking which columns are visible More... | |
| QMenu * | m_contextMenu |
| the context menu (can be extended via addContextMenuAction) More... | |
| QSharedPointer< iALookupTable > | m_lut |
| lookup table, shared with individual scatter plots More... | |
| std::vector< std::vector< iAScatterPlot * > > | m_matrix |
| cache for all scatter plots More... | |
| iAScatterPlot * | m_maximizedPlot |
| pointer to the maximized plot More... | |
| SPMMode | m_mode |
| SPLOM current state: all plots or upper triangle with maximized plot (TODO: Move to settings?) More... | |
| std::vector< char > | m_paramVisibility |
| array of individual parameter visibility More... | |
| double | m_popupHeight |
| height of the last drawn popup More... | |
| iAScatterPlot * | m_previewPlot |
| plot currently being previewed (shown in maximized plot) More... | |
| QPoint | m_scatPlotSize |
| size of one scatter plot in the layout More... | |
| int | m_separationIdx |
| index at which to separate scatterplots spatially (e.g. into in- and output parameters) More... | |
| QSharedPointer< iASPLOMData > | m_splomData |
| contains raw data points used in SPLOM More... | |
| QSharedPointer< iAScatterPlotViewData > | m_viewData |
| std::vector< size_t > | m_visibleIndices |
| stores mapping from visible plot index to parameter index More... | |
| std::vector< std::vector< iAScatterPlot * > > | m_visiblePlots |
| matrix of visible scatter plots More... | |
A scatter plot matrix (SPLOM) widget.
Multidimensional data points are shown using a grid of 2D scatter plots for each pair of dimensions.
Each plot is interactive and user-transformations such as scaling and translating
are possible using mouse wheel and right-button dragging correspondingly.
When 'R' key is pressed all the transformations are reset to default.
The user can also hover over points of any plot, to see a popup with detailed information about the point.
When hovering over a point, it will be highlighted in all plots to allow interactive exploration.
Any parameter of the data can be color-coded using a lookup table.
Any scatter plot from an upper matrix triangle can be maximized by clicking a button in the upper-right corner.
The maximized plot can be minimized by using a button in upper-right corner.
Inherits Q[Open]GLWidget,manages scatter plots internally.
Some customization options are available via the public settings member.
Usage:
- Create iAQSPLOM
- add to a window/widget, make visible
- set some data (using one of the setData methods)
- set a lookup table for dot colors (setLookupTable)
- (optional:) set the parameter visibility (by default, all parameters are visible
- (optional:)
Example (visibleWidget is some widget, currently shown, with a layout):
iAQSplom* splom = new iAQSplom();
visibleWidget->layout()->addWidget(splom);
... you might want enable Qt to process a paint event here, to make sure the OpenGL context is created QSharedPoiner<iASPLOMData> splomData = createSPLOMDataSomehow(); splom->setData(splomData); iALookupTable lut; we assume here you want all points colored in a middle gray; we set up a color lookoup table over all values of column 0, and set the same color for the whole range if you want to color the dots by an actual column value, adapt this to your own needs! lut.setRange( splomData->paramRange(0) ); lut.allocate(2); QColor CustomDotColor(128, 128, 128) lut.setColor( 0, CustomDotColor ); lut.setColor( 1, CustomDotColor ); splom->setLookupTable( lut, 0 );
| enum iAQSplom::ColorMode |
| enum iAQSplom::SPMMode |
| iAQSplom::iAQSplom | ( | QWidget * | parent = nullptr | ) |
| iAQSplom::~iAQSplom | ( | ) |
| void iAQSplom::addContextMenuAction | ( | QAction * | action | ) |
add an additional option to the context menu
|
protected |
|
protected |
Clear all scatter plots in the SPLOM.
| size_t iAQSplom::colorLookupParam | ( | ) | const |
parameter currently used for color lookup
| iAQSplom::ColorMode iAQSplom::colorMode | ( | ) | const |
get current coloring mode
|
overrideprotected |
|
signal |
Emitted when hovered over a new point.
|
protectedvirtualslot |
When hovered over a new point.
| QSharedPointer< iASPLOMData > iAQSplom::data | ( | ) |
set SPLOM data directly.
|
protected |
|
protectedvirtual |
Draws popup on the splom.
|
protected |
Draw ticks for X and Y axes of all plots in the SPLOM.
|
protected |
draws label for the whole scatter plot matrix
| void iAQSplom::enableSelection | ( | bool | enable | ) |
set whether selections are allowed or not
| void iAQSplom::getActivePlotIndices | ( | int * | inds_out | ) |
Get X and Y parameter indices of currently active scatter plot.
| iAColorTheme const * iAQSplom::getBackgroundColorTheme | ( | ) |
retrieve the theme for background colors for the separated regions
|
protected |
|
protected |
Get the width of the longest tick label width.
|
protected |
Get a rectangle of a plot by its indices.
|
protected |
Get a scatter plot at mouse position.
|
protected |
Inverts parameter index. Used for inverting SPLOM Y indexing order.
|
overrideprotected |
| void iAQSplom::loadSettings | ( | iASettings const & | iniFile | ) |
load settings from given object
| QSharedPointer< iALookupTable > iAQSplom::lookupTable | ( | ) | const |
get lookup table
|
signal |
Emitted when the lookup table has changed.
|
protected |
shows a maximized preview of the selected plot
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
overrideprotected |
|
signal |
Emitted when the visibility of a parameter has changed (from within SPLOM, not triggered if it was set from the outside via setParameterVisibility).
|
slot |
Call when color range should be determined from parameter.
|
protected |
Removes maximized plot.
|
protected |
Removes maximized plot if any of his parameters is hidden.
|
protected |
Resets transform in all plots of the matrix.
|
overrideprotected |
| void iAQSplom::saveSettings | ( | QSettings & | iniFile | ) | const |
store current settings into given object
|
signal |
Emitted when new data points are selected. Contains a list of selected data points.
| void iAQSplom::setBackgroundColorTheme | ( | iAColorTheme const * | theme | ) |
define the color theme to use for coloring the different separated regions
| void iAQSplom::setColorParam | ( | const QString & | paramName | ) |
Set the parameter to color code, lookup table will be auto-determined (By Parameter)
| void iAQSplom::setColorParam | ( | size_t | colorLookupParam | ) |
Set the parameter to color code, lookup table will be auto-determined (By Parameter)
|
slot |
Call to adapt color theme used for coloring by a continuous parameter.
|
protectedslot |
Called when color theme changed via combobox in settings dialog.
|
slot |
Call to adapt color theme used for coloring by a qualitative parameter.
| void iAQSplom::setData | ( | QSharedPointer< iASPLOMData > | data, |
| std::vector< char > const & | visibility | ||
| ) |
|
slot |
set whether to flip parameters in large scatterplot
|
slot |
set the number of histogram bins
|
slot |
set visibility of histograms
| void iAQSplom::setLookupTable | ( | iALookupTable & | lut, |
| size_t | paramIndex | ||
| ) |
Set lookup table given the index of a parameter to color-code.
| void iAQSplom::setLookupTable | ( | vtkLookupTable * | lut, |
| const QString & | paramName | ||
| ) |
retrieve SPLOM data
Set lookup table from VTK (vtkLookupTable) given the name of a parameter to color-code.
| void iAQSplom::setParameterInverted | ( | size_t | paramIndex, |
| bool | isInverted | ||
| ) |
whether to invert the axis for a given parameter's index.
| void iAQSplom::setParameterVisibility | ( | const QString & | paramName, |
| bool | isVisible | ||
| ) |
Show/hide scatter plots of a parameter given parameter's name.
| void iAQSplom::setParameterVisibility | ( | size_t | paramIndex, |
| bool | isVisible | ||
| ) |
Show/hide scatter plots of a parameter given parameter's index.
| void iAQSplom::setParameterVisibility | ( | std::vector< char > const & | visibility | ) |
Adapt visibility of all parameters at once.
| void iAQSplom::setPointColor | ( | QColor const & | color | ) |
set the color for all data points
| void iAQSplom::setPointOpacity | ( | double | opacity | ) |
set the opaci ty for all data points
| void iAQSplom::setPointRadius | ( | double | radius | ) |
set the radius for scatter plot points
| void iAQSplom::setSelectionColor | ( | QColor | color | ) |
set the color for selected points
|
slot |
set selection mode to either rectangle or polygon mode
| void iAQSplom::setSeparation | ( | int | idx | ) |
define an index at which a separation margin is inserted
| void iAQSplom::showAllPlots | ( | const bool | enableAllPlotsVisible | ) |
switch between showing all plots or only upper half
| void iAQSplom::showDefaultMaxizimedPlot | ( | ) |
maximize plot in upper left corner
|
slot |
Show the settings dialog.
|
protected |
Updates the rectangle of the maximized scatter plot.
|
protected |
Updates some parameters used for the matrix grid layout calculations.
|
protected |
Updates SPLOM layout: every plot in the matrix + maximized plot (if exists).
|
protected |
Updates matrix using only plots that are currently visible.
| QSharedPointer< iAScatterPlotViewData > iAQSplom::viewData | ( | ) |
| int iAQSplom::visibleParametersCount | ( | ) | const |
Get the number of parameters currently displayed.
|
overrideprotected |
Overrides of Qt event handlers.
|
protected |
scatter plot that user currently interacts with
|
protected |
background colors for regions in the scatterplot
|
protected |
index of the column to use for color lookup (TODO: Move to settings?)
|
protected |
sub-menu of the context menu for picking which columns are visible
|
protected |
the context menu (can be extended via addContextMenuAction)
|
protected |
lookup table, shared with individual scatter plots
|
protected |
cache for all scatter plots
|
protected |
pointer to the maximized plot
|
protected |
SPLOM current state: all plots or upper triangle with maximized plot (TODO: Move to settings?)
|
protected |
array of individual parameter visibility
|
protected |
height of the last drawn popup
|
protected |
plot currently being previewed (shown in maximized plot)
|
protected |
size of one scatter plot in the layout
|
protected |
index at which to separate scatterplots spatially (e.g. into in- and output parameters)
|
protected |
contains raw data points used in SPLOM
|
protected |
|
protected |
stores mapping from visible plot index to parameter index
|
protected |
matrix of visible scatter plots
| Settings iAQSplom::settings |