SMILX  1.01
milxQtSSMPlugin.h
1 /*=========================================================================
2  The Software is copyright (c) Commonwealth Scientific and Industrial Research Organisation (CSIRO)
3  ABN 41 687 119 230.
4  All rights reserved.
5 
6  Licensed under the CSIRO BSD 3-Clause License
7  You may not use this file except in compliance with the License.
8  You may obtain a copy of the License in the file LICENSE.md or at
9 
10  https://stash.csiro.au/projects/SMILI/repos/smili/browse/license.txt
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17 =========================================================================*/
18 #ifndef MILXQTSSMPLUGIN_H
19 #define MILXQTSSMPLUGIN_H
20 
21 #include <QList>
22 
23 #include <milxQtPluginInterface.h>
24 #include <milxQtMain.h>
25 
26 #include "milxQtShapeModel.h"
27 #include "milxQtRobustShapeModel.h"
28 #include "milxQtManager.h"
29 
38 {
39  Q_OBJECT
40 
41 public:
42  milxQtSSMPlugin(QObject *theParent = 0);
43  ~milxQtSSMPlugin();
44 
45  QString name();
46 
47  inline bool hasOpenSupport()
48  { return true; }
49  QString openFileSupport();
50  QStringList openExtensions();
51  inline bool hasSaveSupport()
52  { return true; }
53  QString saveFileSupport();
54  QStringList saveExtensions();
55 
56  inline bool hasCollectionSupport()
57  { return true; }
58  void SetInputCollection(vtkPolyDataCollection* collection, QStringList &filenames);
59  void SetInputCollection(vtkPolyDataCollection* collection, vtkPolyData *atlasSurface, QStringList &filenames);
60 
61  void open(QString filename);
62  void save(QString filename);
63 
67  { return NULL; } //No image result
68  inline QDockWidget* dockWidget()
69  { return dock; }
70  inline Qt::DockWidgetArea dockDefaultArea()
71  { return Qt::RightDockWidgetArea; }
72 
73  bool isPluginRobustWindow(QWidget *window);
74  bool isPluginWindow(QWidget *window);
75 
79  milxQtRobustShapeModel* pluginRobustWindow(QWidget *window);
80  milxQtShapeModel* pluginWindow(QWidget *window);
81 
82 public slots:
83  virtual void loadExtension() {}
84  virtual void update();
85  void updateManager(QWidget *newWindow);
86  void multiModel();
87  void focusedModel();
88  void showAtlasFileDialog();
89  void showSurfacesFileDialog();
90  void closedSSM(QWidget *win);
91  void passOnCollection(vtkPolyDataCollection *modelCollection, QStringList &filenames);
92 
93  void preStartTasks();
94  void postStartTasks();
95 
96 protected:
99  int modelTabIndex;
100  int caseTabIndex;
101 
102  QList< QPointer<milxQtShapeModel> > shapes;
103  QList< QPointer<milxQtRobustShapeModel> > robustShapes;
104  QWidget *currentModel;
106  QPointer<milxQtManager> manager;
107  QPointer<QDockWidget> dock;
108 
109  QPointer<milxQtMain> MainWindow;
110 
111  QMenu* menuSSM;
112  //----SSM---- (hierarchical deletion)
113  QAction* actionMultiModel;
114  QAction* actionFocusModel;
115 
116  //Focus model variables
117  QWizard wizard;
118  QLineEdit *txtAtlasName;
119  QPushButton *btnAtlasName;
120  QString atlasFilename;
121  QListWidget *comboSurfaceNames;
122  QPushButton *btnSurfaceNames;
123  QPushButton *btnClearSurfaceNames;
124  QStringList surfaceFilenames;
125 
126  void run();
127  inline void addShapeModel(milxQtShapeModel *newShapeModel)
128  {
129  cout << "Adding Normal Shape Model to System." << endl;
130  shapes.append(newShapeModel);
131  currentModel = qobject_cast<QWidget *>(newShapeModel);
132  if(isPluginWindow(currentModel))
133  cout << "Successfully added normal model to system" << endl;
134  connect(shapes.last(), SIGNAL(closing(QWidget *)), this, SLOT(closedSSM(QWidget *)));
135  }
136  inline void addShapeModel(milxQtRobustShapeModel *newShapeModel)
137  {
138  cout << "Adding Robust Shape Model to System." << endl;
139  robustShapes.append(newShapeModel);
140  currentModel = qobject_cast<QWidget *>(newShapeModel);
141  connect(robustShapes.last(), SIGNAL(closing(QWidget *)), this, SLOT(closedSSM(QWidget *)));
142  }
143  void createActions();
144  void createMenu();
145  void createWizard();
146  void createConnections();
147 
148 private:
149 
150 };
151 
153 {
154  Q_OBJECT
155  Q_INTERFACES(milxQtPluginFactory)
156 
157 public:
158  milxQtPluginInterface* newPlugin(QObject *theParent = 0)
159  { return new milxQtSSMPlugin(theParent); }
160 };
161 
162 #endif // MILXQTSSMPLUGIN_H
QPointer< milxQtManager > manager
Manager widget.
QWidget * currentModel
Current model being viewed/processed.
QAction * actionMultiModel
hybrid model action
bool modelManagerCreated
Model Manager tab has been created?
virtual QString saveFileSupport()=0
Get the file support string for saving (extension wildcard list). [Implement this in your plugin]...
The Statistical Shape Model (SSM) plugin for milxQt.
This class represents the MILX Qt Render Window Display object using QVTK.
virtual QStringList saveExtensions()=0
Get a list of supported file format extensions. [Implement this in your plugin].
This class represents the MILX Qt Image Display object using VTK.
Definition: milxQtImage.h:118
QDockWidget * dockWidget()
Return the dock widget (if one is provided by plugin). [Implement this in your plugin].
virtual QStringList openExtensions()=0
Get a list of supported file format extensions. [Implement this in your plugin].
QMenu * menuSSM
SSM menu.
virtual void loadExtension()=0
Load the extension. [Implement this in your plugin].
QPointer< QDockWidget > dock
Dock widget.
bool hasSaveSupport()
Does the plugin support opening files? [Implement this in your plugin].
bool hasOpenSupport()
Does the plugin support opening files? [Implement this in your plugin].
QAction * actionFocusModel
focus model action
virtual void postStartTasks()=0
Tasks to complete after running or starting the thread. [Implement this].
virtual QString name()=0
Get the Name of the plugin. [Implement this in your plugin].
This class represents the MILX Qt Model/Mesh Display object using VTK.
Definition: milxQtModel.h:115
virtual void SetInputCollection(vtkPolyDataCollection *collection, QStringList &filenames)=0
Pass a collection to internal plugin class. [Implement this in your plugin].
bool hasCollectionSupport()
Does the plugin support collections (PolyData collection etc.). [Implement this in your plugin]...
milxQtShapeModel * hybridShapeModel
Hybrid model.
Qt::DockWidgetArea dockDefaultArea()
Return the default dock widget area (if one is provided by plugin). [Implement this in your plugin]...
milxQtImage * imageResult()
Get the image result. The result can then be displayed in milxQtMain etc.[Implement this in your plug...
virtual void preStartTasks()=0
Tasks to complete before running or starting the thread. [Implement this].
The interface for any plugins that can be made for milxQtMain.
virtual void update()=0
Update the plugin. [Implement this in your plugin].
virtual bool isPluginWindow(QWidget *window)=0
Is the window provided a plugin generated window? In this case a milxQtShapeModel window...
virtual milxQtModel * modelResult()=0
Get the model result. The result can then be displayed in milxQtMain etc. [Implement this in your plu...
virtual milxQtRenderWindow * genericResult()=0
Get the generic result, which is a milxQtRenderWindow. The result can then be displayed in milxQtMain...
virtual QString openFileSupport()=0
Get the file support string for opening (extension wildcard list). [Implement this in your plugin]...
virtual void open(QString filename)=0
Open the file using the plugin. [Implement this in your plugin].
#define MILXQT_PLUGIN_EXPORT
Define Windows Plugin DLL importing.
bool caseManagerCreated
Model Manager tab has been created?
virtual void save(QString filename)=0
Save the result as a file using the plugin. [Implement this in your plugin].