SMILX  1.01
milxQtRegistrationPlugin.cpp
1 #include "milxQtRegistrationPlugin.h"
2 
3 #include <qplugin.h>
4 
6 {
8  MainWindow = qobject_cast<milxQtMain *>(theParent);
9 
10  threaded = false;
11  dockable = false;
12  consoleWindow = false;
13  extension = true;
14  pluginName = "Registration";
15 
16  createActions();
17  createMenu();
18  createConnections();
19 }
20 
21 milxQtRegistrationPlugin::~milxQtRegistrationPlugin()
22 {
23  if(isRunning() && threaded)
24  quit();
25  cout << "Registration Plugin Destroyed." << endl;
26 }
27 
29 {
30  return pluginName;
31 }
32 
34 {
35  QString openPythonExt = "";
36 
37  return openPythonExt;
38 }
39 
41 {
42  QStringList exts;
43 
44  return exts;
45 }
46 
48 {
49  QStringList exts;
50 
51  return exts;
52 }
53 
55 {
56  QString savePythonExt = "";
57 
58  return savePythonExt;
59 }
60 
61 void milxQtRegistrationPlugin::SetInputCollection(vtkPolyDataCollection* collection, QStringList &filenames)
62 {
63 
64 }
65 
66 void milxQtRegistrationPlugin::open(QString filename)
67 {
68 
69 }
70 
71 void milxQtRegistrationPlugin::save(QString filename)
72 {
73 
74 }
75 
77 {
78  return NULL;
79 } //No image result
80 
82 {
83  //~ denoiseModel = new milxQtRegistrationModel;
84 
85  return NULL;
86  //~ return denoiseModel;
87 } //No image result
88 
90 {
91  return NULL;
92 } //No image result
93 
95 {
96  return NULL;
97 } //No Dock result
98 
100 {
101  //~ if(pluginWindow(window) == 0)
102  return false;
103  //~ else
104  //~ return true;
105 }
106 
107 //~ milxQtDeNoiseModel* milxQtDeNoisePlugin::pluginWindow(QWidget *window)
108 //~ {
109 //~ if(window)
110 //~ return qobject_cast<milxQtDeNoiseModel *>(window);
111 //~ return 0;
112 //~ }
113 
115 {
116  //~ if(!MainWindow->isActiveModel())
117  //~ return;
118 
119  //~ milxQtModel *currentWin = MainWindow->activeModel();
120  //~ milxQtDeNoiseModel *denoiseModel = new milxQtDeNoiseModel(MainWindow); //hierarchical deletion
121  //~ denoiseModel->setName(currentWin->getName());
122  //~ denoiseModel->SetInput(currentWin->GetOutput());
123  //~ denoiseModel->generateModel();
124 
125  //~ MainWindow->display(denoiseModel);
126 }
127 
128 //~ void milxQtRegistrationPlugin::run()
129 //~ {
130 //~ QMutexLocker locker(&mutex); //Lock memory
131 
132 //~ ///Execute own thread work here
133 
134 //~ //exec();
135 //~ }
136 
137 void milxQtRegistrationPlugin::createActions()
138 {
139  actionItkAffine = new QAction(MainWindow);
140  actionItkAffine->setText(QApplication::translate("RegistrationPlugin", "Affine (Itk)", 0, QApplication::UnicodeUTF8));
141 
142  actionItkDemon = new QAction(MainWindow);
143  actionItkDemon->setText(QApplication::translate("RegistrationPlugin", "Demon (Itk)"));
144 
145 #ifdef USE_NIFTI_REG
146  actionF3DNifti = new QAction(MainWindow);
147  actionF3DNifti->setText(QApplication::translate("RegistrationPlugin", "Free Form Deformation (Nifti)", 0, QApplication::UnicodeUTF8));
148 
149  actionAladinNifti = new QAction(MainWindow);
150  actionAladinNifti->setText(QApplication::translate("RegistrationPlugin", "Aladin (Nifti)"));
151 #endif
152 
153 
154 #ifdef USE_ELASTIX
155  actionElastixAffine = new QAction(MainWindow);
156  actionElastixAffine->setText(QApplication::translate("RegistrationPlugin", "Affine (Elastix)", 0, QApplication::UnicodeUTF8));
157 
158  actionElastixBSpline = new QAction(MainWindow);
159  actionElastixBSpline->setText(QApplication::translate("RegistrationPlugin", "BSpline (Elastix)"));
160 #endif
161 
162 }
163 
164 void milxQtRegistrationPlugin::createMenu()
165 {
166  menu = new QMenu(MainWindow);
167  menu->setTitle(QApplication::translate("RegistrationPlugin", "Image Registration", 0, QApplication::UnicodeUTF8));
168 
169  menu->addAction(actionItkAffine);
170  menu->addAction(actionItkDemon);
171 
172 #ifdef USE_NIFTI_REG
173  menu->addAction(actionF3DNifti);
174  menu->addAction(actionAladinNifti);
175 #endif
176 
177 #ifdef USE_ELASTIX
178  menu->addAction(actionElastixAffine);
179  menu->addAction(actionElastixBSpline);
180 #endif
181 
182  menuToAdd.append(menu);
183 }
184 
185 
186 void milxQtRegistrationPlugin::createConnections()
187 {
188  connect(actionItkAffine, SIGNAL(activated()), this, SLOT(ItkAffineRegistrationSlot()));
189  connect(actionItkDemon, SIGNAL(activated()), this, SLOT(ItkDemonRegistrationSlot()));
190 
191 #ifdef USE_NIFTI_REG
192  connect(actionF3DNifti, SIGNAL(activated()), this, SLOT(F3DNiftiRegistrationSlot()));
193  connect(actionAladinNifti, SIGNAL(activated()), this, SLOT(AladinNiftiRegistrationSlot()));
194 #endif
195 
196 #ifdef USE_ELASTIX
197  connect(actionElastixAffine, SIGNAL(activated()), this, SLOT(ElastixAffineRegistrationSlot()));
198  connect(actionElastixBSpline, SIGNAL(activated()), this, SLOT(ElastixBSplineRegistrationSlot()));
199 #endif
200 
201 }
202 
203 // Itk Affine Registration slot
205 {
206  regWindow = new milxQtRegistrationWindow(MainWindow);
207  regWindow->setAlgo(AffineItk);
208  regWindow->show();
209 }
210 
211 // Itk Demon Registration slot
213 {
214  regWindow = new milxQtRegistrationWindow(MainWindow);
215  regWindow->setAlgo(DemonItk);
216  regWindow->show();
217 }
218 
219 #ifdef USE_NIFTI_REG
220 // F3DNifti Registration slot
221 void milxQtRegistrationPlugin::F3DNiftiRegistrationSlot()
222 {
223  regWindow = new milxQtRegistrationWindow(MainWindow);
224  regWindow->setAlgo(F3DNifti);
225  regWindow->show();
226 }
227 
228 // AladinNifti Registration slot
229 void milxQtRegistrationPlugin::AladinNiftiRegistrationSlot()
230 {
231  regWindow = new milxQtRegistrationWindow(MainWindow);
232  regWindow->setAlgo(AladinNifti);
233  regWindow->show();
234 }
235 #endif
236 
237 #ifdef USE_ELASTIX
238 // Elastix Affine Registration slot
239 void milxQtRegistrationPlugin::ElastixAffineRegistrationSlot()
240 {
241  regWindow->setAlgo(ElastixAffine);
242  regWindow->show();
243 }
244 
245 
246 // Elastix BSpline Registration slot
247 void milxQtRegistrationPlugin::ElastixBSplineRegistrationSlot()
248 {
249  regWindow->setAlgo(ElastixBSpline);
250  regWindow->show();
251 }
252 #endif
253 
254 Q_EXPORT_PLUGIN2(registrationPlugin, milxQtRegistrationPluginFactory);
bool threaded
Threaded plugin?
QPointer< milxQtRegistrationWindow > regWindow
registration window
QAction * actionItkAffine
Itk Affine action.
void ItkDemonRegistrationSlot()
Slot for the Itk Demon registration button.
This class represents the MILX Qt Render Window Display object using QVTK.
bool consoleWindow
console window?
This class represents the MILX Qt Image Display object using VTK.
Definition: milxQtImage.h:118
virtual void open(QString filename)
Open the file using the plugin. [Implement this in your plugin].
bool extension
Extension rather than a plugin?
virtual QString openFileSupport()
Get the file support string for opening (extension wildcard list). [Implement this in your plugin]...
QMenu * menu
Registration menu.
virtual void save(QString filename)
Save the result as a file using the plugin. [Implement this in your plugin].
milxQtRegistrationPlugin(QObject *theParent=0)
Default destructor.
virtual void SetInputCollection(vtkPolyDataCollection *collection, QStringList &filenames)
Pass a collection to internal plugin class. [Implement this in your plugin].
QAction * actionItkDemon
Itk Demon action.
virtual QDockWidget * dockWidget()
Return the dock widget (if one is provided by plugin). [Implement this in your plugin].
This class represents the MILX Qt Model/Mesh Display object using VTK.
Definition: milxQtModel.h:115
virtual void loadExtension()
Load the extension. [Implement this in your plugin].
bool dockable
Dockable plugin?
The interface for any plugins that can be made for milxQtMain.
This class is the registration window/form.
virtual QString name()
Get the Name of the plugin. [Implement this in your plugin].
virtual bool isPluginWindow(QWidget *window)
Is the window provided a plugin generated window? In this case a milxQtShapeModel window...
virtual QString saveFileSupport()
Get the file support string for saving (extension wildcard list). [Implement this in your plugin]...
virtual milxQtRenderWindow * genericResult()
Get the generic result, which is a milxQtRenderWindow. The result can then be displayed in milxQtMain...
virtual QStringList saveExtensions()
Get a list of supported file format extensions. [Implement this in your plugin].
virtual milxQtImage * imageResult()
Get the image result. The result can then be displayed in milxQtMain etc.[Implement this in your plug...
This class represents the MILX Qt Main Window object using Qt.
Definition: milxQtMain.h:85
virtual milxQtModel * modelResult()
Get the model result. The result can then be displayed in milxQtMain etc. [Implement this in your plu...
void ItkAffineRegistrationSlot()
Slot for the Itk Affine registration button.
virtual QStringList openExtensions()
Get a list of supported file format extensions. [Implement this in your plugin].