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 );
56 //------------------------------------------------------------------------------
57 vtkVectorsVisu::~vtkVectorsVisu()
62 //------------------------------------------------------------------------------
63 void vtkVectorsVisu::Process()
67 #if VTK_MAJOR_VERSION <= 5
68 _vtkglyph->SetInput( GetDataObject() );
70 _vtkglyph->SetInputData( GetDataObject() );
72 if(GetTypeForm()==1) // source Arrow
74 #if VTK_MAJOR_VERSION <= 5
75 _vtkglyph->SetSource( _vtkarrowsource->GetOutput() );
77 _vtkarrowsource->Update();
78 _vtkglyph->SetSourceData( _vtkarrowsource->GetOutput() );
80 } else { // source Line
81 #if VTK_MAJOR_VERSION <= 5
82 _vtkglyph->SetSource( _vtklinesource->GetOutput() );
84 _vtklinesource->Update();
85 _vtkglyph->SetSourceData( _vtklinesource->GetOutput() );
88 _vtkglyph->SetScaleModeToScaleByVector();
89 _vtkglyph->SetColorModeToColorByVector();
90 _vtkglyph->SetScaleFactor( GetScaleFactor() );
93 #if VTK_MAJOR_VERSION <= 5
94 _pdm->SetInput( _vtkglyph->GetOutput());
96 _pdm->SetInputData( _vtkglyph->GetOutput());
99 vtkPointData *data = _vtkglyph->GetOutput()->GetPointData();
100 //printf("EED -------------------------------------------\n");
101 //_vtkglyph->GetOutput()->Print(std::cout);
102 //printf("EED -------------------------------------------\n");
103 //data->Print(std::cout);
104 int i,sizeDa = data->GetNumberOfArrays();
105 for (i=0;i<sizeDa;i++)
107 data->GetArray(i)->Print(std::cout);
110 _pdm->ScalarVisibilityOn();
111 _pdm->SetColorModeToMapScalars();
112 //_pdm->SetColorModeToDefault();
113 // _pdm->SetColorModeToDirectScalars(); // NOT compile
114 _pdm->SetScalarModeToUsePointFieldData();
115 _pdm->ImmediateModeRenderingOn();
117 _LutEED->SetVectorModeToComponent();
118 //_LutEED->SetVectorModeToRGBColors();
119 //_LutEED->SetVectorModeToMagnitud();
121 // _pdm->SetScalarModeToUsePointFieldData();
122 _pdm->SetLookupTable( _LutEED );
123 _pdm->SelectColorArray( "GlyphVector" );
125 // vSliceMapperVec->SetLookupTable( vGreenToRedLut );
126 // vSliceMapperVec->SetColorModeToMapScalars();
128 #if VTK_MAJOR_VERSION <= 5
133 _actor->SetMapper( _pdm );
134 _actor->GetProperty()->SetOpacity( GetOpacity() );