Hello Anatomist experts,
I am trying to visualize streamlines color coded by their local orientation. To do so, I calculate tangent of these streamlines and incorporate this information
into the normal field of the resulting 2D mesh.
In graphical interface of anatomist, I then click on activate shaders and select color model: normals. However I do not manage to do this operation using pyanatomist. When I do the operation into GUI and then check informations stored into the mesh AObject using getInfos method there is a shader_color_normals field into the material field. Unfortunately I do not manage to modify it using setMaterial method .
Do you have any hint ?
Alex
How to activate coloring by normals using pyanatomist ?
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: How to activate coloring by normals using pyanatomist ?
Hi,
Well, after checking it seems that we haven't done any python bindings for these set of functionalities... That's definitely something we could do...
Denis
Well, after checking it seems that we haven't done any python bindings for these set of functionalities... That's definitely something we could do...
Denis
Re: How to activate coloring by normals using pyanatomist ?
Thank you very much for the answer Denis
Have a good day
Alex
![Smile :)](./images/smilies/icon_smile.gif)
Have a good day
Alex
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: How to activate coloring by normals using pyanatomist ?
Hi,
Well, actually there is a trick to setup normals colors, it's not very convenient but it should work until we do something better:
Denis
Well, actually there is a trick to setup normals colors, it's not very convenient but it should work until we do something better:
Code: Select all
# load/init anatomist
import anatomist.api as ana
a = ana.Anatomist()
# load a mesh
mesh = a.loadObject('soma_mesh.mesh')
# get low-level Material object (not the same as mesh.material)
mat = mesh.GetMaterial()
# set options on it
mat.set({'use_shader': True, 'shader_color_normals': True})
# this line might not be neededd
mesh.SetMaterial(mat)
# force setting material/shading options (this is not done by SetMaterial - for now)
mesh.setHeaderOptions()
# notify changes
mesh.setChanged()
mesh.notifyObservers()
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: How to activate coloring by normals using pyanatomist ?
OK in the next update (or if you are building anatomist from sources), it should be included in setMaterial():
Denis
Code: Select all
mesh.setMaterial(use_shader=1, shader_color_normals=1)
Re: How to activate coloring by normals using pyanatomist ?
Hello Denis,
Sorry for the delay. Thank you very much for your super answers
I will try the first solution for now and will rebuild from source later
Have a good day
Alex
Sorry for the delay. Thank you very much for your super answers
![Smile :)](./images/smilies/icon_smile.gif)
![Razz :P](./images/smilies/icon_razz.gif)
Have a good day
Alex