Go to the documentation of this file.00001
00022 #ifndef DGVMAINVTK_H_INCLUDED
00023 #define DGVMAINVTK_H_INCLUDED
00024
00025 #include <QtGui/QMainWindow>
00026 #include <QtCore/QSignalMapper>
00027
00028 #include "DGVConsole.h"
00029 #include "DGVImage.h"
00030 #include "DGVImageVTK.h"
00031 #include "DGVLatticeVTK.h"
00032 #include "DGVDiophantineVTK.h"
00033 #include "DGVTransform.h"
00034
00043 class DGV_VTK_EXPORT DGVMainVTK : public QMainWindow
00044 {
00045 Q_OBJECT
00046
00047 public:
00052 DGVMainVTK(QWidget *parent = 0);
00057 ~DGVMainVTK();
00058
00063 inline void addWindowToWorkspace(QWidget *win)
00064 { qobject_cast<QWorkspace *>(workspaces->currentWidget())->addWindow(win); }
00069 void addImage(DGVImageVTK *img);
00074 void addImage(DGVImage *img);
00079 void addTable(DGVTable *tbl);
00084 void addTable(DGVTableVTK *tbl);
00089 void addPlot(DGVPlot *plot);
00094 void addPlot(DGVPlotVTK *plot);
00099 void addScan(DGVAnimatedScan *scan);
00104 void addSurfacePlot(DGVSurfacePlotVTK *plot);
00109 void addVolumePlot(DGVVolumePlotVTK *plot);
00114 void addLattice(DGVLatticeVTK *lattice);
00119 bool loadFile(const QString &filename);
00124 void loadFiles(const QStringList &filenames);
00129 bool loadStack(const QString &filenames);
00134 Array<imageType,2>* activeData();
00139 Array<imageType,2>* activeViewedData();
00144 Array<complex<imageType>,2>* activeDataComplex();
00149 bool isActiveDataComplex();
00154 QString activeName();
00159 QString activeNamePrefix();
00160
00161 public slots:
00166 void displayImage(DGVImageVTK *img);
00171 void displayImage(DGVImage *img);
00176 void displayTable(DGVTable *newTable);
00181 void displayTable(DGVTableVTK *newTable);
00186 void displayPlot(DGVPlot *newPlot);
00191 void displayPlot(DGVPlotVTK *newPlot);
00196 void displayScan(DGVAnimatedScan *newScan);
00201 void displaySurfacePlot(DGVSurfacePlotVTK *newPlot);
00206 void displayVolumePlot(DGVVolumePlotVTK *newPlot);
00211 void displayLattice(DGVLatticeVTK *newLattice);
00212
00217 void createImage(Array<imageType,2> newData, QString imgName);
00222 void createImage(Array< complex<imageType>,2 > newData, QString imgName);
00227 void createTable(Array<imageType,2> newData, QString tblName);
00232 void createTable(Array< complex<imageType>,2 > newData, QString tblName);
00233
00238 void open();
00243 void openStack();
00248 void openRecentFile();
00253 void save();
00258 void saveNative();
00263 void saveStack();
00268 void newTab();
00273 void newTable();
00278 void newImage();
00283 void table();
00288 void embed();
00293 void operate();
00298 inline void centerDC(bool center)
00299 { actionCenterDC->setChecked(center); }
00304 void FFT();
00309 void iFFT();
00314 void FFT_Real();
00319 void iFFT_Real();
00324 void FFT_1D(Array<Array<complex<tableType>,1>,1> data);
00329 void iFFT_1D(Array<Array<complex<tableType>,1>,1> data);
00334 void FFT_Real_1D(Array<Array<tableType,1>,1> data);
00339 void iFFT_Real_1D(Array<Array<complex<tableType>,1>,1> data);
00344 void radonSlices();
00349 void FRT();
00354 void iFRT();
00359 void iFRT_Unscaled();
00364 void updateWindowMenu();
00369 void setActiveWindow(QWidget *window);
00370
00375 void setTabName(QWidget *window);
00380 void closeTab(int index);
00385 inline void closeTabActiveWindow()
00386 { qobject_cast<QWorkspace *>(workspaces->currentWidget())->closeActiveWindow(); }
00391 inline void closeTabAllWindows()
00392 { qobject_cast<QWorkspace *>(workspaces->currentWidget())->closeAllWindows(); }
00397 inline void cascadeTab()
00398 { qobject_cast<QWorkspace *>(workspaces->currentWidget())->cascade(); }
00403 inline void tileTab()
00404 { qobject_cast<QWorkspace *>(workspaces->currentWidget())->tile(); }
00405
00410 void working();
00415 void done();
00420 inline void tile()
00421 { qobject_cast<QWorkspace *>(workspaces->currentWidget())->tile(); }
00426 inline void cascade()
00427 { qobject_cast<QWorkspace *>(workspaces->currentWidget())->cascade(); }
00428
00433 void about();
00434 void cut();
00435 void copy();
00436 void paste();
00437
00442 bool isActiveImage();
00447 DGVImageVTK* activeImage();
00452 bool isActiveTable();
00457 DGVTableVTK* activeTable();
00462 bool isActiveSPlot();
00467 DGVSurfacePlotVTK* activeSPlot();
00472 bool isActivePlot();
00477 DGVPlot* activePlot();
00482 bool isActiveVPlot();
00487 DGVVolumePlotVTK* activeVPlot();
00492 bool isActiveLattice();
00497 DGVLatticeVTK* activeLattice();
00502 inline DGVConsole* getConsole()
00503 { return console; }
00508 void setCurrentFile(const QString &fileName);
00509
00510 protected:
00511 bool conductingFFT;
00512 bool conductingFFT_1D;
00513 bool conductingInverseFFT;
00514 bool conductingInverseFFT_1D;
00515 QString currentFile;
00516
00517 QTabWidget *workspaces;
00518 QSignalMapper *windowMapper;
00519
00520 Array<complex<double>,2> field;
00521
00523 enum { MaxRecentFiles = 10 };
00524
00525 QAction *actionOpen;
00526 QAction *actionOpenStack;
00527 QAction *actionSave;
00528 QAction *actionSaveRaw;
00529 QAction *actionSaveStack;
00530 QAction *actionCloseActive;
00531 QAction *actionCloseAll;
00532 QAction *actionsRecentFile[MaxRecentFiles];
00533 QAction *actionRecentFileSeparator;
00534 QAction *actionExit;
00535
00536 QAction *actionNewTab;
00537 QAction *actionNewTable;
00538 QAction *actionNewImage;
00539
00540 QAction *actionTable;
00541 QAction *actionEmbed;
00542 QAction *actionOperate;
00543
00544 QAction *actionFFT;
00545 QAction *actioniFFT;
00546 QAction *actionFFT_Real;
00547 QAction *actioniFFT_Real;
00548 QAction *actionSlice;
00549 QAction *actionNormalise;
00550 QAction *actionCenterDC;
00551 QAction *actionFRT;
00552 QAction *actioniFRT;
00553 QAction *actioniFRT_Unscaled;
00554
00555 QAction *actionCascade;
00556 QAction *actionTile;
00557 QAction *actionSeparator;
00558 QAction *actionConsole;
00559
00560 QAction *actionAbout;
00561
00563 QMenuBar *menuBar;
00564 QMenu *menuFile;
00565 QMenu *submenuNew;
00566 QMenu *menuData;
00567 QMenu *menuTransform;
00568 QMenu *submenuFourier;
00569 QMenu *submenuRadon;
00570 QMenu *menuWindows;
00571 QMenu *menuHelp;
00572 QMenu *contextMenu;
00573
00575 QVector<QMenu *> contextMenusToPass;
00576
00578 QProgressDialog *workingDlg;
00579 bool workingOn;
00580
00582 DGVTransform *Transforms;
00583 DGVConsole *console;
00584
00589 void createMenu();
00594 void createConnections();
00599 void contextMenuEvent(QContextMenuEvent *event);
00604 void dragEnterEvent(QDragEnterEvent *event);
00609 void dropEvent(QDropEvent *event);
00614 void closeEvent(QCloseEvent *event);
00619 void setupTooltips();
00624 void updateRecentFileActions();
00629 void commonChildProperties(QWidget *widget);
00634 inline QString strippedName(const QString &fullFileName)
00635 { return QFileInfo(fullFileName).fileName(); }
00636
00641 void writeSettings();
00646 void readSettings();
00647 };
00648
00649 #endif // DGVMAINVTK_H_INCLUDED