MCPcopy Create free account
hub / github.com/MITK/MITK / PaintHistogram

Method PaintHistogram

Modules/QtWidgetsExt/src/QmitkTransferFunctionCanvas.cpp:151–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151void QmitkTransferFunctionCanvas::PaintHistogram(QPainter &p)
152{
153 if (m_Histogram)
154 {
155 p.save();
156
157 p.setPen(Qt::gray);
158
159 int displayWidth = contentsRect().width();
160 int displayHeight = contentsRect().height();
161
162 double windowLeft = m_Lower;
163 double windowRight = m_Upper;
164
165 double step = (windowRight - windowLeft) / double(displayWidth);
166
167 double pos = windowLeft;
168
169 for (int x = 0; x < displayWidth; x++)
170 {
171 double left = pos;
172 double right = pos + step;
173
174 float height = m_Histogram->GetRelativeBin(left, right);
175
176 if (height >= 0)
177 p.drawLine(x, displayHeight * (1 - height), x, displayHeight);
178
179 pos += step;
180 }
181
182 p.restore();
183 }
184}
185
186void QmitkTransferFunctionCanvas::keyPressEvent(QKeyEvent *e)
187{

Callers

nothing calls this directly

Calls 2

saveMethod · 0.80
GetRelativeBinMethod · 0.80

Tested by

no test coverage detected