forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkImageActorPointPlacer.h
164 lines (137 loc) · 5.26 KB
/
vtkImageActorPointPlacer.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
/*=========================================================================
Program: Visualization Toolkit
Module: vtkImageActorPointPlacer.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 vtkImageActorPointPlacer
* @brief Converts 2D display positions to world positions such that they lie on an ImageActor
*
* This PointPlacer is used to constrain the placement of points on the
* supplied image actor. Additionally, you may set bounds to restrict the
* placement of the points. The placement of points will then be constrained
* to lie not only on the ImageActor but also within the bounds specified.
* If no bounds are specified, they may lie anywhere on the supplied ImageActor.
*/
#ifndef vtkImageActorPointPlacer_h
#define vtkImageActorPointPlacer_h
#include "vtkInteractionWidgetsModule.h" // For export macro
#include "vtkPointPlacer.h"
class vtkBoundedPlanePointPlacer;
class vtkImageActor;
class vtkRenderer;
class VTKINTERACTIONWIDGETS_EXPORT vtkImageActorPointPlacer : public vtkPointPlacer
{
public:
/**
* Instantiate this class.
*/
static vtkImageActorPointPlacer *New();
//@{
/**
* Standard methods for instances of this class.
*/
vtkTypeMacro(vtkImageActorPointPlacer,vtkPointPlacer);
void PrintSelf(ostream& os, vtkIndent indent);
//@}
/**
* Given and renderer and a display position in pixels,
* find a world position and orientation. In this class
* an internal vtkBoundedPlanePointPlacer is used to compute
* the world position and orientation. The internal placer
* is set to use the plane of the image actor and the bounds
* of the image actor as the constraints for placing points.
*/
int ComputeWorldPosition( vtkRenderer *ren,
double displayPos[2],
double worldPos[3],
double worldOrient[9] );
/**
* This method is identical to the one above since the
* reference position is ignored by the bounded plane
* point placer.
*/
int ComputeWorldPosition( vtkRenderer *ren,
double displayPos[2],
double refWorldPos[2],
double worldPos[3],
double worldOrient[9] );
/**
* This method validates a world position by checking to see
* if the world position is valid according to the constraints
* of the internal placer (essentially - is this world position
* on the image?)
*/
int ValidateWorldPosition( double worldPos[3] );
/**
* This method is identical to the one above since the bounded
* plane point placer ignores orientation
*/
int ValidateWorldPosition( double worldPos[3],
double worldOrient[9]);
/**
* Update the world position and orientation according the
* the current constraints of the placer. Will be called
* by the representation when it notices that this placer
* has been modified.
*/
int UpdateWorldPosition( vtkRenderer *ren,
double worldPos[3],
double worldOrient[9]);
/**
* A method for configuring the internal placer according
* to the constraints of the image actor.
* Called by the representation to give the placer a chance
* to update itself, which may cause the MTime to change,
* which would then cause the representation to update
* all of its points
*/
int UpdateInternalState();
//@{
/**
* Set / get the reference vtkImageActor used to place the points.
* An image actor must be set for this placer to work. An internal
* bounded plane point placer is created and set to match the bounds
* of the displayed image.
*/
void SetImageActor( vtkImageActor * );
vtkGetObjectMacro( ImageActor, vtkImageActor );
//@}
//@{
/**
* Optionally, you may set bounds to restrict the placement of the points.
* The placement of points will then be constrained to lie not only on
* the ImageActor but also within the bounds specified. If no bounds are
* specified, they may lie anywhere on the supplied ImageActor.
*/
vtkSetVector6Macro( Bounds, double );
vtkGetVector6Macro( Bounds, double );
//@}
/**
* Set the world tolerance. This propagates it to the internal
* BoundedPlanePointPlacer.
*/
virtual void SetWorldTolerance( double s );
protected:
vtkImageActorPointPlacer();
~vtkImageActorPointPlacer();
// The reference image actor. Must be configured before this placer
// is used.
vtkImageActor *ImageActor;
// The internal placer.
vtkBoundedPlanePointPlacer *Placer;
// Used to keep track of whether the bounds of the
// input image have changed
double SavedBounds[6];
// See the SetBounds method
double Bounds[6];
private:
vtkImageActorPointPlacer(const vtkImageActorPointPlacer&) VTK_DELETE_FUNCTION;
void operator=(const vtkImageActorPointPlacer&) VTK_DELETE_FUNCTION;
};
#endif