[vtkusers] howto output VTK files with python

Prabhu Ramachandran prabhu_r at users.sf.net
Thu Sep 8 13:06:50 EDT 2005


>>>>> "Daniele"  == daniele <dada_dna at yahoo.it> writes:

[...]
    Daniele> order to obtain a 3D progression of them. I've done that
    Daniele> assignin a number to each compound, that is, a number
    Daniele> each 2D spectrum, and I obtained a 3D set of data:
    Daniele> (numberID, wavenumber, intensity).  All coords of the
    Daniele> same compound have the same numberID, so they result
    Daniele> aligned on the same coord.  Eg: spectrum1: 300,1 0,001
    Daniele> 278,4 0,024 250,0 0,007

In the following I guess you mean 300.1 by 300,1.  With your data in
this form you really have a 2D dataset with a set of intensities at
each of the positions.  Effectively, create a 2D "mesh" defined by
your numberID and wavenumber and associate the scalars at each of
these points with the corresponding intensity.  How you represent this
with a VTK data object depends on the nature of the sampled
wavenumbers and numberID's you have.  If the wavenumbers and numberIDs
are regularly spaced you can use a StructuredPoints/ImageData dataset.
If OTOH the wavenumbers and numberID's are not uniformly spaced or
regular in any way then you should just create a polygonal dataset or
an unstructured grid data set.  If this is too painful, just dump the
x, y, z co-ordinates (number_id, wavenumber, intensity) into a flat
ascii file and use this recipe from the MayaVi cookbook to make a VTK
file:

  http://mayavi.sourceforge.net/mwiki/PointClouds

You can then use the generated data file and view it as described in
the URL.

cheers,
prabhu



More information about the vtkusers mailing list