Note
Click here to download the full example code
Anatomist commandsΒΆ
Using the commands interpreter in a generic way
from __future__ import print_function
from __future__ import absolute_import
import anatomist.direct.api as anatomist
from soma import aims
from soma.qt_gui.qt_backend import Qt
import sip
import sys
run_loop = Qt.QApplication.instance() is None \
and 'sphinx_gallery' not in sys.modules
a = anatomist.Anatomist()
cx = anatomist.cpp.CommandContext.defaultContext()
# custom command
i = cx.freeID()
c = a.execute('CreateWindow', type='Coronal', res_pointer=i)
win = c.createdWindow()
# otherwise, we can retreive the new window using the context
# (which will work if the exact command has no python binding)
print(cx.id(win))
print(cx.object(i))
win2 = cx.object(i)
print(win2 is win)
vol = aims.read('irm.ima')
avol = a.toAObject(vol)
avol.releaseAppRef()
# keywords / real objects test
a.execute('AddObject', objects=[avol], windows=[win])
if run_loop:
Qt.QApplication.instance().exec_
if run_loop or 'sphinx_gallery' not in sys.modules:
del win, win2, avol, vol, cx, i
Total running time of the script: ( 0 minutes 0.000 seconds)