Computer Assited Medical Intervention Tool Kit  version 4.1
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
ImageLutWidget Class Reference

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

#include <ImageLutWidget.h>

Inherits QWidget.

Public Member Functions

 ImageLutWidget (QWidget *parent=nullptr)
 Default construtor. 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 invertButtonClicked ()
 Slot called when the invert button is clicked. More...
 
void lineEditLUTLevelChanged ()
 Slot called when the line edit for the lut level has changed. More...
 
void lineEditLUTWindowChanged ()
 Slot called when the line edit for the window width 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 sliderLUTLevelChanged (int)
 Slot called when the slider for the lut level has changed. More...
 
void sliderLUTWindowChanged (int)
 Slot called when the slider for the window width has changed. More...
 

Private Member Functions

void blockAllSignals (bool)
 block/unblock signals for all the GUI widgets More...
 
void draw ()
 draws the histogram and LUT graphic representation More...
 
template<class DATATYPE >
void fillHistogramTable (DATATYPE *data, unsigned int dataDim, DATATYPE minVal, DATATYPE maxVal)
 fill the data for the histogram More...
 
void fitView ()
 ensure that all graphics are completely visible and only that More...
 
void initLevelGUI (int min, int max, int value)
 Init level slider and text with its minimum, maximum and current value. More...
 
void initSlider (QSlider *slider, int min, int max, int value)
 init a slider More...
 
void initWindowGUI (int min, int max, int value)
 Init window slider and text with its minimum, maximum and current value. More...
 
void updateGradient ()
 update the gradient display in the widget More...
 

Private Attributes

double * greyLevels
 Table containing histogram bins. More...
 
double highestGreyLevel
 highest number of grey level (highest value in greyLevels array) More...
 
bool invert
 does the user asked for an invert LUT More...
 
double lutMax
 Min the possible data value (given by the data type of the image) More...
 
double lutMin
 Min the possible data value (given by the data type of the image) More...
 
camitk::ImageComponentmyComponent
 the current ImageComponent More...
 
unsigned int nbHistoBins
 size of greyLevels More...
 
QGraphicsRectItem * sceneRectItem
 the graphics item around all other item in the graphics view 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.

Note
The ui is defined in the corresponding ImageLutWidget.ui

Constructor & Destructor Documentation

◆ ImageLutWidget()

ImageLutWidget::ImageLutWidget ( QWidget *  parent = nullptr)

◆ ~ImageLutWidget()

ImageLutWidget::~ImageLutWidget ( )
override

destructor

References greyLevels.

Member Function Documentation

◆ applyLUT

void ImageLutWidget::applyLUT ( )
privateslot

◆ blockAllSignals()

void ImageLutWidget::blockAllSignals ( bool  block)
private

block/unblock signals for all the GUI widgets

References ui.

Referenced by lineEditLUTLevelChanged(), lineEditLUTWindowChanged(), resetLUT(), sliderLUTLevelChanged(), sliderLUTWindowChanged(), and updateComponent().

◆ draw()

void ImageLutWidget::draw ( )
private

◆ fillHistogramTable()

template<class DATATYPE >
void ImageLutWidget::fillHistogramTable ( DATATYPE *  data,
unsigned int  dataDim,
DATATYPE  minVal,
DATATYPE  maxVal 
)
private

fill the data for the histogram

References CAMITK_ERROR, greyLevels, highestGreyLevel, and nbHistoBins.

◆ fitView()

void ImageLutWidget::fitView ( )
private

ensure that all graphics are completely visible and only that

References sceneRectItem, and ui.

Referenced by draw(), resizeEvent(), and showEvent().

◆ initLevelGUI()

void ImageLutWidget::initLevelGUI ( int  min,
int  max,
int  value 
)
private

Init level slider and text with its minimum, maximum and current value.

References initSlider(), and ui.

Referenced by resetLUT(), and updateComponent().

◆ initSlider()

void ImageLutWidget::initSlider ( QSlider *  slider,
int  min,
int  max,
int  value 
)
private

init a slider

Referenced by ImageLutWidget(), initLevelGUI(), and initWindowGUI().

◆ initWindowGUI()

void ImageLutWidget::initWindowGUI ( int  min,
int  max,
int  value 
)
private

