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