2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------
28 #include "vtkVectorsVisu.h"
30 #include "vtkProperty.h"
33 #include "vtkPointData.h"
36 //------------------------------------------------------------------------------
37 vtkVectorsVisu::vtkVectorsVisu()
38 :vtkVectorsTensorsVisuBase()
40 _vtkarrowsource = vtkArrowSource::New();
41 _vtkglyph = vtkGlyph3D::New();
42 _vtklinesource = vtkLineSource::New();
52 _vtklinesource->SetPoint1( point1 );
53 _vtklinesource->SetPoint2( point2 );
57 //------------------------------------------------------------------------------
58 vtkVectorsVisu::~vtkVectorsVisu()
62 //------------------------------------------------------------------------------
63 void vtkVectorsVisu::Process()
67 _vtkglyph->SetInput( GetDataObject() );
68 if(GetTypeForm()==1) // source Arrow
70 _vtkglyph->SetSource( _vtkarrowsource->GetOutput() );
71 } else { // source Line
72 _vtkglyph->SetSource( _vtklinesource->GetOutput() );
74 _vtkglyph->SetScaleModeToScaleByVector();
75 _vtkglyph->SetColorModeToColorByVector();
76 _vtkglyph->SetScaleFactor( GetScaleFactor() );
78 _pdm->SetInput( _vtkglyph->GetOutput());
79 vtkPointData *data = _vtkglyph->GetOutput()->GetPointData();
80 //printf("EED -------------------------------------------\n");
81 //_vtkglyph->GetOutput()->Print(std::cout);
82 //printf("EED -------------------------------------------\n");
83 //data->Print(std::cout);
84 int i,sizeDa = data->GetNumberOfArrays();
85 for (i=0;i<sizeDa;i++)
87 data->GetArray(i)->Print(std::cout);
90 _pdm->ScalarVisibilityOn();
91 _pdm->SetColorModeToMapScalars();
92 //_pdm->SetColorModeToDefault();
93 // _pdm->SetColorModeToDirectScalars(); // NOT compile
94 _pdm->SetScalarModeToUsePointFieldData();
95 _pdm->ImmediateModeRenderingOn();
97 _LutEED->SetVectorModeToComponent();
98 //_LutEED->SetVectorModeToRGBColors();
99 //_LutEED->SetVectorModeToMagnitud();
103 // _pdm->SetScalarModeToUsePointFieldData();
104 _pdm->SetLookupTable( _LutEED );
105 _pdm->SelectColorArray( "GlyphVector" );
107 // vSliceMapperVec->SetLookupTable( vGreenToRedLut );
108 // vSliceMapperVec->SetColorModeToMapScalars();
110 _actor->SetMapper( _pdm );
111 _actor->GetProperty()->SetOpacity( GetOpacity() );