6 #include "vvLandmarks.h"
8 #include "vtkImageViewer2.h"
10 #include <vvMeshActor.h>
11 #include <vtkSmartPointer.h>
16 class vtkPolyDataMapper2D;
18 class vtkClipPolyData;
21 class vtkCornerAnnotation;
23 class vtkPolyDataMapper2D;
24 class vtkPolyDataMapper;
30 class vtkAssignAttribute;
31 class vtkScalarBarActor;
34 class vvSlicer: public vtkImageViewer2
37 static vvSlicer *New();
38 vtkTypeRevisionMacro(vvSlicer,vtkImageViewer2);
39 void PrintSelf(ostream& os, vtkIndent indent);
41 void SetImage(vvImage::Pointer inputImages);
42 vvImage::Pointer GetImage() {
46 void SetOverlay(vvImage::Pointer inputOverlay);
47 vvImage::Pointer GetOverlay() {
51 vtkImageMapToWindowLevelColors* GetOverlayMapper();
52 vtkImageActor* GetOverlayActor() ;
53 vtkImageMapToWindowLevelColors* GetFusionMapper() ;
54 vtkImageActor* GetFusionActor() ;
55 vtkActor* GetVFActor() ;
56 vtkCornerAnnotation* GetAnnotation() ;
58 void SetFusion(vvImage::Pointer inputFusion);
59 vvImage::Pointer GetFusion() {
63 /**Set an actor's visibility ("overlay, fusion, vf, contour...")
64 Overlay index is the index of the overlay by type, eg. if there are
65 5 contours and we want to activate the 3rd one, pass 2 **/
66 void SetActorVisibility(const std::string& actor_type, int overlay_index,bool vis);
67 void RemoveActor(const std::string& actor_type, int overlay_index);
69 void SetVF(vvImage::Pointer vf);
74 void SetLandmarks(vvLandmarks* landmarks);
75 void SetTSlice(int t);
76 void SetSliceOrientation(int orientation);
78 ///Reimplemented from vtkImageViewer2 to add polydata support
81 return mImage->GetVTKImages().size() - 1;
84 void SetOpacity(double s);
85 void SetRenderWindow(int orientation, vtkRenderWindow * rw);
86 void SetDisplayMode(bool i);
87 void FlipHorizontalView();
88 void FlipVerticalView();
90 ///Sets the camera to fit the image in the window
93 void SetVFSubSampling(int sub);
94 int GetVFSubSampling() {
97 void SetVFScale(int scale);
101 void SetVFLog(int log);
106 void SetFileName(std::string filename) {
107 mFileName = filename;
109 std::string GetFileName() {
113 double* GetCursorPosition() {
117 void SetCurrentPosition(double x, double y, double z, int t);
118 double* GetCurrentPosition() {
122 void UpdateCursorPosition();
123 void SetCursorVisibility(bool s);
124 bool GetCursorVisibility();
125 void SetCursorColor(int r,int g, int b);
127 void GetExtremasAroundMousePointer(double & min, double & max);
129 void UpdateLandmarks();
130 void ForceUpdateDisplayExtent();
132 int* GetDisplayExtent();
133 /**Add a polydata to be displayed as a contour over the image
134 ** the contour can be propagated to a time sequence using a motion field */
135 void AddContour(vvMesh::Pointer contours,bool propagate);
136 ///Toggle temporal superposition of contours
137 void ToggleContourSuperposition();
139 virtual void SetColorWindow(double s);
140 virtual void SetColorLevel(double s);
143 void EnableReducedExtent(bool b);
144 void SetReducedExtent(int * ext);
150 std::string mFileName;
151 vvImage::Pointer mImage;
152 vvImage::Pointer mOverlay;
153 vvImage::Pointer mFusion;
154 vvImage::Pointer mVF;
156 vvLandmarks* mLandmarks;
158 vtkSmartPointer<vtkImageMapToWindowLevelColors> mOverlayMapper;
159 vtkSmartPointer<vtkImageActor> mOverlayActor;
160 vtkSmartPointer<vtkImageMapToWindowLevelColors> mFusionMapper;
161 vtkSmartPointer<vtkImageActor> mFusionActor;
162 vtkSmartPointer<vtkCornerAnnotation> ca;
163 vtkSmartPointer<vtkCursor2D> crossCursor;
164 vtkSmartPointer<vtkPolyDataMapper2D> pdm;
165 vtkSmartPointer<vtkActor2D> pdmA;
166 vtkSmartPointer<vvGlyphSource> mArrow;
167 vtkSmartPointer<vtkAssignAttribute> mAAFilter;
168 vtkSmartPointer<vtkExtractVOI> mVOIFilter;
169 vtkSmartPointer<vvGlyph2D> mGlyphFilter;
170 vtkSmartPointer<vtkPolyDataMapper> mVFMapper;
171 vtkSmartPointer<vtkActor> mVFActor;
172 vtkSmartPointer<vtkGlyph3D> mLandGlyph;
173 vtkSmartPointer<vtkCursor3D> mCross;
174 vtkSmartPointer<vtkClipPolyData> mLandClipper;
175 vtkSmartPointer<vtkPolyDataMapper> mLandMapper;
176 vtkSmartPointer<vtkActor> mLandActor;
177 vtkSmartPointer<vtkBox> mClipBox;
178 vtkSmartPointer<vtkScalarBarActor> legend;
180 std::vector<vvMeshActor*> mSurfaceCutActors;
188 bool mUseReducedExtent;
189 int * mReducedExtent;
190 int * mInitialExtent;
193 void UpdateOrientation();
194 void UpdateDisplayExtent();
195 void ComputeVFDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int extent[6]);
196 void ComputeOverlayDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int overExtent[6]);
197 void ComputeFusionDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int overExtent[6]);
198 void ClipDisplayedExtent(int extent[6], int refExtent[6]);
199 ///Sets the surfaces to be cut on the image slice: update the vtkCutter
200 void SetContourSlice();