cctw  0.2.1
cctwqtmainwindow.cpp
Go to the documentation of this file.
1 #include "cctwqtmainwindow.h"
2 #include "ui_cctwqtmainwindow.h"
3 #include <QLineEdit>
4 #include <QThread>
5 #include <QFileDialog>
6 #include <QMessageBox>
7 #include <QCloseEvent>
8 #include "qwt_plot_curve.h"
9 #include "qwt_legend.h"
10 #include "qwt_plot_panner.h"
11 #include "qwt_plot_magnifier.h"
12 #include "qwt_plot_zoomer.h"
13 #include "qwt_symbol.h"
14 #include "QtConcurrentRun"
15 #include "cctwdatachunk.h"
16 
18  QMainWindow(parent),
19  ui(new Ui::CctwqtMainWindow),
20  m_Application(app),
21  m_TransformTester(NULL),
22  m_SetupOutputDialog(NULL),
23  m_SetupTransformDialog(NULL),
24  m_Legend(NULL),
25  m_Panner(NULL),
26  m_Magnifier(NULL),
27  m_Zoomer(NULL)
28 {
29  ui->setupUi(this);
30 
31  connect(ui->m_CommandInput, SIGNAL(returnPressed()), this, SLOT(doEvaluateCommand()));
32 
33 #ifdef WANT_IMPORT_COMMANDS
34  connect(ui->m_ActionSetupDataImport, SIGNAL(triggered()), this, SLOT(doSetupImport()));
35  connect(ui->m_SetupImportButton, SIGNAL(clicked()), this, SLOT(doSetupImport()));
36 
37  connect(ui->m_ActionImportData, SIGNAL(triggered()), this, SLOT(doImport()));
38  connect(ui->m_ImportButton, SIGNAL(clicked()), this, SLOT(doImport()));
39 #endif
40 
41  connect(ui->m_ActionExecuteScriptFile, SIGNAL(triggered()), this, SLOT(doExecuteScriptFile()));
42  connect(ui->m_ActionSetupOutputData, SIGNAL(triggered()), this, SLOT(doSetupOutput()));
43  connect(ui->m_SetupOutputButton, SIGNAL(clicked()), this, SLOT(doSetupOutput()));
44 
45  connect(ui->m_ActionSetupTransform, SIGNAL(triggered()), this, SLOT(doSetupTransform()));
46  connect(ui->m_SetupTransformButton, SIGNAL(clicked()), this, SLOT(doSetupTransform()));
47 
48  connect(ui->m_ActionPerformTransform, SIGNAL(triggered()), this, SLOT(doTransform()));
49  connect(ui->m_TransformButton, SIGNAL(clicked()), this, SLOT(doTransform()));
50 
51  connect(ui->m_ActionCheckTransform, SIGNAL(triggered()), this, SLOT(doCheckTransform()));
52  connect(ui->m_CheckTransformButton, SIGNAL(clicked()), this, SLOT(doCheckTransform()));
53 
54  connect(ui->m_HaltButton, SIGNAL(clicked()), this, SLOT(doHalt()));
55 
56  connect(ui->m_ActionDependencies, SIGNAL(triggered()), m_Application, SLOT(calculateDependencies()));
57  connect(ui->m_DependenciesButton, SIGNAL(clicked()), m_Application, SLOT(calculateDependencies()));
58 
59  connect(ui->m_ActionReportInputDependencies, SIGNAL(triggered()), this, SLOT(reportInputDependencies()));
60  connect(ui->m_ReportInputDepsButton, SIGNAL(clicked()), this, SLOT(reportInputDependencies()));
61 
62  connect(ui->m_ActionReportOutputDependencies, SIGNAL(triggered()), this, SLOT(reportOutputDependencies()));
63  connect(ui->m_ReportOutputDepsButton, SIGNAL(clicked()), this, SLOT(reportOutputDependencies()));
64 
65  connect(ui->m_ActionSaveDependencies, SIGNAL(triggered()), this, SLOT(doSaveDependencies()));
66  connect(ui->m_SaveDepsButton, SIGNAL(clicked()), this, SLOT(doSaveDependencies()));
67 
68  connect(ui->m_ActionLoadDependencies, SIGNAL(triggered()), this, SLOT(doLoadDependencies()));
69  connect(ui->m_LoadDepsButton, SIGNAL(clicked()), this, SLOT(doLoadDependencies()));
70 
71 
72 #ifdef WANT_IMPORT_COMMANDS
73  connect(ui->m_ActionCheckImportedData, SIGNAL(triggered()), this, SLOT(doCheckImportedData()));
74 #endif
75 
76  connect(ui->m_ActionLoadSettings, SIGNAL(triggered()), this, SLOT(doLoadSettings()));
77  connect(ui->m_ActionSaveSettings, SIGNAL(triggered()), this, SLOT(doSaveSettings()));
78  connect(ui->m_ActionSaveCurrentSettings, SIGNAL(triggered()), m_Application, SLOT(writeSettings()));
79 
80  connect(ui->m_ActionQuit, SIGNAL(triggered()), this, SLOT(possiblyClose()));
81 
82  app->prop_Halting()->linkTo(ui->m_Halting);
83 
84 #ifdef WANT_ANALYSIS_COMMANDS
85  connect(ui->m_ActionAnalyzePEMetaData, SIGNAL(triggered()), this, SLOT(doAnalyzePEMetaData()));
86  connect(ui->m_PEMetaDataButton, SIGNAL(clicked()), this, SLOT(doAnalyzePEMetaData()));
87 
88  connect(ui->m_ActionAnalyseSpecDataFile, SIGNAL(triggered()), this, SLOT(doAnalyzeSpecDataFile()));
89  connect(ui->m_AnalyzeSpecDataButton, SIGNAL(clicked()), this, SLOT(doAnalyzeSpecDataFile()));
90 
91  connect(ui->m_ActionCompareTwoHDF5, SIGNAL(triggered()), this, SLOT(doCompareHDF5()));
92 #else
93  ui->m_ParametersTabs->removeTab(5);
94  ui->m_Menubar->removeAction(ui->m_AnalysisMenu->menuAction());
95 #endif
96 
97 #ifdef WANT_IMPORT_COMMANDS
98  CctwImporter *import = app->m_ImportData;
99 
100  if (import) {
101  import->prop_DarkImagePath()->linkTo(ui->m_ImportDarkImagePath);
102  import->prop_ImageDirectory()->linkTo(ui->m_ImportDataDirectory);
103  import->prop_OutputPath()->linkTo(ui->m_ImportOutputPath);
104  import->prop_OutputDataset()->linkTo(ui->m_ImportOutputDataset);
105  import->prop_Compression()->linkTo(ui->m_ImportOutputCompression);
106 
107  connect(import->prop_ImagePaths(), SIGNAL(valueChanged(QStringList,int)), this, SLOT(updateImportImagePaths(QStringList)));
108 
109  import->prop_ChunkSize()->linkTo(ui->m_ImportOutputChunkX,
110  ui->m_ImportOutputChunkY,
111  ui->m_ImportOutputChunkZ);
112 
113  updateImportImagePaths(import->get_ImagePaths());
114  }
115 #else
116  ui->m_ParametersTabs->removeTab(0);
117  ui->m_FileMenu->removeAction(ui->m_ActionSetupDataImport);
118  ui->m_FileMenu->removeAction(ui->m_ActionImportData);
119 #endif
120 
121  CctwChunkedData *inputData = app->m_InputData;
122 
123  if (inputData) {
124  inputData->prop_DataFileName()->linkTo(ui->m_InputDataFileName);
125  inputData->prop_DataSetName()->linkTo(ui->m_InputDataSetName);
126  inputData->prop_ChunksRead()->linkTo(ui->m_ChunksRead);
127 
128  inputData->prop_Compression()->linkTo(ui->m_InputCompression);
129  inputData->prop_ChunksRead()->linkTo(ui->m_ChunksRead);
130 
131  inputData->prop_Dimensions()->linkTo(ui->m_InputDimensionsX,
132  ui->m_InputDimensionsY,
133  ui->m_InputDimensionsZ);
134 
135  inputData->prop_ChunkSize()->linkTo(ui->m_InputChunkX,
136  ui->m_InputChunkY,
137  ui->m_InputChunkZ);
138 
139  inputData->prop_ChunkCount()->linkTo(ui->m_InputCountX,
140  ui->m_InputCountY,
141  ui->m_InputCountZ);
142 
143  inputData->prop_HDFChunkSize()->linkTo(ui->m_InputHDFChunkX,
144  ui->m_InputHDFChunkY,
145  ui->m_InputHDFChunkZ);
146  }
147 
148  connect(ui->m_BrowseInputFile, SIGNAL(clicked()), this, SLOT(doBrowseInputFile()));
149  connect(ui->m_InputDataFileName, SIGNAL(textChanged(QString)), this, SLOT(doCheckDataFile(QString)));
150  connect(ui->m_BrowseInputDataset, SIGNAL(currentIndexChanged(QString)), this, SLOT(doBrowseInputDataset(QString)));
151  connect(ui->m_InputDataSetName, SIGNAL(textChanged(QString)), this, SLOT(doCheckDataset(QString)));
152 
153  CctwChunkedData *outputData = app->m_OutputData;
154 
155  if (outputData) {
156  outputData->prop_DataFileName()->linkTo(ui->m_OutputDataFileName);
157  outputData->prop_DataSetName()->linkTo(ui->m_OutputDataSetName);
158  outputData->prop_ChunksWritten()->linkTo(ui->m_ChunksWritten);
159  outputData->prop_ChunksHeld()->linkTo(ui->m_ChunksHeld);
160  outputData->prop_ChunksHeldMax()->linkTo(ui->m_ChunksHeldMax);
161 
162  outputData->prop_Compression()->linkTo(ui->m_OutputCompression);
163  outputData->prop_ChunksWritten()->linkTo(ui->m_ChunksWritten);
164 
165  outputData->prop_Dimensions()->linkTo(ui->m_OutputDimensionsX,
166  ui->m_OutputDimensionsY,
167  ui->m_OutputDimensionsZ);
168 
169  outputData->prop_ChunkSize()->linkTo(ui->m_OutputChunkX,
170  ui->m_OutputChunkY,
171  ui->m_OutputChunkZ);
172 
173  outputData->prop_ChunkCount()->linkTo(ui->m_OutputCountX,
174  ui->m_OutputCountY,
175  ui->m_OutputCountZ);
176 
177  outputData->prop_HDFChunkSize()->linkTo(ui->m_OutputHDFChunkX,
178  ui->m_OutputHDFChunkY,
179  ui->m_OutputHDFChunkZ);
180  }
181 
182  CctwTransformer *xform = app->m_Transformer;
183 
184  if (xform) {
185  xform->prop_ProjectX()->linkTo(ui->m_ProjectX);
186  xform->prop_ProjectY()->linkTo(ui->m_ProjectY);
187  xform->prop_ProjectZ()->linkTo(ui->m_ProjectZ);
188  xform->prop_ProjectDestination()->linkTo(ui->m_ProjectDestination);
189  xform->prop_OversampleX()->linkTo(ui->m_OversampleX);
190  xform->prop_OversampleY()->linkTo(ui->m_OversampleY);
191  xform->prop_OversampleZ()->linkTo(ui->m_OversampleZ);
192  }
193 
195 
196  if (parms) {
197  parms->prop_ExtraFlip()->linkTo(ui->m_ExtraFlip);
198  }
199 
200  connect(ui->m_ActionProjectBrowse, SIGNAL(triggered()), this, SLOT(doBrowseProject()));
201  connect(ui->m_ProjectBrowseButton, SIGNAL(clicked()), this, SLOT(doBrowseProject()));
202 
203  connect(ui->m_ActionProjectInput, SIGNAL(triggered()), this, SLOT(doProjectInput()));
204  connect(ui->m_ProjectInputButton, SIGNAL(clicked()), this, SLOT(doProjectInput()));
205 
206  connect(ui->m_ActionProjectOutput, SIGNAL(triggered()), this, SLOT(doProjectOutput()));
207  connect(ui->m_ProjectOutputButton, SIGNAL(clicked()), this, SLOT(doProjectOutput()));
208 
209  connect(app->prop_Progress(), SIGNAL(valueChanged(int,int)), this, SLOT(onProgressUpdate()));
210  connect(app->prop_ProgressLimit(), SIGNAL(valueChanged(int,int)), this, SLOT(onProgressUpdate()));
211 
212  qRegisterMetaType<QwtPlotCurve*>("QwtPlotCurve*");
213 
214  m_Panner = new QwtPlotPanner(ui->m_CctwGraph->canvas());
215  m_Panner -> setMouseButton(Qt::MidButton);
216  m_Panner -> setEnabled(true);
217 
218  m_Zoomer = new QwtPlotZoomer(QwtPlot::xBottom, QwtPlot::yLeft, ui->m_CctwGraph->canvas());
219  m_Zoomer -> setTrackerMode(QwtPicker::AlwaysOn);
220  m_Zoomer -> setMousePattern(QwtEventPattern::MouseSelect2,
221  Qt::LeftButton, Qt::ControlModifier | Qt::ShiftModifier);
222  m_Zoomer -> setMousePattern(QwtEventPattern::MouseSelect3,
223  Qt::LeftButton, Qt::ControlModifier);
224 // m_Zoomer -> setSelectionFlags(QwtPicker::DragSelection | QwtPicker::CornerToCorner);
225 
226  m_Magnifier = new QwtPlotMagnifier(ui->m_CctwGraph->canvas());
227  m_Magnifier -> setMouseFactor(1.0);
228 
229  m_Legend = new QwtLegend;
230  m_Legend -> setFrameStyle(QFrame::Box|QFrame::Sunken);
231 // m_Legend -> setItemMode(QwtLegend::CheckableItem);
232 
233  ui->m_CctwGraph -> insertLegend(m_Legend, QwtPlot::BottomLegend);
234 
235  m_TransformTester = new CctwqtTransformTester(this, app->m_Parameters, this);
236 }
237 
239 {
240  delete ui;
241 }
242 
244 {
245  return m_Application;
246 }
247 
248 void CctwqtMainWindow::closeEvent ( QCloseEvent * event )
249 {
250  if (wantToClose()) {
251  event -> accept();
252  } else {
253  event -> ignore();
254  }
255 }
256 
258 {
259  close();
260 }
261 
263 {
264  THREAD_CHECK;
265 
266  return QMessageBox::question(this, tr("Really Close?"),
267  tr("Do you really want to close the window?"),
268  QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok;
269 }
270 
271 void CctwqtMainWindow::printLine(QString line)
272 {
273  if (QThread::currentThread() != thread()) {
274  QMetaObject::invokeMethod(this, "printLine", Q_ARG(QString, line));
275  } else {
276  ui->m_OutputMessages->append(line);
277  }
278 }
279 
280 void CctwqtMainWindow::printMessage(QString msg, QDateTime dt)
281 {
282  if (QThread::currentThread() != thread()) {
283  QMetaObject::invokeMethod(this, "printMessage", Q_ARG(QString, msg), Q_ARG(QDateTime, dt));
284  } else {
285  ui->m_OutputMessages->append(dt.toString("yyyy MMM dd hh:mm:ss.zzz: ")+msg);
286  }
287 }
288 
290 {
291  QString cmd = ui->m_CommandInput->text();
292 
293  QMetaObject::invokeMethod(m_Application, "evaluateCommand", Q_ARG(QString, cmd));
294 }
295 
296 #ifdef WANT_IMPORT_COMMANDS
297 void CctwqtMainWindow::updateImportImagePaths(QStringList p)
298 {
299  ui->m_ImportDataImages->clear();
300  ui->m_ImportDataImages->addItems(p);
301 }
302 
303 void CctwqtMainWindow::doSetupImport()
304 {
305  if (m_SetupImportDialog == NULL) {
306  m_SetupImportDialog = new CctwqtSetupImportDialog(this, m_Application->m_ImportData);
307  m_SetupImportDialog -> show();
308  }
309 
310  m_SetupImportDialog->raise();
311  m_SetupImportDialog->activateWindow();
312 }
313 
314 void CctwqtMainWindow::doImport()
315 {
316  QtConcurrent::run(m_Application->m_ImportData, &CctwImporter::importData);
317 }
318 #endif
319 
321 {
323 
324  if (inputData) {
325  QString path = QFileDialog::getOpenFileName(this, "Input File",
326  inputData->get_DataFileName());
327 
328  if (path.length() > 0) {
329  inputData->set_DataFileName(path);
330  }
331  }
332 }
333 
334 static herr_t iterate_objects(hid_t o_id,
335  const char *name,
336  const H5O_info_t *object_info,
337  void *op_data)
338 {
339 // printf("Object: %s\n", name);
340 
341  if (object_info) {
342  switch (object_info->type) {
343  case H5O_TYPE_DATASET:
344  if (op_data) {
345  QStringList *sl = (QStringList*)(op_data);
346 
347  if (sl) {
348  sl->append(QString("/%1").arg(name));
349  }
350  }
351  break;
352  }
353  }
354  return 0;
355 }
356 
357 static QStringList iterateHDF5datasets(QString path)
358 {
359  /* Save old error handler */
360  H5E_auto2_t old_func;
361  void *old_client_data;
362 
363  H5Eget_auto(H5E_DEFAULT, &old_func, &old_client_data);
364 
365  /* Turn off error handling */
366  H5Eset_auto(H5E_DEFAULT, NULL, NULL);
367 
368  QStringList paths;
369 
370  hid_t file = H5Fopen(qPrintable(path), H5F_ACC_RDONLY, H5P_DEFAULT);
371 
372 // H5Giterate(file, "/", NULL, dataset, &paths);
373 
374 // H5Lvisit(file, H5_INDEX_NAME, H5_ITER_INC, iterate_links, &paths);
375 
376  H5Ovisit(file, H5_INDEX_NAME, H5_ITER_INC, iterate_objects, &paths);
377 
378  /* Close file */
379  herr_t ret = H5Fclose(file);
380 
381  /* Restore previous error handler */
382  H5Eset_auto(H5E_DEFAULT, old_func, old_client_data);
383 
384  return paths;
385 }
386 
388 {
389 // if (m_Window) {
390 // m_Window->printMessage(tr("CctwqtMainWindow::doCheckDataFile(\"%1\")").arg(path));
391 // }
392 
393  QStringList paths = iterateHDF5datasets(path);
394 
395  ui->m_BrowseInputDataset->clear();
396  ui->m_BrowseInputDataset->addItem("");
397  ui->m_BrowseInputDataset->addItems(paths);
398 }
399 
401 {
402 // if (m_Window) {
403 // m_Window->printMessage(tr("CctwqtMainWindow::doBrowseInputDataset(%1)").arg(entry));
404 // }
405 
406  ui->m_InputDataSetName->setText(entry);
407 }
408 
410 {
411 // if (m_Window) {
412 // m_Window->printMessage(tr("CctwqtMainWindow::doCheckDataset(\"%1\")").arg(name));
413 // }
414 }
415 
417 {
418  if (m_SetupOutputDialog == NULL) {
420  m_SetupOutputDialog -> show();
421  }
422 
423  m_SetupOutputDialog->raise();
424  m_SetupOutputDialog->activateWindow();
425 }
426 
428 {
429  if (m_SetupTransformDialog == NULL) {
431  m_SetupTransformDialog -> show();
432  }
433 
434  m_SetupTransformDialog->raise();
435  m_SetupTransformDialog->activateWindow();
436 }
437 
439 {
441 }
442 
444 {
446 }
447 
449 {
450  m_Application->set_Halting(true);
451 }
452 
454 {
455  QString path = QFileDialog::getOpenFileName(this, "Execute Script from...",
456  m_Application->get_ScriptPath());
457 
458  if (path.length()) {
460  m_Application->set_ScriptPath(path);
461  }
462 }
463 
465 {
466  QString path = QFileDialog::getSaveFileName(this, "Save Settings in...",
467  m_Application->get_SettingsPath());
468 
469  if (path.length()) {
470  m_Application->set_SettingsPath(path);
472  }
473 }
474 
476 {
477  QString path = QFileDialog::getOpenFileName(this, "Load Settings from...",
478  m_Application->get_SettingsPath());
479 
480  if (path.length()) {
482  m_Application->set_SettingsPath(path);
483  }
484 }
485 
487 {
488  QString path = QFileDialog::getSaveFileName(this, "Save Dependencies in...",
489  m_Application->get_DependenciesPath());
490 
491  if (path.length()) {
492  m_Application->set_DependenciesPath(path);
494  }
495 }
496 
498 {
499  QString path = QFileDialog::getOpenFileName(this, "Load Dependencies from...",
500  m_Application->get_DependenciesPath());
501 
502  if (path.length()) {
503  m_Application->set_DependenciesPath(path);
505  }
506 }
507 
509 {
510  if (data) {
511  int maxdeps = 0;
512  int ndeps = 0;
513  int sumdeps = 0;
514  int nchnk = data->chunkCount().volume();
515 
516  for (int i=0; i < nchnk; i++) {
517  CctwDataChunk *chunk = data->chunk(i);
518 
519  if (chunk) {
520  int ct = chunk->dependencyCount();
521 
522  if (ct >= 1) {
523  ndeps++;
524  }
525 
526  if (ct > maxdeps) {
527  maxdeps = ct;
528  }
529 
530  sumdeps += ct;
531  }
532  }
533 
534  ui->m_DependenciesTable->clear();
535  ui->m_DependenciesTable->setRowCount(ndeps + 3);
536  ui->m_DependenciesTable->setColumnCount((maxdeps+1)>4 ? (maxdeps+1):4);
537 
538  ui->m_DependenciesTable->setItem(0, 0, new QTableWidgetItem(title));
539  ui->m_DependenciesTable->setItem(1, 0, new QTableWidgetItem(tr("%1 Deps").arg(ndeps)));
540  ui->m_DependenciesTable->setItem(1, 1, new QTableWidgetItem(tr("%1 Max").arg(maxdeps)));
541  ui->m_DependenciesTable->setItem(1, 2, new QTableWidgetItem(tr("%1 Sum").arg(sumdeps)));
542  ui->m_DependenciesTable->setItem(1, 3, new QTableWidgetItem(tr("%1 Avg").arg(double(sumdeps)/double(nchnk))));
543  ui->m_DependenciesTable->setItem(1, 4, new QTableWidgetItem(tr("%1 Avg-NZ").arg(double(sumdeps)/double(ndeps))));
544 
545  int r = 0;
546 
547  for (int i=0; i < nchnk; i++) {
548  CctwDataChunk *chunk = data->chunk(i);
549 
550  if (chunk) {
551  int ct = chunk->dependencyCount();
552 
553  if (ct >= 1) {
554  ui->m_DependenciesTable->setItem(r+3, 0, new QTableWidgetItem(tr("%1->[%2]").arg(i).arg(ct)));
555 
556  for (int i=0; i<ct; i++) {
557  ui->m_DependenciesTable->setItem(r+3, 1+i, new QTableWidgetItem(tr("%1").arg(chunk->dependency(i))));
558  }
559 
560  r++;
561  }
562  }
563  }
564  }
565 }
566 
568 {
569  reportDependencies(m_Application->m_InputData, "Input Dependencies");
570 }
571 
573 {
574  reportDependencies(m_Application->m_OutputData, "Output Dependencies");
575 }
576 
578 {
579  QString path = QFileDialog::getOpenFileName(this, "Spec Data File for PE rotscan runs...",
580  m_Application->get_SpecDataFilePath());
581 
582  if (path.length()) {
584  }
585 }
586 
588 {
589  QString path = QFileDialog::getOpenFileName(this, "Spec Data File for PE rotscan runs...",
590  m_Application->get_SpecDataFilePath());
591 
592  if (path.length()) {
594  }
595 }
596 
598 {
599  int prog = m_Application->get_Progress();
600  int lim = m_Application->get_ProgressLimit();
601 
602  ui->m_ProgressBar->setMaximum(lim);
603  ui->m_ProgressBar->setValue(prog);
604 }
605 
606 void CctwqtMainWindow::plotCurves(QwtPlotCurve *c1, QwtPlotCurve *c2, QwtPlotCurve *c3, QwtPlotCurve *c4)
607 {
608  if (QThread::currentThread() != thread()) {
609  QMetaObject::invokeMethod(this,
610  "plotCurves",
611  Q_ARG(QwtPlotCurve*, c1),
612  Q_ARG(QwtPlotCurve*, c2),
613  Q_ARG(QwtPlotCurve*, c3),
614  Q_ARG(QwtPlotCurve*, c4));
615  } else {
616  c1->setBrush(QBrush(Qt::red));
617  c1->setStyle(QwtPlotCurve::NoCurve);
618  c1->setSymbol(new QwtSymbol(QwtSymbol::Rect,QBrush(Qt::red),QPen(Qt::red),QSize(3,3)));
619 
620  c2->setBrush(QBrush(Qt::blue));
621  c2->setStyle(QwtPlotCurve::NoCurve);
622  c2->setSymbol(new QwtSymbol(QwtSymbol::Rect,QBrush(Qt::blue),QPen(Qt::blue),QSize(3,3)));
623 
624  c3->setBrush(QBrush(Qt::green));
625  c3->setStyle(QwtPlotCurve::NoCurve);
626  c3->setSymbol(new QwtSymbol(QwtSymbol::Rect,QBrush(Qt::green),QPen(Qt::green),QSize(3,3)));
627 
628  c4->setBrush(QBrush(Qt::black));
629  c4->setStyle(QwtPlotCurve::NoCurve);
630  c4->setSymbol(new QwtSymbol(QwtSymbol::Rect,QBrush(Qt::black),QPen(Qt::black),QSize(3,3)));
631 
632  c1 -> attach(ui->m_CctwGraph);
633  c2 -> attach(ui->m_CctwGraph);
634  c3 -> attach(ui->m_CctwGraph);
635  c4 -> attach(ui->m_CctwGraph);
636 
637  ui->m_CctwGraph -> setAxisAutoScale(QwtPlot::xBottom);
638  ui->m_CctwGraph -> setAxisAutoScale(QwtPlot::yLeft);
639  ui->m_CctwGraph -> setAxisAutoScale(QwtPlot::yRight);
640 
641  m_Zoomer->setZoomBase();
642  }
643 }
644 
646 {
647  if (m_SetupCompareDialog == NULL) {
649  m_SetupCompareDialog -> show();
650  }
651 
652  m_SetupCompareDialog->raise();
653  m_SetupCompareDialog->activateWindow();
654 }
655 
656 #ifdef WANT_IMPORT_COMMANDS
657 void CctwqtMainWindow::doCheckImportedData()
658 {
659  if (m_SetupCheckImportDialog == NULL) {
661  m_SetupCheckImportDialog ->show();
662  }
663 
664  m_SetupCheckImportDialog->raise();
665  m_SetupCheckImportDialog->activateWindow();
666 }
667 #endif
668 
670 {
672 
673  if (xform) {
674  QString s = QFileDialog::getExistingDirectory(this, "Destination", xform->get_ProjectDestination());
675 
676  if (s.length()) {
677  xform->set_ProjectDestination(s);
678  }
679  }
680 }
681 
683 {
685 
686  if (xform) {
687  int flags = (xform->get_ProjectX() ? 1 : 0) +
688  (xform->get_ProjectY() ? 2 : 0) +
689  (xform->get_ProjectZ() ? 4 : 0);
690 
691  QString inputPath = m_Application->m_InputData->get_DataFileName();
692 
693  QFileInfo info(inputPath);
694 
695  QString dst = xform->get_ProjectDestination() + "/" + info.completeBaseName();
696  QString cmd = tr("transformer.inputProject(\"%1\", %2)").arg(dst).arg(flags);
697 
699  }
700 }
701 
703 {
705 
706  if (xform) {
707  int flags = (xform->get_ProjectX() ? 1 : 0) +
708  (xform->get_ProjectY() ? 2 : 0) +
709  (xform->get_ProjectZ() ? 4 : 0);
710 
711  QString outputPath = m_Application->m_OutputData->get_DataFileName();
712 
713  QFileInfo info(outputPath);
714 
715  QString dst = xform->get_ProjectDestination() + "/" + info.completeBaseName();
716  QString cmd = tr("transformer.outputProject(\"%1\", %2)").arg(dst).arg(flags);
717 
719  }
720 }
CctwChunkedData * m_OutputData
int dependencyCount() const
CctwChunkedData * m_InputData
QwtPlotZoomer * m_Zoomer
static herr_t iterate_objects(hid_t o_id, const char *name, const H5O_info_t *object_info, void *op_data)
CctwCrystalCoordinateParameters * m_Parameters
CctwDataChunk * chunk(int n)
QPointer< CctwqtSetupTransformDialog > m_SetupTransformDialog
static QStringList iterateHDF5datasets(QString path)
void executeScriptFile(QString path)
void printLine(QString line)
void analyzeSpecDataFile(QString path)
CctwIntVector3D chunkCount
Ui::CctwqtMainWindow * ui
CctwTransformer * m_Transformer
void doCheckDataFile(QString path)
int dependency(int n) const
void closeEvent(QCloseEvent *event)
void importData()
CctwApplication * cctwApplication()
CctwqtMainWindow(CctwApplication *app, QWidget *parent=0)
CctwqtTransformTester * m_TransformTester
QPointer< CctwqtSetupCompareDialog > m_SetupCompareDialog
void plotCurves(QwtPlotCurve *c1, QwtPlotCurve *c2, QwtPlotCurve *c3, QwtPlotCurve *c4)
void analyzePEMetaData(QString path)
CctwComparer * m_CompareData
QPointer< CctwqtSetupCheckImportDialog > m_SetupCheckImportDialog
void reportDependencies(CctwChunkedData *data, QString title)
QwtPlotMagnifier * m_Magnifier
void saveDependencies(QString path)
void loadDependencies(QString path)
void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime())
QPointer< CctwqtSetupOutputDialog > m_SetupOutputDialog
T volume() const
CctwApplication * m_Application
void evaluateCommand(QString cmd)
QwtLegend * m_Legend
CctwCrystalCoordinateParameters * parameters() const
void doBrowseInputDataset(QString entry)
void doCheckDataset(QString name)
QwtPlotPanner * m_Panner