]> Creatis software - clitk.git/blob - vv/vvImageContour.h
changes in license header
[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
47 protected:
48   vvSlicer * mSlicer;
49   int mSlice;
50   int mTSlice;
51   double mValue;
52   int mPreviousTSlice;
53   double mPreviousValue;
54   bool mHiddenImageIsUsed;
55   vvImage * mHiddenImage;
56   bool mDisplayModeIsPreserveMemory;
57
58   // For preserveMemory mode
59   std::vector<vtkSmartPointer<vtkActor> > mSquaresActorList;
60   std::vector<vtkSmartPointer<vtkImageClip> > mClipperList;
61   std::vector<vtkSmartPointer<vtkMarchingSquares> > mSquaresList;
62   std::vector<vtkSmartPointer<vtkPolyDataMapper> > mSquaresMapperList;
63
64   // For fast cache mode
65   int mPreviousSlice;
66   int mPreviousOrientation;
67   std::vector<std::vector<vtkActor*> > mListOfCachedContourActors;
68
69   // Functions
70   void InitializeCacheMode();
71   void UpdateWithPreserveMemoryMode();
72   void UpdateWithFastCacheMode();
73   void CreateNewActor(int numImage);
74   void UpdateActor(vtkActor * actor, vtkMarchingSquares * squares, vtkImageClip * clipper,
75                    double threshold, int orientation, int slice);
76   void CreateActor(int orientation, int slice);
77   int ComputeCurrentOrientation();
78
79 private:
80   vvImageContour();
81   ~vvImageContour();
82 }; // end class vvImageContour
83 //------------------------------------------------------------------------------
84
85 #endif
86