SMILX  1.01
vtkImageViewer3.h
1 /*=========================================================================
2 
3  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
4  All rights reserved.
5  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE. See the above copyright notice for more information.
10 
11 =========================================================================*/
12 /*=========================================================================
13  The Software is copyright (c) Commonwealth Scientific and Industrial Research Organisation (CSIRO)
14  ABN 41 687 119 230.
15  All rights reserved.
16 
17  Licensed under the CSIRO BSD 3-Clause License
18  You may not use this file except in compliance with the License.
19  You may obtain a copy of the License in the file LICENSE.md or at
20 
21  https://stash.csiro.au/projects/SMILI/repos/smili/browse/license.txt
22 
23  Unless required by applicable law or agreed to in writing, software
24  distributed under the License is distributed on an "AS IS" BASIS,
25  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26  See the License for the specific language governing permissions and
27  limitations under the License.
28 =========================================================================*/
29 #ifndef __vtkImageViewer3_h
30 #define __vtkImageViewer3_h
31 
32 #include <vtkObjectFactory.h> //For image display from VTK5+
33 #include <vtkImageViewer2.h> //For image display from VTK5+
34 #if(VTK_MAJOR_VERSION > 5)
35  #include <vtkResliceCursor.h> //For image display from VTK5+
36  #include <vtkResliceCursorActor.h> //For image display from VTK5+
37  #include <vtkResliceCursorPolyDataAlgorithm.h>
38 #else
39  #include <vtkCursor3D.h> //For image display from VTK5+
40  #include <vtkPolyDataMapper.h> //For image display from VTK5+
41  #include <vtkActor.h> //For image display from VTK5+
42 #endif
43 #if(VTK_MAJOR_VERSION > 5)
44  #include <vtkRenderingImageModule.h> // For export macro
45  #define VTK_EXT_EXPORT VTKRENDERINGIMAGE_EXPORT
46 #else
47  #define VTK_EXT_EXPORT VTK_RENDERING_EXPORT
48 #endif
49 #include <vtkInteractorStyleImage2.h> //For interactor like scanner
50 
51 class VTK_EXT_EXPORT vtkImageViewer3 : public vtkImageViewer2
52 {
53 public:
54  static vtkImageViewer3 *New();
55  vtkTypeMacro(vtkImageViewer3, vtkImageViewer2);
56  void PrintSelf(ostream& os, vtkIndent indent);
57 
58  //Whether to use head first (neurological standard) or feet first orientation
59  vtkSetMacro(NeurologicalView, bool);
60  vtkGetMacro(NeurologicalView, bool);
61  vtkBooleanMacro(NeurologicalView, bool);
62 
63  //Same as those in vtkImageViewer2, but handles cursor also
64  virtual void SetSliceOrientation(int orientation);
65 
66  //Same as those in vtkImageViewer2, but handles cursor also
67  //virtual void SetSlice(int s);
68 
69  //Enable the image cursor/crosshairs
70 #if(VTK_MAJOR_VERSION > 5)
71  inline void SetCursor(vtkResliceCursor* newCursor)
72  {
73  if(cursor)
74  cursor->Delete();
75  cursor = newCursor;
76  cursorActor->GetCursorAlgorithm()->SetResliceCursor(cursor);
77  }
78  inline vtkResliceCursor* GetCursor()
79  {
80  return cursor;
81  }
82  inline void SetCursorActor(vtkResliceCursorActor* newCursorActor)
83  {
84  if(cursorActor)
85  cursorActor->Delete();
86  cursorActor = newCursorActor;
87  }
88  inline vtkProp3D* GetCursorActor()
89  {
90  return cursorActor;
91  }
92 #else
93  inline void SetCursor(vtkCursor3D* newCursor)
94  {
95  if (cursor)
96  cursor->Delete();
97  cursor = newCursor;
98  }
99  inline vtkCursor3D* GetCursor()
100  {
101  return cursor;
102  }
103  inline void SetCursorActor(vtkActor* newCursorActor)
104  {
105  if (cursorActor)
106  cursorActor->Delete();
107  cursorActor = newCursorActor;
108  }
109  inline vtkProp3D* GetCursorActor()
110  {
111  return cursorActor;
112  }
113 #endif
114  void EnableCursor();
115  void DisableCursor();
116  void UpdateCursor();
117  vtkGetMacro(CursorEnabled, bool);
118 
119  double* GetCursorFocalPoint();
120  void SetCursorFocalPoint(double *point);
121 
122 protected:
123  vtkImageViewer3();
124  virtual ~vtkImageViewer3();
125 
126  virtual void UpdateOrientation();
127  virtual void InstallPipeline();
128 
129  bool NeurologicalView;
130  bool CursorEnabled;
131 
132 #if(VTK_MAJOR_VERSION > 5)
133  vtkResliceCursor *cursor;
134  vtkResliceCursorActor *cursorActor;
135 #else
136  vtkCursor3D *cursor;
137  vtkPolyDataMapper *cursorMapper;
138  vtkActor *cursorActor;
139 #endif
140 
141 #if(VTK_MAJOR_VERSION > 5)
142  friend class vtkImageViewer3Callback;
143  friend class vtkImageViewer3CursorCallback;
144 #endif
145 
146 private:
147  vtkImageViewer3(const vtkImageViewer3&) {} // Not implemented.
148  void operator=(const vtkImageViewer3&) {} // Not implemented.
149 };
150 
151 #endif