I want to create a PyAnatomist script that will save a series of .mesh as a .ply . (Actually I would prefer a .vtk but that is a second question.) All the steps work fine in the IPython interactive environment. However when I put them in a small script with bang line the instantiation of Anatomist gives an error. Here are the steps:
#!$BRAINVISAPATH/bin/ipython -q4thread
import os
import anatomist.api as ana
a=ana.Anatomist()
#other code for example
RInflated=a.loadObject('$PATH1/brainvisa-database-local/chimpstudy-humans/abd/t1mri/default_acquisition/default_analysis/segmentation/mesh/abd_Rwhite_inflated.mesh')
RInflated.save(filename='/$PATH2/inflated-meshes/abd/Rwhite_inflated.ply')
#etc.
All of this works perfectly in the IPython interactive but when I run it as a script I get
import anatomist.api as ana
from PyQt4 import QtGui
import sys
qapp = QtGui.QApplication( sys.argv )
a=ana.Anatomist()
# ...
It could baybe be automatically done in the anatomist application instantiation, but I had trouble finding a reliable way to detect whether the Qt app has already been instantiated or not - but I don't remember exactly, this was perhaps by the time we still supported Qt3 compatibility, I have to check that one day...