00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "PSQt/WdgImage.h"
00010 #include "PSQt/Logger.h"
00011 #include "PSCalib/GeometryAccess.h"
00012 #include "ndarray/ndarray.h"
00013
00014 #include "PSQt/QGUtils.h"
00015
00016 #include <iostream>
00017 #include <fstream>
00018
00019 #include <math.h>
00020 #include <cstring>
00021
00022 namespace PSQt {
00023
00024
00025
00026 WdgImage::WdgImage(QWidget *parent, const std::string& ifname)
00027 : QLabel(parent)
00028 , m_pixmap_raw(0)
00029 , m_pixmap_scl(0)
00030 , m_frame(0)
00031 , m_painter(0)
00032 , m_geo_img(0)
00033 , m_pen1(0)
00034 , m_pen2(0)
00035 , m_point1(0)
00036 , m_point2(0)
00037 , m_rect1(0)
00038 , m_rect2(0)
00039 , p_nda_img_raw(0)
00040 {
00041 MsgInLog(_name_(), DEBUG, "ctor1 - using fname");
00042
00043 setWdgParams();
00044
00045 const std::string fname = (ifname!=std::string()) ? ifname
00046 : "/reg/neh/home1/dubrovin/LCLS/pubs/galaxy.jpeg";
00047
00048 loadImageFromFile(fname);
00049 }
00050
00051
00052
00053 WdgImage::WdgImage(QWidget *parent, const QImage* image)
00054 : QLabel(parent)
00055 , m_pixmap_raw(0)
00056 , m_pixmap_scl(0)
00057 , m_frame(0)
00058 , m_painter(0)
00059 , m_geo_img(0)
00060 , m_pen1(0)
00061 , m_pen2(0)
00062 , m_point1(0)
00063 , m_point2(0)
00064 , m_rect1(0)
00065 , m_rect2(0)
00066 , p_nda_img_raw(0)
00067 {
00068 MsgInLog(_name_(), DEBUG, "ctor2 - using QImage*");
00069
00070 setWdgParams();
00071 setPixmapScailedImage(image);
00072 }
00073
00074
00075
00076 WdgImage::~WdgImage()
00077 {
00078 if (m_frame) delete m_frame;
00079 if (m_painter) delete m_painter;
00080 if (m_pen1) delete m_pen1;
00081 if (m_pen2) delete m_pen2;
00082 if (m_point1) delete m_point1;
00083 if (m_point2) delete m_point2;
00084 if (m_rect1) delete m_rect1;
00085 if (m_rect2) delete m_rect2;
00086 if (m_pixmap_raw) delete m_pixmap_raw;
00087 if (m_pixmap_scl) delete m_pixmap_scl;
00088 }
00089
00090
00091
00092 void
00093 WdgImage::setWdgParams()
00094 {
00095 this -> setMinimumSize(606,606);
00096 this -> setAlignment(Qt::AlignTop | Qt::AlignLeft);
00097 this -> setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
00098 this -> setCursor(Qt::PointingHandCursor);
00099 this -> setMargin(0);
00100
00101
00102 this -> setScaledContents (true);
00103
00104
00105 QVector<qreal> dashes;
00106 qreal space = 4;
00107 dashes << 4 << space;
00108
00109 m_pen1 = new QPen(Qt::black, 1, Qt::DashLine);
00110 m_pen2 = new QPen(Qt::white, 1, Qt::DashLine);
00111 m_pen1->setDashPattern(dashes);
00112 m_pen2->setDashPattern(dashes);
00113 m_pen2->setDashOffset(4);
00114 m_point1 = new QPoint();
00115 m_point2 = new QPoint();
00116 m_rect1 = new QRect();
00117 m_rect2 = new QRect();
00118 m_is_pushed = false;
00119
00120 m_painter = new QPainter();
00121
00122 m_amin = 0;
00123 m_amax = 0;
00124 m_ncolors = 1024;
00125 m_hue1 = -120;
00126 m_hue2 = -360;
00127
00128 this->resetZoom();
00129
00130 connect(this, SIGNAL(zoomIsChanged(int&, int&, int&, int&, float&, float&)),
00131 this, SLOT(testSignalZoomIsChanged(int&, int&, int&, int&, float&, float&)));
00132 }
00133
00134
00135
00136 void
00137 WdgImage::paintEvent(QPaintEvent *event)
00138 {
00139 static unsigned count=0; count++;
00140 QLabel::paintEvent(event);
00141
00142 m_painter->begin(this);
00143
00144 if(m_is_pushed) drawRect();
00145
00146 m_painter->end();
00147
00148
00149 }
00150
00151
00152
00153 void
00154 WdgImage::drawRect()
00155 {
00156 m_rect1->setCoords(m_point1->x(), m_point1->y(), m_point2->x(), m_point2->y());
00157 m_rect2->setCoords(m_point1->x(), m_point1->y(), m_point2->x(), m_point2->y());
00158
00159 m_painter->setPen (*m_pen1);
00160 m_painter->drawRect(*m_rect1);
00161 m_painter->setPen (*m_pen2);
00162 m_painter->drawRect(*m_rect2);
00163 }
00164
00165
00166
00167 void
00168 WdgImage::resetZoom()
00169 {
00170 m_point1->setX(0);
00171 m_point1->setY(0);
00172 m_xmin_raw = 0;
00173 m_ymin_raw = 0;
00174
00175
00176 m_zoom_is_on = false;
00177 }
00178
00179
00180
00181 void
00182 WdgImage::zoomInImage()
00183 {
00184 MsgInLog(_name_(), DEBUG, "zoomInImage()");
00185
00186
00187
00188
00189 if(m_point1->x() != 0 or m_point1->y() != 0) {
00190
00191 float sclx = float(m_pixmap_scl->size().width()) / this->size().width();
00192 float scly = float(m_pixmap_scl->size().height()) / this->size().height();
00193
00194 int p1x = int( m_point1->x()*sclx );
00195 int p1y = int( m_point1->y()*scly );
00196 int p2x = int( m_point2->x()*sclx );
00197 int p2y = int( m_point2->y()*scly );
00198
00199 int xmin = min(p1x, p2x);
00200 int xmax = max(p1x, p2x);
00201 int ymin = min(p1y, p2y);
00202 int ymax = max(p1y, p2y);
00203
00204 m_xmin_raw += xmin;
00205 m_ymin_raw += ymin;
00206 m_xmax_raw = m_xmin_raw + xmax-xmin;
00207 m_ymax_raw = m_ymin_raw + ymax-ymin;
00208
00209 m_point1->setX(0);
00210 m_point1->setY(0);
00211
00212 m_zoom_is_on = true;
00213 }
00214
00215 if (m_zoom_is_on) {
00216 int rw = int(m_pixmap_raw->size().width());
00217 int rh = int(m_pixmap_raw->size().height());
00218
00219 if(m_xmax_raw > m_xmin_raw+rw) m_xmax_raw = m_xmin_raw+rw;
00220 if(m_ymax_raw > m_ymin_raw+rh) m_ymax_raw = m_ymin_raw+rh;
00221
00222 *m_pixmap_scl = m_pixmap_raw->copy(m_xmin_raw, m_ymin_raw, m_xmax_raw-m_xmin_raw, m_ymax_raw-m_ymin_raw);
00223 setPixmap(m_pixmap_scl->scaled(this->size(), Qt::KeepAspectRatio, Qt::FastTransformation));
00224
00225 emit zoomIsChanged(m_xmin_raw, m_ymin_raw, m_xmax_raw, m_ymax_raw, m_amin, m_amax);
00226 }
00227 }
00228
00229
00230
00231 QPointF
00232 WdgImage::pointInRaw(const QPointF& point_img)
00233 {
00234 float sclx = float(m_pixmap_scl->size().width()) / this->size().width();
00235 float scly = float(m_pixmap_scl->size().height()) / this->size().height();
00236
00237 double x = point_img.x()*sclx + m_xmin_raw;
00238 double y = point_img.y()*scly + m_ymin_raw;
00239
00240 return QPointF(x,y);
00241 }
00242
00243
00244
00245 QPointF
00246 WdgImage::pointInImage(const QPointF& point_raw)
00247 {
00248
00249
00250 float sclx = this->size().width() / float((m_zoom_is_on)? (m_xmax_raw-m_xmin_raw) : m_pixmap_scl->size().width());
00251 float scly = this->size().height() / float((m_zoom_is_on)? (m_ymax_raw-m_ymin_raw) : m_pixmap_scl->size().height());
00252
00253 float x = (point_raw.x()-m_xmin_raw)*sclx;
00254 float y = (point_raw.y()-m_ymin_raw)*scly;
00255
00256 return QPointF(x,y);
00257 }
00258
00259
00260
00261 void
00262 WdgImage::setPixmapScailedImage(const QImage* image)
00263 {
00264
00265 if(image) {
00266
00267
00268
00269
00270
00271 if(m_pixmap_raw) delete m_pixmap_raw;
00272 m_pixmap_raw = new QPixmap(QPixmap::fromImage(*image));
00273 }
00274
00275 if (m_zoom_is_on) {
00276
00277
00278 QSize size_new = image->size();
00279
00280 if(size_new.width() < m_xmax_raw
00281 || size_new.height() < m_ymax_raw) {
00282 m_xmax_raw = size_new.width();
00283 m_ymax_raw = size_new.height();
00284 }
00285
00286 zoomInImage();
00287 update();
00288 }
00289 else {
00290 if (m_pixmap_scl) delete m_pixmap_scl;
00291 m_pixmap_scl = new QPixmap(*m_pixmap_raw);
00292 setPixmap(m_pixmap_scl->scaled(this->size(), Qt::KeepAspectRatio, Qt::FastTransformation));
00293 m_xmin_raw = 0;
00294 m_ymin_raw = 0;
00295 m_xmax_raw = m_pixmap_raw->size().width();
00296 m_ymax_raw = m_pixmap_raw->size().height();
00297
00298
00299 emit zoomIsChanged(m_xmin_raw, m_ymin_raw, m_xmax_raw, m_ymax_raw, m_amin, m_amax);
00300 }
00301 }
00302
00303
00304
00305 void
00306 WdgImage::setFrame()
00307 {
00308 m_frame = new QFrame(this);
00309 m_frame -> setFrameStyle ( QFrame::Box | QFrame::Sunken);
00310 m_frame -> setLineWidth(0);
00311 m_frame -> setMidLineWidth(1);
00312
00313
00314 m_frame -> setGeometry(this->rect());
00315 m_frame -> setVisible(true);
00316 }
00317
00318
00319
00320 void
00321 WdgImage::resizeEvent(QResizeEvent *event)
00322 {
00323
00324
00325
00326
00327
00328 setPixmap(m_pixmap_scl->scaled(this->size(), Qt::KeepAspectRatio, Qt::FastTransformation));
00329
00330 setWindowTitle("Window is resized");
00331 }
00332
00333
00334
00335 void
00336 WdgImage::closeEvent(QCloseEvent *event)
00337 {
00338 QWidget::closeEvent(event);
00339 stringstream ss; ss << "closeEvent(...): type = " << event -> type();
00340 MsgInLog(_name_(), INFO, ss.str());
00341 }
00342
00343
00344
00345 void
00346 WdgImage::mousePressEvent(QMouseEvent *e)
00347 {
00348 QPointF p = pointInRaw(QPointF(e->x(),e->y()));
00349 const ndarray<GeoImage::raw_image_t,2>& nda = *p_nda_img_raw;
00350
00351 int ix = (int)floor(p.x());
00352 int iy = (int)floor(p.y());
00353 float z = (float)nda[iy][ix];
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363 emit mouseInPoint((float)ix, (float)iy, z);
00364
00365 this -> setCursor(Qt::ClosedHandCursor);
00366
00367 m_point1->setX(e->x());
00368 m_point1->setY(e->y());
00369 m_point2->setX(e->x());
00370 m_point2->setY(e->y());
00371
00372 m_is_pushed = true;
00373 update();
00374 }
00375
00376
00377
00378 void
00379 WdgImage::onZoomResetButton()
00380 {
00381 MsgInLog(_name_(), INFO, "onZoomResetButton()");
00382
00383 this->resetZoom();
00384 float amin = 0;
00385 float amax = 0;
00386 this->setIntensityRange(amin, amax);
00387
00388
00389 }
00390
00391
00392
00393 void
00394 WdgImage::mouseReleaseEvent(QMouseEvent *e)
00395 {
00396
00397
00398
00399
00400
00401
00402
00403
00404 this -> setCursor(Qt::PointingHandCursor);
00405
00406 m_is_pushed = false;
00407
00408 if(e->button() == Qt::MidButton) {
00409
00410 this->resetZoom();
00411 setPixmapScailedImage();
00412 update();
00413 return;
00414 }
00415
00416 if(e->button() == Qt::LeftButton) {
00417
00418 m_point2->setX(e->x());
00419 m_point2->setY(e->y());
00420
00421 QPoint dist = *m_point2 - *m_point1;
00422
00423 if(abs(dist.x()) > 5 && abs(dist.y()) > 5) {
00424
00425 if(! this->rect().contains(*m_point2)) {
00426 int x = int(this->rect().x());
00427 int y = int(this->rect().y());
00428 int w = int(this->rect().width());
00429 int h = int(this->rect().height());
00430
00431 if(e->x() < x ) m_point2->setX(x);
00432 if(e->y() < y ) m_point2->setY(y);
00433 if(e->x() > x+w) m_point2->setX(x+w);
00434 if(e->y() > y+h) m_point2->setY(y+h);
00435 }
00436
00437 zoomInImage();
00438 update();
00439 }
00440 }
00441 }
00442
00443
00444
00445 void
00446 WdgImage::mouseMoveEvent(QMouseEvent *e)
00447 {
00448
00449
00450
00451
00452
00453 m_point2->setX(e->x());
00454 m_point2->setY(e->y());
00455 update();
00456 }
00457
00458
00459
00460 void
00461 WdgImage::loadImageFromFile(const std::string& fname)
00462 {
00463 MsgInLog(_name_(), INFO, "Load image from file " + fname);
00464
00465
00466
00467 QImage image(fname.c_str());
00468
00469 this->resetZoom();
00470 setPixmapScailedImage(&image);
00471
00472
00473
00474
00475
00476 }
00477
00478
00479
00480 void
00481 WdgImage::onFileNameChanged(const std::string& fname)
00482 {
00483 MsgInLog(_name_(), INFO, "onFileNameChanged: " + fname);
00484
00485 loadImageFromFile(fname);
00486 }
00487
00488
00489 void
00490 WdgImage::onImageIsUpdated(ndarray<GeoImage::raw_image_t,2>& nda)
00491 {
00492 p_nda_img_raw = &nda;
00493
00494 stringstream ss; ss << "Update raw image in window,"
00495 << " rows:" << nda.shape()[0] << " cols:" << nda.shape()[1]
00496 << " amin=" << m_amin
00497 << " amax=" << m_amax
00498 << " h1=" << m_hue1
00499 << " h2=" << m_hue2;
00500
00501 MsgInLog(_name_(), INFO, ss.str());
00502
00503 const ndarray<GeoImage::image_t,2> nda_norm =
00504 getUint32NormalizedImage<const GeoImage::raw_image_t>(nda, m_amin, m_amax, m_ncolors, m_hue1, m_hue2);
00505
00506 setNormImage(nda_norm);
00507 update();
00508 }
00509
00510
00511 void
00512 WdgImage::setNormImage(const ndarray<GeoImage::image_t,2>& nda)
00513 {
00514 const unsigned int rows = nda.shape()[0];
00515 const unsigned int cols = nda.shape()[1];
00516
00517 stringstream ss; ss << "setNormImage::set normalized image in window, rows:" << nda.shape()[0] << " cols:" << nda.shape()[1] ;
00518 MsgInLog(_name_(), DEBUG, ss.str());
00519
00520 QImage image((const uchar*) nda.data(), cols, rows, QImage::Format_ARGB32);
00521 setPixmapScailedImage(&image);
00522
00523 static unsigned counter=0; stringstream sst; sst << "Image # " << ++counter;
00524 setWindowTitle(sst.str().c_str());
00525 }
00526
00527
00528
00529 void
00530 WdgImage::getIntensityLimits(float& imin, float& imax)
00531 {
00532 imin=0;
00533 imax=1;
00534 if (! p_nda_img_raw) return;
00535
00536 double a(0);
00537 double s0(0);
00538 double s1(0);
00539 double s2(0);
00540
00541 const ndarray<GeoImage::raw_image_t,2>& nda = *p_nda_img_raw;
00542 for(int iy=m_ymin_raw; iy<m_ymax_raw; ++iy) {
00543 for(int ix=m_xmin_raw; ix<m_xmax_raw; ++ix) {
00544 a = (float)nda[iy][ix];
00545 s0 += 1;
00546 s1 += a;
00547 s2 += a*a;
00548 }
00549 }
00550 double ave = (s0>0) ? s1/s0 : 0;
00551 double rms = (s0>0) ? sqrt(s2/s0-ave*ave) : 1;
00552
00553 imin = floor(ave-3*rms);
00554 imax = ceil(ave+6*rms);
00555
00556
00557
00558
00559 }
00560
00561
00562 void
00563 WdgImage::getIntensityLimitsV1(float& imin, float& imax)
00564 {
00565 float a(0);
00566 const ndarray<GeoImage::raw_image_t,2>& nda = *p_nda_img_raw;
00567 imin = (float)nda[m_ymin_raw][m_xmin_raw];
00568 imax = imin;
00569 for(int iy=m_ymin_raw; iy<m_ymax_raw; ++iy) {
00570 for(int ix=m_xmin_raw; ix<m_xmax_raw; ++ix) {
00571 a = (float)nda[iy][ix];
00572 if(a<imin) imin = a;
00573 if(a>imax) imax = a;
00574 }
00575 }
00576 }
00577
00578
00579 void
00580 WdgImage::setIntensityRange(const float& amin, const float& amax)
00581 {
00582 if(amin && amax) {
00583 m_amin = amin;
00584 m_amax = amax;
00585 }
00586 else {
00587 float Imin, Imax;
00588 this->getIntensityLimits(Imin, Imax);
00589
00590 m_amax = (amax==0) ? Imax : amax;
00591 m_amin = (amin==0) ? Imin : amin;
00592 }
00593
00594 if(p_nda_img_raw) this->onImageIsUpdated(*p_nda_img_raw);
00595
00596 std::stringstream ss; ss << "Set intensity range amin=" << m_amin << " amax=" << m_amax;
00597 MsgInLog(_name_(), INFO, ss.str());
00598 }
00599
00600
00601
00602 void
00603 WdgImage::onPressOnAxes(QMouseEvent* e, QPointF p)
00604 {
00605 std::stringstream ss;
00606 ss << _name_() << " onPressOnAxes button: " << e->button()
00607
00608 << " scene x(), y() = " << p.x() << ", " << p.y();
00609
00610 MsgInLog(_name_(), DEBUG, ss.str());
00611
00612 float amin = m_amin;
00613 float amax = m_amax;
00614
00615 switch (e->button()) {
00616 case Qt::LeftButton : amin = p.x(); break;
00617 case Qt::RightButton : amax = p.x(); break;
00618 default :
00619 case Qt::MidButton : amin = 0; amax = 0; break;
00620 }
00621
00622 setIntensityRange(amin, amax);
00623 }
00624
00625
00626 void
00627 WdgImage::onHueAnglesUpdated(const float& h1, const float& h2)
00628 {
00629 m_hue1 = h1;
00630 m_hue2 = h2;
00631
00632 if(p_nda_img_raw) this->onImageIsUpdated(*p_nda_img_raw);
00633
00634 update();
00635 std::stringstream ss; ss << ":onHueAnglesUpdated h1:" << m_hue1 << " h2:" << m_hue2;
00636 MsgInLog(_name_(), INFO, ss.str());
00637 }
00638
00639
00640 void
00641 WdgImage::testSignalZoomIsChanged(int& xmin, int& ymin, int& xmax, int& ymax, float& amin, float& amax)
00642 {
00643 stringstream ss;
00644 ss << "testSignalZoomIsChanged(...): zoom is changed to"
00645 << " xmin=" << xmin
00646 << " ymin=" << ymin
00647 << " xmax=" << xmax
00648 << " ymax=" << ymax
00649 << " amin=" << amin
00650 << " amax=" << amax;
00651 MsgInLog(_name_(), DEBUG, ss.str());
00652 }
00653
00654
00655
00656
00657
00658
00659
00660 void
00661 WdgImage::setColorPixmap()
00662 {
00663 MsgInLog(_name_(), INFO, "setColorPixmap()");
00664
00665
00666
00667 const int ssize = 1024;
00668 const int isize = ssize*ssize;
00669
00670 uint32_t dimg[ssize][ssize];
00671 std::fill_n(&dimg[0][0], int(isize), uint32_t(0xFF000000));
00672
00673 int vRx = 512 - 128;
00674 int vRy = 512 - 128;
00675 int vGx = 512 + 128;
00676 int vGy = 512 - 128;
00677 int vBx = 512;
00678 int vBy = 512 - 128 + 222;
00679
00680 for(int i=0; i<ssize; ++i) {
00681 for(int j=0; j<ssize; ++j) {
00682
00683 int rR = (int) sqrt( pow(i-vRx,2) + pow(j-vRy,2) );
00684 int rG = (int) sqrt( pow(i-vGx,2) + pow(j-vGy,2) );
00685 int rB = (int) sqrt( pow(i-vBx,2) + pow(j-vBy,2) );
00686
00687
00688
00689
00690 int r = (rR<255) ? rR : 255;
00691 int g = (rG<255) ? rG : 255;
00692 int b = (rB<255) ? rB : 255;
00693
00694 dimg[i][j] += (r<<16) + (g<<8) + b;
00695 }
00696 }
00697
00698 QImage image((const uchar*) &dimg[0], ssize, ssize, QImage::Format_ARGB32);
00699 setPixmapScailedImage(&image);
00700 }
00701
00702
00703
00704 void
00705 WdgImage::setColorWhellPixmap()
00706 {
00707 MsgInLog(_name_(), INFO, "setColorWhellPixmap()");
00708
00709
00710
00711 const int ssize = 1024;
00712 const int isize = ssize*ssize;
00713
00714 const int xc = 512;
00715 const int yc = 512;
00716
00717 const float RAD2DEG = 180/3.14159265;
00718
00719 uint32_t dimg[ssize][ssize];
00720 std::fill_n(&dimg[0][0], int(isize), uint32_t(0xFF000000));
00721
00722
00723 for(int i=0; i<ssize; ++i) {
00724 for(int j=0; j<ssize; ++j) {
00725
00726 float x = i-xc;
00727 float y = j-yc;
00728 float r = sqrt(x*x + y*y) / 512;
00729 r = (r<1) ? r : 0;
00730
00731 float hue = atan2(y,x) * RAD2DEG;
00732 hue = (hue<0) ? hue+360 : hue;
00733
00734 dimg[i][j] = HSV2RGBA(hue, 1, r);
00735 }
00736 }
00737
00738 QImage image((const uchar*) &dimg[0], ssize, ssize, QImage::Format_ARGB32);
00739 setPixmapScailedImage(&image);
00740 }
00741
00742
00743
00744 void
00745 WdgImage::setColorBar( const unsigned& rows,
00746 const unsigned& cols,
00747 const float& hue1,
00748 const float& hue2
00749 )
00750 {
00751 MsgInLog(_name_(), INFO, "setColorBar()");
00752
00753 uint32_t* ctable = ColorTable(cols, hue1, hue2);
00754 uint32_t dimg[rows][cols];
00755
00756 for(unsigned r=0; r<rows; ++r) {
00757 std::memcpy(&dimg[r][0], &ctable[0], cols*sizeof(uint32_t));
00758
00759 }
00760
00761 QImage image((const uchar*) &dimg[0], cols, rows, QImage::Format_ARGB32);
00762 setPixmapScailedImage(&image);
00763 }
00764
00765
00766
00767 void
00768 WdgImage::setCameraImage(const std::string& ifname_geo, const std::string& ifname_img)
00769 {
00770 typedef PSCalib::GeometryAccess::image_t image_t;
00771
00772 const std::string base_dir = "/reg/g/psdm/detector/alignment/cspad/calib-cxi-ds1-2014-05-15/";
00773 const std::string fname_geo = (ifname_geo != std::string()) ? ifname_geo
00774 : base_dir + "calib/CsPad::CalibV1/CxiDs1.0:Cspad.0/geometry/2-end.data";
00775 const std::string fname_img = (ifname_img != std::string()) ? ifname_img
00776 : base_dir + "cspad-arr-cxid2714-r0023-lysozyme-rings.txt";
00777
00778 MsgInLog(_name_(), INFO, "setCameraImage()");
00779
00780 if (m_geo_img) delete m_geo_img;
00781 m_geo_img = new GeoImage(fname_geo, fname_img);
00782
00783 ndarray<uint32_t, 2> inda = m_geo_img->getNormalizedImage();
00784
00785 QImage image((const uchar*) &inda[0][0], inda.shape()[1], inda.shape()[0], QImage::Format_ARGB32);
00786 setPixmapScailedImage(&image);
00787 }
00788
00789
00790
00791 void
00792 WdgImage::onTest()
00793 {
00794 MsgInLog(_name_(), INFO, "onTest() - slot");
00795
00796
00797 static unsigned counter = 0; ++counter;
00798
00799 if(counter%6 == 1) setColorWhellPixmap();
00800 if(counter%6 == 2) setColorBar();
00801 if(counter%6 == 3) setColorPixmap();
00802 if(counter%6 == 4) setCameraImage();
00803 if(counter%6 == 5) this -> setScaledContents (false);
00804 if(counter%6 == 0) this -> setScaledContents (true);
00805 }
00806
00807
00808
00809
00810
00811
00812
00813
00814 }
00815
00816