SMILX  1.01
milxQtDiffusionTensorPlugin.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 "milxQtDiffusionTensorPlugin.h"
19 
20 #include <qplugin.h>
21 
23 {
25  MainWindow = qobject_cast<milxQtMain *>(theParent);
26 
27  threaded = false;
28  dockable = false;
29  consoleWindow = false;
30  extension = true;
31  pluginName = "Diffusion Imaging";
32  dataName = "";
33 
34  //~ createConnections();
35 }
36 
37 milxQtDiffusionTensorPlugin::~milxQtDiffusionTensorPlugin()
38 {
39  if(isRunning() && threaded)
40  quit();
41  cout << "DiffusionTensor Plugin Destroyed." << endl;
42 }
43 
45 {
46  return pluginName;
47 }
48 
50 {
51  QString openPythonExt = "";
52 
53  return openPythonExt;
54 }
55 
57 {
58  QStringList exts;
59 
60  return exts;
61 }
62 
64 {
65  QStringList exts;
66 
67  return exts;
68 }
69 
71 {
72  QString savePythonExt = "";
73 
74  return savePythonExt;
75 }
76 
77 void milxQtDiffusionTensorPlugin::SetInputCollection(vtkPolyDataCollection* collection, QStringList &filenames)
78 {
79 
80 }
81 
82 void milxQtDiffusionTensorPlugin::open(QString filename)
83 {
84 
85 }
86 
87 void milxQtDiffusionTensorPlugin::save(QString filename)
88 {
89 
90 }
91 
93 {
94  return NULL;
95 } //No render result
96 
98 {
100 
101  return diffusionModel;
102 }
103 
105 {
107 
108  return diffusionImage;
109 }
110 
112 {
113  return NULL;
114 } //No Dock result
115 
117 {
118  if(pluginWindow(window) == 0)
119  return false;
120  else
121  return true;
122 }
123 
125 {
126  if(window)
127  return qobject_cast<milxQtDiffusionTensorModel *>(window);
128  return 0;
129 }
130 
132 {
133  if(MainWindow->isActiveModel())
134  {
135  milxQtModel *currentWin = MainWindow->activeModel();
136  diffusionModel = new milxQtDiffusionTensorModel; //hierarchical deletion
137  diffusionModel->setName(currentWin->getName());
138  diffusionModel->SetInput(currentWin->GetOutput());
139  diffusionModel->generateModel();
140 
141  MainWindow->display(diffusionModel);
142  }
143  else if(MainWindow->isActiveImage())
144  {
145  milxQtImage *currentWin = MainWindow->activeImage();
146  diffusionImage = new milxQtDiffusionTensorImage; //hierarchical deletion
147  diffusionImage->setName(currentWin->getName());
148  diffusionImage->setData(currentWin->GetVectorImage(), false);
149  diffusionImage->generateImage();
150  diffusionImage->disableInterpolateDisplay();
151 
152  QObject::connect(diffusionImage, SIGNAL(resultAvailable(milxQtModel*)), MainWindow, SLOT(display(milxQtModel*)));
153  QObject::connect(diffusionImage, SIGNAL(resultAvailable(milxQtRenderWindow*)), MainWindow, SLOT(display(milxQtRenderWindow*)));
154 
155  MainWindow->display(diffusionImage);
156  }
157  else
158  return;
159 }
160 
161 //~ void milxQtDiffusionTensorPlugin::run()
162 //~ {
163  //~ QMutexLocker locker(&mutex); //Lock memory
164 
165  //~ ///Execute own thread work here
166 
167  //~ //exec();
168 //~ }
169 
170 //~ void milxQtDiffusionTensorPlugin::createConnections()
171 //~ {
172  //~ //QObject::connect(denoiseAct, SIGNAL(triggered(bool)), denoiseModel, SLOT(denoise()));
173 //~ }
174 
175 Q_EXPORT_PLUGIN2(DTIPlugin, milxQtDiffusionTensorPluginFactory);
bool threaded
Threaded plugin?
virtual void loadExtension()
Load the extension. [Implement this in your plugin].
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
bool extension
Extension rather than a plugin?
void resultAvailable(milxQtRenderWindow *)
Send signal that Resultant render window is available for showing.
vectorImageType::Pointer GetVectorImage()
Returns the internal vector image data. Unlike the other Get*Image() members, the return value can be...
Definition: milxQtImage.h:426
virtual void save(QString filename)
Save the result as a file using the plugin. [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?
virtual QString name()
Get the Name of the plugin. [Implement this in your plugin].
virtual milxQtModel * modelResult()
Get the model result. The result can then be displayed in milxQtMain etc. [Implement this in your plu...
milxQtDiffusionTensorModel * pluginWindow(QWidget *window)
The interface for any plugins that can be made for milxQtMain.
vtkSmartPointer< vtkPolyData > GetOutput()
Returns the mesh data object (PolyData) used internally VTK style.
virtual QDockWidget * dockWidget()
Return the dock widget (if one is provided by plugin). [Implement this in your plugin].
QString getName()
Returns the name of the data.
Definition: milxQtWindow.h:67
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...
virtual QStringList openExtensions()
Get a list of supported file format extensions. [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 openFileSupport()
Get the file support string for opening (extension wildcard list). [Implement this in your plugin]...
QPointer< milxQtDiffusionTensorImage > diffusionImage
Image extension.
virtual void SetInputCollection(vtkPolyDataCollection *collection, QStringList &filenames)
Pass a collection to internal plugin class. [Implement this in your plugin].
milxQtDiffusionTensorPlugin(QObject *theParent=0)
Default destructor.
This class represents the MILX Qt Main Window object using Qt.
Definition: milxQtMain.h:85
virtual milxQtRenderWindow * genericResult()
Get the generic result, which is a milxQtRenderWindow. The result can then be displayed in milxQtMain...
QPointer< milxQtDiffusionTensorModel > diffusionModel
Model extension.
virtual QString saveFileSupport()
Get the file support string for saving (extension wildcard list). [Implement this in your plugin]...
virtual void open(QString filename)
Open the file using the plugin. [Implement this in your plugin].