7 #include <qwt_legend.h>
15 setWindowTitle( tr(
"Residuals Pixel Map" ) );
18 QGridLayout*
main =
new QGridLayout(
this );
19 main->setSpacing ( 2 );
20 main->setContentsMargins( 2, 2, 2, 2 );
28 setAttribute( Qt::WA_DeleteOnClose,
true );
34 int scanCount = resids.size();
35 int valCount = resids[ 0 ].size();
39 for (
int ii = 0; ii < scanCount; ii++ )
41 for (
int jj = 0; jj < valCount; jj++ )
43 sigma += pow( resids[ ii ][ jj ], 2.0 );
47 sigma = sqrt( sigma / (
double)( scanCount * valCount ) );
56 QImage res_image( valCount, scanCount, QImage::Format_ARGB32 );
60 for (
int ii = 0; ii < scanCount; ii++ )
62 for (
int jj = 0; jj < valCount; jj++ )
64 vres = resids[ ii ][ jj ];
65 kres = qRound( 255.0 * vres / sigma );
69 red = kres < 255 ? kres : 255;
77 green = kres < 255 ? kres : 255;
81 res_image.setPixel( jj, ii, QColor( red, green, blue ).rgb() );
85 int mwid = valCount < 600 ? valCount : 600;
86 int mhgt = scanCount < 100 ? scanCount : 100;
89 resize( mwid + 4, mhgt + 4 );
91 QPixmap pmap( mwid, mhgt );
92 pmap = pmap.fromImage( res_image.scaled( mwid, mhgt ) );