Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkHistogram Class Reference

A QwtPlotItem that renders a histogram as vertical bars in a QwtPlot. More...

#include <QmitkHistogram.h>

Inheritance diagram for QmitkHistogram:
Collaboration diagram for QmitkHistogram:

Public Member Functions

 QmitkHistogram (const QString &title=QString())
 Construct a histogram with a plain text title. More...
 
 QmitkHistogram (const QwtText &title)
 Construct a histogram with a formatted QwtText title. More...
 
 ~QmitkHistogram () override
 Destructor. More...
 
void setData (const QwtIntervalSeriesData &data)
 Set the interval series data for the histogram. More...
 
const QwtIntervalSeriesData & data () const
 Get the current interval series data. More...
 
void setColor (const QColor &color)
 Set the fill color for the histogram bars. More...
 
QColor color () const
 Get the current bar color. More...
 
QRectF boundingRect () const override
 Calculate the bounding rectangle of the histogram data. More...
 
void draw (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override
 Draw the histogram bars onto the given painter. More...
 
void setBaseline (double reference)
 Set the baseline reference value for the histogram. More...
 
double baseline () const
 Get the current baseline reference value. More...
 

Protected Member Functions

virtual void drawBar (QPainter *painter, Qt::Orientation o, const QRect &rect) const
 Draw a single histogram bar with 3D shading. More...
 

Detailed Description

A QwtPlotItem that renders a histogram as vertical bars in a QwtPlot.

Each bar corresponds to an interval sample. Bars are drawn with a 3D shading effect using lighter/darker pen colors. The baseline reference value can be adjusted.

See also
QmitkPlotWidget, QmitkPlotDialog

Definition at line 31 of file QmitkHistogram.h.

Constructor & Destructor Documentation

◆ QmitkHistogram() [1/2]

QmitkHistogram::QmitkHistogram ( const QString &  title = QString())
explicit

Construct a histogram with a plain text title.

Parameters
[in]titleThe title string for the histogram item.

◆ QmitkHistogram() [2/2]

QmitkHistogram::QmitkHistogram ( const QwtText &  title)
explicit

Construct a histogram with a formatted QwtText title.

Parameters
[in]titleThe QwtText title.

◆ ~QmitkHistogram()

QmitkHistogram::~QmitkHistogram ( )
override

Destructor.

Member Function Documentation

◆ baseline()

double QmitkHistogram::baseline ( ) const

Get the current baseline reference value.

Returns
The baseline value.

◆ boundingRect()

QRectF QmitkHistogram::boundingRect ( ) const
override

Calculate the bounding rectangle of the histogram data.

Returns
The bounding rectangle including the baseline.

◆ color()

QColor QmitkHistogram::color ( ) const

Get the current bar color.

Returns
The color.

◆ data()

const QwtIntervalSeriesData& QmitkHistogram::data ( ) const

Get the current interval series data.

Returns
Const reference to the data.

◆ draw()

void QmitkHistogram::draw ( QPainter *  painter,
const QwtScaleMap &  xMap,
const QwtScaleMap &  yMap,
const QRectF &  canvasRect 
) const
override

Draw the histogram bars onto the given painter.

Parameters
[in]painterThe QPainter to draw with.
[in]xMapScale map for the x axis.
[in]yMapScale map for the y axis.
[in]canvasRectThe canvas rectangle (unused).

◆ drawBar()

virtual void QmitkHistogram::drawBar ( QPainter *  painter,
Qt::Orientation  o,
const QRect &  rect 
) const
protectedvirtual

Draw a single histogram bar with 3D shading.

Parameters
[in]painterThe QPainter.
[in]oThe bar orientation.
[in]rectThe rectangle defining the bar area.

◆ setBaseline()

void QmitkHistogram::setBaseline ( double  reference)

Set the baseline reference value for the histogram.

Parameters
[in]referenceThe y value of the baseline.

◆ setColor()

void QmitkHistogram::setColor ( const QColor &  color)

Set the fill color for the histogram bars.

Parameters
[in]colorThe bar color.

◆ setData()

void QmitkHistogram::setData ( const QwtIntervalSeriesData &  data)

Set the interval series data for the histogram.

Parameters
[in]dataThe interval series data containing bin intervals and values.

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