[vtkusers] vtkTensorGlyph connections and opacity?

Charles Bassée charles.bassee at gmail.com
Thu Jul 24 09:39:12 EDT 2008


Hi,
I'm trying to use vtkTensorGlyph to display a volume tensor field.
First, the set of points is specified. Then a table of values for colors and
a table of tensors.

The provided data is a volumetric image of size : Nx, Ny, Nz.
The spacing is hx, hy, hz.
T is a double array of size Nx*Ny*Nz*9 : double T[Nx*Ny*Nz][9]. It contains
a symmetric definite matrix for each voxel (an anisotropic mertric).
double Scalars[Nx*Ny*Nz] is an array containing some norm of the tensor
field T (for example the sum of eigenvalues, or the max of eigenvalues, or
any other information). It gives the color for each ellipsoid.

the first part of the code :

vtkPoints* points = vtkPoints::*New*();

float POS[3];



vtkFloatArray* scalars = vtkFloatArray::*New*();



vtkFloatArray* tensors = vtkFloatArray::*New*();



for(x = 0; x < Nx; x++)

   for(y = 0; y < Ny; y++)

      for(z = 0; z < Nz; z++){

         POS[0] = (x - (Nx-1)/2.0)*hx;

         POS[1] = (y - (Ny-1)/2.0)*hy;

         POS[2] = (z - (Nz-1)/2.0)*hz;

         points->*InsertNextPoint*(POS);

         point  = x + y*Nx + z*NxNy;

         scalars->*InsertNextValue*(Scalars[point]);

         tensors->*InsertNextTuple9*(T[point][0], T[point][1], T[point][2],

                                   T[point][3], T[point][4], T[point][5],

                                   T[point][6], T[point][7], T[point][8]

}



Then the vtkTensorGlyph and the geometry:



vtkSphereSource * sg1 = vtkSphereSource::*New*();

sg1->*SetRadius*(0.35);

sg1->*SetCenter*(0.0, 0.0, 0.0);



vtkTensorGlyph *g1 = vtkTensorGlyph::*New*();

g1->*SetSource*(sg1->*GetOutput*());




- My first problem is how can I connect the points, scalars and tensors to
the vtkTensorGlyph : g1.

Since the only example I have is :
/Graphics/Testing/Python/TestTensorGlyph.py
<http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Graphics/Testing/Python/TestTensorGlyph.py?root=VTK&content-type=text/plain>

The data comes from the file 'tensors.vtk' which contains almost the same
informations.


So I have to convert [points, scalars, tensors] to a vtkAlgorithmOutput.

Then   g1->SetInputConnection()

Please, I need a help for this.


- The second point is that vtkTensorGlyph does not handle transparency.

Since values of scalars are very low on most voxels but has bigger values
along few tubular structures, It will be very useful to have transparency
with respect to scalars or to an other table.



Regards,

------------------

Charles Bassée
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080724/7328b810/attachment.htm>


More information about the vtkusers mailing list