70 , m_pPixmapColorbar(NULL)
81 , m_pPixmapColorbar(NULL)
93 , m_pPixmapColorbar(NULL)
104 , m_pPixmapData(NULL)
105 , m_pPixmapColorbar(NULL)
148 if(p_dMat.rows() > 0 && p_dMat.cols() > 0)
169 MatrixXd t_dMat = p_fMat.cast<
double>();
178 MatrixXd t_dMat = p_iMat.cast<
double>();
204 QImage t_qImageData(x, y, QImage::Format_RGB32);
205 for(i = 0; i < x; ++i)
206 for(j = 0; j < y; ++j)
209 m_pPixmapData =
new QPixmap(QPixmap::fromImage(t_qImageData));
217 QRgb t_qRgb =
pColorMapper(t_dQuantile*((
double)(m_iColorbarGradSteps-1-j))*1.0);
218 t_qImageColorbar.setPixel(0, j, t_qRgb);
260 if(p_sColorMap ==
"Jet")
262 else if(p_sColorMap ==
"Hot")
264 else if(p_sColorMap ==
"HotNeg1")
266 else if(p_sColorMap ==
"HotNeg2")
268 else if(p_sColorMap ==
"Bone")
270 else if(p_sColorMap ==
"RedBlue")
281 void ImageSc::paintEvent(QPaintEvent *)
283 QPainter painter(
this);
286 QPoint t_qPointTopLeft(0,0);
294 QPixmap t_qPixmapScaledData =
m_pPixmapData->scaled(t_qSizePixmapData, Qt::IgnoreAspectRatio);
296 t_qPointTopLeft.setX((
m_qSizeWidget.width()-t_qPixmapScaledData.width())/2);
297 t_qPointTopLeft.setY((
m_qSizeWidget.height()-t_qPixmapScaledData.height())/2);
299 painter.drawPixmap(t_qPointTopLeft,t_qPixmapScaledData);
301 painter.drawRect(t_qPointTopLeft.x()-1, t_qPointTopLeft.y()-1, t_qPixmapScaledData.width()+1, t_qPixmapScaledData.height()+1);
309 t_qSizePixmapColorbar.setHeight(t_qPixmapScaledData.height());
312 QPixmap t_qPixmapScaledColorbar =
m_pPixmapColorbar->scaled(t_qSizePixmapColorbar, Qt::IgnoreAspectRatio);
314 t_qPointTopLeft.setY(t_qPointTopLeft.y());
315 t_qPointTopLeft.setX(t_qPointTopLeft.x() + t_qPixmapScaledData.width() +
m_iBorderLeftRight/3);
317 painter.drawPixmap(t_qPointTopLeft,t_qPixmapScaledColorbar);
319 painter.drawRect(t_qPointTopLeft.x()-1, t_qPointTopLeft.y()-1,
m_iColorbarWidth+1, t_qPixmapScaledData.height()+1);
332 painter.translate(x, y_max-1);
333 painter.drawText(QRect(0, 0, 100, 12), Qt::AlignLeft, QString::number(
m_dMaxValue));
337 painter.drawLine(x_markLeft,y_max_mark,x_markLeft+2,y_max_mark);
338 painter.drawLine(x_markRight-3,y_max_mark,x_markRight-1,y_max_mark);
342 qint32 y_min = t_qPointTopLeft.y() + t_qSizePixmapColorbar.height()-1 -
m_qFontColorbar.pixelSize()/2;
343 painter.translate(x, y_min-1);
344 painter.drawText(QRect(0, 0, 100, 12), Qt::AlignLeft, QString::number(
m_dMinValue));
348 painter.drawLine(x_markLeft,y_min_mark,x_markLeft+2,y_min_mark);
349 painter.drawLine(x_markRight-3,y_min_mark,x_markRight-1,y_min_mark);
352 qint32 y_dist = y_min - y_max;
355 qint32 y_current = y_min - (minPercent*y_dist);
356 qint32 y_current_mark;
361 painter.translate(x, y_current-1);
362 painter.drawText(QRect(0, 0, 100, 12), Qt::AlignLeft, QString::number(
m_qVecScaleValues[i]));
366 painter.drawLine(x_markLeft,y_current_mark,x_markLeft+2,y_current_mark);
367 painter.drawLine(x_markRight-3,y_current_mark,x_markRight-1,y_current_mark);
369 y_current -= distPercent*y_dist;
374 Graph::drawLabels(t_qPixmapScaledData.width(), t_qPixmapScaledData.height());
ColorMap class declaration.
ImageSc(QWidget *parent=0)
ImageSc class declaration.
MatrixXd m_matCentNormData
QVector< double > m_qVecScaleValues
qint32 m_iBorderLeftRight
static QRgb valueToHot(double v)
QPixmap * m_pPixmapColorbar
static QRgb valueToHotNegative2(double v)
static QRgb valueToJet(double v)
static QRgb valueToHotNegative1(double v)
qint32 m_iBorderTopBottom
qint32 m_iColorbarGradSteps
static QRgb valueToBone(double v)
void updateData(MatrixXd &p_dMat)
static QRgb valueToRedBlue(double v)
void setColorMap(const QString &p_sColorMap)
QRgb(* pColorMapper)(double)