VTK
vtkResliceCursorRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkResliceCursorRepresentation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
27 #ifndef vtkResliceCursorRepresentation_h
28 #define vtkResliceCursorRepresentation_h
29 
30 #include "vtkInteractionWidgetsModule.h" // For export macro
32 
33 class vtkTextProperty;
34 class vtkActor2D;
35 class vtkTextMapper;
36 class vtkImageData;
37 class vtkImageReslice;
38 class vtkPlane;
39 class vtkPlaneSource;
41 class vtkResliceCursor;
42 class vtkMatrix4x4;
43 class vtkScalarsToColors;
45 class vtkActor;
46 class vtkImageActor;
47 class vtkTexture;
48 class vtkTextActor;
49 class vtkImageAlgorithm;
50 
51 // Private.
52 #define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF 128
53 
54 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorRepresentation : public vtkWidgetRepresentation
55 {
56 public:
58 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
71  vtkSetClampMacro(Tolerance,int,1,100);
72  vtkGetMacro(Tolerance,int);
74 
76 
79  vtkSetMacro( ShowReslicedImage, vtkTypeBool );
80  vtkGetMacro( ShowReslicedImage, vtkTypeBool );
81  vtkBooleanMacro( ShowReslicedImage, vtkTypeBool );
83 
85 
89  vtkSetMacro(RestrictPlaneToVolume,vtkTypeBool);
90  vtkGetMacro(RestrictPlaneToVolume,vtkTypeBool);
91  vtkBooleanMacro(RestrictPlaneToVolume,vtkTypeBool);
93 
95 
100  vtkSetStringMacro(ThicknessLabelFormat);
101  vtkGetStringMacro(ThicknessLabelFormat);
103 
104  // Used to communicate about the state of the representation
105  enum { Outside=0, NearCenter, NearAxis1, NearAxis2,
106  OnCenter, OnAxis1, OnAxis2};
107  enum { None=0, PanAndRotate, RotateBothAxes,
108  ResizeThickness, WindowLevelling };
109 
113  virtual char* GetThicknessLabelText();
114 
116 
119  virtual double* GetThicknessLabelPosition();
120  virtual void GetThicknessLabelPosition(double pos[3]);
121  virtual void GetWorldThicknessLabelPosition(double pos[3]);
123 
127  void BuildRepresentation() override;
128 
130 
133  vtkGetObjectMacro( ResliceAxes, vtkMatrix4x4 );
134  vtkGetObjectMacro( Reslice, vtkImageAlgorithm );
136 
138 
141  vtkGetObjectMacro( ImageActor, vtkImageActor );
143 
145 
152  virtual void SetLookupTable(vtkScalarsToColors*);
153  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
155 
157 
163  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
164  virtual void SetColorMap(vtkImageMapToColors *);
166 
168 
174  void SetWindowLevel(double window, double level, int copy = 0);
175  void GetWindowLevel(double wl[2]);
176  double GetWindow(){return this->CurrentWindow;}
177  double GetLevel(){return this->CurrentLevel;}
179 
180  virtual vtkResliceCursor * GetResliceCursor() = 0;
181 
183 
187  vtkSetMacro(DisplayText,vtkTypeBool);
188  vtkGetMacro(DisplayText,vtkTypeBool);
189  vtkBooleanMacro(DisplayText,vtkTypeBool);
191 
193 
196  void SetTextProperty(vtkTextProperty* tprop);
197  vtkTextProperty* GetTextProperty();
199 
201 
205  vtkSetMacro( UseImageActor, vtkTypeBool );
206  vtkGetMacro( UseImageActor, vtkTypeBool );
207  vtkBooleanMacro( UseImageActor, vtkTypeBool );
209 
211 
215  void SetManipulationMode( int m );
216  vtkGetMacro(ManipulationMode, int);
218 
220 
225  void ActivateText(int);
226  void ManageTextDisplay();
228 
230 
234  virtual void InitializeReslicePlane();
235  virtual void ResetCamera();
237 
241  virtual vtkResliceCursorPolyDataAlgorithm * GetCursorAlgorithm() = 0;
242 
244 
248  vtkGetObjectMacro( PlaneSource, vtkPlaneSource );
250 
251 protected:
253  ~vtkResliceCursorRepresentation() override;
254 
256 
260  virtual void CreateDefaultResliceAlgorithm();
261  virtual void SetResliceParameters(
262  double outputSpacingX, double outputSpacingY,
263  int extentX, int extentY );
265 
269  virtual void WindowLevel( double x, double y );
270 
274  virtual void UpdateReslicePlane();
275 
279  virtual void ComputeReslicePlaneOrigin();
280 
281  // for negative window values.
282  void InvertTable();
283 
284  // recompute origin to make the location of the reslice cursor consistent
285  // with its physical location
286  virtual void ComputeOrigin( vtkMatrix4x4 * );
287 
289  void GetVector1( double d[3] );
290  void GetVector2( double d[3] );
292 
298 
299  // Keep track if modifier is set
300  int Modifier;
301 
302  // Selection tolerance for the handles
304 
305  // Format for printing the distance
307 
326  double CurrentLevel;
328  double InitialLevel;
329  double LastEventPosition[2];
333 
334  vtkScalarsToColors * CreateDefaultLookupTable();
335  void GenerateText();
336 
337 private:
339  void operator=(const vtkResliceCursorRepresentation&) = delete;
340 };
341 
342 #endif
vtkWidgetRepresentation.h
vtkResliceCursorRepresentation::ImageActor
vtkImageActor * ImageActor
Definition: vtkResliceCursorRepresentation.h:321
vtkPlane
perform various plane computations
Definition: vtkPlane.h:37
VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF
#define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF
Definition: vtkResliceCursorRepresentation.h:52
vtkResliceCursorRepresentation::Texture
vtkTexture * Texture
Definition: vtkResliceCursorRepresentation.h:319
vtkResliceCursorRepresentation::RotateBothAxes
Definition: vtkResliceCursorRepresentation.h:107
vtkResliceCursorRepresentation::LookupTable
vtkScalarsToColors * LookupTable
Definition: vtkResliceCursorRepresentation.h:320
vtkResliceCursorRepresentation::NewResliceAxes
vtkMatrix4x4 * NewResliceAxes
Definition: vtkResliceCursorRepresentation.h:316
vtkPlaneSource
create an array of quadrilaterals located in a plane
Definition: vtkPlaneSource.h:60
vtkResliceCursor
Geometry for a reslice cursor.
Definition: vtkResliceCursor.h:46
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkImageMapToColors
map the input image through a lookup table
Definition: vtkImageMapToColors.h:44
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:40
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkResliceCursorRepresentation::DisplayText
vtkTypeBool DisplayText
Definition: vtkResliceCursorRepresentation.h:332
vtkResliceCursorRepresentation::InitialLevel
double InitialLevel
Definition: vtkResliceCursorRepresentation.h:328
vtkResliceCursorRepresentation::CurrentWindow
double CurrentWindow
Definition: vtkResliceCursorRepresentation.h:325
vtkResliceCursorRepresentation::ColorMap
vtkImageMapToColors * ColorMap
Definition: vtkResliceCursorRepresentation.h:317
vtkResliceCursorRepresentation::PlaneSource
vtkPlaneSource * PlaneSource
Definition: vtkResliceCursorRepresentation.h:309
vtkX3D::level
Definition: vtkX3D.h:395
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:71
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:53
vtkResliceCursorRepresentation::OriginalWindow
double OriginalWindow
Definition: vtkResliceCursorRepresentation.h:323
vtkResliceCursorRepresentation::OnCenter
Definition: vtkResliceCursorRepresentation.h:106
vtkResliceCursorRepresentation::ManipulationMode
int ManipulationMode
The widget sets the manipulation mode.
Definition: vtkResliceCursorRepresentation.h:297
vtkResliceCursorRepresentation::ThicknessLabelFormat
char * ThicknessLabelFormat
Definition: vtkResliceCursorRepresentation.h:306
vtkResliceCursorPolyDataAlgorithm
generates a 2D reslice cursor polydata
Definition: vtkResliceCursorPolyDataAlgorithm.h:45
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkTextActor
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:56
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
vtkResliceCursorRepresentation::ShowReslicedImage
vtkTypeBool ShowReslicedImage
Definition: vtkResliceCursorRepresentation.h:311
vtkImageReslice
Reslices a volume along a new set of axes.
Definition: vtkImageReslice.h:77
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:66
vtkResliceCursorRepresentation::GetLevel
double GetLevel()
Definition: vtkResliceCursorRepresentation.h:177
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkResliceCursorRepresentation::GetWindow
double GetWindow()
Definition: vtkResliceCursorRepresentation.h:176
vtkResliceCursorRepresentation::InitialWindow
double InitialWindow
Definition: vtkResliceCursorRepresentation.h:327
vtkResliceCursorRepresentation::CurrentLevel
double CurrentLevel
Definition: vtkResliceCursorRepresentation.h:326
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkResliceCursorRepresentation::ThicknessTextProperty
vtkTextProperty * ThicknessTextProperty
Definition: vtkResliceCursorRepresentation.h:312
vtkImageActor
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:49
vtkResliceCursorRepresentation::RestrictPlaneToVolume
vtkTypeBool RestrictPlaneToVolume
Definition: vtkResliceCursorRepresentation.h:310
vtkResliceCursorRepresentation::Tolerance
int Tolerance
Definition: vtkResliceCursorRepresentation.h:303
vtkResliceCursorRepresentation::ResliceAxes
vtkMatrix4x4 * ResliceAxes
Definition: vtkResliceCursorRepresentation.h:315
vtkResliceCursorRepresentation::TextActor
vtkTextActor * TextActor
Definition: vtkResliceCursorRepresentation.h:322
vtkResliceCursorRepresentation::OriginalLevel
double OriginalLevel
Definition: vtkResliceCursorRepresentation.h:324
vtkResliceCursorRepresentation::Modifier
int Modifier
Definition: vtkResliceCursorRepresentation.h:300
vtkResliceCursorRepresentation::TexturePlaneActor
vtkActor * TexturePlaneActor
Definition: vtkResliceCursorRepresentation.h:318
vtkResliceCursorRepresentation::Reslice
vtkImageAlgorithm * Reslice
Definition: vtkResliceCursorRepresentation.h:308
vtkResliceCursorRepresentation
represent the vtkResliceCursorWidget
Definition: vtkResliceCursorRepresentation.h:54
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkResliceCursorRepresentation::UseImageActor
vtkTypeBool UseImageActor
Definition: vtkResliceCursorRepresentation.h:330
vtkResliceCursorRepresentation::ThicknessTextActor
vtkActor2D * ThicknessTextActor
Definition: vtkResliceCursorRepresentation.h:314
vtkResliceCursorRepresentation::ThicknessTextMapper
vtkTextMapper * ThicknessTextMapper
Definition: vtkResliceCursorRepresentation.h:313
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.