Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 
26 #ifndef vtkMRMLSliceIntersectionInteractionRepresentation_h
27 #define vtkMRMLSliceIntersectionInteractionRepresentation_h
28 
29 #include "vtkMRMLDisplayableManagerExport.h" // For export macro
32 
34 #include "vtkMRMLSliceNode.h"
35 
38 class vtkMRMLSliceLogic;
39 
40 class vtkProperty2D;
41 class vtkActor2D;
42 class vtkPolyDataMapper2D;
43 class vtkPolyData;
44 class vtkPoints;
45 class vtkCellArray;
46 class vtkTextProperty;
47 class vtkLeaderActor2D;
48 class vtkTextMapper;
49 class vtkTransform;
50 class vtkActor2D;
51 
52 class SliceIntersectionInteractionDisplayPipeline;
54 
56 {
57  public:
62 
64 
68  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
71  void SetSliceNode(vtkMRMLSliceNode* sliceNode);
72  vtkMRMLSliceNode* GetSliceNode();
73 
74  vtkMRMLSliceDisplayNode* GetSliceDisplayNode();
75 
76  bool IsDisplayable();
77  void UpdateFromMRML(vtkMRMLNode* caller, unsigned long event, void* callData = nullptr) override;
78 
79  void AddIntersectingSliceLogic(vtkMRMLSliceLogic* sliceLogic);
80  void RemoveIntersectingSliceNode(vtkMRMLSliceNode* sliceNode);
81  void UpdateIntersectingSliceNodes();
82  void RemoveAllIntersectingSliceNodes();
83 
85 
88  void GetActors2D(vtkPropCollection*) override;
89  void ReleaseGraphicsResources(vtkWindow*) override;
90  int RenderOverlay(vtkViewport* viewport) override;
92 
93  void SetMRMLApplicationLogic(vtkMRMLApplicationLogic*);
94  vtkGetObjectMacro(MRMLApplicationLogic, vtkMRMLApplicationLogic);
95 
97  void ComputeSliceIntersectionPoint();
98 
100  double* GetSliceIntersectionPoint();
101 
103  bool IsMouseCursorInSliceView(double cursorPosition[2]);
104 
105  void SetPipelinesHandlesVisibility(bool visible);
106  void SetPipelinesHandlesOpacity(double opacity);
107 
108  void TransformIntersectingSlices(vtkMatrix4x4* rotatedSliceToSliceTransformMatrix);
109 
113  virtual std::string CanInteract(vtkMRMLInteractionEventData* interactionEventData,
114  int& foundComponentType, int& foundComponentIndex, double& closestDistance2, double& handleOpacity);
115 
116  virtual double GetMaximumHandlePickingDistance2();
117 
119  {
120  public:
121  HandleInfo(int index, int componentType, const std::string& intersectingSliceNodeID, double positionWorld[3], double positionLocal[3])
122  : Index(index)
123  , ComponentType(componentType)
124  , IntersectingSliceNodeID(intersectingSliceNodeID)
125  {
126  for (int i = 0; i < 3; ++i)
127  {
128  this->PositionWorld[i] = positionWorld[i];
129  }
130  this->PositionWorld[3] = 1.0;
131  for (int i = 0; i < 3; ++i)
132  {
133  this->PositionLocal[i] = positionLocal[i];
134  }
135  this->PositionLocal[3] = 1.0;
136  }
137  int Index;
140  double PositionLocal[4];
141  double PositionWorld[4];
142  };
143 
145  typedef std::vector<HandleInfo> HandleInfoList;
146  virtual HandleInfoList GetHandleInfoList(SliceIntersectionInteractionDisplayPipeline* pipeline);
147 
148  virtual int GetTranslateArrowCursor(const std::string& intersectingSliceNodeID);
149 
150  protected:
153 
154  SliceIntersectionInteractionDisplayPipeline* GetDisplayPipelineFromSliceLogic(vtkMRMLSliceLogic* sliceLogic);
155 
156  static void SliceNodeModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
157  void SliceNodeModified(vtkMRMLSliceNode* sliceNode);
158  void SliceModelDisplayNodeModified(vtkMRMLModelDisplayNode* sliceNode);
159 
160  void UpdateSliceIntersectionDisplay(SliceIntersectionInteractionDisplayPipeline* pipeline);
161 
162  vtkMRMLSliceDisplayNode* GetSliceDisplayNode(vtkMRMLSliceNode* sliceNode);
163 
164  void SetSliceDisplayNode(vtkMRMLSliceDisplayNode* sliceDisplayNode);
165 
166  double GetSliceRotationAngleRad(int eventPos[2]);
167 
168  double GetLineThicknessFromMode(int lineThicknessMode);
169 
171  double LastEventPosition[2];
172 
174  double SliceIntersectionPoint[4];
175 
178 
183  double InteractionSize{ 3.0 };
184 
185  double GetViewScaleFactorAtPosition(double positionWorld[3]);
186 
188 
189  class vtkInternal;
190  vtkInternal* Internal;
191 
193 
194  private:
196  void operator=(const vtkMRMLSliceIntersectionInteractionRepresentation&) = delete;
197 };
198 
199 #endif
MRML node to represent a display property of 3D surface model.
void PrintSelf(ostream &os, vtkIndent indent) override
bool SliceIntersectionPointFound
Indicate whether a valid slice intersection point was found or not.
MRML node to store display properties of slice nodes.
MRML node for storing a slice through RAS space.
represent intersections of other slice views in the current slice view
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
std::vector< HandleInfo > HandleInfoList
Get the list of info for all interaction handles.
HandleInfo(int index, int componentType, const std::string &intersectingSliceNodeID, double positionWorld[3], double positionLocal[3])
represent intersections of other slice views in the current slice view
vtkMRMLSliceIntersectionInteractionRepresentationHelper * Helper
virtual void UpdateFromMRML(vtkMRMLNode *caller, unsigned long event, void *callData=nullptr)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
Slicer logic class for slice manipulation.