SMILX  1.01
milxQtSSMPlugin.cpp
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 #include "milxQtSSMPlugin.h"
19 
20 #include <qplugin.h>
21 
22 //SMILI
23 #include <milxQtFile.h>
24 
26 {
28  MainWindow = qobject_cast<milxQtMain *>(theParent);
29 
30  threaded = false;
31  dockable = true;
32  consoleWindow = false;
33  extension = false;
34  pluginName = "Statistical Shape Model (SSM)";
35  dataName = "";
36  modelManagerCreated = false;
37  caseManagerCreated = false;
38 
39  modelTabIndex = 0;
40  caseTabIndex = 0;
41 
42  manager = new milxQtManager(MainWindow);
43  manager->hide();
44  dock = new QDockWidget(tr("Manager"), MainWindow);
45  dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
46  dock->setWidget(manager);
47  dock->setObjectName("Manager");
48 
49  //focus variables
50  txtAtlasName = new QLineEdit;
51  btnAtlasName = new QPushButton;
52  comboSurfaceNames = new QListWidget;
53  btnSurfaceNames = new QPushButton;
54  btnClearSurfaceNames = new QPushButton;
55 
56  createActions();
57  createMenu();
58  createWizard();
59  createConnections();
60 }
61 
62 milxQtSSMPlugin::~milxQtSSMPlugin()
63 {
64  shapes.clear();
65  robustShapes.clear();
66  cerr << "SSM Destroyed" << endl;
67 }
68 
70 {
71  return pluginName;
72 }
73 
75 {
76  QString openSSMExt = "Shape Model Files (*.ssm *.rssm)";
77 
78  return openSSMExt;
79 }
80 
82 {
83  QStringList exts;
84 
85  exts.append(".ssm");
86  exts.append(".rssm");
87 
88  return exts;
89 }
90 
92 {
93  QStringList exts;
94 
95  exts.append(".ssm");
96  exts.append(".rssm");
97 
98  return exts;
99 }
100 
102 {
103  QString saveSSMExt = "Shape Model Files (*.ssm *.rssm)";
104 
105  return saveSSMExt;
106 }
107 
108 void milxQtSSMPlugin::SetInputCollection(vtkPolyDataCollection* collection, QStringList &filenames)
109 {
110  cout << "Loading Collection via the SSM Plugin" << endl;
111  addShapeModel( new milxQtShapeModel );
112  currentModel = shapes.last();
113  shapes.last()->setConsole(console);
114  shapes.last()->SetInputCollection(collection, filenames);
115  connect(shapes.last(), SIGNAL(resultAvailable(milxQtRenderWindow*)), MainWindow, SLOT(display(milxQtRenderWindow*)));
116  connect(shapes.last(), SIGNAL(resultAvailable(milxQtModel*)), MainWindow, SLOT(display(milxQtModel*)));
117  connect(shapes.last(), SIGNAL(collectionAvailable(vtkPolyDataCollection*, QStringList&)), this, SLOT(passOnCollection(vtkPolyDataCollection*, QStringList&)));
118  cout << "Loaded Collection as a Normal SSM." << endl;
119 
121  QStringList headingList;
122 
123  headingList << "Index" << "Case ID";
124  if(!caseManagerCreated)
125  {
126  caseTabIndex = manager->newTab("Case Browser", headingList);
127  caseManagerCreated = true;
128  }
129  else
130  manager->clearTab(caseTabIndex);
131 
132  cout << "Loading cases into browser." << endl;
133  QList< int > cases = shapes.last()->getCaseIDs();
134  for(int j = 0; j < cases.size(); j ++)
135  {
136  QStringList caseList;
137 
138  caseList << QString::number(j) << "Case " + QString::number(cases[j]);
139 
140  manager->addItem(caseTabIndex, caseList, Qt::NoItemFlags);
141  }
142 
143  manager->show();
144  cout << "Done." << endl;
145 }
146 
147 void milxQtSSMPlugin::SetInputCollection(vtkPolyDataCollection* collection, vtkPolyData *atlasSurface, QStringList &filenames)
148 {
149  cout << "Loading Collection via the SSM Plugin" << endl;
150  addShapeModel( new milxQtRobustShapeModel );
151  currentModel = robustShapes.last();
152  robustShapes.last()->setConsole(console);
153  robustShapes.last()->SetInputCollection(collection, atlasSurface, filenames);
154  connect(robustShapes.last(), SIGNAL(resultAvailable(milxQtRenderWindow*)), MainWindow, SLOT(display(milxQtRenderWindow*)));
155  connect(robustShapes.last(), SIGNAL(resultAvailable(milxQtModel*)), MainWindow, SLOT(display(milxQtModel*)));
156  connect(robustShapes.last(), SIGNAL(collectionAvailable(vtkPolyDataCollection*, QStringList&)), this, SLOT(passOnCollection(vtkPolyDataCollection*, QStringList&)));
157  cout << "Loaded Collection as a Robust SSM." << endl;
158 
159  if(!robustShapes.last()->isLoaded())
160  {
161  cout << "Model failed to be loaded. See log/terminal output." << endl;
162  return;
163  }
164 
166  QStringList headingList;
167 
168  headingList << "Index" << "Case ID";
169  if(!caseManagerCreated)
170  {
171  caseTabIndex = manager->newTab("Case Browser", headingList);
172  caseManagerCreated = true;
173  }
174  else
175  manager->clearTab(caseTabIndex);
176 
177  cout << "Loading cases into browser." << endl;
178  QList< int > cases = robustShapes.last()->getCaseIDs();
179  for(int j = 0; j < cases.size(); j ++)
180  {
181  QStringList caseList;
182 
183  caseList << QString::number(j) << "Case " + QString::number(cases[j]);
184 
185  manager->addItem(caseTabIndex, caseList, Qt::NoItemFlags);
186  }
187 
188  manager->show();
189  cout << "Done." << endl;
190 }
191 
192 void milxQtSSMPlugin::open(QString filename)
193 {
194  if(filename.contains(".rssm", Qt::CaseInsensitive))
195  {
196  cout << "Loading as Robust Shape Model" << endl;
197  addShapeModel( new milxQtRobustShapeModel );
198  currentModel = robustShapes.last();
199  robustShapes.last()->setConsole(console);
200  robustShapes.last()->openModel(filename);
201  connect(robustShapes.last(), SIGNAL(resultAvailable(milxQtRenderWindow*)), MainWindow, SLOT(display(milxQtRenderWindow*)));
202  connect(robustShapes.last(), SIGNAL(resultAvailable(milxQtModel*)), MainWindow, SLOT(display(milxQtModel*)));
203  connect(robustShapes.last(), SIGNAL(collectionAvailable(vtkPolyDataCollection*, QStringList&)), this, SLOT(passOnCollection(vtkPolyDataCollection*, QStringList&)));
204  }
205  else if(filename.contains(".ssm", Qt::CaseInsensitive))
206  {
207  cout << "Loading as Normal Shape Model" << endl;
208  addShapeModel( new milxQtShapeModel );
209  currentModel = shapes.last();
210  shapes.last()->setConsole(console);
211  shapes.last()->openModel(filename);
212  connect(shapes.last(), SIGNAL(resultAvailable(milxQtRenderWindow*)), MainWindow, SLOT(display(milxQtRenderWindow*)));
213  connect(shapes.last(), SIGNAL(resultAvailable(milxQtModel*)), MainWindow, SLOT(display(milxQtModel*)));
214  connect(shapes.last(), SIGNAL(collectionAvailable(vtkPolyDataCollection*, QStringList&)), this, SLOT(passOnCollection(vtkPolyDataCollection*, QStringList&)));
215  }
216  else
217  {
218  cout << "File extension not supported." << endl;
219  return;
220  }
221 
222  dataName = filename;
223  cout << "Loaded SSM File." << endl;
224 }
225 
226 void milxQtSSMPlugin::save(QString filename)
227 {
228  cout << "Saving as an SSM file" << endl;
229  if(filename.contains(".rssm", Qt::CaseInsensitive))
230  robustShapes.last()->saveModel(filename);
231  else if(filename.contains(".ssm", Qt::CaseInsensitive))
232  shapes.last()->saveModel(filename);
233  else
234  {
235  cout << "File Extension not support!" << endl;
236  return;
237  }
238 
239  dataName = filename;
240  cout << "Done." << endl;
241 }
242 
244 {
245  if(!isPluginRobustWindow(currentModel))
246  {
247  cout << "Creating Normal SSM Model for display." << endl;
248  shapes.last()->generateMeanModel();
249  shapes.last()->setName(dataName);
250  shapes.last()->generateRender();
251 
252  return shapes.last();
253  }
254 
255  cout << "Creating Robust SSM Model for display." << endl;
256  robustShapes.last()->generateMeanModel();
257  robustShapes.last()->setName(dataName);
258  robustShapes.last()->generateRender();
259 
260  return robustShapes.last();
261 }
262 
264 {
265  if(!isPluginRobustWindow(currentModel))
266  {
267  QPointer<milxQtModel> model = shapes.last()->getMeanModel();
268  model->setName(dataName + " - Mean Model");
269  model->setDeletableOnClose(false);
270 
271  return model;
272  }
273 
274  QPointer<milxQtModel> model = robustShapes.last()->getMeanModel();
275  model->setName(dataName + " - Mean Model");
276  model->setDeletableOnClose(false);
277 
278  return model;
279 }
280 
281 bool milxQtSSMPlugin::isPluginRobustWindow(QWidget *window) //not in plugin-interface
282 {
283  if(pluginRobustWindow(window) == 0)
284  return false;
285  else
286  return true;
287 }
288 
289 bool milxQtSSMPlugin::isPluginWindow(QWidget *window)
290 {
291  if(pluginWindow(window) == 0)
292  return false;
293  else
294  return true;
295 }
296 
297 milxQtRobustShapeModel* milxQtSSMPlugin::pluginRobustWindow(QWidget *window) //not in plugin-interface
298 {
299  if(window)
300  {
301  milxQtRobustShapeModel *ssmWindow = qobject_cast<milxQtRobustShapeModel *>(window);
302  if(ssmWindow)
303  return ssmWindow;
304  }
305 
306  return 0;
307 }
308 
309 milxQtShapeModel* milxQtSSMPlugin::pluginWindow(QWidget *window)
310 {
311  if(window)
312  {
313  milxQtShapeModel *ssmWindow = qobject_cast<milxQtShapeModel *>(window);
314  if(ssmWindow)
315  return ssmWindow;
316  }
317 
318  return 0;
319 }
320 
321 void milxQtSSMPlugin::preStartTasks()
322 {
323  cout << "Pre Start Tasks" << endl;
324  if(dataName.contains(".rssm", Qt::CaseInsensitive))
325  {
326  cout << "Loading as Robust Shape Model" << endl;
327  addShapeModel( new milxQtRobustShapeModel );
328  currentModel = robustShapes.last();
329  }
330  else if(dataName.contains(".ssm", Qt::CaseInsensitive))
331  {
332  cout << "Loading as Normal Shape Model" << endl;
333  addShapeModel( new milxQtShapeModel );
334  currentModel = shapes.last();
335  }
336 }
337 
338 void milxQtSSMPlugin::postStartTasks()
339 {
340  cout << "Post Start Tasks" << endl;
341  if(dataName.contains(".rssm", Qt::CaseInsensitive))
342  {
343  robustShapes.last()->generateMeanModel();
344  robustShapes.last()->generateRender();
345  }
346  else if(dataName.contains(".ssm", Qt::CaseInsensitive))
347  {
348  shapes.last()->generateMeanModel();
349  shapes.last()->generateRender();
350  }
351 
352  cout << "Creating Shape Model Display" << endl;
354  cout << "Creating Mean Display" << endl;
355  milxQtModel *mdl = modelResult();
356 
357  cout << "Updating Plugin" << endl;
358  update();
359 
360  emit resultAvailable(rnd);
361  emit resultAvailable(mdl);
362 }
363 
365 {
366  QMutexLocker locker(&mutex); //Lock memory
367 
369  int duration = 0;
370  QTime *timer = new QTime;
371 
372  timer->start();
373  cout << "Executing load." << endl;
374  if(dataName.contains(".rssm", Qt::CaseInsensitive))
375  {
376  robustShapes.last()->setName(dataName);
377  robustShapes.last()->openModel(dataName);
378  robustShapes.last()->generateSSM();
379  }
380  else if(dataName.contains(".ssm", Qt::CaseInsensitive))
381  {
382  shapes.last()->setName(dataName);
383  shapes.last()->openModel(dataName);
384  shapes.last()->generateSSM();
385  }
386 
387 // cout << "Creating Shape Model Display" << endl;
388 // milxQtRenderWindow *rnd = genericResult();
389 // cout << "Creating Mean Display" << endl;
390 // milxQtModel *mdl = modelResult();
391 //
392 // cout << "Updating Plugin" << endl;
393 // update();
394 //
395 // emit resultAvailable(rnd);
396 // emit resultAvailable(mdl);
397  cout << "Completed load." << endl;
398 
399  duration = timer->elapsed();
400  cout << "Computation took: " << QString::number(duration/1000.0).toStdString() << " secs" << endl;
401  delete timer;
402 
403  //exec();
404 }
405 
406 void milxQtSSMPlugin::update()
407 {
408  if(shapes.isEmpty() && modelManagerCreated)
409  manager->clearTab(modelTabIndex);
410  else if(!isPluginRobustWindow(currentModel))
411  updateManager(shapes.last());
412  else
413  updateManager(robustShapes.last());
414 
415  if(!shapes.isEmpty() || !robustShapes.isEmpty())
416  actionMultiModel->setDisabled(false);
417  else
418  actionMultiModel->setDisabled(true);
419 }
420 
421 void milxQtSSMPlugin::updateManager(QWidget *newWindow)
422 {
423  milxQtShapeModel *newModel = pluginWindow(newWindow);
425 
426  if(!newModel)
427  return;
428 
429  if(!modelManagerCreated)
430  {
431  QStringList headings;
432 
433  headings << "Model Name" << "# Shapes" << "Weight" << "";
434 
435  modelTabIndex = manager->newTab("Model Browser", headings);
436 
437  modelManagerCreated = true;
438  }
439 
442  manager->clearTab(modelTabIndex);
443 // MainWindow->initialiseWindowTraversal();
444 // for(int j = 0; j < MainWindow->getNumberOfWindows(); j ++)
445 // {
446 // milxQtShapeModel *newWindow = pluginWindow(MainWindow->nextWindow());
447 //
448 // if(!newWindow)
449 // continue;
450 //
451 // QStringList modelEntry;
452 // size_t n = newWindow->GetNumberOfShapes();
453 //
454 // modelEntry << newWindow->strippedBaseName() << QString::number(n) << "1.0";
455 // manager->addItem(modelTabIndex, modelEntry);
456 // }
457 
460  foreach(QPointer<milxQtShapeModel> currModel, shapes)
461  {
462  QStringList modelEntry;
463 // QPushButton *editButton = new QPushButton;
464  size_t n = currModel->GetNumberOfShapes();
465 
466 // editButton->setText("Edit");
467 
468  modelEntry << currModel->strippedName() << QString::number(n) << "1.0"; //Last entry is the widget
469 // manager->addItem(modelTabIndex, modelEntry, editButton, modelEntry.size()-1); //Put button at end
470  manager->addItem(modelTabIndex, modelEntry, Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable); //Put button at end
471  }
472 }
473 
475 {
476  if(shapes.isEmpty())
477  return;
478 
479  hybridShapeModel = new milxQtShapeModel(MainWindow);
480 
481  const int n = shapes.last()->GetNumberOfShapes();
482 
483  cout << "Creating a Multi-Model by Fusing " << n << " Shapes together." << endl;
484  vtkPolyDataCollection* collection = vtkPolyDataCollection::New();
485  for(int j = 0; j < n; j ++)
486  {
487  milxQtModel *hybridModel = new milxQtModel;
488 
489  foreach(QPointer<milxQtShapeModel> shape, shapes)
490  {
491  hybridModel->AddInput( shape->GetShape(j) );
492 // hybridModel->AddInput( shape->GetAlignedShape(j) );
493 
494  qApp->processEvents();
495  }
496 
497  hybridModel->generateModel();
498 // MainWindow->display(hybridModel);
499 
500 // hybridShapeModel->AddShape( hybridModel->GetOutput() );
501  collection->AddItem( hybridModel->GetOutput() );
502 
503  qApp->processEvents();
504  }
506 
507  cout << "Display Hybrid Shape Model with " << hybridShapeModel->GetNumberOfShapes() << " shapes" << endl;
508  addShapeModel(hybridShapeModel);
509  currentModel = shapes.last();
510  MainWindow->display( genericResult() );
511  cout << "Displayed Hybrid Shape." << endl;
512  MainWindow->display( modelResult() );
513 
514  update();
515 }
516 
517 void milxQtSSMPlugin::focusedModel()
518 {
519  int ret = wizard.exec();
520 
521  if(ret == QDialog::Rejected)
522  {
523  wizard.restart();
524  return;
525  }
526 
527  atlasFilename = txtAtlasName->text();
528 
529  //open atlas
530  cout << "Opening atlas model" << endl;
531  vtkSmartPointer<vtkPolyData> atlasMesh;
532  milx::File::OpenModel(atlasFilename.toStdString(), atlasMesh);
533  QPointer<milxQtModel> atlasModel = new milxQtModel;
534  atlasModel->setName(atlasFilename);
535  atlasModel->SetInput(atlasMesh);
536  atlasModel->generateModel();
537  emit resultAvailable(atlasModel);
538 
539  //open collection
540  vtkPolyDataCollection* modelCollection = vtkPolyDataCollection::New(); //RSSM takes ownership, but not fully?
541  /*std::vector<std::string> filenames;
542  for (int j = 0; j < surfaceFilenames.size(); j ++)
543  filenames.push_back(surfaceFilenames.at(j).toStdString());
544  milx::File::OpenModelCollection(filenames, collection);*/
545  QPointer<milxQtFile> file = new milxQtFile;
546  if(!file->openModelCollection(modelCollection, surfaceFilenames))
547  {
548  cout << "Unable to read selected files." << endl;
549  return;
550  }
551 
552  //create model
553  cout << "Computing Model..." << endl;
554  SetInputCollection(modelCollection, atlasMesh, surfaceFilenames);
555 
556  //emit results for display
557  emit resultAvailable(genericResult()); //shape model
558  emit resultAvailable(modelResult()); //mean shape
559 
560  wizard.restart();
561  update();
562 }
563 
565 {
566  QSettings settings("Shekhar Chandra", "milxQt");
567  //Add supported file entry
568  QString exts = openModelExts.c_str();
569  QString path = settings.value("recentPath").toString();
570 
571  QFileDialog *fileOpener = new QFileDialog;
572  atlasFilename = fileOpener->getOpenFileName(&wizard,
573  tr("Select Atlas Surface to Open"),
574  path,
575  tr(exts.toStdString().c_str()) );
576  txtAtlasName->setText(atlasFilename);
577 }
578 
580 {
581  QSettings settings("Shekhar Chandra", "milxQt");
582  //Add supported file entry
583  QString exts = openModelExts.c_str();
584  QString path = settings.value("recentPath").toString();
585 
586  QFileDialog *fileOpener = new QFileDialog;
587  surfaceFilenames = fileOpener->getOpenFileNames(&wizard,
588  tr("Select Training Surfaces to Open"),
589  path,
590  tr(exts.toStdString().c_str()) );
591  comboSurfaceNames->insertItems(0, surfaceFilenames);
592 }
593 
594 void milxQtSSMPlugin::closedSSM(QWidget *win)
595 {
596  milxQtShapeModel *tmpModel = pluginWindow(win);
597  shapes.removeAll(tmpModel);
598  update();
599 }
600 
601 void milxQtSSMPlugin::passOnCollection(vtkPolyDataCollection *modelCollection, QStringList &filenames)
602 {
603  cout << "Passing On Collection Signal" << endl;
604  emit resultAvailable(modelCollection, filenames);
605 }
606 
607 void milxQtSSMPlugin::createActions()
608 {
609  actionMultiModel = new QAction(MainWindow);
610  actionMultiModel->setText(QApplication::translate("SSMPlugin", "Create &Multi-Model", 0, QApplication::UnicodeUTF8));
611  actionMultiModel->setShortcut(tr("Ctrl+m"));
612  actionFocusModel = new QAction(MainWindow);
613  actionFocusModel->setText(QApplication::translate("SSMPlugin", "Create &Focused Model", 0, QApplication::UnicodeUTF8));
614  actionFocusModel->setShortcut(tr("Ctrl+f"));
615 }
616 
617 void milxQtSSMPlugin::createMenu()
618 {
619  menuSSM = new QMenu(MainWindow);
620  menuSSM->setTitle(QApplication::translate("SSMPlugin", "Shape Models", 0, QApplication::UnicodeUTF8));
621  menuSSM->addAction(actionMultiModel);
622  menuSSM->addAction(actionFocusModel);
623  actionMultiModel->setDisabled(true);
624 
625  menuToAdd.append(menuSSM);
626 }
627 
628 void milxQtSSMPlugin::createWizard()
629 {
630  //use wizard to ask
631  //intro
632  QWizardPage *introPage = new QWizardPage;
633  introPage->setTitle("Introduction");
634 
635  QLabel *label1 = new QLabel("This wizard will help you create a focused model from your training surfaces.");
636  label1->setWordWrap(true);
637  QLabel *label2 = new QLabel("You will be asked to provide an atlas/template mesh with scalars representing the weights for the model.");
638  label2->setWordWrap(true);
639  QLabel *label3 = new QLabel("You will be asked to provide training surfaces (with correspondences pre-computed) for the model.");
640  label3->setWordWrap(true);
641  QVBoxLayout *introLayout = new QVBoxLayout;
642  introLayout->addWidget(label1);
643  introLayout->addWidget(label2);
644  introLayout->addWidget(label3);
645  introPage->setLayout(introLayout);
646 
647  //ask for atlas mesh
648  QWizardPage *atlasPage = new QWizardPage;
649  atlasPage->setTitle("Atlas Surface with Weights");
650 
651  QLabel *label4 = new QLabel("Please provide an atlas/template mesh with scalars representing the weights for the model.");
652  QLabel *label4b = new QLabel("Atlas/template mesh with scalars must have correspondence with training surfaces.");
653  QLabel *label4c = new QLabel("Atlas/template mesh with scalars must not have zero values. Replace any with very small values.");
654  label4->setWordWrap(true);
655  //txtAtlasName class var
656  //btnAtlasName class var
657  btnAtlasName->setText("Browse...");
658  QHBoxLayout *atlasNameLayout = new QHBoxLayout;
659  atlasNameLayout->addWidget(txtAtlasName);
660  atlasNameLayout->addWidget(btnAtlasName);
661  QGroupBox *atlasGroupBox = new QGroupBox("Atlas/Template Surface Filename");
662  atlasGroupBox->setLayout(atlasNameLayout);
663  QVBoxLayout *atlasLayout = new QVBoxLayout;
664  atlasLayout->addWidget(label4);
665  atlasLayout->addWidget(label4b);
666  atlasLayout->addWidget(label4c);
667  atlasLayout->addWidget(atlasGroupBox);
668  atlasPage->setLayout(atlasLayout);
669 
670  //ask for training surfaces
671  QWizardPage *surfacesPage = new QWizardPage;
672  surfacesPage->setTitle("Training Surfaces");
673 
674  QLabel *label5 = new QLabel("Please provide training surfaces (with correspondences pre-computed) for the model.");
675  label5->setWordWrap(true);
676  //comboSurfaceNames class var
677  //btnSurfaceNames class var
678  //btnClearSurfaceNames class var
679  btnSurfaceNames->setText("Add...");
680  btnClearSurfaceNames->setText("Clear");
681  QFormLayout *surfaceNamesLayout = new QFormLayout;
682  surfaceNamesLayout->addRow(btnClearSurfaceNames, btnSurfaceNames);
683  surfaceNamesLayout->addRow(comboSurfaceNames);
684  QGroupBox *surfacesGroupBox = new QGroupBox("Atlas/Template Surface Filename");
685  surfacesGroupBox->setLayout(surfaceNamesLayout);
686  QVBoxLayout *surfacesLayout = new QVBoxLayout;
687  surfacesLayout->addWidget(label5);
688  surfacesLayout->addWidget(surfacesGroupBox);
689  surfacesPage->setLayout(surfacesLayout);
690 
691  //wizard class var
692  wizard.addPage(introPage);
693  wizard.addPage(atlasPage);
694  wizard.addPage(surfacesPage);
695 
696  wizard.setWindowTitle("Focused Model Wizard");
697 }
698 
699 void milxQtSSMPlugin::createConnections()
700 {
701 // connect(MainWindow, SIGNAL(windowActivated(QWidget*)), this, SLOT(updateManager(QWidget*)));
702  connect(actionMultiModel, SIGNAL(activated()), this, SLOT(multiModel()));
703  connect(actionFocusModel, SIGNAL(activated()), this, SLOT(focusedModel()));
704 
705  connect(btnAtlasName, SIGNAL(clicked()), this, SLOT(showAtlasFileDialog()));
706  connect(btnSurfaceNames, SIGNAL(clicked()), this, SLOT(showSurfacesFileDialog()));
707  connect(btnClearSurfaceNames, SIGNAL(clicked()), comboSurfaceNames, SLOT(clear()));
708 }
709 
710 Q_EXPORT_PLUGIN2(SSMPlugin, milxQtSSMPluginFactory);
QPointer< milxQtManager > manager
Manager widget.
bool threaded
Threaded plugin?
QWidget * currentModel
Current model being viewed/processed.
QAction * actionMultiModel
hybrid model action
void save(QString filename)
Save the result as a file using the plugin. [Implement this in your plugin].
bool isPluginWindow(QWidget *window)
Is the window provided a plugin generated window? In this case a milxQtShapeModel window...
bool modelManagerCreated
Model Manager tab has been created?
void setName(const QString filename)
Set the name of the data.
virtual void SetInputCollection(vtkPolyDataCollection *meshes)
Uses the collection of polydata to create shape model.
This class represents the MILX Qt Render Window Display object using QVTK.
bool consoleWindow
console window?
A manager (tabbed) widget class for displaying information about data such as case ID etc...
Definition: milxQtManager.h:31
QStringList saveExtensions()
Get a list of supported file format extensions. [Implement this in your plugin].
bool extension
Extension rather than a plugin?
This class represents the MILX Qt File I/O object using VTK/ITK/Qt.
Definition: milxQtFile.h:60
QMenu * menuSSM
SSM menu.
milxQtRobustShapeModel * pluginRobustWindow(QWidget *window)
void AddInput(vtkSmartPointer< vtkPolyData > mesh)
Assigns and coninually appends meshes provided to the class, preparing for display. Call generateModel() and then show() to display.
Definition: milxQtModel.cpp:97
void resultAvailable(milxQtRenderWindow *)
Send signal that Resultant render window is available for showing.
static bool OpenModel(const std::string filename, vtkSmartPointer< vtkPolyData > &data)
Opens a model file, which can be a VTK XML, Legacy VTK PolyData File (i.e. either a *...
Definition: milxFile.cxx:488
QPointer< QDockWidget > dock
Dock widget.
milxQtModel * modelResult()
Get the model result. The result can then be displayed in milxQtMain etc. [Implement this in your plu...
QAction * actionFocusModel
focus model action
void updateManager(QWidget *newWindow)
QStringList openExtensions()
Get a list of supported file format extensions. [Implement this in your plugin].
This class represents the MILX Qt Model/Mesh Display object using VTK.
Definition: milxQtModel.h:115
bool dockable
Dockable plugin?
milxQtShapeModel * hybridShapeModel
Hybrid model.
milxQtConsole * console
console for logging
milxQtRenderWindow * genericResult()
Get the generic result, which is a milxQtRenderWindow. The result can then be displayed in milxQtMain...
void generateModel(float red=defaultColour, float green=defaultColour, float blue=defaultColour)
Generates the model so that its ready for display. It requires that data has been set or assigned alr...
void SetInputCollection(vtkPolyDataCollection *collection, QStringList &filenames)
Pass a collection to internal plugin class. [Implement this in your plugin].
The interface for any plugins that can be made for milxQtMain.
milxQtSSMPlugin(QObject *theParent=0)
vtkSmartPointer< vtkPolyData > GetOutput()
Returns the mesh data object (PolyData) used internally VTK style.
int GetNumberOfShapes()
Returns the number of shapes in the Statistical Shape Model. Assumes SSM has been generated (via gene...
bool caseManagerCreated
Model Manager tab has been created?
QString saveFileSupport()
Get the file support string for saving (extension wildcard list). [Implement this in your plugin]...
This class represents the MILX Qt Main Window object using Qt.
Definition: milxQtMain.h:85
QString openFileSupport()
Get the file support string for opening (extension wildcard list). [Implement this in your plugin]...
void open(QString filename)
Open the file using the plugin. [Implement this in your plugin].
QString name()
Get the Name of the plugin. [Implement this in your plugin].