Go to the documentation of this file.00001
00022 #ifndef DGVTableVTK_H
00023 #define DGVTableVTK_H
00024
00025 #include <QtGui/QTableWidget>
00026 #include <QtGui/QtGui>
00027
00028 #include "DGVConsole.h"
00029 #include "DGVPlot.h"
00030 #include "DGVAnimatedScan.h"
00031 #include "DGVSurfacePlotVTK.h"
00032
00033 typedef imageType tableType;
00034
00054 class DGV_VTK_EXPORT DGVTableVTK : public QTableWidget
00055 {
00056 Q_OBJECT
00057
00058 public:
00063 DGVTableVTK(QWidget *parent = 0);
00068 virtual ~DGVTableVTK();
00069
00074 void setName(QString filename);
00079 virtual void setItem(int row, int column, tableType value);
00080 virtual void setItem(int row, int column, QString value);
00085 tableType getItem(int x, int y);
00086
00091 bool loadCSV(const QString filename);
00096 void complexValuedMode(bool complexValues);
00101 inline bool isComplexValued()
00102 { return complexData; }
00108 void linkToImageData(bool link);
00114 inline bool isLinkedToImage()
00115 { return linkedToImage; }
00120 void setData(Array<tableType,2> &values);
00121 void setData(Array<tableType,1> &values);
00122 void setData(Array<Array<tableType,1>,1> &values);
00127 void setData(Array<complex<tableType>,2> &values);
00128 void setData(Array<complex<tableType>,1> &values);
00129 void setData(Array< Array<complex<tableType>,1>,1 > &values);
00135 void setDataSize(int rows, int cols);
00140 inline void setPrecision(int prec)
00141 { tablePrecision = prec; }
00146 inline int getPrecision()
00147 { return tablePrecision; }
00152 inline void generateTable()
00153 { refresh(); }
00158 void reload();
00163 void viewMagnitude()
00164 { absoluteMagnitudeAct->setChecked(true); refresh(); }
00169 inline bool viewingMagnitude()
00170 { return absoluteMagnitudeAct->isChecked(); }
00175 void viewImaginaryPart()
00176 { imaginaryPartAct->setChecked(true); refresh(); }
00181 inline bool viewingImaginaryPart()
00182 { return imaginaryPartAct->isChecked(); }
00187 void viewRealPart()
00188 { realPartAct->setChecked(true); refresh(); }
00193 inline bool viewingRealPart()
00194 { return realPartAct->isChecked(); }
00199 void viewPhase()
00200 { phaseAct->setChecked(true); refresh(); }
00205 inline bool viewingPhase()
00206 { return phaseAct->isChecked(); }
00211 inline bool isViewChanging()
00212 { return viewChanging; }
00217 Array<tableType,2>& data();
00222 Array<complex<tableType>,2>& dataComplex();
00229 Array<tableType,2>& dataViewing();
00234 QString strippedName();
00239 QString strippedNamePrefix();
00244 void addToContextMenu(QVector<QMenu*> &menus);
00250 void setConsole(DGVConsole *newConsole);
00255 inline void setVerboseMode(bool verbose)
00256 { verboseMode = verbose; }
00257
00262 inline void clearArray()
00263 { tableData.free(); }
00264
00265 public slots:
00270 void zapSelection();
00275 void delSelection();
00280 void plotSelection();
00285 void fftSelection();
00290 void ifftSelection();
00295 void fftRealSelection();
00300 void ifftRealSelection();
00305 void surfacePlotSelection();
00310 void scanSelection();
00315 void saveSelection();
00320 void saveAll();
00325 void refresh();
00330 void renameData();
00335 void updateData(int row, int col);
00336
00337 signals:
00342 void plotAvailable(DGVPlot *);
00347 void animationAvailable(DGVAnimatedScan *);
00352 void surfacePlotAvailable(DGVSurfacePlotVTK *);
00357 void fftSelectionAvailable(Array<Array<complex<tableType>,1>,1> selectedData);
00362 void ifftSelectionAvailable(Array<Array<complex<tableType>,1>,1> selectedData);
00367 void fftRealSelectionAvailable(Array<Array<tableType,1>,1> selectedData);
00372 void ifftRealSelectionAvailable(Array<Array<complex<tableType>,1>,1> selectedData);
00377 void recentFileAvailable(const QString &fileName);
00378
00379 protected:
00380 bool complexData;
00381 bool linkedToImage;
00382 bool viewChanging;
00383 bool verboseMode;
00384 bool consoleAssigned;
00385 bool editable;
00386 int tablePrecision;
00387 QString name;
00388
00389
00390 QMenu *contextMenu;
00391 QVector<QMenu*> menusToAdd;
00392 QActionGroup *selectGroup;
00393 QAction *zapAct;
00394 QAction *delAct;
00395
00396 QActionGroup *globalGroup;
00397 QAction *plotAct;
00398 QAction *fft_1DAct;
00399 QAction *ifft_1DAct;
00400 QAction *fft_Real_1DAct;
00401 QAction *ifft_Real_1DAct;
00402 QAction *surfacePlotAct;
00403 QAction *scanAct;
00404
00405 QActionGroup *complexGroup;
00406 QAction *absoluteMagnitudeAct;
00407 QAction *imaginaryPartAct;
00408 QAction *realPartAct;
00409 QAction *phaseAct;
00410
00411 QAction *fitColsAct;
00412 QAction *fitRowsAct;
00413 QAction *saveAct;
00414 QAction *saveAllAct;
00415 QAction *refreshAct;
00416 QAction *renameAct;
00417 QAction *closeAct;
00418
00419 Array<tableType,2> tableData;
00420 Array<complex<tableType>,2> tableComplexData;
00421
00422 DGVConsole *console;
00423
00428 void addContextMenuExtras();
00433 virtual void contextMenuEvent(QContextMenuEvent *event);
00438 void createConnections();
00439 void createActions();
00440 void selectionToArray(Array<Array<tableType,1>,1> &xData, Array<Array<tableType,1>,1> &selectedData);
00441 void selectionToArray(Array<Array<tableType,1>,1> &xData, Array<Array<complex<tableType>,1>,1> &selectedData);
00446 void printError(QString msg);
00451 void printWarning(QString msg);
00456 void printInfo(QString msg);
00457 };
00458
00459
00460
00461 #endif // DGVTableVTK_H