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();
42 _vtklinesource = vtkLineSource::New();
45 _vtkglyph = vtkGlyph3D::New();
46 _vtklinesource = vtkLineSource::New();
56 _vtklinesource->SetPoint1( point1 );
57 _vtklinesource->SetPoint2( point2 );
60 //------------------------------------------------------------------------------
61 vtkVectorsVisu::~vtkVectorsVisu()
66 //------------------------------------------------------------------------------
67 void vtkVectorsVisu::Process()
75 #if VTK_MAJOR_VERSION <= 5
76 _vtkglyph->SetInput( GetDataObject() );
79 _vtkglyph->SetInputData( GetDataObject() );
84 if(GetTypeForm()==1) // source Arrow
86 #if VTK_MAJOR_VERSION <= 5
87 _vtkglyph->SetSource( _vtkarrowsource->GetOutput() );
89 _vtkarrowsource->Update();
90 _vtkglyph->SetSourceData( _vtkarrowsource->GetOutput() );
92 } else { // source Line
93 #if VTK_MAJOR_VERSION <= 5
94 _vtkglyph->SetSource( _vtklinesource->GetOutput() );
96 _vtklinesource->Update();
97 _vtkglyph->SetSourceData( _vtklinesource->GetOutput() );
100 _vtkglyph->SetScaleModeToScaleByVector();
101 _vtkglyph->SetColorModeToColorByVector();
102 _vtkglyph->SetScaleFactor( GetScaleFactor() );
107 #if VTK_MAJOR_VERSION <= 5
108 _pdm->SetInput( _vtkglyph->GetOutput());
110 _pdm->SetInputData( _vtkglyph->GetOutput());
115 _pdm->SetInput( _vtkglyph->GetOutput());
117 vtkPointData *data = _vtkglyph->GetOutput()->GetPointData();
118 //printf("EED -------------------------------------------\n");
119 //_vtkglyph->GetOutput()->Print(std::cout);
120 //printf("EED -------------------------------------------\n");
121 //data->Print(std::cout);
122 int i,sizeDa = data->GetNumberOfArrays();
123 for (i=0;i<sizeDa;i++)
126 printf("EED vtkVectorsVisu::Process-name %d, %s \n", i, data->GetArrayName(i) );
129 //EED _pdm->SetScalarRange( range );
130 //EED vtkPolyData *pd = vGlyphFlowPlane->GetOutput();
131 //EED vtkPointData *pointdata = pd->GetPointData();
132 //EED vtkDataArray *da = pointdata->GetVectors();
133 //EED vtkDataArray *nda = vtkFloatArray::New();
134 //EED nda->DeepCopy(da);
135 // pointdata->RemoveArray( "GlyphVector" );
136 // bbGetInputIn()->GetPointData()->RemoveArray( "GlyphVector" );
137 //EED pointdata->AddArray( nda );
138 //EED bbGetInputIn()->GetPointData()->AddArray( nda );
139 //EED2 _pdm->ScalarVisibilityOn();
142 data->GetArray(i)->Print(std::cout);
146 _pdm->ScalarVisibilityOn();
147 _pdm->SetColorModeToMapScalars();
148 //_pdm->SetColorModeToDefault();
149 // _pdm->SetColorModeToDirectScalars(); // NOT compile
150 _pdm->SetScalarModeToUsePointFieldData();
151 _pdm->ImmediateModeRenderingOn();
153 _LutEED->SetVectorModeToComponent();
154 //_LutEED->SetVectorModeToRGBColors();
155 //_LutEED->SetVectorModeToMagnitud();
157 // _pdm->SetScalarModeToUsePointFieldData();
158 _pdm->SetLookupTable( _LutEED );
159 _pdm->SelectColorArray( "GlyphVector" );
161 // vSliceMapperVec->SetLookupTable( vGreenToRedLut );
162 // vSliceMapperVec->SetColorModeToMapScalars();
164 #if VTK_MAJOR_VERSION <= 5
169 _actor->SetMapper( _pdm );
170 _actor->GetProperty()->SetOpacity( GetOpacity() );