原文通道:http://wiki.opengatecollaboration.org/index.php/Users_Guide:How_to_run_Gate#Interactive_mode
原文通道:http://wiki.opengatecollaboration.org/index.php/Users_Guide:Visualization#Visualization_with_OpenGL
一、怎样运行Gate
互动模式
输入
$ Gate
输出类似下面的界面
1 [G4] *************************************************************
2 [G4] Geant4 version Name: geant4-10-03 (4-December-2015)
3 [G4] Copyright : Geant4 Collaboration
4 [G4] Reference : NIM A 506 (2003), 250-303
5 [G4] WWW : http://cern.ch/geant4
6 [G4] *************************************************************
7 [G4]
8 [Core-0] Initialization of geometry
9 [Core-0] Initialization of physics
10 [Core-0] Initialization of actors
11 [Core-0]
12 [Core-0] **********************************************************************
13 [Core-0] GATE version name: gate_v8.0
14 [Core-0] Copyright : OpenGATE Collaboration
15 [Core-0] Reference : Phys. Med. Biol. 49 (2004) 4543-4561
16 [Core-0] Reference : Phys. Med. Biol. 56 (2011) 881-901
17 [Core-0] WWW : http://www.opengatecollaboration.org
18 [Core-0] **********************************************************************
19 [Core-0]
20 [Core-0] You are using Geant4 version 10.3.0
21 Idle>
输入ls,得到Gate可用的命令目录
1 Idle> ls
2 Command directory path : /
3 Sub-directories :
4 /control/ UI control commands.
5 /units/ Available units.
6 /process/ Process Table control commands.
7 /gate/ GATE detector control.
8 /particle/ Particle control commands.
9 /geometry/ Geometry control commands.
10 /tracking/ TrackingManager and SteppingManager control commands.
11 /event/ EventManager control commands.
12 /cuts/ Commands for G4VUserPhysicsList.
13 /run/ Run control commands.
14 /random/ Random number status control commands.
15 /material/ Commands for materials
16 /hits/ Sensitive detectors and Hits
17 /vis/ Visualization commands.
18 /digi/ DigitizerModule
19 /gps/ ...Title not available...
Commands :
查看/control,输入 ls /control
1 Idle> ls /control
2 Command directory path : /control/
3
4
5 Guidance :
6 UI control commands.
7
8 Sub-directories :
9 /control/cout/ Control cout/cerr for local thread.
10 /control/matScan/ Material scanner commands.
11 Commands :
12 macroPath * Set macro search pathwith colon-separated list.
13 execute * Execute a macro file.
14 loop * Execute a macro file more than once.
15 foreach * Execute a macro file more than once.
16 suppressAbortion * Suppress the program abortion caused by G4Exception.
17 verbose * Applied command will also be shown on screen.
18 saveHistory * Store command history to a file.
19 stopSavingHistory * Stop saving history file.
20 alias * Set an alias.
21 unalias * Remove an alias.
22 listAlias * List aliases.
23 getEnv * Get a shell environment variable and define it as an alias.
24 getVal * Get the current value of the UI command and define it as an alias.
25 echo * Display the aliased value.
26 shell * Execute a (Unix) SHELL command.
27 manual * Display all of sub-directories and commands.
28 createHTML * Generate HTML files for all of sub-directories and commands.
29 maximumStoredHistory * Set maximum number of stored UI commands.
30 if * Execute a macro file if the expression is true.
31 doif * Execute a macro file if the expression is true.
32 add * Define a new alias as the sum of two values.
33 subtract * Define a new alias as the subtraction of two values.
34 multiply * Define a new alias as the multiplification of two values.
35 divide * Define a new alias as the division of two values.
36 remainder * Define a new alias as the remainder of two values.
*代表这是最后一级目录。
执行mac文件
1 Idle> /control/execute myScanner.mac
注意,这个命令只是执行.mac文件中所有的命令,而不是启动一个仿真,启动仿真的命令是
/gate/application/startDAQ
这个命令一般都在.mac文件最后一行
其他命令:
退出
Idle> exit
帮助
$ Gate -h
qt模式打开
输入
$ Gate --qt
如果你在qt中session文本框中输入/control/execute benchPET.mac,你会看到下面
为了使用QT,你要在Gate宏中输入
/vis/open OGLSQt
注意:QT模式是仿真后的结果,你执行的操作都是在仿真后的操作
二、可视化
介绍
Gate中的可视化和geant4中的可视化功能相同,geant4中大部分的可视化操作可以运用到Gate中
重要提示
在用opengl打开图像时,推荐使用OpenGL Immediate-X viewer而不是常用的Stored-X viewer
命令行
使用geat4中的可视化命令进行可视化操作,如下面所述
用openGL可视化
最好的方法是敲/vis/open OGL让openGL自己选择模式。
openGL操作的代码http://geant4.slac.stanford.edu/Presentations/vis/G4OpenGLTutorial/G4OpenGLTutorial.html
例如:如果你想要放大某一部位,你可以用pan命令来放大
/vis/viewer/panTo -5 -1
/vis/viewer/zoom 4.
# V I E W E R #
/vis/open OGL
# define the zoom factor
/vis/viewer/zoom 1.5
# Set the viewing angle
/vis/viewer/set/viewpointThetaPhi 5 60
# Set the drawing style
/vis/viewer/set/style surface
# Tell the viewer to draw the volumes
/vis/drawVolume
# The trajectories for each run should be drawn together
# don't store trajectories = 0; store trajectories = 1
/tracking/storeTrajectory 1
# Requests viewer to refresh hits, tracks, etc., at end of event.
# Or to accumulate drawings. Detector remains or is redrawn.
/vis/scene/endOfEventAction accumulate
下面的是Gate中额外添加的选项
# draw object in WireFrame Mode
/gate/block/vis/forceWireframe
# draw object to appear as a solid
/gate/block/vis/forceSolid
# define object color
/gate/block/vis/setColor blue
任何时候都可以用下面命令手动进行几何重建,
/gate/geometry/rebuild
图像的可视化
Gate从7.0版本之后就可以用OpenGL打开图像,但是只能在快速模式中
快速模式
/vis/open OGLI
存储模式
注:只翻译了OpenGL部分,省略部分请参考原文