-
Notifications
You must be signed in to change notification settings - Fork 3
/
vtkVVPlugin.h
325 lines (273 loc) · 9.91 KB
/
vtkVVPlugin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
/*=========================================================================
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.kitware.com/VolViewCopyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkVVPlugin - this class represents a plugin for VolView
#ifndef __vtkVVPlugin_h
#define __vtkVVPlugin_h
#include "vtkKWCompositeWidget.h"
#include "vtkVVPluginAPI.h"
#define VTK_VV_PLUGIN_DEFAULT_GROUP "Miscelaneous"
class vtkImageData;
class vtkKWLabel;
class vtkKWLabelWithLabel;
class vtkKWPushButton;
class vtkVVWindowBase;
class vtkVVPluginSelector;
class vtkVVGUIItem;
class vtkKWOpenWizard;
class vtkVV4DOpenWizard;
class vtkKWEPaintbrushDrawing;
class VTK_EXPORT vtkVVPlugin : public vtkKWCompositeWidget
{
public:
static vtkVVPlugin* New();
vtkTypeRevisionMacro(vtkVVPlugin,vtkKWCompositeWidget);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Set/Get the window (do not ref count it since the window will ref count
// this widget).
vtkGetObjectMacro(Window, vtkVVWindowBase);
virtual void SetWindow(vtkVVWindowBase*);
// Description:
// Refresh the interface given the current value of the Window or Ivars
virtual void Update();
// Description:
// Apply the plugin onto the window's data
virtual int CanBeExecuted(vtkVVPluginSelector *);
virtual void Execute(vtkVVPluginSelector *);
virtual void Cancel(vtkVVPluginSelector *);
// Description:
// Load this plugin and return success or failure. Success is zero.
virtual int Load(const char *pluginDir, vtkKWApplication *app);
// Used internally for then a plugin is executed in pieces
float ProgressMinimum;
float ProgressMaximum;
// Description:
// Set/Get some properties of the plugin
vtkGetStringMacro(Name);
vtkSetStringMacro(Name);
vtkGetStringMacro(Group);
vtkSetStringMacro(Group);
vtkGetStringMacro(TerseDocumentation);
vtkSetStringMacro(TerseDocumentation);
vtkGetStringMacro(FullDocumentation);
vtkSetStringMacro(FullDocumentation);
vtkGetStringMacro(PlottingXAxisTitle);
vtkSetStringMacro(PlottingXAxisTitle);
vtkGetStringMacro(PlottingYAxisTitle);
vtkSetStringMacro(PlottingYAxisTitle);
vtkGetStringMacro(ResultingDistanceUnits);
vtkSetStringMacro(ResultingDistanceUnits);
vtkGetStringMacro(ResultingComponent1Units);
vtkSetStringMacro(ResultingComponent1Units);
vtkGetStringMacro(ResultingComponent2Units);
vtkSetStringMacro(ResultingComponent2Units);
vtkGetStringMacro(ResultingComponent3Units);
vtkSetStringMacro(ResultingComponent3Units);
vtkGetStringMacro(ResultingComponent4Units);
vtkSetStringMacro(ResultingComponent4Units);
vtkGetMacro(NumberOfGUIItems, int);
vtkGetMacro(RequiresSecondInput, int);
vtkGetMacro(SecondInputIsUnstructuredGrid, int);
vtkGetMacro(SecondInputOptional, int);
vtkGetMacro(RequiresLabelInput, int);
//BTX
#ifdef KWVolView_PLUGINS_USE_SPLINE
vtkGetMacro(RequiresSplineSurfaces, int);
#endif
//ETX
//BTX
#ifdef KWVolView_PLUGINS_USE_SERIES
vtkGetMacro(RequiresSeriesInput, int);
vtkGetMacro(ProducesSeriesOutput, int);
#endif
//ETX
vtkGetMacro(ProducesPlottingOutput, int);
// Description:
// Set/Get the second input filename
virtual const char* GetSecondInputFileName();
virtual void SetSecondInputFileName(const char *);
vtkGetObjectMacro(SecondInputOpenWizard, vtkKWOpenWizard);
//BTX
#ifdef KWVolView_PLUGINS_USE_SERIES
// Description:
// Set/Get the series input filename
virtual void GetSeriesInputFileNames(const char **pattern,int & min, int & max);
virtual void SetSeriesInputFileNames(const char *pattern,int min, int max);
vtkGetObjectMacro(SeriesInputOpenWizard, vtkVV4DOpenWizard);
virtual void SetSeriesInputFileName(const char *pattern,int index);
#endif
//ETX
// Description:
// Set/Get some properties from the plugin point-of-view
void SetProperty(int param, const char *value);
const char *GetProperty(int param);
void SetGUIProperty(int num, int param, const char *value);
const char *GetGUIProperty(int num, int param);
// Description:
// Convenience method to Set/Get some properties from the plugin
// point-of-view using the label name of the property, not its index.
// The VVP_GUI_LABEL parameter of the property is compared to 'label'
void SetGUIProperty(const char *label, int param, const char *value);
const char *GetGUIProperty(const char *label, int param);
// Description:
// Convenience method to Set/Get the VVP_GUI_VALUE parameter of a property
// from the plugin point-of-view, using the label name of the property.
// The VVP_GUI_LABEL parameter of the property is compared to 'label'
void SetGUIPropertyValue(const char *label, const char *value);
const char *GetGUIPropertyValue(const char *label);
// Description:
// Set the report and stop/watch text
virtual void SetReportText(const char *text);
virtual char* GetReportText();
virtual void SetStopWatchText(const char *text);
virtual char* GetStopWatchText();
// Description:
// Callback invoked when the users selects a second input
virtual void SecondInputCallback();
//BTX
#ifdef KWVolView_PLUGINS_USE_SERIES
// Description:
// Callback invoked when the users selects a series input
virtual void SeriesInputCallback();
#endif
//ETX
// Description:
// Verify paramters and load second and series input if required
int PreparePlugin(vtkVVPluginSelector *);
//BTX
#ifdef KWVolView_PLUGINS_USE_SPLINE
// Description:
// Convert the spline surfaces into a list of points to be used
// by the plugin. This prevents the plugin from having to know
// about the mathematical details of the splines used in VolView.
int PrepareSplineSurfaces();
#endif
//ETX
// Description:
// Synchronize the GUI and the plugin structure
void SetGUIValues();
void GetGUIValues();
// Description:
// Update the "enable" state of the object and its internal parts.
// Depending on different Ivars (this->Enabled, the application's
// Limited Edition Mode, etc.), the "enable" state of the object is updated
// and propagated to its internal parts/subwidgets. This will, for example,
// enable/disable parts of the widget UI, enable/disable the visibility
// of 3D widgets, etc.
virtual void UpdateEnableState();
//BTX
#ifdef KWVolView_PLUGINS_USE_SERIES
// Description:
// Save volume series that may be produced by a plugin.
virtual int SaveVolumeSeries(vtkVVProcessDataStruct *pds);
virtual int SaveVolumeSeries(vtkVVProcessDataStruct *pds, const char *fname);
#endif
//ETX
// Description:
// Display the XY plot that may be the output of a plugin
virtual void DisplayPlot(vtkVVProcessDataStruct *pds);
protected:
vtkVVPlugin();
~vtkVVPlugin();
// Description:
// Create the widget
virtual void CreateWidget();
vtkVVPluginInfo PluginInfo;
vtkKWWidget **Widgets;
vtkKWLabel *DocLabel;
vtkKWLabelWithLabel *DocText;
vtkKWLabelWithLabel *ReportText;
vtkKWLabelWithLabel *StopWatchText;
vtkVVWindowBase *Window;
virtual void UpdateGUI();
// push new properties (not ImageData) to the widgets
virtual void PushNewProperties();
// widget for setting the second input if required
vtkKWPushButton *SecondInputButton;
vtkKWOpenWizard *SecondInputOpenWizard;
virtual void UpdateAccordingToSecondInput();
//BTX
#ifdef KWVolView_PLUGINS_USE_SERIES
// widget for setting the series input if required
vtkKWPushButton *SeriesInputButton;
vtkVV4DOpenWizard *SeriesInputOpenWizard;
virtual void UpdateAccordingToSeriesInput();
#endif
//ETX
void ExecuteData(vtkImageData *, vtkVVPluginSelector *);
void UpdateData(vtkImageData *);
void ProcessInOnePiece(vtkImageData *input, int memCheck,
vtkVVProcessDataStruct *, vtkVVPluginSelector *);
void ProcessInPieces(vtkImageData *input, int memCheck,
vtkVVProcessDataStruct *);
//BTX
#ifdef KWVolView_PLUGINS_USE_SERIES
void ProcessSeriesByVolumes(vtkImageData *input, int memCheck,
vtkVVProcessDataStruct *, vtkVVPluginSelector *);
#endif
//ETX
// handle memory issues for this plugin, warn if to big
int CheckMemory(vtkImageData *);
// these members must be set by the plugin
char *Name;
char *Group;
char *TerseDocumentation;
char *FullDocumentation;
int SupportProcessingPieces;
int SupportInPlaceProcessing;
//BTX
#ifdef KWVolView_PLUGINS_USE_SERIES
int SupportProcessingSeriesByVolumes;
#endif
//ETX
int NumberOfGUIItems;
//BTX
#ifdef KWVolView_PLUGINS_USE_SPLINE
int ProducesMeshOnly;
#endif
//ETX
int RequiredZOverlap;
float PerVoxelMemoryRequired;
int AbortProcessing;
int RequiresSecondInput;
int SecondInputIsUnstructuredGrid;
int SecondInputOptional;
int RequiresLabelInput;
//BTX
#ifdef KWVolView_PLUGINS_USE_SPLINE
int RequiresSplineSurfaces;
#endif
#ifdef KWVolView_PLUGINS_USE_SERIES
int RequiresSeriesInput;
int ProducesSeriesOutput;
#endif
//ETX
int ProducesPlottingOutput;
char *PlottingXAxisTitle;
char *PlottingYAxisTitle;
// why am I not using a fricking map here
int ResultingComponentsAreIndependent;
char *ResultingDistanceUnits;
char *ResultingComponent1Units;
char *ResultingComponent2Units;
char *ResultingComponent3Units;
char *ResultingComponent4Units;
// where the GUI elements are stored
vtkVVGUIItem *GUIItems;
// Get the label image of the paintbrush widget that's selected. If there
// is no paintbrush widget selected, this returns NULL
vtkImageData * GetInputLabelImage();
// Convenience helper method to get the paintbrush drawing from the
// selected preset, if any.
vtkKWEPaintbrushDrawing * GetPaintbrushDrawing();
private:
vtkVVPlugin(const vtkVVPlugin&); // Not implemented
void operator=(const vtkVVPlugin&); // Not Implemented
};
#endif