9 #include <QtCore/QDebug>
10 #include <QtCore/QSettings>
11 #include <QtCore/QFileInfo>
13 #if QT_VERSION >= 0x050000
14 #include <QtWidgets/QVBoxLayout>
15 #include <QtWidgets/QToolBar>
16 #include <QtWidgets/QSpinBox>
17 #include <QtWidgets/QLabel>
18 #include <QtWidgets/QFileDialog>
19 #include <QtWidgets/QInputDialog>
20 #include <QtWidgets/QAction>
22 #include <QtGui/QVBoxLayout>
23 #include <QtGui/QToolBar>
24 #include <QtGui/QSpinBox>
25 #include <QtGui/QLabel>
26 #include <QtGui/QFileDialog>
27 #include <QtGui/QInputDialog>
28 #include <QtGui/QAction>
32 #include <qwt_scale_widget.h>
33 #include <qwt_plot_layout.h>
34 #include <qwt_plot_spectrogram.h>
35 #include <qwt_color_map.h>
36 #include <qwt_scale_engine.h>
59 _plot =
new QwtPlot(
this);
60 QwtScaleWidget *rightAxis(
_plot->axisWidget(QwtPlot::yRight));
61 rightAxis->setColorBarEnabled(
true);
62 _plot->enableAxis(QwtPlot::yRight);
63 _plot->plotLayout()->setAlignCanvasToScales(
true);
64 _plot->setAutoReplot(
false);
74 _zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
75 Qt::RightButton, Qt::ControlModifier);
76 _zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
92 tr(
"Toggle Axis Titles"),toolbar);
100 tr(
"Load geom file"),
114 _colorId->setValue(settings.
value(
"ColorTableID",-1).toInt());
116 _colorId->setToolTip(tr(
"Select the used Colorbar"));
121 resize(settings.
value(
"WindowSize",
size()).toSize());
122 move(settings.
value(
"WindowPosition",pos()).toPoint());
152 if (
data().isEmpty())
163 pix.
save(filename,
"PNG");
209 std::vector<size_t>::const_iterator idx(
_lut.
lut.begin());
211 for (; srcpixel != srcImageEnd; ++srcpixel, ++idx)
212 (*labHist)[*idx] = *srcpixel;
214 data().front()->setResult(labHist);
241 list <<
"h5"<<
"hst"<<
"csv"<<
"png"<<
"cbf";
261 data->setInterval(Qt::ZAxis,QwtInterval(min,max));
264 _plot->setAxisScale(QwtPlot::yRight,min,max);
267 _plot->setAxisScaleEngine(QwtPlot::yRight,
new QwtLogScaleEngine);
269 _plot->setAxisScaleEngine(QwtPlot::yRight,
new QwtLinearScaleEngine);
278 _plot->axisWidget(QwtPlot::xBottom)->setTitle(xtitle);
280 _plot->axisWidget(QwtPlot::yLeft)->setTitle(ytitle);
285 _plot->axisWidget(QwtPlot::yLeft)->setTitle(
"");
286 _plot->axisWidget(QwtPlot::xBottom)->setTitle(
"");
295 settings.
setValue(
"ColorTableID",colorid);
307 double wavelength_A = 0;
308 double cameraDistance_cm = 0;
309 double pixelsize_um = 0;
317 QString filter(
"Geom Files (*.geom)");
329 tr(
"Wavelength [Angstroem]:"),
330 settings.
value(
"Wavelength_A",5).toDouble(),
337 tr(
"Camera Distance [cm]:"),
338 settings.
value(
"CameraDistance_cm",7).toDouble(),
345 tr(
"Pixel Size [um]:"),
346 settings.
value(
"PixelSize_um",110).toDouble(),
352 settings.
setValue(
"Wavelength_A",wavelength_A);
353 settings.
setValue(
"CameraDistance_cm",cameraDistance_cm);
354 settings.
setValue(
"PixelSize_um",pixelsize_um);
365 QwtLinearColorMap *
map(log ?
new LogColorMap(Qt::black, Qt::red) :
366 new QwtLinearColorMap(Qt::black, Qt::red));
367 map->addColorStop(0.999,
QColor(Qt::white));
368 map->addColorStop(0.001,
QColor(Qt::white));
373 QwtLinearColorMap *
map(log ?
new LogColorMap(Qt::black, Qt::black) :
374 new QwtLinearColorMap(Qt::black, Qt::black));
375 map->addColorStop(0.999,
QColor(Qt::white));
380 QwtLinearColorMap *
map(log ?
new LogColorMap(Qt::white, Qt::black) :
381 new QwtLinearColorMap(Qt::white, Qt::black));
386 QwtLinearColorMap *
map(log ?
new LogColorMap(Qt::black, Qt::white) :
387 new QwtLinearColorMap(Qt::black, Qt::white));
390 else if(colorid == 0)
392 QwtLinearColorMap *
map(log ?
new LogColorMap(Qt::darkCyan, Qt::red) :
393 new QwtLinearColorMap(Qt::darkCyan, Qt::red));
394 map->addColorStop(0.10,
QColor(Qt::darkCyan));
395 map->addColorStop(0.60,
QColor(Qt::green));
396 map->addColorStop(0.90,
QColor(Qt::yellow));
399 else if(colorid == 1)
402 new QwtLinearColorMap(Qt::black,
QColor(255,0,0)));
403 map->addColorStop(0.10,
QColor(50,0,0));
404 map->addColorStop(0.35,
QColor(115,0,0));
405 map->addColorStop(0.80,
QColor(180,0,0));
408 else if(colorid == 2)
411 new QwtLinearColorMap(Qt::black,
QColor(0,255,0)));
414 else if(colorid == 3)
417 new QwtLinearColorMap(Qt::black,
QColor(0,0,255)));
420 else if(colorid == 4)
423 new QwtLinearColorMap(Qt::black,
QColor(255,0,255)));
426 else if(colorid == 5)
429 new QwtLinearColorMap(Qt::black,
QColor(0,255,255)));
432 else if(colorid == 7)
435 new QwtLinearColorMap(Qt::black,
QColor(255,255,0)));
438 else if(colorid == 6)
440 QwtLinearColorMap *
map(log ?
new LogColorMap(Qt::black, Qt::red) :
441 new QwtLinearColorMap(Qt::black, Qt::red));
442 map->addColorStop(0.10, Qt::blue);
443 map->addColorStop(0.30, Qt::darkCyan);
444 map->addColorStop(0.40, Qt::cyan);
445 map->addColorStop(0.60, Qt::darkGreen);
446 map->addColorStop(0.70, Qt::green);
447 map->addColorStop(0.95, Qt::yellow);
450 else if(colorid == 8)
452 QwtLinearColorMap *
map(log ?
new LogColorMap(Qt::darkBlue, Qt::white) :
453 new QwtLinearColorMap(Qt::darkBlue, Qt::white));
454 map->addColorStop(0.15, Qt::blue);
455 map->addColorStop(0.30,
QColor(255,90,255));
456 map->addColorStop(0.40, Qt::yellow);
457 map->addColorStop(0.60, Qt::darkYellow);
458 map->addColorStop(0.70, Qt::red);
459 map->addColorStop(0.80, Qt::darkRed);
460 map->addColorStop(0.95,
QColor(149,24,0));
463 else if(colorid == 9)
466 new QwtLinearColorMap(
QColor(65,105,241),
QColor(255,51,204)));
467 map->addColorStop(0.10,
QColor(0,127,255));
468 map->addColorStop(0.60,
QColor(221,0,225));
469 map->addColorStop(0.95,
QColor(255,51,204));
472 else if(colorid ==10)
475 new QwtLinearColorMap(
QColor(72,6,7), Qt::white));
476 map->addColorStop(0.10,
QColor(72,6,7));
477 map->addColorStop(0.20, Qt::darkRed);
478 map->addColorStop(0.35, Qt::red);
479 map->addColorStop(0.65,
QColor(255,195,59));
480 map->addColorStop(0.85, Qt::yellow);
481 map->addColorStop(0.98, Qt::white);
484 else if(colorid ==11)
487 new QwtLinearColorMap(
QColor(16,16,255),
QColor(0,255,129)));
488 map->addColorStop(0.10,
QColor(16,16,255));
489 map->addColorStop(0.50, Qt::cyan);
490 map->addColorStop(0.90,
QColor(0,255,155));
493 else if(colorid ==12)
496 new QwtLinearColorMap(
QColor(10,10,10),
QColor(184,115,51)));
497 map->addColorStop(0.10,
QColor(10,10,10));
498 map->addColorStop(0.20,
QColor(149,34,0));
499 map->addColorStop(0.90,
QColor(184,115,51));
QwtInterval origZInterval(bool log) const
return the min max values of the values in the data
TrackZoomer2D * _zoomer
a zoomer for the 2d view
storage_t::const_iterator const_iterator
a const iterator on the storage
addToolBar(Qt::ToolBarArea area, QToolBar *toolbar)
contains zoomer for a 2d plot with tracking information
QwtPlotSpectrogram * _spectrogram
the spectrogram that is used to display the 2d data
const_iterator end() const
retrieve iterator to the end of storage
virtual void dataChanged()
update the plot
create the noise and bad pixel map[Processor]
std::tr1::shared_ptr< self_type > shared_pointer
a shared pointer of this class
contains the wrappe of the data for the 2d viewer
QString _geomFile
the geom file to convert data to lab frame
bool log() const
return wether log is enabled
static void saveData(const QString &filename, result_t::shared_pointer data)
save data to a given file
virtual QString type() const
retrieve the type of the data viewer
contains the base class for add viewer data
virtual QList< Data * > data()
set the data to display
void setWavelength_A(double wavelength_A)
set the wavelength that is needed of the optional resolution calculation
QwtPlot * _plot
the plot inside which the data will be displayed
size_type size() const
return the raw size of the storage
std::string name() const
retrieve the name of the result
void replot()
replot the data
an axis of a more than 0 dimensional container
void setCameraDistance_cm(double cameradistance_cm)
set the camera distance that is needed of the optional resolution calculation
things written only at end of run H5Dump ProcessorSummary size
setRange(int minimum, int maximum)
widget to control the min and max values
virtual void saveData(const QString &filename)
save the data to file
MinMaxControl * _zControl
the z-scale control
setValue(const QString &key, const QVariant &value)
virtual ~TwoDViewer()
destructor
const_iterator begin() const
retrieve a iterator for read access to beginning
void on_load_geomfile_triggered()
load the geom file
fromStdString(const std::string &str)
void setPixelSize_um(double pixelsize_um)
set the size of a pixel in micro meters
save(const QString &fileName, const char *format=0, int quality=-1)
cass::GeometryInfo::lookupTable_t _lut
the geom file to convert data to lab frame
shared_pointer clone() const
create a copy of the result
bool autoscale() const
return whether the plot should be autoscaled
contains a logarithmic color map.
QwtLinearColorMap * cmap(const int mapId, bool log) const
retrieve a color id
TwoDViewer(QString title, QWidget *parent=0)
constructor
setCentralWidget(QWidget *widget)
cass::Result< float >::shared_pointer _origHist
the original histogram
value(const QString &key, const QVariant &defaultValue=QVariant()
bool _isOriginalData
flag to tell whether the data is the original data
result_t::shared_pointer result()
retrieve the pointer to the data
QSpinBox * _colorId
the colorbar control
QAction * _axisTitleControl
an action to control the legend of curves
QStringList cmaps() const
return the list of possible colormaps
double max() const
retieve the maximum value
contains a control over min and max values
class that allows to zoom in a 2d view with tracking information
getOpenFileName(QWidget *parent=0, const QString &caption=QString()
void setData(TwoDViewerData *data)
set the data to retrieve the values from
shape_t shape() const
return the shape of the result
double min() const
retrieve the minimum value
bool _lutPresent
the geom file to convert data to lab frame
virtual QStringList dataFileSuffixes() const
suffixes for the data of this viewer
beginGroup(const QString &prefix)
std::vector< size_t > lut
contains the viewer for 2d data
lookupTable_t generateLookupTable(const std::string &filename, const size_t sizeOfSrc, const size_t nSrcCols, const bool convertFromCheetahToCASS)
generate a lookup table for a new image