コード例 #1
0
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
#

from mien.interface.cellview3D import CellViewer
import wx, os, sys, tempfile
from mien.parsers.mzip import deserialize
sys.path.append("/home/gic/mienblocks")
from ccbcv.rest import PSDB

URL = 'http://cercus.cns.montana.edu:8090'
PATH = '/CercalCellAfferent/'
CERCDB = PSDB(URL, PATH)
os.environ['DISPLAY'] = 'localhost:1.0'
record = sys.argv[1]
wxapp = wx.PySimpleApp()
x = CellViewer()
x.Show(True)
df = CERCDB.getFile(record)
doc = deserialize(df)
x.newDoc(doc)
fid, fname=tempfile.mkstemp('.png')
x.graph.screenShot(fname)
CERCDB.putFile(record, open(fname,'rb').read(), "snapshot", 'image/png')
os.unlink(fname)
コード例 #2
0
ファイル: snapshotscript.py プロジェクト: gic888/mienblocks
#2) Create a CellViewer, and load the data

#First, set the display
import os
os.environ['DISPLAY'] = 'localhost:1.0'
#This is required to set the display if you are logged into phobos (or another linux box) via ssh
#Unless Ryan simplified this part of the setup
#Somewhere else in the system, you will need to issue "xinit -- /usr/bin/X 1:" in order to start this 
#display so you can bind to it. 
#If you are locally logged in on console, you don't need this

#Now make a CV
import wx
from mien.interface.cellview3D import CellViewer
wxapp = wx.PySimpleApp()
x = CellViewer()
x.Show(True) # On Mac or Windows, you don't need to do this "Show" step, but on recent Linux, you do.

#Attach the document you downloaded to the CV

x.newDoc(doc)

#3) Set the camera viewpoint

# A) you can load a saved viewpoint from a file:

fn = "/path/to/viewpoint.nmpml"  # you had to make this file separately,
# use CV->Extensions->Viewpoints->Save Display Specification from an interactive CV session.
from mien.spatial.viewpoints import readDisplaySpec
readDisplaySpec(x, fn)