Dear Anatomist experts,
I am currently working on a Python script to show sulci. For the time being, I can load all the sulci :
import anatomist.api as anatomist
from soma import aims
import numpy as np
a = anatomist.Anatomist()
graph_name=...
graph = a.loadObject( graph_name )
awin = a.createWindow( '3D' )
awin.addObjects( graph )
Still, I don't know how I can decide which sulcus I want to hide or show.
How can I do that?
Thanks,
Rolls
Hide/Show chosen sulcus
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Re: Hide/Show chosen sulcus
Hi,
Yes it is possible, but... well I've just found a bug here, I have fixed it but you might have to recompile anatomist with latest updates for everything to work.
So it is possible to display a graph without its vertices (thus not display anything by default), then use the selection mechanism to display selected vertices.
The part which may not work without the fix is that the attribute storing the vertices label is "label" in automatic labeling (by morphologist) and "name" for manual labeling, and the selection command takes the wrong one (normally "name").
Denis
Yes it is possible, but... well I've just found a bug here, I have fixed it but you might have to recompile anatomist with latest updates for everything to work.
So it is possible to display a graph without its vertices (thus not display anything by default), then use the selection mechanism to display selected vertices.
Code: Select all
import anatomist.api as anatomist
from soma import aims
import os
a = anatomist.Anatomist()
graph_name = ...
graph = a.loadObject(graph_name)
# force automatic labeling mode - use 'name' for manual labeling
graph.setLabelProperty('label')
awin = a.createWindow( '3D' )
# put the graph into the window, without displaying its vertices - nothing
# will be shown yet.
awin.addObjects(graph, add_graph_nodes=False)
nomenclname = os.path.join(aims.carto.Paths.shfjShared(), 'nomenclature',
'hierarchy', 'sulcal_root_colors.hie')
nomenclature = a.loadObject(nomenclname)
# group represents the group of windows - selection occurs within a group
# group 0 is the default one
group = a.AWindowsGroup(a, 0)
# select labels we need: sulci will appear in the window awin
group.setSelectionByNomenclature(nomenclature, ['S.C._left', 'S.Pe.C.inf._left'])
# un-select to remove the red selection color
group.setSelection([])
graph.setLabelProperty('label') # there is an update problem somewhere - fix it
Denis
Re: Hide/Show chosen sulcus
Thank you very much, it's exactly what I needed.
Everything works perfectly for me.
Kindest regards,
Rolls
Everything works perfectly for me.
Kindest regards,
Rolls