Hide/Show chosen sulcus

Questions about Anatomist manipulation

Moderators: riviere, denghien

Rolls
Posts: 2
Joined: Fri Mar 30, 2018 1:20 pm

Hide/Show chosen sulcus

Postby Rolls » Tue Apr 24, 2018 10:07 am

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

User avatar
riviere
Site Admin
Posts: 1358
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: Hide/Show chosen sulcus

Postby riviere » Tue Apr 24, 2018 11:28 am

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

Rolls
Posts: 2
Joined: Fri Mar 30, 2018 1:20 pm

Re: Hide/Show chosen sulcus

Postby Rolls » Tue Apr 24, 2018 2:31 pm

Thank you very much, it's exactly what I needed.

Everything works perfectly for me.

Kindest regards,
Rolls


Return to “Anatomist”

Who is online

Users browsing this forum: No registered users and 3 guests