| 149 | } |
| 150 | |
| 151 | void 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 | |
| 186 | void QmitkTransferFunctionCanvas::keyPressEvent(QKeyEvent *e) |
| 187 | { |
nothing calls this directly
no test coverage detected