Page 1 of 1

Hide/Show chosen sulcus

Posted: Tue Apr 24, 2018 10:07 am
by Rolls
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

Re: Hide/Show chosen sulcus

Posted: Tue Apr 24, 2018 11:28 am
by riviere
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.

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
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

Re: Hide/Show chosen sulcus

Posted: Tue Apr 24, 2018 2:31 pm
by Rolls
Thank you very much, it's exactly what I needed.

Everything works perfectly for me.

Kindest regards,
Rolls