Hello,
My ultimate goal is to import some sulci into a vtk scene.
The T1 Pipeline 2007 produced a sulci graph for the left hemisphere "Lxxx.arg" (version 3.0)
Then I used "sulcus volume label creation", then AimsMesh to remesh the sulci as explained in a previous post :
http://brainvisa.info/forum/viewtopic.p ... 4&start=15
AimsMesh produced many meshes like :
Lsulci_xxx_default_session_auto_1_0.mesh
Lsulci_xxx_default_session_auto_2_0.mesh
Lsulci_xxx_default_session_auto_2_1.mesh
Lsulci_xxx_default_session_auto_2_2.mesh
...
Lsulci_xxx_default_session_auto_57_0.mesh
Lsulci_xxx_default_session_auto_57_1.mesh
Lsulci_xxx_default_session_auto_58_0.mesh
1) The numbering of meshes (1_0, ..58_0) is a bit mysterious to me.... How can I get the correspondence between these numbers and the names of the sulci (SC.left for instance) available when opening the graph in anatomist ?
2) with AimsMesh, it seems like we lost the color of the sulcus/piece of sulcus
For info, my next steps are AimsMeshConverter to get a .ply file that Paraview opens and converts to vtk. Prior to this step, AimsZCat is used to merge several or the .mesh files. So, my problem is to identify which meshes are parts of my sulci of interest.
Or maybe there is another way to extract some sulci from a graph and export them to a vtk scene ?
Thanks,
Best,
Isabelle
How to pick one sulcus from a graph / from meshes ?
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: How to pick one sulcus from a graph / from meshes ?
Hi Isabelle,
AimsMesh makes one mesh for every object interface in the volume. An object is defined by a unique voxel value, and may be split into several disconnected parts, or have holes etc, so there may be several meshes for one object. You don't really have the control on the output mesh files naming: they are suffixed by the object label (the voxel value), and by an interface number.
By the way AimsMesh, as any other Aims command, can output directly in .ply format or any other supported mesh format (but not vtk, sorry).
Colors are normally not saved in the mesh files, but are assigned by the nomenclature (objects in .hie files) according to object names in the sulcal graph: it is handled at a higher level in Anatomist (so that you may switch between several labelings).
However if you don't need to get one single mesh per sulcus, the meshes are already present in the sulcal graphs, so there is maybe no need to remesh them using AimsMesh ? It is possible to pick them in the sulcal graphs and re-write them if needed (after concatenation if you like, and as the format you like) in a small python script. There are example of such manipulations in the pyaims documentation, see for instance:
graph manipulation example
and the pyaims tutorial.
Binding colors with labels is a little bit more difficult as you have to lookup colors in the nomenclature object. You could make a little python script looking like this:
colors will not be saved in the output meshes themselves (I don't even know if the ply format allows it or not but aims doesn't use this if it exists), but it will be stored in the little additional .minf header file next to each mesh file. You could also improve the script to do something on the fly with meshes and colors...
Denis
AimsMesh makes one mesh for every object interface in the volume. An object is defined by a unique voxel value, and may be split into several disconnected parts, or have holes etc, so there may be several meshes for one object. You don't really have the control on the output mesh files naming: they are suffixed by the object label (the voxel value), and by an interface number.
By the way AimsMesh, as any other Aims command, can output directly in .ply format or any other supported mesh format (but not vtk, sorry).
Colors are normally not saved in the mesh files, but are assigned by the nomenclature (objects in .hie files) according to object names in the sulcal graph: it is handled at a higher level in Anatomist (so that you may switch between several labelings).
However if you don't need to get one single mesh per sulcus, the meshes are already present in the sulcal graphs, so there is maybe no need to remesh them using AimsMesh ? It is possible to pick them in the sulcal graphs and re-write them if needed (after concatenation if you like, and as the format you like) in a small python script. There are example of such manipulations in the pyaims documentation, see for instance:
graph manipulation example
and the pyaims tutorial.
Binding colors with labels is a little bit more difficult as you have to lookup colors in the nomenclature object. You could make a little python script looking like this:
Code: Select all
from soma import aims
import os
sulciname = 'sulcal_graph.arg'
outgraphprefix = '/tmp/toto_'
outgraphext = '.ply'
nom = aims.read( os.path.join( aims.carto.Paths.shfjShared(), 'nomenclature', 'hierarchy', 'sulcal_root_colors.hie' ) )
graph = aims.read( sulciname )
meshes = {}
for v in graph.vertices():
if v.has_key( 'label' ) and v.has_key( 'aims_Tmtktri' ):
label = v[ 'label' ];hn = nom.find( v[ 'label' ] )
if hn and hn[0].has_key( 'color' ):
col = hn[0][ 'color' ]
mesh = v[ 'aims_Tmtktri' ]
mesh.header()[ 'material' ] = { 'diffuse' : col }
if meshes.has_key( label ):
# concatenate with previous meshes with the same label
aims.SurfaceManip.meshMerge( meshes[ label ], mesh )
else:
meshes[ label ] = mesh
# save meshes
for label, mesh in meshes.iteritems():
aims.write( mesh, outgraphprefix + label + outgraphext )
Denis
Re: How to pick one sulcus from a graph / from meshes ?
Hi Isabelle,
>Or maybe there is another way to extract some sulci from a graph and export them to a vtk scene ?
if you want to automatically extract-and-save (in .mesh format) a single or multiple sulci from the graph you can check this post:
http://brainvisa.info/forum/viewtopic.php?f=2&t=1560
merci,
-joost
>Or maybe there is another way to extract some sulci from a graph and export them to a vtk scene ?
if you want to automatically extract-and-save (in .mesh format) a single or multiple sulci from the graph you can check this post:
http://brainvisa.info/forum/viewtopic.php?f=2&t=1560
merci,
-joost
Re: How to pick one sulcus from a graph / from meshes ?
Hi Denis and Joost,
Sorry my late reply but thanks a lot for all the tips and info.
About "sulcus label volume creation" and AimsMesh :
It is explained somewhere in the documentation but I had missed it... To get the correspondence between the mesh numbers and the names of the sulci, one has to fill in the output field "int_to_label_translation" in "sulcus label volume creation", for instance "int_to_label_translation" = myPath/myLeftLabels.txt. Then the correspondence is given in the file "myLeftLabels.txt".
This worked for the needs I had a couple of weeks ago but I agree sulci didn't need to be remeshed since they are already nicely meshed in the graph. Picking them up directly from the graph sounds a much better solution. I hadn't had time so far to try that but I'll look into it in the (hopefully) near future,
Thanks again,
Best,
Isabelle.
Sorry my late reply but thanks a lot for all the tips and info.
About "sulcus label volume creation" and AimsMesh :
It is explained somewhere in the documentation but I had missed it... To get the correspondence between the mesh numbers and the names of the sulci, one has to fill in the output field "int_to_label_translation" in "sulcus label volume creation", for instance "int_to_label_translation" = myPath/myLeftLabels.txt. Then the correspondence is given in the file "myLeftLabels.txt".
This worked for the needs I had a couple of weeks ago but I agree sulci didn't need to be remeshed since they are already nicely meshed in the graph. Picking them up directly from the graph sounds a much better solution. I hadn't had time so far to try that but I'll look into it in the (hopefully) near future,
Thanks again,
Best,
Isabelle.