]> Creatis software - clitk.git/blob - vv/vvImageContour.h
- small correction about Render (a bit less unuseful Render)
[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://oncora1.lyon.fnclcc.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
31 {
32   //  Q_OBJECT
33  public:
34   vvImageContour();
35   ~vvImageContour();
36
37   void setSlicer(vvSlicer * slicer);
38   void update(double value);
39   void hideActors();
40   void showActors();
41   void setColor(double r, double g, double b);
42   void SetLineWidth(double w);
43   void setImage(vvImage::Pointer image);
44   void setPreserveMemoryModeEnabled(bool b);
45
46  protected:
47   vvSlicer * mSlicer;
48   int mSlice;
49   int mTSlice;
50   double mValue;
51   int mPreviousTSlice;
52   double mPreviousValue;
53   bool mHiddenImageIsUsed;
54   vvImage::Pointer mHiddenImage;
55   bool mDisplayModeIsPreserveMemory;
56
57   // For preserveMemory mode
58   std::vector<vtkImageClip*> mClipperList;
59   std::vector<vtkMarchingSquares*> mSquaresList;
60   std::vector<vtkActor*> mSquaresActorList;
61
62   // For fast cache mode
63   int mPreviousSlice;
64   int mPreviousOrientation;
65   std::vector<std::vector<vtkActor*> > mListOfCachedContourActors;
66
67   // Functions
68   void initializeCacheMode();
69   void updateWithPreserveMemoryMode();
70   void updateWithFastCacheMode();
71   void createNewActor(vtkActor ** actor, 
72                       vtkMarchingSquares ** squares, 
73                       vtkImageClip ** clipper, int numImage);
74   void updateActor(vtkActor * actor, 
75                    vtkMarchingSquares * squares,
76                    vtkImageClip * clipper, 
77                    double threshold, int orientation, int slice);
78   void createActor(int orientation, int slice);
79   int computeCurrentOrientation();
80   
81 }; // end class vvImageContour
82 //------------------------------------------------------------------------------
83
84 #endif
85