Computer Assited Medical Intervention Tool Kit  version 5.0
ImageLutWidget Class Reference

The class ImageLutWidget defines a widget controling the Look Up Table of an instance of ImageComponent. More...

#include <ImageLutWidget.h>

+ Inheritance diagram for ImageLutWidget:
+ Collaboration diagram for ImageLutWidget:

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...
 
HistogramGraphicsRectItemhistogramGraphicsRectItem
 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...
 
ImageLutModelmodel
 the current image LUT model (histogram, etc...) More...
 
camitk::ImageComponentmyComponent
 the current ImageComponent More...
 
Ui::ui_ImageLutWidget ui
 the Qt GUI (build by ImageLutWidget.ui) More...
 

Detailed Description

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.

Note
The ui is defined in the corresponding ImageLutWidget.ui

Constructor & Destructor Documentation

◆ ImageLutWidget()

ImageLutWidget::ImageLutWidget ( QWidget *  parent = nullptr)

Default construtor.

References applyLUT(), binComboBoxChanged(), histogramGraphicsRectItem, invertButtonClicked(), levelSliderChanged(), levelSpinBoxChanged(), model, myComponent, resetLUT(), setMaxColor(), setMinColor(), ui, windowSliderChanged(), and windowSpinBoxChanged().

+ Here is the call graph for this function:

◆ ~ImageLutWidget()

ImageLutWidget::~ImageLutWidget ( )
override

destructor

References allModels.

Member Function Documentation

◆ applyLUT

void ImageLutWidget::applyLUT ( )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ binComboBoxChanged

void ImageLutWidget::binComboBoxChanged ( QString  value)
privateslot

change the number of histogram bins

References applyLUT(), ImageLutModel::getNumberOfBins(), model, ImageLutModel::setNumberOfBins(), and updateBinComboBox().

Referenced by ImageLutWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ blockAllSignals()

void ImageLutWidget::blockAllSignals ( bool  block)
private

block/unblock signals for all the GUI widgets

References ui.

Referenced by initLevel(), initWindow(), levelSliderChanged(), levelSpinBoxChanged(), resetLUT(), setColor(), updateBinComboBox(), windowSliderChanged(), and windowSpinBoxChanged().

+ Here is the caller graph for this function:

◆ drawGraphics()

void ImageLutWidget::drawGraphics ( )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fitView()

void ImageLutWidget::fitView ( )
private

ensure that all graphics are completely visible and only that

References histogramGraphicsRectItem, and ui.

Referenced by resizeEvent(), and showEvent().

+ Here is the caller graph for this function:

◆ initLevel()

void ImageLutWidget::initLevel ( double  value)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initWindow()

void ImageLutWidget::initWindow ( double  value)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invertButtonClicked

void ImageLutWidget::invertButtonClicked ( )
privateslot

Slot called when the invert button is clicked.

References applyLUT(), maxColor, minColor, setColor(), and updateGradient().

Referenced by ImageLutWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ levelSliderChanged

void ImageLutWidget::levelSliderChanged ( int  level)
privateslot

Slot called when the slider for the lut level has changed.

References applyLUT(), blockAllSignals(), ImageLutModel::getLevelFromPercent(), model, and ui.

Referenced by ImageLutWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ levelSpinBoxChanged

void ImageLutWidget::levelSpinBoxChanged ( double  level)
privateslot

Slot called when the level sping box has changed.

References applyLUT(), blockAllSignals(), ImageLutModel::getPercentFromLevel(), model, and ui.

Referenced by ImageLutWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetLUT

void ImageLutWidget::resetLUT ( )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resizeEvent()

void ImageLutWidget::resizeEvent ( QResizeEvent *  )
overrideprotected

overwritten from QWidget to ensure fit in view, see fitView()

References fitView().

+ Here is the call graph for this function:

◆ setColor()

bool ImageLutWidget::setColor ( QString  whichColor,
QColor  newColor 
)
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

Parameters
whichColorQString parameter specify which button is to set. It should be either "min" or "max"
newColorthe new color value to use
Returns
true if whichColor and color are valid and the background was set

References blockAllSignals(), maxColor, minColor, and ui.

Referenced by invertButtonClicked(), resetLUT(), setMaxColor(), setMinColor(), and updateComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMaxColor

void ImageLutWidget::setMaxColor ( )
privateslot

slot called when the max color button is clicked

References applyLUT(), maxColor, setColor(), and updateGradient().

Referenced by ImageLutWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMinColor

void ImageLutWidget::setMinColor ( )
privateslot

slot called when the min color button is clicked

References applyLUT(), minColor, setColor(), and updateGradient().

Referenced by ImageLutWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showEvent()

void ImageLutWidget::showEvent ( QShowEvent *  )
overrideprotected

overwritten from QWidget to ensure fit in view, see fitView()

References fitView().

+ Here is the call graph for this function:

◆ showHistogramTooltip()

void ImageLutWidget::showHistogramTooltip ( QPointF  mousePos)

show tool tip from the histogramGraphicsRectItem

References ImageLutModel::getBinValue(), ImageLutModel::getMaxValue(), ImageLutModel::getMinValue(), ImageLutModel::getNumberOfBins(), histogramGraphicsRectItem, and model.

+ Here is the call graph for this function:

◆ updateBinComboBox()

void ImageLutWidget::updateBinComboBox ( )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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().

+ Here is the call graph for this function:

◆ updateGradient()

void ImageLutWidget::updateGradient ( )
private

update the gradient display in the widget

References maxColor, minColor, and ui.

Referenced by invertButtonClicked(), resetLUT(), setMaxColor(), setMinColor(), and updateComponent().

+ Here is the caller graph for this function:

◆ windowSliderChanged

void ImageLutWidget::windowSliderChanged ( int  window)
privateslot

Slot called when the slider for the window width has changed.

References applyLUT(), blockAllSignals(), ImageLutModel::getWindowFromPercent(), model, and ui.

Referenced by ImageLutWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ windowSpinBoxChanged

void ImageLutWidget::windowSpinBoxChanged ( double  window)
privateslot

Slot called when the line edit for the window width has changed.

References applyLUT(), blockAllSignals(), ImageLutModel::getPercentFromWindow(), model, and ui.

Referenced by ImageLutWidget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ allModels

QMap<camitk::ImageComponent*, ImageLutModel*> ImageLutWidget::allModels
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().

◆ histogramGraphicsRectItem

HistogramGraphicsRectItem* ImageLutWidget::histogramGraphicsRectItem
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().

◆ maxColor

QColor ImageLutWidget::maxColor
private

◆ minColor

QColor ImageLutWidget::minColor
private

min and max colors

Referenced by applyLUT(), invertButtonClicked(), setColor(), setMinColor(), and updateGradient().

◆ model

◆ myComponent

camitk::ImageComponent* ImageLutWidget::myComponent
private

the current ImageComponent

Referenced by applyLUT(), drawGraphics(), ImageLutWidget(), and updateComponent().

◆ ui


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