The class ImageLutWidget defines a widget controling the Look Up Table of an instance of ImageComponent. More...
#include <ImageLutWidget.h>
Public Member Functions | |
ImageLutWidget (QWidget *parent=nullptr) | |
Default construtor. More... | |
void | showHistogramTooltip (QPointF) |
show tool tip from the histogramGraphicsRectItem More... | |
void | updateComponent (camitk::ImageComponent *) |
load the LUT data using the LUT from the image component More... | |
~ImageLutWidget () override | |
destructor More... | |
Protected Member Functions | |
void | resizeEvent (QResizeEvent *) override |
overwritten from QWidget to ensure fit in view, see fitView() More... | |
void | showEvent (QShowEvent *) override |
overwritten from QWidget to ensure fit in view, see fitView() More... | |
Private Slots | |
void | applyLUT () |
Update the component LUT using the GUI values. More... | |
void | binComboBoxChanged (QString) |
change the number of histogram bins More... | |
void | invertButtonClicked () |
Slot called when the invert button is clicked. More... | |
void | levelSliderChanged (int) |
Slot called when the slider for the lut level has changed. More... | |
void | levelSpinBoxChanged (double) |
Slot called when the level sping box has changed. More... | |
virtual void | resetLUT () |
Slot that reset changed applied to the LUT. More... | |
void | setMaxColor () |
slot called when the max color button is clicked More... | |
void | setMinColor () |
slot called when the min color button is clicked More... | |
void | windowSliderChanged (int) |
Slot called when the slider for the window width has changed. More... | |
void | windowSpinBoxChanged (double) |
Slot called when the line edit for the window width has changed. More... | |
Private Member Functions | |
void | blockAllSignals (bool) |
block/unblock signals for all the GUI widgets More... | |
void | drawGraphics () |
draws the histogram and LUT graphic representations More... | |
void | fitView () |
ensure that all graphics are completely visible and only that More... | |
void | initLevel (double value) |
Init level slider and text with its minimum, maximum and current value. More... | |
void | initWindow (double value) |
Init window slider and text with its minimum, maximum and current value. More... | |
bool | setColor (QString whichColor, QColor newColor) |
Update minColor or maxColor attribut and set the given push button background to the given color using stylesheet depending on the whichButton QString. More... | |
void | updateBinComboBox () |
update binComboBox with the actual number of bins in the model More... | |
void | updateGradient () |
update the gradient display in the widget More... | |
Private Attributes | |
QMap< camitk::ImageComponent *, ImageLutModel * > | allModels |
History of all the models computed so far This optimizes the change of images currently selected by the action and avoir re-computation. More... | |
HistogramGraphicsRectItem * | histogramGraphicsRectItem |
the graphics item around all other item in the graphics view (needed to scale the histogram view to this rectangle and to show a tool tip when mouse hover More... | |
QColor | maxColor |
QColor | minColor |
min and max colors More... | |
ImageLutModel * | model |
the current image LUT model (histogram, etc...) More... | |
camitk::ImageComponent * | myComponent |
the current ImageComponent More... | |
Ui::ui_ImageLutWidget | ui |
the Qt GUI (build by ImageLutWidget.ui) More... | |
The class ImageLutWidget defines a widget controling the Look Up Table of an instance of ImageComponent.
Uses double data type to manage the histogram. This allows for managin properly all type of voxel datatype.
ImageLutWidget::ImageLutWidget | ( | QWidget * | parent = nullptr | ) |
Default construtor.
References applyLUT(), binComboBoxChanged(), histogramGraphicsRectItem, invertButtonClicked(), levelSliderChanged(), levelSpinBoxChanged(), model, myComponent, resetLUT(), setMaxColor(), setMinColor(), ui, windowSliderChanged(), and windowSpinBoxChanged().
|
override |
destructor
References allModels.
|
privateslot |
Update the component LUT using the GUI values.
References drawGraphics(), camitk::ImageComponent::getLut(), maxColor, minColor, myComponent, camitk::ImageComponent::refresh(), and ui.
Referenced by binComboBoxChanged(), ImageLutWidget(), invertButtonClicked(), levelSliderChanged(), levelSpinBoxChanged(), resetLUT(), setMaxColor(), setMinColor(), updateComponent(), windowSliderChanged(), and windowSpinBoxChanged().
|
privateslot |
change the number of histogram bins
References applyLUT(), ImageLutModel::getNumberOfBins(), model, ImageLutModel::setNumberOfBins(), and updateBinComboBox().
Referenced by ImageLutWidget().
|
private |
block/unblock signals for all the GUI widgets
References ui.
Referenced by initLevel(), initWindow(), levelSliderChanged(), levelSpinBoxChanged(), resetLUT(), setColor(), updateBinComboBox(), windowSliderChanged(), and windowSpinBoxChanged().
|
private |
draws the histogram and LUT graphic representations
References a, ImageLutModel::getBinIndexAsDouble(), ImageLutModel::getBinValue(), camitk::Viewer::getDockWidget(), camitk::ImageComponent::getLut(), ImageLutModel::getMaxBinValue(), ImageLutModel::getNumberOfBins(), histogramGraphicsRectItem, model, myComponent, and ui.
Referenced by applyLUT().
|
private |
ensure that all graphics are completely visible and only that
References histogramGraphicsRectItem, and ui.
Referenced by resizeEvent(), and showEvent().
|
private |
Init level slider and text with its minimum, maximum and current value.
References blockAllSignals(), ImageLutModel::getMaxValue(), ImageLutModel::getMinValue(), ImageLutModel::getPercentFromLevel(), model, and ui.
Referenced by resetLUT(), and updateComponent().
|
private |
Init window slider and text with its minimum, maximum and current value.
References blockAllSignals(), ImageLutModel::getMaxValue(), ImageLutModel::getMinValue(), ImageLutModel::getPercentFromWindow(), model, and ui.
Referenced by resetLUT(), and updateComponent().
|
privateslot |
Slot called when the invert button is clicked.
References applyLUT(), maxColor, minColor, setColor(), and updateGradient().
Referenced by ImageLutWidget().
|
privateslot |
Slot called when the slider for the lut level has changed.
References applyLUT(), blockAllSignals(), ImageLutModel::getLevelFromPercent(), model, and ui.
Referenced by ImageLutWidget().
|
privateslot |
Slot called when the level sping box has changed.
References applyLUT(), blockAllSignals(), ImageLutModel::getPercentFromLevel(), model, and ui.
Referenced by ImageLutWidget().
|
privatevirtualslot |
Slot that reset changed applied to the LUT.
References applyLUT(), blockAllSignals(), ImageLutModel::getMaxValue(), ImageLutModel::getMinValue(), initLevel(), initWindow(), model, setColor(), and updateGradient().
Referenced by ImageLutWidget().
|
overrideprotected |
|
private |
Update minColor or maxColor attribut and set the given push button background to the given color using stylesheet depending on the whichButton QString.
Also update the transparency states. Guarantees that the UI and minColor/maxColor attributes are coherent
whichColor | QString parameter specify which button is to set. It should be either "min" or "max" |
newColor | the new color value to use |
References blockAllSignals(), maxColor, minColor, and ui.
Referenced by invertButtonClicked(), resetLUT(), setMaxColor(), setMinColor(), and updateComponent().
|
privateslot |
slot called when the max color button is clicked
References applyLUT(), maxColor, setColor(), and updateGradient().
Referenced by ImageLutWidget().
|
privateslot |
slot called when the min color button is clicked
References applyLUT(), minColor, setColor(), and updateGradient().
Referenced by ImageLutWidget().
|
overrideprotected |
void ImageLutWidget::showHistogramTooltip | ( | QPointF | mousePos | ) |
show tool tip from the histogramGraphicsRectItem
References ImageLutModel::getBinValue(), ImageLutModel::getMaxValue(), ImageLutModel::getMinValue(), ImageLutModel::getNumberOfBins(), histogramGraphicsRectItem, and model.
|
private |
update binComboBox with the actual number of bins in the model
References blockAllSignals(), ImageLutModel::getMaxValue(), ImageLutModel::getMinValue(), ImageLutModel::getNumberOfBins(), model, and ui.
Referenced by binComboBoxChanged(), and updateComponent().
void ImageLutWidget::updateComponent | ( | camitk::ImageComponent * | imageComponent | ) |
load the LUT data using the LUT from the image component
References allModels, applyLUT(), camitk::ImageComponent::getImageData(), camitk::ImageComponent::getLut(), initLevel(), initWindow(), model, myComponent, setColor(), updateBinComboBox(), and updateGradient().
|
private |
update the gradient display in the widget
References maxColor, minColor, and ui.
Referenced by invertButtonClicked(), resetLUT(), setMaxColor(), setMinColor(), and updateComponent().
|
privateslot |
Slot called when the slider for the window width has changed.
References applyLUT(), blockAllSignals(), ImageLutModel::getWindowFromPercent(), model, and ui.
Referenced by ImageLutWidget().
|
privateslot |
Slot called when the line edit for the window width has changed.
References applyLUT(), blockAllSignals(), ImageLutModel::getPercentFromWindow(), model, and ui.
Referenced by ImageLutWidget().
|
private |
History of all the models computed so far This optimizes the change of images currently selected by the action and avoir re-computation.
Referenced by updateComponent(), and ~ImageLutWidget().
|
private |
the graphics item around all other item in the graphics view (needed to scale the histogram view to this rectangle and to show a tool tip when mouse hover
Referenced by drawGraphics(), fitView(), ImageLutWidget(), and showHistogramTooltip().
|
private |
Referenced by applyLUT(), invertButtonClicked(), setColor(), setMaxColor(), and updateGradient().
|
private |
min and max colors
Referenced by applyLUT(), invertButtonClicked(), setColor(), setMinColor(), and updateGradient().
|
private |
the current image LUT model (histogram, etc...)
Referenced by binComboBoxChanged(), drawGraphics(), ImageLutWidget(), initLevel(), initWindow(), levelSliderChanged(), levelSpinBoxChanged(), resetLUT(), showHistogramTooltip(), updateBinComboBox(), updateComponent(), windowSliderChanged(), and windowSpinBoxChanged().
|
private |
the current ImageComponent
Referenced by applyLUT(), drawGraphics(), ImageLutWidget(), and updateComponent().
|
private |
the Qt GUI (build by ImageLutWidget.ui)
Referenced by applyLUT(), blockAllSignals(), drawGraphics(), fitView(), ImageLutWidget(), initLevel(), initWindow(), levelSliderChanged(), levelSpinBoxChanged(), setColor(), updateBinComboBox(), updateGradient(), windowSliderChanged(), and windowSpinBoxChanged().