1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkResliceCursorActor.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 =========================================================================*/
15 /**
16  * @class   vtkResliceCursorActor
17  * @brief   Represent a reslice cursor
18  *
19  * A reslice cursor consists of a pair of lines (cross hairs), thin or thick,
20  * that may be interactively manipulated for thin/thick reformats through the
21  * data.
22  * @sa
23  * vtkResliceCursor vtkResliceCursorPolyDataAlgorithm vtkResliceCursorWidget
24  * vtkResliceCursorRepresentation vtkResliceCursorLineRepresentation
25  */
26 
27 #ifndef vtkResliceCursorActor_h
28 #define vtkResliceCursorActor_h
29 
30 #include "vtkInteractionWidgetsModule.h" // For export macro
31 #include "vtkProp3D.h"
32 
33 class vtkResliceCursor;
34 class vtkResliceCursorPolyDataAlgorithm;
35 class vtkPolyDataMapper;
36 class vtkActor;
37 class vtkProperty;
38 class vtkBoundingBox;
39 
40 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorActor : public vtkProp3D
41 {
42 
43 public:
44   ///@{
45   /**
46    * Standard VTK methods
47    */
48   static vtkResliceCursorActor* New();
49   vtkTypeMacro(vtkResliceCursorActor, vtkProp3D);
50   void PrintSelf(ostream& os, vtkIndent indent) override;
51   ///@}
52 
53   ///@{
54   /**
55    * Get the cursor algorithm. The cursor must be set on the algorithm
56    */
57   vtkGetObjectMacro(CursorAlgorithm, vtkResliceCursorPolyDataAlgorithm);
58   ///@}
59 
60   /**
61    * Support the standard render methods.
62    */
63   int RenderOpaqueGeometry(vtkViewport* viewport) override;
64 
65   /**
66    * Does this prop have some translucent polygonal geometry? No.
67    */
68   vtkTypeBool HasTranslucentPolygonalGeometry() override;
69 
70   /**
71    * Release any graphics resources that are being consumed by this actor.
72    * The parameter window could be used to determine which graphic
73    * resources to release.
74    */
75   void ReleaseGraphicsResources(vtkWindow*) override;
76 
77   /**
78    * Get the bounds for this Actor as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
79    */
80   double* GetBounds() override;
81 
82   /**
83    * Get the actors mtime plus consider its algorithm.
84    */
85   vtkMTimeType GetMTime() override;
86 
87   ///@{
88   /**
89    * Get property of the internal actor.
90    */
91   vtkProperty* GetCenterlineProperty(int i);
92   vtkProperty* GetThickSlabProperty(int i);
93   ///@}
94 
95   /**
96    * Get the centerline actor along a particular axis
97    */
98   vtkActor* GetCenterlineActor(int axis);
99 
100   /**
101    * Set the user matrix on all the internal actors.
102    */
103   virtual void SetUserMatrix(vtkMatrix4x4* matrix);
104 
105 protected:
106   vtkResliceCursorActor();
107   ~vtkResliceCursorActor() override;
108 
109   void UpdateViewProps(vtkViewport* v = nullptr);
110   void UpdateHoleSize(vtkViewport* v);
111 
112   vtkResliceCursorPolyDataAlgorithm* CursorAlgorithm;
113   vtkPolyDataMapper* CursorCenterlineMapper[3];
114   vtkActor* CursorCenterlineActor[3];
115   vtkPolyDataMapper* CursorThickSlabMapper[3];
116   vtkActor* CursorThickSlabActor[3];
117   vtkProperty* CenterlineProperty[3];
118   vtkProperty* ThickSlabProperty[3];
119 
120 private:
121   vtkResliceCursorActor(const vtkResliceCursorActor&) = delete;
122   void operator=(const vtkResliceCursorActor&) = delete;
123 };
124 
125 #endif
126