![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Histogram widget. More...
#include <ecvHistogramWindow.h>


Public Types | |
| enum | HISTOGRAM_COLOR_SCHEME { USE_SOLID_COLOR , USE_CUSTOM_COLOR_SCALE , USE_SF_SCALE } |
| enum class | AxisDisplayOption { None = 0x0 , XAxis = 0x01 , YAxis = 0x02 , All = XAxis | YAxis } |
| enum class | SFInteractionMode { None = 0x0 , DisplayRange = 0x01 , SaturationRange = 0x02 , All = DisplayRange | SaturationRange } |
Signals | |
| void | sfMinDispValChanged (double) |
| void | sfMaxDispValChanged (double) |
| void | sfMinSatValChanged (double) |
| void | sfMaxSatValChanged (double) |
Public Member Functions | |
| ccHistogramWindow (QWidget *parent=0) | |
| Default constructor. More... | |
| virtual | ~ccHistogramWindow () |
| Destructor. More... | |
| void | setTitle (const QString &str) |
| Sets title. More... | |
| void | setAxisLabels (const QString &xLabel, const QString &yLabel) |
| Sets axis labels. More... | |
| void | fromSF (ccScalarField *sf, unsigned initialNumberOfClasses=0, bool numberOfClassesCanBeChanged=true, bool showNaNValuesInGrey=true) |
| Computes histogram from a scalar field. More... | |
| void | fromBinArray (const std::vector< unsigned > &histoValues, double minVal, double maxVal) |
| void | setCurveValues (const std::vector< double > &curveValues) |
| Sets overlay curve values. More... | |
| void | setColorScheme (HISTOGRAM_COLOR_SCHEME scheme) |
| Sets how the gradient bars should be colored. More... | |
| void | setSolidColor (QColor color) |
| Sets solid color. More... | |
| void | setColorScale (ccColorScale::Shared scale) |
| Sets gradient color scale. More... | |
| void | clear () |
| Clears the display. More... | |
| void | refresh () |
| Updates the display. More... | |
| void | refreshBars () |
| Updates the histogram bars only. More... | |
| const std::vector< unsigned > & | histoValues () const |
| Returns the current histogram bins. More... | |
| double | minVal () const |
| Returns the current histogram min value. More... | |
| double | maxVal () const |
| Returns the current histogram max value. More... | |
| void | setSFInteractionMode (SFInteractionModes modes) |
| Enables SF interaction mode. More... | |
| void | setAxisDisplayOption (AxisDisplayOptions axisOptions) |
| void | setRefreshAfterResize (bool refreshAfterResize) |
| void | setMinDispValue (double) |
| void | setMaxDispValue (double) |
| void | setMinSatValue (double) |
| void | setMaxSatValue (double) |
Protected Types | |
| enum | SELECTABLE_ITEMS { NONE , LEFT_AREA , RIGHT_AREA , BOTH_AREAS , LEFT_ARROW , RIGHT_ARROW , BOTH_ARROWS } |
| Selectable items in "SF interaction" mode. More... | |
Protected Member Functions | |
| void | setNumberOfClasses (size_t n) |
| Changes the current number of classes. More... | |
| void | mousePressEvent (QMouseEvent *event) |
| void | mouseMoveEvent (QMouseEvent *event) |
| void | wheelEvent (QWheelEvent *event) |
| void | resizeEvent (QResizeEvent *event) |
| unsigned | getMaxHistoVal () |
| Returns current maximum bin size. More... | |
| bool | computeBinArrayFromSF (size_t binCount) |
| Dynamically computes histogram bins from scalar field. More... | |
| void | updateOverlayCurveWidth (int w, int h) |
| Updates overlay curve width depending on the widget display size. More... | |
Histogram widget.
Definition at line 28 of file ecvHistogramWindow.h.
|
strong |
| Enumerator | |
|---|---|
| None | |
| XAxis | |
| YAxis | |
| All | |
Definition at line 111 of file ecvHistogramWindow.h.
| Enumerator | |
|---|---|
| USE_SOLID_COLOR | |
| USE_CUSTOM_COLOR_SCALE | |
| USE_SF_SCALE | |
Definition at line 75 of file ecvHistogramWindow.h.
|
protected |
Selectable items in "SF interaction" mode.
| Enumerator | |
|---|---|
| NONE | |
| LEFT_AREA | |
| RIGHT_AREA | |
| BOTH_AREAS | |
| LEFT_ARROW | |
| RIGHT_ARROW | |
| BOTH_ARROWS | |
Definition at line 218 of file ecvHistogramWindow.h.
|
strong |
| Enumerator | |
|---|---|
| None | |
| DisplayRange | |
| SaturationRange | |
| All | |
Definition at line 120 of file ecvHistogramWindow.h.
|
explicit |
Default constructor.
Definition at line 35 of file ecvHistogramWindow.cpp.
References m_renderingFont.
|
virtual |
Destructor.
Definition at line 85 of file ecvHistogramWindow.cpp.
| void ccHistogramWindow::clear | ( | void | ) |
Clears the display.
Definition at line 87 of file ecvHistogramWindow.cpp.
References refresh().
Referenced by ccColorFromScalarDlg::updateChannel(), ccColorLevelsDlg::updateHistogram(), and ccColorFromScalarDlg::updateHistogram().
|
protected |
Dynamically computes histogram bins from scalar field.
Definition at line 179 of file ecvHistogramWindow.cpp.
References count, cloudViewer::ScalarField::currentSize(), CVLog::Error(), cloudViewer::utility::floor(), ccScalarField::getHistogram(), cloudViewer::ScalarField::getValue(), m_associatedSF, m_histoValues, m_maxVal, m_minVal, min(), and CVLog::Warning().
Referenced by setNumberOfClasses().
| void ccHistogramWindow::fromBinArray | ( | const std::vector< unsigned > & | histoValues, |
| double | minVal, | ||
| double | maxVal | ||
| ) |
Creates histogram from a bin array (each bin = number of elements per class) Number of classes can't be modified.
| histoValues | array of bins |
| minVal | minimum value |
| maxVal | maximum value |
Definition at line 153 of file ecvHistogramWindow.cpp.
References getMaxHistoVal(), histoValues(), m_histoValues, m_maxHistoVal, m_maxVal, m_minVal, m_numberOfClassesCanBeChanged, maxVal(), minVal(), and CVLog::Warning().
Referenced by ccColorFromScalarDlg::ccColorFromScalarDlg(), ccEntityAction::computeStatParams(), MainWindow::spawnHistogramDialog(), and ccColorLevelsDlg::updateHistogram().
| void ccHistogramWindow::fromSF | ( | ccScalarField * | sf, |
| unsigned | initialNumberOfClasses = 0, |
||
| bool | numberOfClassesCanBeChanged = true, |
||
| bool | showNaNValuesInGrey = true |
||
| ) |
Computes histogram from a scalar field.
Number of classes can be freely modified afterwards (if enabled).
| sf | associated scalar field |
| initialNumberOfClasses | initial number of classes |
| numberOfClassesCanBeChanged | whether to allow the user to modify the number of classes |
| showNaNValuesInGrey | show NaN values (in gray) |
Definition at line 127 of file ecvHistogramWindow.cpp.
References ccScalarField::displayRange(), cloudViewer::ScalarField::getMax(), cloudViewer::ScalarField::getMin(), CCShareable::link(), m_associatedSF, m_maxVal, m_minVal, m_numberOfClassesCanBeChanged, CCShareable::release(), setColorScheme(), setNumberOfClasses(), ccScalarField::Range::start(), ccScalarField::Range::stop(), and USE_SF_SCALE.
Referenced by sfEditDlg::fillDialogWith(), ccComparisonDlg::showHisto(), and ccColorFromScalarDlg::updateChannel().
|
protected |
Returns current maximum bin size.
Definition at line 245 of file ecvHistogramWindow.cpp.
References m_histoValues, m_maxHistoVal, and max().
Referenced by fromBinArray(), and setNumberOfClasses().
|
inline |
Returns the current histogram bins.
Definition at line 102 of file ecvHistogramWindow.h.
References m_histoValues.
Referenced by ccHistogramWindowDlg::exportToCSV(), and fromBinArray().
|
inline |
Returns the current histogram max value.
Definition at line 108 of file ecvHistogramWindow.h.
References m_maxVal.
Referenced by ccHistogramWindowDlg::exportToCSV(), fromBinArray(), and refresh().
|
inline |
Returns the current histogram min value.
Definition at line 106 of file ecvHistogramWindow.h.
References m_minVal.
Referenced by ccHistogramWindowDlg::exportToCSV(), fromBinArray(), and refresh().
|
protected |
Definition at line 710 of file ecvHistogramWindow.cpp.
References BOTH_AREAS, BOTH_ARROWS, QCPSelectableCursor::currentVal(), event, LEFT_AREA, LEFT_ARROW, m_areaLeft, m_areaRight, m_arrowLeft, m_arrowRight, m_drawVerticalIndicator, m_histogram, m_histoValues, m_lastMouseClick, m_selectedItem, m_sfInteractionModes, m_verticalIndicatorPositionPercent, max(), min(), NONE, QCPSelectableCursor::pixelToKey(), QCPColoredBars::rect(), refresh(), RIGHT_AREA, RIGHT_ARROW, setMaxDispValue(), setMaxSatValue(), setMinDispValue(), setMinSatValue(), rect::width, and rect::x.
Referenced by mousePressEvent().
|
protected |
Definition at line 676 of file ecvHistogramWindow.cpp.
References BOTH_AREAS, BOTH_ARROWS, DisplayRange, event, QCPSelectableCursor::isSelectable(), LEFT_AREA, LEFT_ARROW, m_areaLeft, m_areaRight, m_arrowLeft, m_arrowRight, m_lastMouseClick, m_selectedItem, m_sfInteractionModes, mouseMoveEvent(), NONE, RIGHT_AREA, RIGHT_ARROW, and SaturationRange.
| void ccHistogramWindow::refresh | ( | ) |
Updates the display.
Definition at line 323 of file ecvHistogramWindow.cpp.
References QCPBarsWithText::appendText(), ecvColor::RgbTpl< Type >::b, colors, ecvColor::darkGrey(), ecvGui::ParamStruct::displayedNumPrecision, DisplayRange, ccScalarField::displayRange(), ecvColor::RgbTpl< Type >::g, ccScalarField::getColor(), ccScalarField::getColorRampSteps(), ccScalarField::getColorScale(), ccColorScalesManager::GetDefaultScale(), height, ecvColor::lightGrey(), m_areaLeft, m_areaLeftlastValue, m_areaRight, m_areaRightlastValue, m_arrowLeft, m_arrowLeftlastValue, m_arrowRight, m_arrowRightlastValue, m_associatedSF, m_axisDisplayOptions, m_colorScale, m_colorScheme, m_curveValues, m_drawVerticalIndicator, m_histogram, m_histoValues, m_maxHistoVal, m_maxVal, m_minVal, m_overlayCurve, m_renderingFont, m_sfInteractionModes, m_solidColor, m_titlePlot, m_titleStr, m_vertBar, m_verticalIndicatorPositionPercent, ccScalarField::Range::max(), max(), maxVal(), ccScalarField::Range::min(), min(), minVal(), ecvGui::Parameters(), ecvColor::RgbTpl< Type >::r, ecvColor::red(), SaturationRange, ccScalarField::saturationRange(), QCPArrow::setColor(), QCPSelectableCursor::setCurrentVal(), QCPColoredBars::setData(), QCPSelectableCursor::setRange(), QCPBarsWithText::setText(), QCPBarsWithText::setTextAlignment(), ccScalarField::Range::start(), ccScalarField::Range::stop(), ccScalarField::symmetricalScale(), updateOverlayCurveWidth(), USE_CUSTOM_COLOR_SCALE, USE_SF_SCALE, USE_SOLID_COLOR, width, XAxis, and YAxis.
Referenced by clear(), ccEntityAction::computeStatParams(), sfEditDlg::logScaleChanged(), mouseMoveEvent(), resizeEvent(), MainWindow::spawnHistogramDialog(), sfEditDlg::symmetricalScaleChanged(), ccColorLevelsDlg::updateHistogram(), ccColorFromScalarDlg::updateHistogram(), and wheelEvent().
| void ccHistogramWindow::refreshBars | ( | ) |
Updates the histogram bars only.
Only works if a SF is associated and color scheme is USE_SF_SCALE.
Definition at line 276 of file ecvHistogramWindow.cpp.
References ecvColor::RgbTpl< Type >::b, QCPColoredBars::clearData(), colors, ecvColor::RgbTpl< Type >::g, ccScalarField::getColor(), ccScalarField::getColorScale(), ecvColor::lightGrey(), m_associatedSF, m_colorScheme, m_histogram, m_histoValues, m_maxVal, m_minVal, ecvColor::RgbTpl< Type >::r, QCPColoredBars::setData(), and USE_SF_SCALE.
Referenced by setMaxDispValue(), setMaxSatValue(), setMinDispValue(), and setMinSatValue().
|
protected |
Definition at line 667 of file ecvHistogramWindow.cpp.
References event, m_refreshAfterResize, refresh(), and updateOverlayCurveWidth().
| void ccHistogramWindow::setAxisDisplayOption | ( | AxisDisplayOptions | axisOptions | ) |
Definition at line 315 of file ecvHistogramWindow.cpp.
References m_axisDisplayOptions.
Referenced by ccColorFromScalarDlg::updateHistogram().
| void ccHistogramWindow::setAxisLabels | ( | const QString & | xLabel, |
| const QString & | yLabel | ||
| ) |
Sets axis labels.
Definition at line 108 of file ecvHistogramWindow.cpp.
Referenced by ccEntityAction::computeStatParams(), ccComparisonDlg::showHisto(), MainWindow::spawnHistogramDialog(), ccColorLevelsDlg::updateHistogram(), and ccColorFromScalarDlg::updateHistogram().
|
inline |
Sets gradient color scale.
Only used if color scheme is set to USE_CUSTOM_COLOR_SCALE.
Definition at line 90 of file ecvHistogramWindow.h.
References m_colorScale.
Referenced by ccEntityAction::computeStatParams().
|
inline |
Sets how the gradient bars should be colored.
Definition at line 81 of file ecvHistogramWindow.h.
References m_colorScheme.
Referenced by ccColorLevelsDlg::ccColorLevelsDlg(), ccEntityAction::computeStatParams(), and fromSF().
| void ccHistogramWindow::setCurveValues | ( | const std::vector< double > & | curveValues | ) |
Sets overlay curve values.
The curve will only appear over an histogram
| curveValues | curve points 'Y' coordinates only (regularly sampled between the min and max histogram values) |
Definition at line 170 of file ecvHistogramWindow.cpp.
References m_curveValues, and CVLog::Warning().
Referenced by ccEntityAction::computeStatParams().
| void ccHistogramWindow::setMaxDispValue | ( | double | val | ) |
Definition at line 605 of file ecvHistogramWindow.cpp.
References QCPSelectableCursor::currentVal(), m_areaRight, m_areaRightlastValue, m_associatedSF, refreshBars(), QCPSelectableCursor::setCurrentVal(), ccScalarField::setMaxDisplayed(), and sfMaxDispValChanged().
Referenced by sfEditDlg::maxValSBChanged(), and mouseMoveEvent().
| void ccHistogramWindow::setMaxSatValue | ( | double | val | ) |
Definition at line 639 of file ecvHistogramWindow.cpp.
References QCPSelectableCursor::currentVal(), m_arrowRight, m_arrowRightlastValue, m_associatedSF, refreshBars(), QCPSelectableCursor::setCurrentVal(), ccScalarField::setSaturationStop(), and sfMaxSatValChanged().
Referenced by ccColorFromScalarDlg::maxChanged(), sfEditDlg::maxSatSBChanged(), mouseMoveEvent(), and ccColorFromScalarDlg::setDefaultSatValuePerChannel().
| void ccHistogramWindow::setMinDispValue | ( | double | val | ) |
Definition at line 588 of file ecvHistogramWindow.cpp.
References QCPSelectableCursor::currentVal(), m_areaLeft, m_areaLeftlastValue, m_associatedSF, refreshBars(), QCPSelectableCursor::setCurrentVal(), ccScalarField::setMinDisplayed(), and sfMinDispValChanged().
Referenced by sfEditDlg::minValSBChanged(), and mouseMoveEvent().
| void ccHistogramWindow::setMinSatValue | ( | double | val | ) |
Definition at line 622 of file ecvHistogramWindow.cpp.
References QCPSelectableCursor::currentVal(), m_arrowLeft, m_arrowLeftlastValue, m_associatedSF, refreshBars(), QCPSelectableCursor::setCurrentVal(), ccScalarField::setSaturationStart(), and sfMinSatValChanged().
Referenced by ccColorFromScalarDlg::minChanged(), sfEditDlg::minSatSBChanged(), mouseMoveEvent(), and ccColorFromScalarDlg::setDefaultSatValuePerChannel().
|
protected |
Changes the current number of classes.
Warning: n should be a multiple of 4.
Definition at line 255 of file ecvHistogramWindow.cpp.
References computeBinArrayFromSF(), getMaxHistoVal(), m_associatedSF, m_histoValues, and m_maxHistoVal.
Referenced by fromSF(), and wheelEvent().
| void ccHistogramWindow::setRefreshAfterResize | ( | bool | refreshAfterResize | ) |
Definition at line 319 of file ecvHistogramWindow.cpp.
References m_refreshAfterResize.
Referenced by ccColorFromScalarDlg::ccColorFromScalarDlg().
| void ccHistogramWindow::setSFInteractionMode | ( | SFInteractionModes | modes | ) |
Enables SF interaction mode.
Definition at line 311 of file ecvHistogramWindow.cpp.
References m_sfInteractionModes.
Referenced by sfEditDlg::sfEditDlg(), and ccColorFromScalarDlg::updateHistogram().
|
inline |
Sets solid color.
Only used if color scheme is set to USE_SOLID_COLOR.
Definition at line 87 of file ecvHistogramWindow.h.
References color, and m_solidColor.
Referenced by ccColorLevelsDlg::ccColorLevelsDlg(), and ccColorLevelsDlg::updateHistogram().
| void ccHistogramWindow::setTitle | ( | const QString & | str | ) |
Sets title.
Definition at line 106 of file ecvHistogramWindow.cpp.
References m_titleStr.
Referenced by ccEntityAction::computeStatParams(), ccComparisonDlg::showHisto(), and MainWindow::spawnHistogramDialog().
|
signal |
Referenced by setMaxDispValue(), and sfEditDlg::sfEditDlg().
|
signal |
Referenced by ccColorFromScalarDlg::ccColorFromScalarDlg(), setMaxSatValue(), and sfEditDlg::sfEditDlg().
|
signal |
Referenced by setMinDispValue(), and sfEditDlg::sfEditDlg().
|
signal |
Referenced by ccColorFromScalarDlg::ccColorFromScalarDlg(), setMinSatValue(), and sfEditDlg::sfEditDlg().
|
protected |
Updates overlay curve width depending on the widget display size.
Definition at line 656 of file ecvHistogramWindow.cpp.
References m_overlayCurve, and max().
Referenced by refresh(), and resizeEvent().
|
protected |
Definition at line 822 of file ecvHistogramWindow.cpp.
References m_histoValues, m_numberOfClassesCanBeChanged, qtCompatWheelEventDelta(), refresh(), and setNumberOfClasses().
|
protected |
Left greyed area.
Definition at line 231 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), mousePressEvent(), refresh(), and setMinDispValue().
|
protected |
Definition at line 232 of file ecvHistogramWindow.h.
Referenced by refresh(), and setMinDispValue().
|
protected |
Right greyed area.
Definition at line 234 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), mousePressEvent(), refresh(), and setMaxDispValue().
|
protected |
Definition at line 235 of file ecvHistogramWindow.h.
Referenced by refresh(), and setMaxDispValue().
|
protected |
Left arrow.
Definition at line 238 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), mousePressEvent(), refresh(), and setMinSatValue().
|
protected |
Definition at line 239 of file ecvHistogramWindow.h.
Referenced by refresh(), and setMinSatValue().
|
protected |
Right arrow.
Definition at line 241 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), mousePressEvent(), refresh(), and setMaxSatValue().
|
protected |
Definition at line 242 of file ecvHistogramWindow.h.
Referenced by refresh(), and setMaxSatValue().
|
protected |
Associated scalar field.
Definition at line 184 of file ecvHistogramWindow.h.
Referenced by computeBinArrayFromSF(), fromSF(), refresh(), refreshBars(), setMaxDispValue(), setMaxSatValue(), setMinDispValue(), setMinSatValue(), and setNumberOfClasses().
|
protected |
Definition at line 211 of file ecvHistogramWindow.h.
Referenced by refresh(), and setAxisDisplayOption().
|
protected |
Gradient color scale.
Definition at line 181 of file ecvHistogramWindow.h.
Referenced by refresh(), and setColorScale().
|
protected |
Color scheme.
Definition at line 177 of file ecvHistogramWindow.h.
Referenced by refresh(), refreshBars(), and setColorScheme().
|
protected |
Definition at line 201 of file ecvHistogramWindow.h.
Referenced by refresh(), and setCurveValues().
|
protected |
Definition at line 205 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), and refresh().
|
protected |
Definition at line 193 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), refresh(), and refreshBars().
|
protected |
Definition at line 194 of file ecvHistogramWindow.h.
Referenced by computeBinArrayFromSF(), fromBinArray(), getMaxHistoVal(), histoValues(), mouseMoveEvent(), refresh(), refreshBars(), setNumberOfClasses(), and wheelEvent().
|
protected |
Last mouse click.
Definition at line 245 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
protected |
Definition at line 197 of file ecvHistogramWindow.h.
Referenced by fromBinArray(), getMaxHistoVal(), refresh(), and setNumberOfClasses().
|
protected |
Definition at line 196 of file ecvHistogramWindow.h.
Referenced by computeBinArrayFromSF(), fromBinArray(), fromSF(), maxVal(), refresh(), and refreshBars().
|
protected |
Definition at line 195 of file ecvHistogramWindow.h.
Referenced by computeBinArrayFromSF(), fromBinArray(), fromSF(), minVal(), refresh(), and refreshBars().
|
protected |
Only possible with an associated scalar field.
Definition at line 188 of file ecvHistogramWindow.h.
Referenced by fromBinArray(), fromSF(), and wheelEvent().
|
protected |
Overlay curve.
Definition at line 200 of file ecvHistogramWindow.h.
Referenced by refresh(), and updateOverlayCurveWidth().
|
protected |
Definition at line 190 of file ecvHistogramWindow.h.
Referenced by resizeEvent(), and setRefreshAfterResize().
|
protected |
Rendering font.
Definition at line 209 of file ecvHistogramWindow.h.
Referenced by ccHistogramWindow(), and refresh().
|
protected |
Currently selected item.
Definition at line 228 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
protected |
Which SF interaction modes are enabled.
Definition at line 215 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), mousePressEvent(), refresh(), and setSFInteractionMode().
|
protected |
Solid color.
Definition at line 179 of file ecvHistogramWindow.h.
Referenced by refresh(), and setSolidColor().
|
protected |
Definition at line 174 of file ecvHistogramWindow.h.
Referenced by refresh().
|
protected |
Definition at line 173 of file ecvHistogramWindow.h.
Referenced by refresh(), and setTitle().
|
protected |
Definition at line 204 of file ecvHistogramWindow.h.
Referenced by refresh().
|
protected |
Definition at line 206 of file ecvHistogramWindow.h.
Referenced by mouseMoveEvent(), and refresh().