File: vtkKWImageWidget.h

package info (click to toggle)
volview 3.4-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 25,204 kB
  • sloc: cpp: 132,585; ansic: 11,612; tcl: 236; sh: 64; makefile: 25; xml: 8
file content (234 lines) | stat: -rw-r--r-- 8,088 bytes parent folder | download
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
/*=========================================================================

  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 vtkKWImageWidget
// .SECTION Description

#ifndef __vtkKWImageWidget_h
#define __vtkKWImageWidget_h

#include "vtkKW2DRenderWidget.h"
#include "XML/vtkXMLIOBaseMacros.h" // Needed for XML reader/writer macros

class vtkImageActor;
class vtkProperty;
class vtkKWCroppingRegionsWidget;
class vtkKWCursorWidget;
class vtkKWScaleBarWidget;
class vtkKWInteractorStyleImageView;
class vtkKW2DSplineSurfacesWidget;
class vtkKWScalarBarWidget;

class VTK_EXPORT vtkKWImageWidget : public vtkKW2DRenderWidget
{
public:
  static vtkKWImageWidget* New();
  vtkTypeRevisionMacro(vtkKWImageWidget, vtkKW2DRenderWidget);
  void PrintSelf(ostream& os, vtkIndent indent);
  //BTX
  vtkKWGetXMLReaderWriterObjectsMacro();
  //ETX

  // Description:
  // Render the scene.
  virtual void Render();

  // Description:
  // Slice navigation
  virtual void SetSlice(int n);
  virtual void IncrementPage();
  virtual void DecrementPage();

  // Description
  // Callback triggered when a slice has been changed through the UI
  virtual void SliceSelectedCallback(double value);
  
  // Description:
  // Enable/Disable cropping regions 
  virtual void SetCroppingRegionsVisibility(int state);
  virtual int  GetCroppingRegionsVisibility();
  vtkBooleanMacro(CroppingRegionsVisibility, int);
  virtual void SetCroppingPlanes(double p[6]);
  virtual double* GetCroppingPlanes();
  virtual void ResetCroppingPlanes();
  virtual void SetCroppingRegionFlags(int);
  virtual void SetCroppingPlanes(
    double p0, double p1, double p2, double p3, double p4, double p5);
  virtual int GetCroppingRegionFlags();
  vtkGetObjectMacro(CroppingWidget, vtkKWCroppingRegionsWidget);

  // Description:
  // Convenience method to set the visibility of all annotations.
  virtual void SetAnnotationsVisibility(int v);

  // Description:
  // Enable/disable scalar bar
  virtual void SetScalarBarVisibility(int state);
  virtual int  GetScalarBarVisibility();
  virtual void ToggleScalarBarVisibility();
  vtkBooleanMacro(ScalarBarVisibility, int);
  virtual void SetScalarBarComponent(int comp);
  virtual int  GetScalarBarComponent();
  vtkGetObjectMacro(ScalarBarWidget, vtkKWScalarBarWidget);
  virtual void SetSupportScalarBar(int);
  vtkGetMacro(SupportScalarBar, int);
  vtkBooleanMacro(SupportScalarBar, int);
  
  // Description:
  // Enable/Disable scale bar
  virtual void SetScaleBarVisibility(int state);
  virtual int  GetScaleBarVisibility();
  virtual void ToggleScaleBarVisibility();
  vtkBooleanMacro(ScaleBarVisibility, int);
  virtual double* GetScaleBarColor();
  virtual void SetScaleBarColor(double r, double g, double b);
  virtual void SetScaleBarColor(double *rgb)
    { this->SetScaleBarColor(rgb[0], rgb[1], rgb[2]); };
  vtkGetObjectMacro(ScaleBarWidget, vtkKWScaleBarWidget);
  virtual void SetSupportScaleBar(int);
  vtkGetMacro(SupportScaleBar, int);
  vtkBooleanMacro(SupportScaleBar, int);

  // Description:
  // Set the 3D cursor
  //BTX
  enum
  {
    CURSOR_TYPE_CROSSHAIR = 0,
    CURSOR_TYPE_PLANE = 1
  };
  //ETX
  virtual void SetCursor3DPosition(double x, double y, double z);
  virtual double* GetCursor3DPosition();
  virtual void GetCursor3DPosition(double pos[3]);
  virtual void SetCursor3DXColor(double r, double g, double b);
  virtual void SetCursor3DXColor(double *rgb)
    { this->SetCursor3DXColor(rgb[0], rgb[1], rgb[2]); };
  virtual void SetCursor3DYColor(double r, double g, double b);
  virtual void SetCursor3DYColor(double *rgb)
    { this->SetCursor3DYColor(rgb[0], rgb[1], rgb[2]); };
  virtual void SetCursor3DZColor(double r, double g, double b);
  virtual void SetCursor3DZColor(double *rgb)
    { this->SetCursor3DZColor(rgb[0], rgb[1], rgb[2]); };
  virtual double* GetCursor3DXColor();
  virtual double* GetCursor3DYColor();
  virtual double* GetCursor3DZColor();
  virtual void SetCursor3DType(int type);
  virtual int  GetCursor3DType();
  virtual void SetCursor3DVisibility(int state);
  virtual int  GetCursor3DVisibility();
  vtkBooleanMacro(Cursor3DVisibility, int);
  virtual void SetCursor3DInteractiveState(int state);
  vtkGetObjectMacro(Cursor3DWidget, vtkKWCursorWidget);
  vtkGetObjectMacro(Image, vtkImageActor);
  
  // Description:
  // Set the spline curves in 3D
  virtual void SetSplineCurves3D( vtkKW3DSplineCurvesWidget * curves );
  
  // Description:
  // Set the spline surfaces in 3D
  // Set their visibility as a group
  // Set the visibility of a single spline surface
  virtual void SetSplineSurfaces3D( vtkKW3DSplineSurfacesWidget * surfaces );
  void SetSplineSurfaces3DVisibility(int v);
  void SetSplineSurfaces3DVisibility(const char * surfaceId, int v);
  void SetSplineSurfaces3DProperty(const char * surfaceId, vtkProperty * property);
 
  // Description:
  // Get the interactor style
  virtual vtkKWInteractorStyle2DView* GetInteractorStyle();

  // Description:
  // Given mouse coordinate, compute world coordinate, eventually return
  // the id of the renderer if the widget supports multiple renderers
  // (see vtkKWRenderWidget::GetNthRenderer, 
  // vtkKWRenderWidget::GetRendererIndex)
  virtual int ComputeWorldCoordinate(int x, int y, double *result, int *id = 0);

  // Description:
  // Configure the event map
  virtual void ConfigureEventMap();

  // Description:
  // Enable/Disable linear interpolation
  virtual void SetInterpolate(int state);
  virtual int  GetInterpolate();

protected:
  vtkKWImageWidget();
  ~vtkKWImageWidget();
  
  // Description:
  // Create the widget
  virtual void CreateWidget();
  
  // Description:
  // Connects the internal object together given the Input.
  virtual int ConnectInternalPipeline();

  // Description:
  // Those methods are called automatically by UpdateAccordingToInput() if:
  // - InputScalarStructureHasChanged(): the input scalar structure has changed
  // - InputBoundsHaveChanged(): the input bounds have changed
  // - InputHasChanged(): any of the above changes happened, it is passed
  //                      a mask representing the changes.
  // Returns 1 on success, 0 on error or to signal that it is safe to abort
  virtual int InputScalarStructureHasChanged();
  virtual int InputBoundsHaveChanged();
  virtual int InputHasChanged(int mask);

  // Description:
  // Update the display extent according to what part of the Input has to
  // be displayed. It is probably the right place to adjust/place the 3D
  // widget which position depends on the display extent.
  virtual void UpdateDisplayExtent();

  // Description:
  // Update the image map
  virtual void UpdateImageMap();

  // Description:
  // Update internal objects according to the orientation and type
  virtual void UpdateSliceOrientationAndType();
  
  // Description:
  // Update internal objects according to the current unit
  virtual void UpdateAccordingToUnits();

  // Update the orientation and position of the implicit plane defining the
  // image plane.
  void UpdateImplicitPlaneSplineSurfaces();

  // Description:
  // Populate the context menu
  virtual void PopulateContextMenuWithAnnotationEntries(vtkKWMenu*);

  vtkImageActor *Image;
  
  vtkKWInteractorStyleImageView *InteractorStyle;

  int Cursor3DType;
  int SupportScaleBar;
  int SupportScalarBar;

  vtkKWCursorWidget           *Cursor3DWidget;
  vtkKWCroppingRegionsWidget  *CroppingWidget;
  vtkKWScalarBarWidget        *ScalarBarWidget;
  vtkKWScaleBarWidget         *ScaleBarWidget;
  vtkKW2DSplineSurfacesWidget *SplineSurfaces;
  
private:
  vtkKWImageWidget(const vtkKWImageWidget&);  // Not implemented
  void operator=(const vtkKWImageWidget&);  // Not implemented
};

#endif