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 "vtkTensorsVisu.h"
30 #include "vtkProperty.h"
32 //------------------------------------------------------------------------
33 vtkTensorsVisu::vtkTensorsVisu() : vtkVectorsTensorsVisuBase()
35 ss = vtkSphereSource::New();
36 cs = vtkCubeSource::New();
37 tg = vtkTensorGlyph::New();
38 pdn = vtkPolyDataNormals::New();
39 pd = vtkPolyData::New();
40 pod = vtkPointData::New();
43 //------------------------------------------------------------------------
44 vtkTensorsVisu::~vtkTensorsVisu()
49 //------------------------------------------------------------------------
50 void vtkTensorsVisu::Process()
52 printf("EED vtkTensorsVisu::Process Start\n");
56 std::string source="sphere";
59 tg->SetSource(ss->GetOutput());
61 else if(source=="cube")
63 tg->SetSource(ss->GetOutput());
68 tg->SetInput( GetDataObject() );
70 // tg->SetScaling(25);
72 tg->SetScaleFactor( GetScaleFactor() );
75 // //tg->SetScaleFactor(2);
76 // tg->SetScaleFactor(scale_factor);
79 //The normals are needed to generate the right colors and if
80 // not used some of the glyphs are black.
81 pdn->SetInput(tg->GetOutput());
85 //EED================================
86 //pdm->SetInput( tg->GetOutput());
87 //pdm->SetScalarRange( range );
89 //vtkPolyData *pd = tg->GetOutput();
90 //vtkPointData *pointdata = pd->GetPointData();
91 //vtkDataArray *da = pointdata->GetVectors();
93 //vtkDataArray *nda = vtkFloatArray::New();
96 //pointdata->AddArray( nda );
97 //reader->GetOutput()->GetPointData()->AddArray( nda );
99 //pdm->SetInput(pdn->GetOutput());
100 //pdm->ScalarVisibilityOn();
101 //pdm->SetLookupTable(vLutEED);
102 //pdm->SetColorModeToMapScalars();
103 //pdm->SelectColorArray("color");
104 //pdm->SetScalarModeToUsePointFieldData();
105 //pdm->ImmediateModeRenderingOn();
106 //=====================================
108 _pdm->SetInput( pdn->GetOutput() );
109 _pdm->ImmediateModeRenderingOn();
111 _pdm->ScalarVisibilityOn();
112 _pdm->SetScalarModeToUsePointFieldData();
115 //EED _pdm->Update();
117 _actor->SetMapper( _pdm );
118 _actor->GetProperty()->SetOpacity( GetOpacity() );
121 tg->ExtractEigenvaluesOn();
122 tg->SetColorModeToEigenvalues();
124 _pdm->SetLookupTable( _LutEED );
125 _pdm->SelectColorArray( "Normals" );
128 //int tcg = tg->GetColorGlyphs();
129 // tg->SetColorGlyphs(10);
130 //tg->SetColorModeToScalars();
131 //tg->ThreeGlyphsOn();
134 //vtkDataArray* da = vtkDataArray::New();
135 pd = tg->GetOutput();
137 pod = pd->GetPointData();
139 //EED1 if(pod->GetScalars())
141 //EED1 _pdm->SetScalarRange(pod->GetScalars()->GetRange());
143 //pdm->SelectColorArray("GlyphVector");
145 //EED _pdm->Update();
150 vtkPolyData *pd = pdn->GetOutput();
151 vtkPointData *pointdata = pd->GetPointData();
153 int i,sizeDa = pointdata->GetNumberOfArrays();
154 printf("EED vtkTensorsVisu::Process sizeDa %d \n", sizeDa );
155 for (i=0;i<sizeDa;i++)
157 printf("EED vtkTensorsVisu::Process-name %d, %s, size=%d \n", i, pointdata->GetArrayName(i) , pointdata->GetArray(i)->GetSize() );
167 printf("EED vtkTensorsVisu::Process End.\n");