]> Creatis software - clitk.git/blob - vv/vvImageContour.h
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
[clitk.git] / vv / vvImageContour.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef VVIMAGECONTOUR_H
19 #define VVIMAGECONTOUR_H
20
21 #include "clitkCommon.h"
22 #include "vvSlicer.h"
23
24 class vtkImageClip;
25 class vtkMarchingSquares;
26 class vtkActor;
27 class vvImage;
28
29 //------------------------------------------------------------------------------
30 class vvImageContour: public itk::LightObject
31 {
32   //  Q_OBJECT
33 public:
34   typedef vvImageContour Self;
35   typedef itk::SmartPointer<Self> Pointer;
36   itkNewMacro(Self);
37
38   void SetSlicer(vvSlicer * slicer);
39   void Update(double value);
40   void HideActors();
41   void ShowActors();
42   void SetColor(double r, double g, double b);
43   void SetLineWidth(double w);
44   void SetImage(vvImage * image);
45   void SetPreserveMemoryModeEnabled(bool b);
46   void SetDepth(double d) { mDepth = d; }
47
48 protected:
49   vvSlicer * mSlicer;
50   int mSlice;
51   int mTSlice;
52   double mValue;
53   int mPreviousTSlice;
54   double mPreviousValue;
55   bool mHiddenImageIsUsed;
56   vvImage * mHiddenImage;
57   bool mDisplayModeIsPreserveMemory;
58   double mDepth;
59
60   // For preserveMemory mode
61   std::vector<vtkSmartPointer<vtkActor> > mSquaresActorList;
62   std::vector<vtkSmartPointer<vtkImageClip> > mClipperList;
63   std::vector<vtkSmartPointer<vtkMarchingSquares> > mSquaresList;
64   std::vector<vtkSmartPointer<vtkPolyDataMapper> > mSquaresMapperList;
65
66   // For fast cache mode
67   int mPreviousSlice;
68   int mPreviousOrientation;
69   std::vector<std::vector<vtkActor*> > mListOfCachedContourActors;
70
71   // Functions
72   void InitializeCacheMode();
73   void UpdateWithPreserveMemoryMode();
74   void UpdateWithFastCacheMode();
75   void CreateNewActor(int numImage);
76   void UpdateActor(vtkActor * actor, vtkPolyDataMapper * mapper, vtkMarchingSquares * squares, vtkImageClip * clipper,
77                    double threshold, int orientation, int slice);
78   void CreateActor(int orientation, int slice);
79   int ComputeCurrentOrientation();
80
81 private:
82   vvImageContour();
83   ~vvImageContour();
84     int mPreviousTslice;
85 }; // end class vvImageContour
86 //------------------------------------------------------------------------------
87
88 #endif
89