TestMain::TestMain(QWidget *parent) :
QWidget(parent)
{
imageRed=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
imageGreen=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
imageBlue=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
image=(double*)calloc(IMAGE_N*IMAGE_N, sizeof(double));
ovrl=(bool*)calloc(IMAGE_N*IMAGE_N, sizeof(bool));
x=(double*)calloc(N1, sizeof(double));
y1=(double*)calloc(N1, sizeof(double));
y2=(double*)calloc(N1, sizeof(double));
y3=(double*)calloc(N1, sizeof(double));
QGridLayout* gl=new QGridLayout(this);
setLayout(gl);
QTabWidget* t=new QTabWidget(this);
gl->addWidget(t,0,0);
QWidget* w=new QWidget(this);
gl=new QGridLayout(w);
w->setLayout(gl);
gl->addWidget(pl1, 0, 0);
pl2->setMaximumWidth(100);
w->connect(pl1, SIGNAL(replotting()), pl2, SLOT(redrawPlot()));
gl->addWidget(pl2, 0, 1);
w->connect(pl1, SIGNAL(replotting()), pl3, SLOT(redrawPlot()));
gl->addWidget(pl3, 1, 0);
xx.clear();
yy.clear();
for (int i=0; i<N1; i++) {
x[i]=(i+1)*XMAX/(double)N1;
xx.push_back(x[i]);
yy.push_back(sin(0.5*M_PI*x[i])+2.0);
std::cout<<xx[i]<<", "<<yy[i]<<std::endl;
y1[i]=i*XMAX/(double)N1;
y2[i]=log(x[i]);
y3[i]=log10(x[i]);
}
img=QImage("lena.png");
for (int x=0; x<IMAGE_N; x++) {
for (int y=0; y<IMAGE_N; y++) {
image[y*IMAGE_N+x]=IMAGE_N*(1.1+sin(sqrt((x-50)*(x-50)+(y-50)*(y-50))));
if (x>50 && y>50) image[y*IMAGE_N+x]=0;
if (x<50 && y<50) image[y*IMAGE_N+x]=50;
if (abs(x-(IMAGE_N-y))<4) ovrl[y*IMAGE_N+x]=true; else ovrl[y*IMAGE_N+x]=false;
}
}
QColor col=QColor("red");
col.setAlpha(127);
pl3->setObjectName("pl3");
QComboBox* spin=new QComboBox(w);
gl->addWidget(spin, 2,0);
connect(spin, SIGNAL(currentIndexChanged(int)), p5, SLOT(setPalette(int)));
QComboBox* scale=new QComboBox(w);
scale->addItem("TopLeft");
scale->addItem("TopRight");
scale->addItem("BottomLeft");
scale->addItem("BottomRight");
gl->addWidget(scale, 3,0);
connect(scale, SIGNAL(currentIndexChanged(int)), sb, SLOT(setPosition(int)));
t->addTab(w, tr("Basic Test"));
w=new QWidget(this);
gl=new QGridLayout(w);
w->setLayout(gl);
gl->addWidget(p21, 0, 0, 1, 3);
for (int x=0; x<IMAGE_N; x++) {
for (int y=0; y<IMAGE_N; y++) {
imageRed[y*IMAGE_N+x]=(fabs(x)+fabs(y))/2.0;
imageGreen[y*IMAGE_N+x]=(fabs(double(IMAGE_N)-x)+fabs(y))/2.0;
imageBlue[y*IMAGE_N+x]=sqrt(x*x+y*y);
}
}
prgb->setImage(imageRed,
JKQTFP_double, imageGreen,
JKQTFP_double, imageBlue,
JKQTFP_double, IMAGE_N, IMAGE_N,0,10,0,10);
QCheckBox* c=new QCheckBox(tr("red channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableRed(bool)));
gl->addWidget(c, 1,0);
c=new QCheckBox(tr("green channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableGreen(bool)));
gl->addWidget(c, 1,1);
c=new QCheckBox(tr("blue channel"), w);
c->setChecked(true);
connect(c, SIGNAL(toggled(bool)), this, SLOT(enableBlue(bool)));
gl->addWidget(c, 1,2);
t->addTab(w, tr("Overlay Test"));
t->setCurrentIndex(1);
resize(500,400);
}
a simple line plot for JKQTFastPlotter
Definition jkqtfastplotter.h:1049
a plot of a QImage
Definition jkqtfastplotter.h:1699
plot a horizontal scale bar
Definition jkqtfastplotter.h:3280
plots 1,2 or 3 given grayscale images as an overlay plot, where each channel is drawn as one color ch...
Definition jkqtfastplotter.h:2761
a simple vertical bar plot for JKQTFastPlotter
Definition jkqtfastplotter.h:1334
plot a range of x values
Definition jkqtfastplotter.h:1370
void setFillStyle(Qt::BrushStyle __value)
fill style of the graph
Definition jkqtfastplotter.h:1432
plots an image overlay, i.e. a boolean image where each true pixel is drawn with a given color and th...
Definition jkqtfastplotter.h:3124
plots a given grayscale image with a given color palette
Definition jkqtfastplotter.h:2388
a speed optimized plotter class
Definition jkqtfastplotter.h:106
void setPlotBorderLeft(int __value)
free space between widget left border and plot left border
Definition jkqtfastplotter.h:483
void addPlot(JKQTFPPlot *g)
add a new graph
void setSynchronizeY(JKQTFastPlotter *__value)
synchronize y-axis settings to this plotter
Definition jkqtfastplotter.h:932
void setPlotBorderRight(int __value)
free space between widget right border and plot left border
Definition jkqtfastplotter.h:509
void setSynchronizeX(JKQTFastPlotter *__value)
synchronize x-axis settings to this plotter
Definition jkqtfastplotter.h:919
void setYAxisLabelVisible(bool __value)
plot y axis label
Definition jkqtfastplotter.h:906
void setMaintainAspectRatio(bool __value)
indicates whether to maintain a specific aspect ratio
Definition jkqtfastplotter.h:880