forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkResliceCursorPicker.h
115 lines (94 loc) · 3.54 KB
/
vtkResliceCursorPicker.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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPicker.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.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.
=========================================================================*/
/**
* @class vtkResliceCursorPicker
* @brief ray-cast cell picker for the reslice cursor
*
* This class is is used by the vtkResliceCursorWidget to pick reslice axes
* drawn by a vtkResliceCursorActor. The class returns the axes picked if
* any, whether one has picked the center. It takes as input an instance
* of vtkResliceCursorPolyDataAlgorithm. This is all done internally by
* vtkResliceCursorWidget and as such users are not expected to use this
* class directly, unless they are overriding the behaviour of
* vtkResliceCursorWidget.
* @sa
* vtkResliceCursor vtkResliceCursorWidget
*/
#ifndef vtkResliceCursorPicker_h
#define vtkResliceCursorPicker_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkPicker.h"
class vtkPolyData;
class vtkGenericCell;
class vtkResliceCursorPolyDataAlgorithm;
class vtkMatrix4x4;
class vtkPlane;
class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorPicker : public vtkPicker
{
public:
static vtkResliceCursorPicker *New();
vtkTypeMacro(vtkResliceCursorPicker, vtkPicker);
void PrintSelf(ostream& os, vtkIndent indent);
/**
* Perform pick operation with selection point provided. Normally the
* first two values are the (x,y) pixel coordinates for the pick, and
* the third value is z=0. The return value will be non-zero if
* something was successfully picked.
*/
virtual int Pick(double selectionX, double selectionY, double selectionZ,
vtkRenderer *renderer);
//@{
/**
* Get the picked axis
*/
vtkGetMacro( PickedAxis1, int );
vtkGetMacro( PickedAxis2, int );
vtkGetMacro( PickedCenter, int );
//@}
//@{
/**
* Set the reslice cursor algorithm. One must be set
*/
virtual void SetResliceCursorAlgorithm(
vtkResliceCursorPolyDataAlgorithm * );
vtkGetObjectMacro( ResliceCursorAlgorithm,
vtkResliceCursorPolyDataAlgorithm );
//@}
virtual void SetTransformMatrix( vtkMatrix4x4 * );
/**
* Overloaded pick method that returns the picked coordinates of the current
* resliced plane in world coordinates when given a display position
*/
void Pick(
double displayPos[2], double world[3], vtkRenderer *ren );
protected:
vtkResliceCursorPicker();
~vtkResliceCursorPicker();
virtual int IntersectPolyDataWithLine(
double p1[3], double p2[3], vtkPolyData *, double tol );
virtual int IntersectPointWithLine(
double p1[3], double p2[3], double X[3], double tol );
void TransformPlane();
void TransformPoint( double pIn[4], double pOut[4] );
void InverseTransformPoint( double pIn[4], double pOut[4] );
private:
vtkGenericCell *Cell; //used to accelerate picking
vtkResliceCursorPolyDataAlgorithm * ResliceCursorAlgorithm;
int PickedAxis1;
int PickedAxis2;
int PickedCenter;
vtkMatrix4x4 * TransformMatrix;
vtkPlane * Plane;
private:
vtkResliceCursorPicker(const vtkResliceCursorPicker&) VTK_DELETE_FUNCTION;
void operator=(const vtkResliceCursorPicker&) VTK_DELETE_FUNCTION;
};
#endif