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>

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::~ImageLutWidget ( )
override

destructor

References allModels.

Member Function Documentation

◆ applyLUT

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

◆ blockAllSignals()

void ImageLutWidget::blockAllSignals ( bool  block)
private

◆ drawGraphics()

◆ fitView()

void ImageLutWidget::fitView ( )
private

ensure that all graphics are completely visible and only that

References histogramGraphicsRectItem, and ui.

Referenced by resizeEvent(), and showEvent().

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

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

◆ invertButtonClicked

void ImageLutWidget::invertButtonClicked ( )
privateslot

Slot called when the invert button is clicked.

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

Referenced by ImageLutWidget().

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

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

◆ resetLUT

void ImageLutWidget::resetLUT ( )
privatevirtualslot

◆ resizeEvent()

void ImageLutWidget::resizeEvent ( QResizeEvent *  )
overrideprotected

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

References fitView().

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

◆ setMaxColor

void ImageLutWidget::setMaxColor ( )
privateslot

slot called when the max color button is clicked

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

Referenced by ImageLutWidget().

◆ setMinColor

void ImageLutWidget::setMinColor ( )
privateslot

slot called when the min color button is clicked

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

Referenced by ImageLutWidget().

◆ showEvent()

void ImageLutWidget::showEvent ( QShowEvent *  )
overrideprotected

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

References fitView().

◆ showHistogramTooltip()

void ImageLutWidget::showHistogramTooltip ( QPointF  mousePos)

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

◆ updateComponent()

void ImageLutWidget::updateComponent ( camitk::ImageComponent imageComponent)

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

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

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

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: