Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLSliceIntersectionInteractionRepresentation.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Ebatinca S.L., Las Palmas de Gran Canaria, Spain
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16==============================================================================*/
17
25
26#ifndef vtkMRMLSliceIntersectionInteractionRepresentation_h
27#define vtkMRMLSliceIntersectionInteractionRepresentation_h
28
29#include "vtkMRMLDisplayableManagerExport.h" // For export macro
32
34#include "vtkMRMLSliceNode.h"
35
39
40class vtkProperty2D;
41class vtkActor2D;
42class vtkPolyDataMapper2D;
43class vtkPolyData;
44class vtkPoints;
45class vtkCellArray;
46class vtkTextProperty;
47class vtkLeaderActor2D;
48class vtkTextMapper;
49class vtkTransform;
50class vtkActor2D;
51
52class SliceIntersectionInteractionDisplayPipeline;
54
56{
57public:
62
64
68 void PrintSelf(ostream& os, vtkIndent indent) override;
70
72 void SetViewNode(vtkMRMLAbstractViewNode* viewNode) override;
74
76
78 void UpdateFromMRML(vtkMRMLNode* caller, unsigned long event, void* callData = nullptr) override;
79
84
86
89 void GetActors2D(vtkPropCollection*) override;
90 void ReleaseGraphicsResources(vtkWindow*) override;
91 int RenderOverlay(vtkViewport* viewport) override;
93
96
99
101 bool DistanceFromSliceIntersectionToPoint(vtkMRMLSliceNode* intersectingSlice, double point_RAS[3], double& distance);
102
104 double* GetSliceIntersectionPoint() VTK_SIZEHINT(3);
105
107 bool IsMouseCursorInSliceView(double cursorPosition[2]);
108
110 void SetPipelinesHandlesOpacity(double opacity);
111
112 void TransformIntersectingSlices(vtkMatrix4x4* rotatedSliceToSliceTransformMatrix);
113
117 virtual std::string CanInteract(vtkMRMLInteractionEventData* interactionEventData,
118 int& foundComponentType,
119 int& foundComponentIndex,
120 double& closestDistance2,
121 double& handleOpacity);
122
124
126 {
127 public:
128 HandleInfo(int index, int componentType, const std::string& intersectingSliceNodeID, double positionWorld[3], double positionLocal[3])
129 : Index(index)
130 , ComponentType(componentType)
131 , IntersectingSliceNodeID(intersectingSliceNodeID)
132 {
133 for (int i = 0; i < 3; ++i)
134 {
135 this->PositionWorld[i] = positionWorld[i];
136 }
137 this->PositionWorld[3] = 1.0;
138 for (int i = 0; i < 3; ++i)
139 {
140 this->PositionLocal[i] = positionLocal[i];
141 }
142 this->PositionLocal[3] = 1.0;
143 }
144 int Index;
147 double PositionLocal[4];
148 double PositionWorld[4];
149 };
150
152 typedef std::vector<HandleInfo> HandleInfoList;
153 virtual HandleInfoList GetHandleInfoList(SliceIntersectionInteractionDisplayPipeline* pipeline);
154
155 virtual int GetTranslateArrowCursor(const std::string& intersectingSliceNodeID);
156
157protected:
160
161 SliceIntersectionInteractionDisplayPipeline* GetDisplayPipelineFromSliceLogic(vtkMRMLSliceLogic* sliceLogic);
162
163 static void SliceNodeModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
166
167 void UpdateSliceIntersectionDisplay(SliceIntersectionInteractionDisplayPipeline* pipeline);
168
170
172
173 double GetSliceRotationAngleRad(int eventPos[2]);
174
175 double GetLineThicknessFromMode(int lineThicknessMode);
176
179
182
185
190 double InteractionSize{ 3.0 };
191
193
194 class vtkInternal;
195 vtkInternal* Internal;
196
197 vtkSmartPointer<vtkMRMLSliceIntersectionInteractionRepresentationHelper> Helper;
198
199private:
201 void operator=(const vtkMRMLSliceIntersectionInteractionRepresentation&) = delete;
202};
203
204#endif
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
MRML node to represent a display property of 3D surface model.
Abstract Superclass for all specific types of MRML nodes.
MRML node to store display properties of slice nodes.
HandleInfo(int index, int componentType, const std::string &intersectingSliceNodeID, double positionWorld[3], double positionLocal[3])
void SetSliceDisplayNode(vtkMRMLSliceDisplayNode *sliceDisplayNode)
double GetLineThicknessFromMode(int lineThicknessMode)
void PrintSelf(ostream &os, vtkIndent indent) override
vtkMRMLSliceDisplayNode * GetSliceDisplayNode()
bool DistanceFromSliceIntersectionToPoint(vtkMRMLSliceNode *intersectingSlice, double point_RAS[3], double &distance)
Compute distance between a point and a slice intersection.
bool SliceIntersectionPointFound
Indicate whether a valid slice intersection point was found or not.
virtual HandleInfoList GetHandleInfoList(SliceIntersectionInteractionDisplayPipeline *pipeline)
vtkSmartPointer< vtkMRMLSliceIntersectionInteractionRepresentationHelper > Helper
bool IsMouseCursorInSliceView(double cursorPosition[2])
Check whether the mouse cursor is within the slice view or not.
void TransformIntersectingSlices(vtkMatrix4x4 *rotatedSliceToSliceTransformMatrix)
virtual int GetTranslateArrowCursor(const std::string &intersectingSliceNodeID)
vtkMRMLSliceDisplayNode * GetSliceDisplayNode(vtkMRMLSliceNode *sliceNode)
void UpdateFromMRML(vtkMRMLNode *caller, unsigned long event, void *callData=nullptr) override
static void SliceNodeModifiedCallback(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
void SetMRMLApplicationLogic(vtkMRMLApplicationLogic *)
void ComputeSliceIntersectionPoint()
Compute slice intersection point between red, green and yellow slice nodes.
double * GetSliceIntersectionPoint() VTK_SIZEHINT(3)
Get slice intersection point between red, green and yellow slice nodes.
static vtkMRMLSliceIntersectionInteractionRepresentation * New()
void GetActors2D(vtkPropCollection *) override
SliceIntersectionInteractionDisplayPipeline * GetDisplayPipelineFromSliceLogic(vtkMRMLSliceLogic *sliceLogic)
int RenderOverlay(vtkViewport *viewport) override
void UpdateSliceIntersectionDisplay(SliceIntersectionInteractionDisplayPipeline *pipeline)
void RemoveIntersectingSliceNode(vtkMRMLSliceNode *sliceNode)
void SliceNodeModified(vtkMRMLSliceNode *sliceNode)
void AddIntersectingSliceLogic(vtkMRMLSliceLogic *sliceLogic)
virtual std::string CanInteract(vtkMRMLInteractionEventData *interactionEventData, int &foundComponentType, int &foundComponentIndex, double &closestDistance2, double &handleOpacity)
std::vector< HandleInfo > HandleInfoList
Get the list of info for all interaction handles.
void SetViewNode(vtkMRMLAbstractViewNode *viewNode) override
Sets the view node. Accepts only vtkMRMLSliceNode; use GetSliceNode() to retrieve it.
void ReleaseGraphicsResources(vtkWindow *) override
void SliceModelDisplayNodeModified(vtkMRMLModelDisplayNode *sliceNode)
Slicer logic class for slice manipulation.
MRML node for storing a slice through RAS space.