[Python] vtkClipPolyData

2011-02-09 Per discussione mariagrazia.madas...@libero.it
Hello,

I have a 3D portion of kidney: a membrane and cells on its surface.
What I have to do is to determine the area of competence of each cells, that
is to calculate the points of the surface nearer to each cells and then
determine the value of the area formed of these points.
Cells, obviously, are a group of points.
I have calculated the barycentre of each cells and I have calculated the
distance between barycentres and points of surface.
I have created a list called 'ids' with an id for each points of surface; the
id refers to the barycentre nearer to the point.
Example: ids = [ 0, 0, 0, 1, 1, 0, 1, 0, 0, 2, 1, 1, ]  length(ids)=number
of points of surface
Then I have created an array that permits to associate a different color to
each id. In paraview I can visualize the surface with the areas of competence
of each cells with differents color.

I have done a test with one barycentre.
I have create a new list called 'ids_new' and I have associated to the points
nearer to the barycentre 0 id 0 and to the other points id 1.
In Paraview I have apllied the Clip filter with a scalar between 0 and 1,
which gives only the points with id 0 and with the filter integrateVariables I
have found the value of the area.

Now, I need to do this thing many time because I have 4 surfaces and about 200
cells for each surface.
So I think the best way is to do that by python code.

I'm not so practice of python and vtk so I ask you an help.
How can I insert in my code the part of vtkClipPolyData? I have some errors. I
can't find the way to say to the code to use a scalar instead of a function.

And then, is there any way to calculate the area from the code?
Better, is there any way to do what Paraview does with the IntegrateVariables
in python code?


Thank's 
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


[Python] Da file excel a visualizzazione 3D

2010-11-17 Per discussione mariagrazia.madas...@libero.it
Immaginate questa cosa: ho una capsula 3D di forma irregolare (formata da un 
insieme finito di punti) sula quale ci sono dei nuclei.
Volevo determinare l'insieme di punti della capsula più vicini ad ogni nucleo.
Ho scritto un codice che mi salva in un file excel le coordinate x, y, z della 
capsula e ad ogni coordinata associa un id in base al nucleo al quale è più 
vicino.
Per capirci vi faccio un esempio:
0.3   0.9   0.20
0.5   0.1   0.30


0.4  0.5   0.70
0.3  0.9   0.81
.

0.6  0.7   0.21

Adesso devo rendere il tutto visualizzabile in 3D e ad ogni id devo associare 
un colore, in modo da visualizzare una capsula formata da tante aree colorate e 
delle quali devo poi calcolare l'area.

Qualcuno ha idea di come potrei associare un colore (random) ad ogni id e 
passare alla visualizzazione?

Il programma di visualizzazione che utilizzo è Paraview. 

La cosa più interessante sarebbe quella di riuscire a creare un file .vtp 
(apribile poi con Paraview).



Ciao
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


[Python] Indice di una lista

2010-10-27 Per discussione mariagrazia.madas...@libero.it
Ho una lista così formata 

A = [ 9 , 5 ]

LISTA = [ 1 ,  A]

Da questa lista voglio ricavare una lista così formata [ 1, 1 ] :

il primo elemento è lo stesso della linea precedente, mentre il secondo 
elemento indica l'indice della lista A a  cui corrisponde il min(A).

Come si ricava l'indice di un elemento di una lista (conoscendo il valore 
dell'elemento)?
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python