1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
23 #include "vvLandmarks.h"
25 #include "vtkImageViewer2.h"
27 #include <vvMeshActor.h>
28 #include <vtkSmartPointer.h>
33 class vtkPolyDataMapper2D;
35 class vtkClipPolyData;
37 class vvBlendImageActor;
39 class vtkCornerAnnotation;
41 class vtkPolyDataMapper2D;
42 class vtkPolyDataMapper;
48 class vtkAssignAttribute;
49 class vtkScalarBarActor;
51 class vtkImageReslice;
53 class vvSlicer: public vtkImageViewer2
56 static vvSlicer *New();
57 vtkTypeRevisionMacro(vvSlicer,vtkImageViewer2);
58 void PrintSelf(ostream& os, vtkIndent indent);
60 void SetImage(vvImage::Pointer inputImages);
61 vvImage::Pointer GetImage() {
65 void SetOverlay(vvImage::Pointer inputOverlay);
66 vvImage::Pointer GetOverlay() {
70 vtkImageMapToWindowLevelColors* GetOverlayMapper();
71 vvBlendImageActor* GetOverlayActor() ;
72 vtkImageMapToWindowLevelColors* GetFusionMapper() ;
73 vtkImageActor* GetFusionActor() ;
74 vtkActor* GetVFActor() ;
75 vtkCornerAnnotation* GetAnnotation();
77 void SetFusion(vvImage::Pointer inputFusion);
78 vvImage::Pointer GetFusion() {
82 /**Set an actor's visibility ("overlay, fusion, vf, contour...")
83 Overlay index is the index of the overlay by type, eg. if there are
84 5 contours and we want to activate the 3rd one, pass 2 **/
85 void SetActorVisibility(const std::string& actor_type, int overlay_index,bool vis);
86 void RemoveActor(const std::string& actor_type, int overlay_index);
88 void SetVF(vvImage::Pointer vf);
93 void SetLandmarks(vvLandmarks* landmarks);
94 void SetTSlice(int t);
95 void SetSliceOrientation(int orientation);
97 ///Reimplemented from vtkImageViewer2 to add polydata support
100 return mImage->GetVTKImages().size() - 1;
103 void SetOpacity(double s);
104 void SetRenderWindow(int orientation, vtkRenderWindow * rw);
105 void SetDisplayMode(bool i);
106 void FlipHorizontalView();
107 void FlipVerticalView();
109 ///Sets the camera to fit the image in the window
112 void SetVFSubSampling(int sub);
113 int GetVFSubSampling() {
116 void SetVFScale(int scale);
117 void SetVFWidth(int width);
121 void SetVFLog(int log);
126 void SetFileName(std::string filename) {
127 mFileName = filename;
129 std::string GetFileName() {
133 double* GetCursorPosition() {
137 void SetCurrentPosition(double x, double y, double z, int t);
138 double* GetCurrentPosition() {
142 void UpdateCursorPosition();
143 void SetCursorVisibility(bool s);
144 bool GetCursorVisibility();
145 void SetCursorColor(int r,int g, int b);
147 void GetExtremasAroundMousePointer(double & min, double & max);
149 void UpdateLandmarks();
150 void ForceUpdateDisplayExtent();
152 int* GetDisplayExtent();
153 /**Add a polydata to be displayed as a contour over the image
154 ** the contour can be propagated to a time sequence using a motion field */
155 void AddContour(vvMesh::Pointer contours,bool propagate);
156 ///Toggle temporal superposition of contours
157 void ToggleContourSuperposition();
159 virtual void SetColorWindow(double s);
160 virtual void SetColorLevel(double s);
163 void EnableReducedExtent(bool b);
164 void SetReducedExtent(int * ext);
166 void ClipDisplayedExtent(int extent[6], int refExtent[6]);
167 int GetOrientation();
174 std::string mFileName;
175 vvImage::Pointer mImage;
176 vvImage::Pointer mOverlay;
177 vvImage::Pointer mFusion;
178 vvImage::Pointer mVF;
180 vvLandmarks* mLandmarks;
182 vtkSmartPointer<vtkImageMapToWindowLevelColors> mOverlayMapper;
183 vtkSmartPointer<vvBlendImageActor> mOverlayActor;
184 vtkSmartPointer<vtkImageMapToWindowLevelColors> mFusionMapper;
185 vtkSmartPointer<vtkImageActor> mFusionActor;
186 vtkSmartPointer<vtkCornerAnnotation> ca;
187 vtkSmartPointer<vtkCursor2D> crossCursor;
188 vtkSmartPointer<vtkPolyDataMapper2D> pdm;
189 vtkSmartPointer<vtkActor2D> pdmA;
190 vtkSmartPointer<vvGlyphSource> mArrow;
191 vtkSmartPointer<vtkAssignAttribute> mAAFilter;
192 vtkSmartPointer<vtkExtractVOI> mVOIFilter;
193 vtkSmartPointer<vvGlyph2D> mGlyphFilter;
194 vtkSmartPointer<vtkPolyDataMapper> mVFMapper;
195 vtkSmartPointer<vtkActor> mVFActor;
196 vtkSmartPointer<vtkGlyph3D> mLandGlyph;
197 vtkSmartPointer<vtkCursor3D> mCross;
198 vtkSmartPointer<vtkClipPolyData> mLandClipper;
199 vtkSmartPointer<vtkPolyDataMapper> mLandMapper;
200 vtkSmartPointer<vtkActor> mLandActor;
201 vtkSmartPointer<vtkBox> mClipBox;
202 vtkSmartPointer<vtkScalarBarActor> legend;
203 std::vector<vvMeshActor*> mSurfaceCutActors;
212 bool mUseReducedExtent;
213 int * mReducedExtent;
214 int * mInitialExtent;
217 void UpdateOrientation();
218 void UpdateDisplayExtent();
219 void ComputeVFDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int extent[6]);
220 void ComputeOverlayDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int overExtent[6]);
221 void ComputeFusionDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int overExtent[6]);
222 ///Sets the surfaces to be cut on the image slice: update the vtkCutter
223 void SetContourSlice();