VTK  9.0.1
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
106  {
107  Outside = 0,
113  OnAxis2
114  };
115  enum
116  {
117  None = 0,
121  WindowLevelling
122  };
123 
127  virtual char* GetThicknessLabelText();
128 
130 
133  virtual double* GetThicknessLabelPosition();
134  virtual void GetThicknessLabelPosition(double pos[3]);
135  virtual void GetWorldThicknessLabelPosition(double pos[3]);
137 
141  void BuildRepresentation() override;
142 
144 
147  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
148  vtkGetObjectMacro(Reslice, vtkImageAlgorithm);
150 
152 
155  vtkGetObjectMacro(ImageActor, vtkImageActor);
157 
159 
167  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
169 
171 
177  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
180 
182 
188  void SetWindowLevel(double window, double level, int copy = 0);
189  void GetWindowLevel(double wl[2]);
190  double GetWindow() { return this->CurrentWindow; }
191  double GetLevel() { return this->CurrentLevel; }
193 
195 
197 
201  vtkSetMacro(DisplayText, vtkTypeBool);
202  vtkGetMacro(DisplayText, vtkTypeBool);
203  vtkBooleanMacro(DisplayText, vtkTypeBool);
205 
207 
213 
215 
219  vtkSetMacro(UseImageActor, vtkTypeBool);
220  vtkGetMacro(UseImageActor, vtkTypeBool);
221  vtkBooleanMacro(UseImageActor, vtkTypeBool);
223 
225 
229  void SetManipulationMode(int m);
230  vtkGetMacro(ManipulationMode, int);
232 
234 
239  void ActivateText(int);
242 
244 
248  virtual void InitializeReslicePlane();
249  virtual void ResetCamera();
251 
256 
258 
262  vtkGetObjectMacro(PlaneSource, vtkPlaneSource);
264 
265 protected:
268 
270 
275  virtual void SetResliceParameters(
276  double outputSpacingX, double outputSpacingY, int extentX, int extentY);
278 
282  virtual void WindowLevel(double x, double y);
283 
287  virtual void UpdateReslicePlane();
288 
293 
294  // for negative window values.
295  void InvertTable();
296 
297  // recompute origin to make the location of the reslice cursor consistent
298  // with its physical location
299  virtual void ComputeOrigin(vtkMatrix4x4*);
300 
302  void GetVector1(double d[3]);
303  void GetVector2(double d[3]);
305 
311 
312  // Keep track if modifier is set
313  int Modifier;
314 
315  // Selection tolerance for the handles
317 
318  // Format for printing the distance
320 
339  double CurrentLevel;
341  double InitialLevel;
342  double LastEventPosition[2];
346 
348  void GenerateText();
349 
350 private:
352  void operator=(const vtkResliceCursorRepresentation&) = delete;
353 };
354 
355 #endif
vtkWidgetRepresentation.h
vtkResliceCursorRepresentation::ImageActor
vtkImageActor * ImageActor
Definition: vtkResliceCursorRepresentation.h:334
vtkPlane
perform various plane computations
Definition: vtkPlane.h:32
vtkResliceCursorRepresentation::SetTextProperty
void SetTextProperty(vtkTextProperty *tprop)
Set/Get the text property for the image data and window-level annotation.
VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF
#define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF
Definition: vtkResliceCursorRepresentation.h:52
vtkResliceCursorRepresentation::GetTextProperty
vtkTextProperty * GetTextProperty()
vtkResliceCursorRepresentation::Texture
vtkTexture * Texture
Definition: vtkResliceCursorRepresentation.h:332
vtkResliceCursorRepresentation::OnAxis1
@ OnAxis1
Definition: vtkResliceCursorRepresentation.h:112
vtkResliceCursorRepresentation::GetResliceCursor
virtual vtkResliceCursor * GetResliceCursor()=0
vtkResliceCursorRepresentation::LookupTable
vtkScalarsToColors * LookupTable
Definition: vtkResliceCursorRepresentation.h:333
vtkResliceCursorRepresentation::NewResliceAxes
vtkMatrix4x4 * NewResliceAxes
Definition: vtkResliceCursorRepresentation.h:329
vtkPlaneSource
create an array of quadrilaterals located in a plane
Definition: vtkPlaneSource.h:55
vtkResliceCursor
Geometry for a reslice cursor.
Definition: vtkResliceCursor.h:44
vtkResliceCursorRepresentation::BuildRepresentation
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkResliceCursorRepresentation::NearCenter
@ NearCenter
Definition: vtkResliceCursorRepresentation.h:108
vtkImageMapToColors
map the input image through a lookup table
Definition: vtkImageMapToColors.h:38
vtkResliceCursorRepresentation::SetLookupTable
virtual void SetLookupTable(vtkScalarsToColors *)
Set/Get the internal lookuptable (lut) to one defined by the user, or, alternatively,...
vtkResliceCursorRepresentation::SetColorMap
virtual void SetColorMap(vtkImageMapToColors *)
vtkResliceCursorRepresentation::GetVector2
void GetVector2(double d[3])
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:38
vtkResliceCursorRepresentation::DisplayText
vtkTypeBool DisplayText
Definition: vtkResliceCursorRepresentation.h:345
vtkResliceCursorRepresentation::RotateBothAxes
@ RotateBothAxes
Definition: vtkResliceCursorRepresentation.h:119
vtkResliceCursorRepresentation::ResetCamera
virtual void ResetCamera()
vtkResliceCursorRepresentation::InitialLevel
double InitialLevel
Definition: vtkResliceCursorRepresentation.h:341
vtkResliceCursorRepresentation::CreateDefaultLookupTable
vtkScalarsToColors * CreateDefaultLookupTable()
vtkResliceCursorRepresentation::CurrentWindow
double CurrentWindow
Definition: vtkResliceCursorRepresentation.h:338
vtkResliceCursorRepresentation::ColorMap
vtkImageMapToColors * ColorMap
Definition: vtkResliceCursorRepresentation.h:330
vtkResliceCursorRepresentation::PlaneSource
vtkPlaneSource * PlaneSource
Definition: vtkResliceCursorRepresentation.h:322
vtkResliceCursorRepresentation::ActivateText
void ActivateText(int)
INTERNAL - Do not use.
vtkX3D::level
@ level
Definition: vtkX3D.h:401
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:66
vtkResliceCursorRepresentation::GetCursorAlgorithm
virtual vtkResliceCursorPolyDataAlgorithm * GetCursorAlgorithm()=0
Get the underlying cursor source.
vtkResliceCursorRepresentation::ResizeThickness
@ ResizeThickness
Definition: vtkResliceCursorRepresentation.h:120
vtkResliceCursorRepresentation::GetWorldThicknessLabelPosition
virtual void GetWorldThicknessLabelPosition(double pos[3])
vtkResliceCursorRepresentation::GetThicknessLabelPosition
virtual double * GetThicknessLabelPosition()
Get the position of the widget's label in display coordinates.
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:48
vtkResliceCursorRepresentation::ManageTextDisplay
void ManageTextDisplay()
vtkResliceCursorRepresentation::OriginalWindow
double OriginalWindow
Definition: vtkResliceCursorRepresentation.h:336
vtkResliceCursorRepresentation::CreateDefaultResliceAlgorithm
virtual void CreateDefaultResliceAlgorithm()
Create New Reslice plane.
vtkResliceCursorRepresentation::ManipulationMode
int ManipulationMode
The widget sets the manipulation mode.
Definition: vtkResliceCursorRepresentation.h:310
vtkResliceCursorRepresentation::GetWindowLevel
void GetWindowLevel(double wl[2])
vtkResliceCursorRepresentation::ThicknessLabelFormat
char * ThicknessLabelFormat
Definition: vtkResliceCursorRepresentation.h:319
vtkResliceCursorPolyDataAlgorithm
generates a 2D reslice cursor polydata
Definition: vtkResliceCursorPolyDataAlgorithm.h:46
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
vtkTextActor
An actor that displays text.
Definition: vtkTextActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
vtkResliceCursorRepresentation::NearAxis2
@ NearAxis2
Definition: vtkResliceCursorRepresentation.h:110
vtkResliceCursorRepresentation::InitializeReslicePlane
virtual void InitializeReslicePlane()
Initialize the reslice planes and the camera center.
vtkResliceCursorRepresentation::ShowReslicedImage
vtkTypeBool ShowReslicedImage
Definition: vtkResliceCursorRepresentation.h:324
vtkImageReslice
Reslices a volume along a new set of axes.
Definition: vtkImageReslice.h:71
vtkResliceCursorRepresentation::SetManipulationMode
void SetManipulationMode(int m)
INTERNAL - Do not use Set the manipulation mode.
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:60
vtkResliceCursorRepresentation::GetLevel
double GetLevel()
Definition: vtkResliceCursorRepresentation.h:191
vtkResliceCursorRepresentation::ComputeReslicePlaneOrigin
virtual void ComputeReslicePlaneOrigin()
Compute the origin of the planes so as to capture the entire image.
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:34
vtkResliceCursorRepresentation::GetWindow
double GetWindow()
Definition: vtkResliceCursorRepresentation.h:190
vtkResliceCursorRepresentation::InitialWindow
double InitialWindow
Definition: vtkResliceCursorRepresentation.h:340
vtkResliceCursorRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkResliceCursorRepresentation::CurrentLevel
double CurrentLevel
Definition: vtkResliceCursorRepresentation.h:339
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:40
vtkResliceCursorRepresentation::PanAndRotate
@ PanAndRotate
Definition: vtkResliceCursorRepresentation.h:118
vtkResliceCursorRepresentation::ThicknessTextProperty
vtkTextProperty * ThicknessTextProperty
Definition: vtkResliceCursorRepresentation.h:325
vtkResliceCursorRepresentation::WindowLevel
virtual void WindowLevel(double x, double y)
Process window level.
vtkResliceCursorRepresentation::UpdateReslicePlane
virtual void UpdateReslicePlane()
Update the reslice plane.
vtkResliceCursorRepresentation::GenerateText
void GenerateText()
vtkImageActor
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:43
vtkResliceCursorRepresentation::RestrictPlaneToVolume
vtkTypeBool RestrictPlaneToVolume
Definition: vtkResliceCursorRepresentation.h:323
vtkResliceCursorRepresentation::SetWindowLevel
void SetWindowLevel(double window, double level, int copy=0)
Set/Get the current window and level values.
vtkResliceCursorRepresentation::OnCenter
@ OnCenter
Definition: vtkResliceCursorRepresentation.h:111
vtkResliceCursorRepresentation::Tolerance
int Tolerance
Definition: vtkResliceCursorRepresentation.h:316
vtkResliceCursorRepresentation::ResliceAxes
vtkMatrix4x4 * ResliceAxes
Definition: vtkResliceCursorRepresentation.h:328
vtkResliceCursorRepresentation::TextActor
vtkTextActor * TextActor
Definition: vtkResliceCursorRepresentation.h:335
vtkResliceCursorRepresentation::OriginalLevel
double OriginalLevel
Definition: vtkResliceCursorRepresentation.h:337
vtkResliceCursorRepresentation::Modifier
int Modifier
Definition: vtkResliceCursorRepresentation.h:313
vtkResliceCursorRepresentation::ComputeOrigin
virtual void ComputeOrigin(vtkMatrix4x4 *)
vtkResliceCursorRepresentation::~vtkResliceCursorRepresentation
~vtkResliceCursorRepresentation() override
vtkResliceCursorRepresentation::TexturePlaneActor
vtkActor * TexturePlaneActor
Definition: vtkResliceCursorRepresentation.h:331
vtkResliceCursorRepresentation::vtkResliceCursorRepresentation
vtkResliceCursorRepresentation()
vtkResliceCursorRepresentation::Reslice
vtkImageAlgorithm * Reslice
Definition: vtkResliceCursorRepresentation.h:321
vtkResliceCursorRepresentation::NearAxis1
@ NearAxis1
Definition: vtkResliceCursorRepresentation.h:109
vtkResliceCursorRepresentation::InvertTable
void InvertTable()
vtkResliceCursorRepresentation::GetThicknessLabelText
virtual char * GetThicknessLabelText()
Get the text shown in the widget's label.
vtkResliceCursorRepresentation
represent the vtkResliceCursorWidget
Definition: vtkResliceCursorRepresentation.h:55
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkResliceCursorRepresentation::GetVector1
void GetVector1(double d[3])
vtkResliceCursorRepresentation::GetThicknessLabelPosition
virtual void GetThicknessLabelPosition(double pos[3])
vtkResliceCursorRepresentation::SetResliceParameters
virtual void SetResliceParameters(double outputSpacingX, double outputSpacingY, int extentX, int extentY)
vtkResliceCursorRepresentation::UseImageActor
vtkTypeBool UseImageActor
Definition: vtkResliceCursorRepresentation.h:343
vtkResliceCursorRepresentation::ThicknessTextActor
vtkActor2D * ThicknessTextActor
Definition: vtkResliceCursorRepresentation.h:327
vtkResliceCursorRepresentation::ThicknessTextMapper
vtkTextMapper * ThicknessTextMapper
Definition: vtkResliceCursorRepresentation.h:326