]> Creatis software - creaVtk.git/blob - lib/creaVtk/vtkVectorsTensorsVisuBase.h
f229542a7283f9341c04c438f496cc1063ef8d8e
[creaVtk.git] / lib / creaVtk / vtkVectorsTensorsVisuBase.h
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 #                        pour la Sante)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and
11 #  abiding by the rules of distribution of free software. You can  use,
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B
13 #  license as circulated by CEA, CNRS and INRIA at the following URL
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability.
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
26 */
27
28 #ifndef _VTKVECTORSTENSORSVISUBASE_H_
29 #define _VTKVECTORSTENSORSVISUBASE_H_
30
31 #include "vtkActor.h"
32 #include "vtkLookupTable.h"
33 #include "vtkPolyDataMapper.h"
34 #include "vtkRenderer.h"
35 #include "vtkSmartPointer.h"
36 #include "vtkVectorNorm.h"
37
38 //---------------------------------------------
39 // Class Name: vtkVectorsTensorsVisuBase
40 // [classdescription]
41 //---------------------------------------------
42
43 class /*VTK_COMMON_EXPORT*/ vtkLookupTableDirectionVector : public vtkScalarsToColors
44 {
45 public:
46         // Description:
47         // Construct with range=[0,1]; and hsv ranges set up for rainbow color table 
48         // (from red to blue).
49         static vtkLookupTableDirectionVector *New();
50         
51         vtkTypeMacro(vtkLookupTableDirectionVector,vtkScalarsToColors);
52         void PrintSelf(ostream& os, vtkIndent indent);
53
54         double *GetRange() { return this->GetTableRange(); };
55         void SetRange(double min, double max) { this->SetTableRange(min, max); };
56         void SetRange(double rng[2]) { this->SetRange(rng[0], rng[1]); };
57         
58         void SetTableRange(double r[2]); 
59         virtual void SetTableRange(double min, double max);
60         vtkGetVectorMacro(TableRange,double,2);
61                         
62         unsigned char *MapValue(double v);
63         
64         void GetColor(double x, double rgb[3]);
65         
66         void MapScalarsThroughTable2(void *input, unsigned char *output,
67                                                                  int inputDataType, int numberOfValues,
68                                                                  int inputIncrement, int outputIncrement);
69                 
70 protected:
71         double TableRange[2];
72         vtkLookupTableDirectionVector(int sze=256, int ext=256);
73         ~vtkLookupTableDirectionVector();
74                 
75 private:
76         vtkLookupTableDirectionVector(const vtkLookupTableDirectionVector&);  // Not implemented.
77         void operator=(const vtkLookupTableDirectionVector&);  // Not implemented.
78 };
79
80
81 class vtkVectorsTensorsVisuBase
82 {
83
84 //---------------------------------------------
85 //Methods and attributes exposed to other classes
86 //---------------------------------------------
87 public :
88   vtkVectorsTensorsVisuBase();
89   ~vtkVectorsTensorsVisuBase();
90
91    void                                 SetActive(bool);
92    void                                 SetDataObject(vtkDataObject*);
93    void                                 SetRenderer(vtkRenderer *);
94    void                                 SetScaleFactor(double);
95    void                                 SetOpacity(double);
96    void                                 SetTypeForm(int);
97    void                                 SetColorLaw(int);
98    void                                 SetColor(std::vector<double>);
99    void                                 SetOrientation(int orientation);
100
101    bool                                 GetActive();
102    vtkDataObject*               GetDataObject();
103    vtkRenderer*                 GetRenderer();
104    double                               GetScaleFactor();
105    double                               GetOpacity();
106    vtkProp3D*                   GetProp3D();
107    int                                  GetTypeForm();
108    int                                  GetOrientation();
109
110    virtual void                 Process();
111    void                                 VisibilityActor();
112
113
114
115 //---------------------------------------------
116 //Methods and attributes exposed only to classes
117 //that are derived from this class
118 //---------------------------------------------
119 protected:
120
121 //---------------------------------------------
122 //Methods and attributes only visible by this class
123 //---------------------------------------------
124 private:
125         bool                                                                            _actorAdded;
126         double                                                                          _scalefactor;
127         double                                                                          _opacity;
128         vtkDataObject                                                           *_dataobject;
129         vtkRenderer                                                             *_renderer;
130         int                                                                                     _typeForm;
131         int                                                                                     _orientation;
132
133 protected:
134         bool                                                                            _firsttime;
135         bool                                                                            _active;
136         vtkSmartPointer<vtkPolyDataMapper>                      _pdm;
137         vtkSmartPointer<vtkActor>                       _actor;
138         vtkLookupTableDirectionVector                           *_LutEED;
139         int                                                                             _colorlaw;
140         double                                                                          _colorR,_colorG,_colorB;
141 };
142
143 //-end of _VTKVECTORSTENSORSVISUBASE_H_------------------------------------------------------
144 #endif