]> Creatis software - creaVtk.git/blob - lib/creaVtk/vtkVectorsTensorsVisuBase.h
#2446 creaVtk Feature New Normal - Stream Tracer, Stream Line (interface, widget)
[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
32 #include "vtkActor.h"
33 #include "vtkLookupTable.h"
34 #include "vtkPolyDataMapper.h"
35 #include "vtkRenderer.h"
36 #include "vtkSmartPointer.h"
37 #include "vtkVectorNorm.h"
38
39
40 //---------------------------------------------
41 // Class Name: vtkVectorsTensorsVisuBase
42 // [classdescription]
43 //---------------------------------------------
44
45
46
47
48 class /*VTK_COMMON_EXPORT*/ vtkLookupTableDirectionVector : public vtkScalarsToColors
49 {
50 public:
51         // Description:
52         // Construct with range=[0,1]; and hsv ranges set up for rainbow color table 
53         // (from red to blue).
54         static vtkLookupTableDirectionVector *New();
55         
56         vtkTypeMacro(vtkLookupTableDirectionVector,vtkScalarsToColors);
57         void PrintSelf(ostream& os, vtkIndent indent);
58
59         double *GetRange() { return this->GetTableRange(); };
60         void SetRange(double min, double max) { this->SetTableRange(min, max); };
61         void SetRange(double rng[2]) { this->SetRange(rng[0], rng[1]); };
62         
63         void SetTableRange(double r[2]); 
64         virtual void SetTableRange(double min, double max);
65         vtkGetVectorMacro(TableRange,double,2);
66                         
67         unsigned char *MapValue(double v);
68         
69         void GetColor(double x, double rgb[3]);
70         
71         void MapScalarsThroughTable2(void *input, unsigned char *output,
72                                                                  int inputDataType, int numberOfValues,
73                                                                  int inputIncrement, int outputIncrement);
74         
75         
76 protected:
77         
78          double TableRange[2];
79         vtkLookupTableDirectionVector(int sze=256, int ext=256);
80         ~vtkLookupTableDirectionVector();
81         
82                 
83 private:
84         vtkLookupTableDirectionVector(const vtkLookupTableDirectionVector&);  // Not implemented.
85         void operator=(const vtkLookupTableDirectionVector&);  // Not implemented.
86 };
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 class vtkVectorsTensorsVisuBase
102 {
103
104 //---------------------------------------------
105 //Methods and attributes exposed to other classes
106 //---------------------------------------------
107 public :
108   vtkVectorsTensorsVisuBase();
109   ~vtkVectorsTensorsVisuBase();
110
111    void                                 SetActive(bool);
112    void                                 SetDataObject(vtkDataObject*);
113    void                                 SetRenderer(vtkRenderer *);
114    void                                 SetScaleFactor(double);
115    void                                 SetOpacity(double);
116    void                                 SetTypeForm(int);
117    void                                 SetColorLaw(int);
118    void                                 SetColor(std::vector<double>);
119
120    bool                                         GetActive();
121    vtkDataObject*               GetDataObject();
122    vtkRenderer*         GetRenderer();
123    double                               GetScaleFactor();
124    double                               GetOpacity();
125    vtkProp3D*                   GetProp3D();
126    int                                  GetTypeForm();
127
128    virtual void                 Process();
129    void                                         VisibilityActor();
130
131
132
133 //---------------------------------------------
134 //Methods and attributes exposed only to classes
135 //that are derived from this class
136 //---------------------------------------------
137 protected:
138
139 //---------------------------------------------
140 //Methods and attributes only visible by this class
141 //---------------------------------------------
142 private:
143    bool                                 _actorAdded;
144
145    double                       _scalefactor;
146    double                       _opacity;
147    vtkDataObject        *_dataobject;
148    vtkRenderer          *_renderer;
149    int                          _typeForm;
150
151
152 protected:
153    bool                                                                                         _firsttime;
154    bool                                                                                 _active;
155
156    vtkSmartPointer<vtkPolyDataMapper>   _pdm;
157    vtkSmartPointer<vtkActor>           _actor;
158    vtkLookupTableDirectionVector                        *_LutEED;
159         int                                                                                     _colorlaw;
160         double                                                                          _colorR,_colorG,_colorB;
161
162 };
163
164 //-end of _VTKVECTORSTENSORSVISUBASE_H_------------------------------------------------------
165 #endif