Init window slider and text with its minimum, maximum and current value.

References initSlider(), and ui.

Referenced by resetLUT(), and updateComponent().

◆ invertButtonClicked

void ImageLutWidget::invertButtonClicked ( )
privateslot

Slot called when the invert button is clicked.

References applyLUT(), invert, and updateGradient().

Referenced by ImageLutWidget().

◆ lineEditLUTLevelChanged

void ImageLutWidget::lineEditLUTLevelChanged ( )
privateslot

Slot called when the line edit for the lut level has changed.

References applyLUT(), blockAllSignals(), and ui.

Referenced by ImageLutWidget().

◆ lineEditLUTWindowChanged

void ImageLutWidget::lineEditLUTWindowChanged ( )
privateslot

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

References applyLUT(), blockAllSignals(), and ui.

Referenced by ImageLutWidget().

◆ resetLUT

void ImageLutWidget::resetLUT ( )
privatevirtualslot

Slot that reset changed applied to the LUT.

References applyLUT(), blockAllSignals(), initLevelGUI(), initWindowGUI(), invert, lutMax, lutMin, and ui.

Referenced by ImageLutWidget().

◆ resizeEvent()

void ImageLutWidget::resizeEvent ( QResizeEvent *  )
overrideprotected

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

References fitView().

◆ setMaxColor

void ImageLutWidget::setMaxColor ( )
privateslot

slot called when the max color button is clicked

References applyLUT(), ui, and updateGradient().

Referenced by ImageLutWidget().

◆ setMinColor

void ImageLutWidget::setMinColor ( )
privateslot

slot called when the min color button is clicked

References applyLUT(), ui, and updateGradient().

Referenced by ImageLutWidget().

◆ showEvent()

void ImageLutWidget::showEvent ( QShowEvent *  )
overrideprotected

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

References fitView().

◆ sliderLUTLevelChanged

void ImageLutWidget::sliderLUTLevelChanged ( int  level)
privateslot

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

References applyLUT(), blockAllSignals(), and ui.

Referenced by ImageLutWidget().

◆ sliderLUTWindowChanged

void ImageLutWidget::sliderLUTWindowChanged ( int  window)
privateslot

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

References applyLUT(), blockAllSignals(), and ui.

Referenced by ImageLutWidget().

◆ updateComponent()

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

◆ updateGradient()

void ImageLutWidget::updateGradient ( )
private

update the gradient display in the widget

References ui.

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

Member Data Documentation

◆ greyLevels

double* ImageLutWidget::greyLevels
private

Table containing histogram bins.

Note
use double as it can have a high number of pixel of the same number

Referenced by draw(), fillHistogramTable(), ImageLutWidget(), updateComponent(), and ~ImageLutWidget().

◆ highestGreyLevel

double ImageLutWidget::highestGreyLevel
private

highest number of grey level (highest value in greyLevels array)

Note
use double as it can have a high number of pixel of the same number

Referenced by draw(), and fillHistogramTable().

◆ invert

bool ImageLutWidget::invert
private

does the user asked for an invert LUT

Referenced by applyLUT(), invertButtonClicked(), resetLUT(), and updateComponent().

◆ lutMax

double ImageLutWidget::lutMax
private

Min the possible data value (given by the data type of the image)

Referenced by draw(), ImageLutWidget(), resetLUT(), and updateComponent().

◆ lutMin

double ImageLutWidget::lutMin
private

Min the possible data value (given by the data type of the image)

Referenced by draw(), ImageLutWidget(), resetLUT(), and updateComponent().

◆ myComponent

camitk::ImageComponent* ImageLutWidget::myComponent
private

the current ImageComponent

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

◆ nbHistoBins

unsigned int ImageLutWidget::nbHistoBins
private

size of greyLevels

Note
the maximum number of histogram bins is UINT_MAX

Referenced by draw(), fillHistogramTable(), ImageLutWidget(), and updateComponent().

◆ sceneRectItem

QGraphicsRectItem* ImageLutWidget::sceneRectItem
private

the graphics item around all other item in the graphics view

Referenced by draw(), and fitView().

◆ ui

Ui::ui_ImageLutWidget ImageLutWidget::ui
private

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