2007年6月29日星期五

补充 Re: 另外一个crystal overlapping 的问题

如果repeat number是奇数(53、55)的时候就没有这个错误,而偶数时(52、54)就出现这个错误。

在模拟mosaic的过程中,使用了linear repeater来重复axial方向上的52个crystal,但是有时候(不总是)出现Overlapping daughter volumes

/gate/crystal/repeaters/insert linear
/gate/crystal/linear/setRepeatNumber 52
/gate/crystal/linear/setRepeatVector 0. 0. 2.3 mm
/gate/crystal/linear/autoCenter true


另外一个crystal overlapping 的问题

在模拟mosaic的过程中,使用了linear repeater来重复axial方向上的52个crystal,但是有时候(不总是)出现Overlapping daughter volumes

/gate/crystal/repeaters/insert linear
/gate/crystal/linear/setRepeatNumber 52
/gate/crystal/linear/setRepeatVector 0. 0. 2.3 mm
/gate/crystal/linear/autoCenter true

错误是最靠近中心的两个crystal重叠(但实际上应该并没有):

GeomTest Error: Overlapping daughter volumes
    The volumes crystal_P[25] and crystal_P[26],
    both daughters of volume rsector_P[0],
    appear to overlap at the following points in global coordinates: (list truncated)
       length (cm)    ---------- start position (cm) -----------   ----------- end position (cm) ------------
              0.23              -0.49       -0.1078         -0.23            -0.49       -0.1078             0
              0.23             -0.45         0.099         -0.23            -0.45         0.099             0
              0.23              -0.4         0.088         -0.23             -0.4         0.088             0
              0.23             -0.35         0.077         -0.23            -0.35         0.077             0
              0.23              -0.3         0.066         -0.23             -0.3         0.066             0
              0.23             -0.25         0.055         -0.23            -0.25         0.055             0
              0.23              -0.2         0.044         -0.23             -0.2         0.044             0
              0.23             -0.15         0.033         -0.23            -0.15         0.033             0
              0.23              -0.1         0.022         -0.23             -0.1         0.022             0
              0.23             -0.05         0.011         -0.23            -0.05         0.011             0
              0.23       2.77556e-17   2.08167e-18         -0.23      2.77556e-17   2.08167e-18             0
              0.23              0.05        -0.011         -0.23             0.05        -0.011             0
              0.23               0.1        -0.022         -0.23              0.1        -0.022             0
              0.23              0.15        -0.033         -0.23             0.15        -0.033             0
              0.23               0.2        -0.044         -0.23              0.2        -0.044             0
              0.23              0.25        -0.055         -0.23             0.25        -0.055             0
              0.23               0.3        -0.066         -0.23              0.3        -0.066             0
              0.23              0.35        -0.077         -0.23             0.35        -0.077             0
              0.23               0.4        -0.088         -0.23              0.4        -0.088             0
              0.23              0.45        -0.099         -0.23             0.45        -0.099             0
 Which in the mother coordinate system are:
       length (cm)    ---------- start position (cm) -----------   ----------- end position (cm) ------------
              0.23             -0.49       -0.1078         -0.23            -0.49       -0.1078             0
              0.23             -0.45         0.099         -0.23            -0.45         0.099             0
              0.23              -0.4         0.088         -0.23             -0.4         0.088             0
              0.23             -0.35         0.077         -0.23            -0.35         0.077             0
              0.23              -0.3         0.066         -0.23             -0.3         0.066             0
              0.23             -0.25         0.055         -0.23            -0.25         0.055             0
              0.23              -0.2         0.044         -0.23             -0.2         0.044             0
              0.23             -0.15         0.033         -0.23            -0.15         0.033             0
              0.23              -0.1         0.022         -0.23             -0.1         0.022             0
              0.23             -0.05         0.011         -0.23            -0.05         0.011             0
              0.23       2.77556e-17   2.08167e-18         -0.23      2.77556e-17   2.08167e-18             0
              0.23              0.05        -0.011         -0.23             0.05        -0.011             0
              0.23               0.1        -0.022         -0.23              0.1        -0.022             0
              0.23              0.15        -0.033         -0.23             0.15        -0.033             0
              0.23               0.2        -0.044         -0.23              0.2        -0.044             0
              0.23              0.25        -0.055         -0.23             0.25        -0.055             0
              0.23               0.3        -0.066         -0.23              0.3        -0.066             0
              0.23              0.35        -0.077         -0.23             0.35        -0.077             0
              0.23               0.4        -0.088         -0.23              0.4        -0.088             0
              0.23              0.45        -0.099         -0.23             0.45        -0.099             0
    Which in the coordinate system of crystal_P[25] are:
       length (cm)    ---------- start position (cm) -----------   ----------- end position (cm) ------------
              0.23             -0.49       -0.1078        -0.115            -0.49       -0.1078         0.115
              0.23             -0.45         0.099        -0.115            -0.45         0.099         0.115
              0.23              -0.4         0.088        -0.115             -0.4         0.088         0.115
              0.23             -0.35         0.077        -0.115            -0.35         0.077         0.115
              0.23              -0.3         0.066        -0.115             -0.3         0.066         0.115
              0.23             -0.25         0.055        -0.115            -0.25         0.055         0.115
              0.23              -0.2         0.044        -0.115             -0.2         0.044         0.115
              0.23             -0.15         0.033        -0.115            -0.15         0.033         0.115
              0.23              -0.1         0.022        -0.115             -0.1         0.022         0.115
              0.23             -0.05         0.011        -0.115            -0.05         0.011         0.115
              0.23       2.77556e-17   2.08167e-18        -0.115      2.77556e-17   2.08167e-18         0.115
              0.23              0.05        -0.011        -0.115             0.05        -0.011         0.115
              0.23               0.1        -0.022        -0.115              0.1        -0.022         0.115
              0.23              0.15        -0.033        -0.115             0.15        -0.033         0.115
              0.23               0.2        -0.044        -0.115              0.2        -0.044         0.115
              0.23              0.25        -0.055        -0.115             0.25        -0.055         0.115
              0.23               0.3        -0.066        -0.115              0.3        -0.066         0.115
              0.23              0.35        -0.077        -0.115             0.35        -0.077         0.115
              0.23               0.4        -0.088        -0.115              0.4        -0.088         0.115
              0.23              0.45        -0.099        -0.115             0.45        -0.099         0.115
    Which in the coordinate system of crystal_P[26] are:
       length (cm)    ---------- start position (cm) -----------   ----------- end position (cm) ------------
              0.23             -0.49       - 0.1078        -0.345            -0.49       -0.1078        -0.115
              0.23             -0.45         0.099        -0.345            -0.45         0.099        -0.115
              0.23              -0.4         0.088        -0.345             -0.4         0.088        -0.115
              0.23             -0.35         0.077        -0.345            -0.35         0.077        -0.115
              0.23              -0.3         0.066        -0.345             -0.3         0.066        -0.115
              0.23             -0.25         0.055        -0.345            -0.25         0.055        -0.115
              0.23              -0.2         0.044        -0.345             -0.2         0.044        -0.115
              0.23             -0.15         0.033        -0.345            -0.15         0.033        -0.115
              0.23              -0.1         0.022        -0.345             -0.1         0.022        -0.115
              0.23             -0.05         0.011        -0.345            -0.05         0.011        -0.115
              0.23       2.77556e-17   2.08167e-18         -0.345      2.77556e-17   2.08167e-18        -0.115
              0.23              0.05        -0.011        -0.345             0.05        -0.011        -0.115
              0.23               0.1        - 0.022        -0.345              0.1        -0.022        -0.115
              0.23              0.15        -0.033        -0.345             0.15        -0.033        -0.115

手册里关于ring repeater的一个错误

手册里说:

To set the rotation angle difference between the first and the last copy, use:
/gate/Name_Volume/ring/setAngularSpan x deg

The default angle is 360 deg.

The AngularSpan, the FirstAngle and the RepeatNumber allow one to define the rotation angle difference between two adjacent copies (AngularPitch).

(AngularSpan-FirstAngle)/(RepeatNumber-1)= AngularPitch

AngularSpandifference between the first and the last copy, 这个没有错,但是上面的计算AngularPitch的公式里不应该有FirstAngle。

比如在定义Mosaic的crystal的时候,先用下面的定义没有问题:

/gate/rsector/repeaters/insert ring
/gate/rsector/ring/setFirstAngle 0. deg
/gate/rsector/ring/setAngularSpan -358.705 deg
/gate/rsector/ring/setRepeatNumber 278

为了让第一个crystal有一个angular shift,我改成了这样:

/gate/rsector/repeaters/insert ring
/gate/rsector/ring/setFirstAngle -0.6475 deg
/gate/rsector/ring/setAngularSpan -359.3525 deg
/gate/rsector/ring/setRepeatNumber 278

结果就不对了。最后发现,setFirstAngle增加一个shift之后,setAngularSpan仍然不变,即setAngularSpan是第一个和最后一个crystal的差,而不是最后一个crystal的绝对位置。下面的定义是正确的:

/gate/rsector/repeaters/insert ring
/gate/rsector/ring/setFirstAngle -0.6475 deg
/gate/rsector/ring/setAngularSpan -358.705 deg
/gate/rsector/ring/setRepeatNumber 278

SolidProblem 问题

下面定义collimator的方法在recursive test时出现SolidProblem错误:

/gate/world/daughters/name Collimator
/gate/world/daughters/insert cylinder

#- Define the dimensions of the Collimator volume

/gate/Collimator/geometry/setRmax 42 mm
/gate/Collimator/geometry/setRmin 28 mm
/gate/Collimator/geometry/setHeight 120 mm
/gate/Collimator/setMaterial Air

#- CollimatorLead is the real Lead part

/gate/Collimator/daughters/name CollimatorLead
/gate/Collimator/daughters/insert cylinder

#- Define the dimensions of the Lead volume

/gate/CollimatorLead/geometry/setRmax 37 mm
/gate/CollimatorLead/geometry/setRmin 30 mm
/gate/CollimatorLead/geometry/setHeight 120 mm

#- Set the material of the collimator volume
/gate/CollimatorLead/setMaterial Lead

出现很多下面的错误:

GeomTest Error: SolidProblem
Spurious exiting intersection point
Solid name = Collimator_S
Local position = 2.8 0 5.6 cm

如果Collimator和CollimatorLead定义的大小一样的话:

/gate/Collimator/geometry/setRmax 37 mm
/gate/Collimator/geometry/setRmin 30 mm

就没有错误。

Ring Repeater

The default rotation axis is the Z axis. Note that the default ring
repetition goes counter clockwise.

如果想让它顺时针转,我用的是下面的方法:

/gate/rsector/repeaters/insert ring
/gate/rsector/ring/setFirstAngle 0 deg
/gate/rsector/ring/setAngularSpan -360 deg
/gate/rsector/ring/setRepeatNumber 4

但是上面运行结果只重复了3个,而不是4。 原因是:最后一个的位置和第一个完全重复了。

修改成:/gate/rsector/ring/setAngularSpan -270 deg 就可以了

对于mosaic系统,可以用:

/gate/rsector/ring/setFirstAngle -0.6475 deg
/gate/rsector/ring/setAngularSpan -359.3525 deg
/gate/rsector/ring/setRepeatNumber 278

第一个crystal的角度在 -360/278/2= -0.6475 degree
最后一个(277)个crystal的角度在 -(360-0.6475)= -359.3525 degree

2007年6月27日星期三

voxels.dat 和 gateVoxels.root

1.  什么是voxels.dat文件?

When you build a voxelised source or a voxelized phantom, by default, GATE writes the voxel density values in a file (voxels.dat), to allow a cross-check of what you have loaded. In your macro, you can disable this option : /gate/output/ascii/setOutFileVoxelFlag 0

The format of the file voxels.dat is:

* line 1 : Nx Ny Nz : number of voxels in the three directions,
* line 2 : dx dy dz :size of the voxel in millimeters,
* line 3 to the end: voxel density values.

The order of the voxels is chosen as follow : increase the index along x, then y, then z.

For example for a 2 × 2 × 2 matrix the densities are written in the following order :

• d(0,0,0) d(1,0,0)
• d(0,1,0) d(1,1,0)
• d(0,0,1) d(1,0,1)
• d(0,1,1) d(1,1,1)

2. 什么是gateVoxels.root 文件?

A file gateVoxels.root is also created when using a voxelized phantom in your macro.

运行benchmarkSPECT出错

 Initial seed = 9876
 u[] = 0.826754 0.440362 0.400187 0.725149 0.664275 0.883651 0.0197456 0.869407 0.497477 0.921073 0.91885
4 0.44801 0.431195 0.366517 0.997041 0.276654 0.709869 0.61508 0.644361 0.0669515 0.652996 0.408643 0.180
346 0.485567 0.527954 0.221724 0.0236536 0.676716 0.111153 0.0149288 0.378921 0.730443 0.370631 0.212985
0.996026 0.828911 0.792252 0.670679 0.975645 0.61798 0.35904 0.777169 0.840619 0.210687 0.26916 0.251163
0.327169 0.320799 0.565341 0.595557 0.653566 0.541681 0.338881 0.487544 0.631033 0.206735 0.176723 0.7742
37 0.238176 0.558025 0.136802 0.766291 0.0966802 0.786162 0.741185 0.341802 0.429851 0.611746 0.913643 0.
0634804 0.60221 0.4976 0.772045 0.270605 0.69445 0.859647 0.0742606 0.318619 0.794827 0.1716 0.0967165 0.
046794 0.931993 0.244178 0.730236 0.676193 0.165356 0.956988 0.418709 0.634537 0.270004 0.513184 0.076297
2 0.550409 0.554157 0.624754 0.403
 c = 0.317872, cd = 0.456233, cm = 1
 i97 = 64, u[i97] = 0.741185
 j97 = 0, u[j97] = 0.826754
----------------------------------------
Time set to (s) 600
 Current Output Root File: 0xa100c20 named benchSPECT.root
GateToRoot: ROOT: files writing...
GateToRoot: ROOT: files closing...
     User simulation time (sec)   := 9604.63
     Real simulation time (sec)   := 9860.34
     System simulation time (sec) := 117.71
Idle> /control/verbose 1
Idle> /control/saveHistory
/control/saveHistory
Idle> /run/verbose 0
/run/verbose 0
Idle> /event/verbose 1
/event/verbose 1
Idle> /tracking/verbose 1
/tracking/verbose 1
Idle>
Idle> /gate/timing/setTime 0. s
/gate/timing/setTime 0. s
Time set to (s) 0
/vis/scene/notifyHandlers scene-0
Idle> /gate/application/setTimeSlice 1. s
/gate/application/setTimeSlice 1. s
Idle>
Idle> /control/execute SPECTbench.mac
/control/execute SPECTbench.mac
/control/execute visu.mac
/vis/open OGLSX
Got standard cmap
Window name: viewer-1 (OpenGLStoredX)
/vis/viewer/reset
/vis/viewer/refresh
/vis/viewer/set/viewpointThetaPhi 45 45
/vis/viewer/refresh
/vis/viewer/zoom 5
/vis/viewer/refresh
/vis/viewer/set/style surface
/vis/viewer/refresh
/vis/drawVolume
/tracking/storeTrajectory 1
/vis/scene/endOfEventAction accumulate
/vis/viewer/update
/vis/verbose 2
Visualization verbosity changed to errors (2)
/gate/geometry/enableAutoUpdate
/gate/geometry/enableAutoUpdate
/gate/world/geometry/setXLength 100 cm
/vis/scene/notifyHandlers scene-0
/vis/scene/notifyHandlers scene-1
/gate/world/geometry/setYLength 100 cm
/vis/scene/notifyHandlers scene-0
/vis/scene/notifyHandlers scene-1
/gate/world/geometry/setZLength 100 cm
/vis/scene/notifyHandlers scene-0
/vis/scene/notifyHandlers scene-1
/gate/world/daughters/name SPECThead
/gate/world/daughters/insert box
***** Illegal application state </gate/world/daughters/insert box> *****
***** Command ignored *****

还不知道什么原因。。。

2007年6月26日星期二

Re: 答复: 答复: Dr.shawn,您好!

你好!

我没有用过openmosix,不知道它可不可以实现你的设想(一台Linux控制其他的Cygwin PC)。我用xgrid也有类似的问题,我解决的办法是,在一个节点上安装好GATE,然后其他节点通过mount命令来把第一个节点上GATE所在的目录变成等效于本地路径,一样可以运行GATE。

如果你用openmosix成功的话,我很愿意知道你是怎么做的。以后有条件的话,我也想尝试在PC机上做cluster允许GATE,到时候会向你请教了!

祝好
Shawn

On 6/26/07,

Dr. Shawn,

您好!

谢谢您的分析,我现在得想法是这样:我用一台 Linux PC ,其他的PC 机我想安装cygwin Linux虚拟机)来构建 cluster, 在平台上我准备用的是openmosix . 我之所以要构建一个标准的cluster,正如您所说,我是想把所有的任务送到一台 PC上,而每个任务都各占用自己 PC机上的 CPU。这样不就能提高运行速度了吗?

我觉得要是用 ssh将自己写的script 发送到不同机器上的话,这应该要求每台机器上都要安装上GATE软件,要是这样的话,假如要用 100 PC机同时运算的话,安装软件的工作量就会很大了。不知我的理解是否正确,请您指点!

祝好!

Ntuple

Gate输出里有一个 /gate/output/root/setRootNtupleFlag 1

ROOT里关于Ntuple的说明:

In case you want to store large quantities of same-class objects, ROOT has designed the TTree and TNtuple classes specifically for that
purpose. The TTree class is optimized to reduce disk space and enhance access speed. A TNtuple is a TTree that is limited to only hold floating-point numbers; a TTree on the other hand can hold all kind of data, such as objects or arrays in addition to all the simple types.

attachCrystalSD 和 attachPhantomSD

# SENSITIVE DETECTORS
# GATE provides two sensitive detectors, which have two different functions
# Using them properly is very important for getting accurate results
 
# Crystal SD
# The crystal SD makes it possible to record hits in a sensitive volume ( e.g.,. in a scintillation crystal)
# It must be attached to any volume for which hit-data must be obtained
# For recording hits in the NaI volume only, the name of which is crystal, this volume is attached
# to the crystal SD
/gate/crystal/attachCrystalSD

# Phantom SD
# The phantom SD makes it possible to record Compton events in the volumes within the field of view
# This can provide information for result analysis to discriminate between
# scattered and unscattered photons
# It must be attached to each and every volume for whom Compton interactions have to be recorded
/gate/Phantom/attachPhantomSD

Re: 答复: Dr.shawn,您好!

吴先生,你好!

首先想知道你的cluster是基于什么结构的?目前常见的有
openmosix,condor,openPBS,和xgrid。因为我们实验室的cluster是苹果机(mac),所以我的经验主要是使用xgrid方面。如果你用Linux PC构建cluster,我想不外乎是其他几个方式。

事实上,以我的理解,如果是通过分割时间段(job splitter正是采用这个方式)来运行一个大的Gate任务,并不一定需要构建一个标准的cluster。你可以通过自己编写的script通过ssh等方式来把子任务递交到不同的电脑上,再把产生的数据归拢到一起就可以了。(在cluster上,你是把所有任务递交到某一个电脑,然后cluster的软件自动把子任务分配到其他节点上,适合很多人很多不同的任务的管理。)

GATE的job splitter生产的文件中,submit split文件是针对不同标准的cluster的,所以如果你没有一个标准的cluster,这个文件没有用。my(n).mac是每个子任务的源文件,seed(n).rndm是每个子任务需要读入的随机数种子(否则每个子任务产生的数据就相同了)。

希望我的理解对你有所帮助。如果我有什么地方说得不对(很有可能,因为我也刚用不久),欢迎讨论!

Shawn

Dr. Shawn

       在您的博客中提到用 clutter进行联机模拟,我现在也正朝这个方向做,因为要的得到一个完整的模拟数据用一台 PC实在是太慢了。正如您所说的,现在 GATE方面的资料非常少,因此,在实现联机的过程中也遇到了难题。

我现在已经用 job splitter所提供的 gjs 将一个完整的scripts 分割后得到几个 subscripts, 以及submit file split file 具体的如下

my1.mac my3.mac my5.mac   seed1.rndm seed3.rndm seed5.rndm

my2.mac my4.mac my. split   seed2.rndm  seed4.rndm

想请教您的问题是:在得到这些 subscripts后,接下来该如何实现联机?也就是说该怎样才能让其他的 PC 机也能运行我的subscript

因为我曾试着执行 .submit命令结果不能产生任何的数据。

谢谢!

祝您生活开心、顺利!!!


2007年6月25日星期一

两个并行任务的random seed

任务1:

/random/resetEngineFrom seed0.rndm

----- HepJamesRandom engine status -----
 Initial seed = 9876
 u[] = 0.266173 0.255289 0.726667 0.114279 0.820013 0.382269 0.0164884 0.910961 0.326838 0.641517 0.775423 0.906602 0.212787 0
.734817 0.854896 0.571655 0.723533 0.439135 0.15704 0.660746 0.84414 0.278271 0.35479 0.48473 0.0941981 0.0574776 0.706956 0.6
95854 0.991612 0.415643 0.555734 0.566765 0.275263 0.616787 0.331544 0.0159348 0.955403 0.36012 0.0602649 0.708039 0.558607 0.
294949 0.678828 0.628692 0.722706 0.516777 0.588294 0.323029 0.33095 0.976353 0.445113 0.519173 0.397293 0.389422 0.266685 0.7
00877 0.135912 0.471904 0.946966 0.201473 0.484335 0.708344 0.272465 0.551475 0.958607 0.786533 0.13347 0.525151 0.118901 0.14
7471 0.0258384 0.95194 0.000184774 0.992118 0.937095 0.754522 0.271566 0.100606 0.607633 0.870699 0.762509 0.805175 0.452052 0
.984826 0.0255338 0.892312 0.437965 0.712359 0.0144815 0.763534 0.491063 0.574366 0.27083 0.936098 0.208711 0.815249 0.175017
 c = 0.0216029, cd = 0.456233, cm = 1
 i97 = 96, u[i97] = 0.175017
 j97 = 32, u[j97] = 0.275263
----------------------------------------

任务2:

/random/resetEngineFrom seed1.rndm

----- HepJamesRandom engine status -----
 Initial seed = 9876
 u[] = 0.299579 0.0643118 0.830503 0.415154 0.215294 0.273986 0.388915 0.687681 0.678652 0.868535 0.0620566 0.54626 0.26461
7 0.136585 0.750484 0.0799972 0.531266 0.309177 0.723956 0.383019 0.552072 0.0372045 0.287497 0.810954 0.307222 0.434334 0.
582098 0.785536 0.831693 0.835768 0.829271 0.110575 0.390805 0.68525 0.768618 0.686261 0.956181 0.921951 0.930676 0.381295
0.350551 0.00638956 0.817898 0.516878 0.0926232 0.198684 0.363688 0.670666 0.025583 0.0233951 0.275618 0.161902 0.698571 0.
804214 0.43405 0.806662 0.620648 0.739453 0.195194 0.0819512 0.445937 0.813955 0.790057 0.818255 0.500647 0.288763 0.664657
 0.407582 0.544611 0.246955 0.382959 0.152106 0.786232 0.882233 0.749656 0.185871 0.453442 0.0888592 0.61292 0.49511 0.8898
25 0.236962 0.842197 0.227387 0.642075 0.291405 0.0412306 0.237188 0.169403 0.7242 0.417909 0.581457 0.958405 0.994713 0.39
9275 0.919056 0.95626
 c = 0.0216029, cd = 0.456233 , cm = 1
 i97 = 96, u[i97] = 0.95626
 j97 = 32, u[j97] = 0.390805
----------------------------------------

在cluster上运行一个simulation

先用 gjs 产生random seed文件
/Applications/gate_v3.1.0//Cluster_Tools/jobsplitter/bin/Darwin-g++/gjs -numberofsplits 40 -clusterplatform xgrid mosaic.mac

然后把产生的seed文件复制到xgrid的input目录下

没有使用Gate产生的.plist文件,而是使用自己的script递交xgrid任务

以第9个任务为例:

/gate/output/root/setSaveRndmFlag 0
/random/resetEngineFrom seed9.rndm
/gate/application/startDAQ

尚不清楚这样的方法是否正确,以及和使用Gate提供的 /gate/application/startDAQCluster 有多大区别。。。

关于random seed的讨论

[gate-users] Random seed

Dirk Kruecker d.kruecker at fz-juelich.de
Thu Jun 30 12:55:11 CEST 2005

Dear Martin,

I guess the random number generation in GATE can be somewhat
confusing. I better explain everything in detail.

-------------------------------------------------------------
The default behaviour:

Without any
/gate/output/root/setSaveRndmFlag n
/random/resetEngineFrom xxx
command GATE will create 2 random seed files:
beginOfRun.rndm and endOfRun.rndm.
If you do not change these files the next run will be initialized from the
endOfRun.rndm file (the beginOfRun.rndm will not change anyhow). So by
default each run will be different.

The random number engine will be initialized from the endOfRun.rndm.
If there is no endOfRun.rndm GATE will create a beginOfRun.rndm and will
start from this file. The beginOfRun.rndm will _always_ be the same! The
endOfRun.rndm will change after each run.

------------------------------------------------------------
Rerunning with the same random numbers:

If you want to re-run the same events you can set
/gate/output/root/setSaveRndmFlag 0
GATE will be initialized internally and each run will be the same.

----------------------------------------------------------------
Continuning an existing simulation to increase the number of events:
In the case where you already run a simulation and want to continue to get
better statistics you need the endOfRun.rndm from your first simulation.
/gate/output/root/setSaveRndmFlag 1
GATE will automatically look for the endOfRun.rndm file in directory where it
runs.

--------------------------------------------------------------------------------------
BTW
When the SaveRndmFlag is set you can observe the status of the random
generator at run end. There are some lines before GATE stops:

----- HepJamesRandom engine status -----
Initial seed = 9876
u[] = 0.207714 ...

I skip the 103 numbers describing the state of the random number engine. If
(at least 1 of) these 103 numbers are different your events will be
statistically independent.

--------------------------------------------------------------------------------------
Continuning an existing simulation to increase the number of events in the
case where you did not save the endOfRun.rndm from the first simulation:

Here the safest method is to use a seed which is totally different from what
GATE creates. I have included a zip file with a few seeds to create
independent random number streams.

/gate/output/root/setSaveRndmFlag 0
/random/resetEngineFrom StartSeq(n).rndm

Just giving the filename without /gate/output/root/setSaveRndmFlag 0 will not be sufficient since GATE will still look for the endOfRun.rndm file.

I hope this helps

Dirk


-------------------------------------------------------------------


GATE运行速度

我的GATE运行环境:Apple G5 Server Dual 2GHz 2GRAM
MOBY phantom (64x64x256) 1Bq  (总共111microCurie)
multi-pinhole SPECT on a PET scanner
模拟1秒的采集需要运行将近6个小时。

20个CPU同时工作时,采集10分钟的数据需要180个小时。

几篇有关GATE的Validation的文章

Phys Med Biol. 2004 Jan 21;49(2):271-85.

Validation of the GATE Monte Carlo simulation platform for modelling a CsI(Tl) scintillation camera dedicated to small-animal imaging.

Laboratoire de Physique Corpusculaire, CNRS/IN2P3, Université de Clermont-Ferrand, 24 avenue des Landais, 63177 Aubière, France. lazaro@clermont.in2p3.fr

Monte Carlo simulations are increasingly used in scintigraphic imaging to model imaging systems and to develop and assess tomographic reconstruction algorithms and correction methods for improved image quantitation. GATE (GEANT4 application for tomographic emission) is a new Monte Carlo simulation platform based on GEANT4 dedicated to nuclear imaging applications. This paper describes the GATE simulation of a prototype of scintillation camera dedicated to small-animal imaging and consisting of a CsI(Tl) crystal array coupled to a position-sensitive photomultiplier tube. The relevance of GATE to model the camera prototype was assessed by comparing simulated 99mTc point spread functions, energy spectra, sensitivities, scatter fractions and image of a capillary phantom with the corresponding experimental measurements. Results showed an excellent agreement between simulated and experimental data: experimental spatial resolutions were predicted with an error less than 100 microns. The difference between experimental and simulated system sensitivities for different source-to-collimator distances was within 2%. Simulated and experimental scatter fractions in a [98-182 keV] energy window differed by less than 2% for sources located in water. Simulated and experimental energy spectra agreed very well between 40 and 180 keV. These results demonstrate the ability and flexibility of GATE for simulating original detector designs. The main weakness of GATE concerns the long computation time it requires: this issue is currently under investigation by the GEANT4 and the GATE collaborations.

Phys Med Biol. 2005 Jul 7;50(13):3113-25. Epub 2005 Jun 22.

Validation of the Monte Carlo simulator GATE for indium-111 imaging.

UMR 678 INSERM/UPMC, CHU Pitié Salpêtrière, 91 boulevard de l'Hôpital, 75634 Paris Cedex 13, France.

Monte Carlo simulations are useful for optimizing and assessing single photon emission computed tomography (SPECT) protocols, especially when aiming at measuring quantitative parameters from SPECT images. Before Monte Carlo simulated data can be trusted, the simulation model must be validated. The purpose of this work was to validate the use of GATE, a new Monte Carlo simulation platform based on GEANT4, for modelling indium-111 SPECT data, the quantification of which is of foremost importance for dosimetric studies. To that end, acquisitions of (111)In line sources in air and in water and of a cylindrical phantom were performed, together with the corresponding simulations. The simulation model included Monte Carlo modelling of the camera collimator and of a back-compartment accounting for photomultiplier tubes and associated electronics. Energy spectra, spatial resolution, sensitivity values, images and count profiles obtained for experimental and simulated data were compared. An excellent agreement was found between experimental and simulated energy spectra. For source-to-collimator distances varying from 0 to 20 cm, simulated and experimental spatial resolution differed by less than 2% in air, while the simulated sensitivity values were within 4% of the experimental values. The simulation of the cylindrical phantom closely reproduced the experimental data. These results suggest that GATE enables accurate simulation of (111)In SPECT acquisitions.

Med Phys. 2006 Jan;33(1):198-208.

Validation of GATE Monte Carlo simulations of the GE Advance/Discovery LS PET scanners.

Department of Medical Physics, Memorial Sloan-Kettering Cancer Center, 1275 York Avenue, New York, New York 10021, USA. scmidtr@mskcc.org

The recently developed GATE (GEANT4 application for tomographic emission) Monte Carlo package, designed to simulate positron emission tomography (PET) and single photon emission computed tomography (SPECT) scanners, provides the ability to model and account for the effects of photon noncollinearity, off-axis detector penetration, detector size and response, positron range, photon scatter, and patient motion on the resolution and quality of PET images. The objective of this study is to validate a model within GATE of the General Electric (GE) Advance/Discovery Light Speed (LS) PET scanner. Our three-dimensional PET simulation model of the scanner consists of 12 096 detectors grouped into blocks, which are grouped into modules as per the vendor's specifications. The GATE results are compared to experimental data obtained in accordance with the National Electrical Manufactures Association/Society of Nuclear Medicine (NEMA/SNM), NEMA NU 2-1994, and NEMA NU 2-2001 protocols. The respective phantoms are also accurately modeled thus allowing us to simulate the sensitivity, scatter fraction, count rate performance, and spatial resolution. In-house software was developed to produce and analyze sinograms from the simulated data. With our model of the GE Advance/Discovery LS PET scanner, the ratio of the sensitivities with sources radially offset 0 and 10 cm from the scanner's main axis are reproduced to within 1% of measurements. Similarly, the simulated scatter fraction for the NEMA NU 2-2001 phantom agrees to within less than 3% of measured values (the measured scatter fractions are 44.8% and 40.9 +/- 1.4% and the simulated scatter fraction is 43.5 +/- 0.3%). The simulated count rate curves were made to match the experimental curves by using deadtimes as fit parameters. This resulted in deadtime values of 625 and 332 ns at the Block and Coincidence levels, respectively. The experimental peak true count rate of 139.0 kcps and the peak activity concentration of 21.5 kBq/cc were matched by the simulated results to within 0.5% and 0.1% respectively. The simulated count rate curves also resulted in a peak NECR of 35.2 kcps at 10.8 kBq/cc compared to 37.6 kcps at 10.0 kBq/cc from averaged experimental values. The spatial resolution of the simulated scanner matched the experimental results to within 0.2 mm.

Phys Med Biol. 2006 Feb 21;51(4):943-62. Epub 2006 Feb 1.

Validation of a Monte Carlo simulation of the Philips Allegro/GEMINI PET systems using GATE.

U650 INSERM, Laboratoire du Traitement de l'information medicale (LaTIM), CHU Morvan, Université de Bretagne Occidentale, Brest, 29609, France. Frederic.Lamare@univ-brest.fr

A newly developed simulation toolkit, GATE (Geant4 Application for Tomographic Emission), was used to develop a Monte Carlo simulation of a fully three-dimensional (3D) clinical PET scanner. The Philips Allegro/GEMINI PET systems were simulated in order to (a) allow a detailed study of the parameters affecting the system's performance under various imaging conditions, (b) study the optimization and quantitative accuracy of emission acquisition protocols for dynamic and static imaging, and (c) further validate the potential of GATE for the simulation of clinical PET systems. A model of the detection system and its geometry was developed. The accuracy of the developed detection model was tested through the comparison of simulated and measured results obtained with the Allegro/GEMINI systems for a number of NEMA NU2-2001 performance protocols including spatial resolution, sensitivity and scatter fraction. In addition, an approximate model of the system's dead time at the level of detected single events and coincidences was developed in an attempt to simulate the count rate related performance characteristics of the scanner. The developed dead-time model was assessed under different imaging conditions using the count rate loss and noise equivalent count rates performance protocols of standard and modified NEMA NU2-2001 (whole body imaging conditions) and NEMA NU2-1994 (brain imaging conditions) comparing simulated with experimental measurements obtained with the Allegro/GEMINI PET systems. Finally, a reconstructed image quality protocol was used to assess the overall performance of the developed model. An agreement of <3% was obtained in scatter fraction, with a difference between 4% and 10% in the true and random coincidence count rates respectively, throughout a range of activity concentrations and under various imaging conditions, resulting in <8% differences between simulated and measured noise equivalent count rates performance. Finally, the image quality validation study revealed a good agreement in signal-to-noise ratio and contrast recovery coefficients for a number of different volume spheres and two different (clinical level based) tumour-to-background ratios. In conclusion, these results support the accurate modelling of the Philips Allegro/GEMINI PET systems using GATE in combination with a dead-time model for the signal flow description, which leads to an agreement of <10% in coincidence count rates under different imaging conditions and clinically relevant activity concentration levels.

Phys Med Biol. 2003 Sep 21;48(18):3021-42.

Monte Carlo simulations of a scintillation camera using GATE: validation and application modelling.

ELIS Department, Ghent University, Sint-Pietersnieuwstraat, 41 B-9000 Ghent, Belgium. Steven.Staelens@ugent.be

Geant4 application for tomographic emission (GATE) is a recently developed simulation platform based on Geant4, specifically designed for PET and SPECT studies. In this paper we present validation results of GATE based on the comparison of simulations against experimental data, acquired with a standard SPECT camera. The most important components of the scintillation camera were modelled. The photoelectric effect. Compton and Rayleigh scatter are included in the gamma transport process. Special attention was paid to the processes involved in the collimator: scatter, penetration and lead fluorescence. A LEHR and a MEGP collimator were modelled as closely as possible to their shape and dimensions. In the validation study, we compared the simulated and measured energy spectra of different isotopes: 99mTc, 22Na, 57Co and 67Ga. The sensitivity was evaluated by using sources at varying distances from the detector surface. Scatter component analysis was performed in different energy windows at different distances from the detector and for different attenuation geometries. Spatial resolution was evaluated using a 99mTc source at various distances. Overall results showed very good agreement between the acquisitions and the simulations. The clinical usefulness of GATE depends on its ability to use voxelized datasets. Therefore, a clinical extension was written so that digital patient data can be read in by the simulator as a source distribution or as an attenuating geometry. Following this validation we modelled two additional camera designs: the Beacon transmission device for attenuation correction and the Solstice scanner prototype with a rotating collimator. For the first setup a scatter analysis was performed and for the latter design. the simulated sensitivity results were compared against theoretical predictions. Both case studies demonstrated the flexibility and accuracy of GATE and exemplified its potential benefits in protocol optimization and in system design.

一篇关于Gate的并行计算的文章

Geometry and tracking (GEANT4) is a Monte Carlo package designed for high energy physics experiments. It is used as the basis layer for Monte Carlo simulations of nuclear medicine acquisition systems in GEANT4 Application for Tomographic Emission (GATE). GATE allows the user to realistically model experiments using accurate physics models and time synchronization for detector movement through a script language contained in a macro file. The downside of this high accuracy is long computation time. This paper describes a platform independent computing approach for running GATE simulations on a cluster of computers in order to reduce the overall simulation time. Our software automatically creates fully resolved, nonparametrized macros accompanied with an on-the-fly generated cluster specific submit file used to launch the simulations. The scalability of GATE simulations on a cluster is investigated for two imaging modalities, positron emission tomography (PET) and single photon emission computed tomography (SPECT). Due to a higher sensitivity, PET simulations are characterized by relatively high data output rates that create rather large output files. SPECT simulations, on the other hand, have lower data output rates but require a long collimator setup time. Both of these characteristics hamper scalability as a function of the number of CPUs. The scalability of PET simulations is improved here by the development of a fast output merger. The scalability of SPECT simulations is improved by greatly reducing the collimator setup time. Accordingly, these two new developments result in higher scalability for both PET and SPECT simulations and reduce the computation time to more practical values.

Cluster computing software for GATE simulations

Medical Physics -- June 2007 -- Volume 34, Issue 6, pp. 1926-1933

    Jan De Beenhouwer and Steven Staelens
    Ghent University, ELIS/MEDISIP, De Pintelaan 185, Block B, B-9000 Ghent, Belgium

    Dirk Kruecker
    Forschungszentrum Juelich, Institute of Medicine, 52425 Juelich, Germany

    Ludovic Ferrer
    INSERM U601, CHU Nantes, F-44093 Nantes, France

    Yves D'Asseler and Ignace Lemahieu
    Ghent University, ELIS/MEDISIP, De Pintelaan 185, Block B, B-9000 Ghent, Belgium

    Fernando R. Rannou
    Departamento de Ingeniera Informaticá, Universidad de Santiago de Chile, Av. Ecuador, 3659 Santiago, Chile

(Received 11 May 2006; revised 26 March 2007; accepted 27 March 2007; published 9 May 2007)

2007年6月22日星期五

一个很不错的介绍Gate的Powerpoint文件

本地下载:
8-Nicolas_Karakatsanis_GATE_woskshop_Chicago.PPT

GATE Overview and recent advances

Nicolas Karakatsanis and Irène Buvat

National Technical University of Athens, Greece
Laboratory of Functional Imaging, U678 INSERM, Paris, France

Outline

* Evolution of the use of MC simulations in ET since 1996
* OpenGATE motivation and short history
* New features in MC simulators in ETAlign Left
* New applications for MC simulations
* Upcoming developments in MC simulations
* Conclusion

2007年6月21日星期四

MOBY Phantom 的使用

使用phantom进行simulate之前,应该弄懂几个问题:

1. How to use the 4D NCAT and MOBY software to produce phantoms of the human and mouse, respectively.
2. How to simulate varying anatomies, motions, and diseased states with the software.
3. How to combine the phantoms with models for the imaging process to simulate imaging data of different modalities.

Medical imaging simulation is a powerful tool for characterizing, evaluating, and optimizing medical imaging devices and techniques. A vital aspect of simulation is to have a realistic phantom or model of the subject's anatomy.Based on state-of-the-art computer graphics techniques, the 4D NURBS-based Cardiac-Torso (NCAT) and 4D Mouse Whole-Body (MOBY) phantoms provide realistic models of the human and mouse anatomy and physiology for imaging studies. Both phantoms, when combined with accurate models for the imaging process, are capable of providing a wealth of realistic imaging data from subjects with various anatomies and motions (caridac and respiratory) in health and disease. With this ability, the phantoms have enormous potential to study the effects of anatomical, physiological, physical, and instrumentational factors on medical and small animal imaging and to research new instrumentation, image acquisition strategies, image processing and reconstruction methods and image visualization and interpretation techniques. The 4D NCAT and MOBY phantom software is distributed free-of-charge to academic institutions and is widely used in imaging research. The NCAT has been distributed to more than 300 academic users around the world while the newly released MOBY phantom is used by over 100 academic sites and continues to gain popularity. Both phantoms are also licensed to several commercial medical imaging companies.

phantom软件下载: http://www.bme.unc.edu/~wsegars/phantom.html

MOBY phantom: Each voxel value in the phantom  image is a 4 byte floating point number. To change the type of output produced by the MOBY program, the mphan_output_bin.c file can be modified. The phantoms are output with the given basename output_name. Phantom files with the extension _act are activity phantoms while those with the extension _atn are attenuation coefficient phantoms. The general_parameter_file contains numerous parameters to define the phantoms produced by the program. This includes parameters to define voxel size, motion, variations in anatomy, radionuclide uptake ratios for the activity phantoms, photon energy to define attenuation coefficients, ect.

W.P. Segars, B.M.W. Tsui, E.C. Frey, G.A. Johnson, and S.S. Berr, "Development of a 4D digital mouse 
phantom for molecular imaging research", Molecular Imaging & Biology, Vol. 6, Issue 3, p. 149-159, 2004.

2007年6月20日星期三

voxelized phantom 显示问题

尽管 voxelized phantom 现在可以读入了,但是当phantom的size比较大时(比如128x128x128, 0.5mm3/voxel),显示就会出错:

/vis/scene/notifyHandlers scene-0
Gate(2440) malloc: *** vm_allocate(size=8421376) failed (error code=3)
Gate(2440) malloc: *** error: can't allocate region
Gate(2440) malloc: *** set a breakpoint in szone_error to debug

 *** Break *** bus error
Abort


Fwd: How can I simu lation warm sphere sources in cylinder backgrond source?


你好

我做了一个简单的测试,象你那样使用了两个源,在我这里是可以的
。我模拟的是spect,程序如下:

# S O U R C E S
/gate/source/addSource cylinder_phantom
/gate/source/cylinder_phantom/setActivity 1000000. becquerel
/gate/source/cylinder_phantom/gps/particle gamma
/gate/source/cylinder_phantom/gps/energytype Mono
/gate/source/cylinder_phantom/gps/monoenergy 0.140 MeV
/gate/source/cylinder_phantom/setForcedHalfLife 21636 s
/gate/source/cylinder_phantom/gps/centre 0. 0. 0. cm
/gate/source/cylinder_phantom/gps/type Volume
/gate/source/cylinder_phantom/gps/shape Cylinder
/gate/source/cylinder_phantom/gps/radius 0.1 mm
/gate/source/cylinder_phantom/gps/halfz 0.5 mm
/gate/source/cylinder_phantom/gps/angtype iso
/gate/source/cylinder_phantom/gps/mintheta 0. deg
/gate/source/cylinder_phantom/gps/maxtheta 180. deg
/gate/source/cylinder_phantom/gps/minphi 0. deg
/gate/source/cylinder_phantom/gps/maxphi 360. deg

/gate/source/addSource SphereSource
/gate/source/SphereSource/setActivity 1000000. becquerel
/gate/source/SphereSource/gps/particle gamma
/gate/source/SphereSource/gps/monoenergy 0.140 MeV
/gate/source/SphereSource/setForcedHalfLife 65860 s
/gate/source/SphereSource/gps/energytype Mono
/gate/source/SphereSource/gps/type Volume
/gate/source/SphereSource/gps/shape Sphere
/gate/source/SphereSource/gps/radius 3 mm
/gate/source/SphereSource/gps/angtype iso
/gate/source/SphereSource/gps/centre 0.0 0.0 1.0 cm

/gate/source/list

---------- Forwarded message ----------
From: Guifen Lin
Date: Jun 17, 2007 2:14 AM
Subject: How can I simu lation warm sphere sources in cylinder backgrond source?
To: Shawn@tutorsky.net

Hi,All
  I want to simulation warm sphere sources in cylinder backgrond
source.
  Here is my scripts:
  #       P H A N T O M   G E O M E T R Y----"phantom.mac"
/gate/world/daughters/name Phantom
/gate/world/daughters/insert box
/gate/Phantom/placement/setTranslation 0.0 0.0 0.0 cm
/gate/Phantom/geometry/setXLength 35. cm
/gate/Phantom/geometry/setYLength 35. cm
/gate/Phantom/geometry/setZLength 35. cm
/gate/Phantom/setMaterial Air
/gate/Phantom/vis/forceWireframe
/gate/Phantom/vis/setColor gray
  # Outer SHell of Phantom
# Center Section of Upper Outer Shell
/gate/Phantom/daughters/name outershell
/gate/Phantom/daughters/insert cylinder
/gate/outershell/geometry/setRmax 11. cm
/gate/outershell/geometry/setRmin 10. cm
/gate/outershell/geometry/setHeight 20 cm
/gate/outershell/setMaterial Plastic
/gate/outershell/vis/forceWireframe
/gate/outershell/vis/setColor red
  # Water in Phantom
/gate/Phantom/daughters/name interior
/gate/Phantom/daughters/insert cylinder
/gate/interior/geometry/setRmax 10 cm
/gate/interior/geometry/setRmin  0.0 cm
/gate/interior/geometry/setHeight 20 cm
/gate/interior/setMaterial Water
/gate/interior/vis/forceWireframe
/gate/interior/vis/setColor blue
  
  # 10 mm Sphere
/gate/interior/daughters/name sphere10
/gate/interior/daughters/insert sphere
/gate/sphere10/placement/setTranslation 2.86 4.95367 0 cm
/gate/sphere10/geometry/setRmax 1 cm
/gate/sphere10/geometry/setRmin 0.0 cm
/gate/sphere10/setMaterial Air
#/gate/sphere10/vis/forceWireframe
/gate/sphere10/vis/setColor gray
  # 10 mm Sphere Exterior
/gate/interior/daughters/name sphere10out
/gate/interior/daughters/insert sphere
/gate/sphere10out/placement/setTranslation 2.86 4.95367 3.7 cm
/gate/sphere10out/geometry/setRmax 0.6 cm
/gate/sphere10out/geometry/setRmin 0.5 cm
/gate/sphere10out/setMaterial Plastic
#/gate/sphere10out/vis/forceWireframe
/gate/sphere10out/vis/setColor red
  #      A t t a c h   P h a n t o m
/gate/Phantom/attachPhantomSD
/gate/interior/attachPhantomSD
/gate/sphere10/attachPhantomSD
/gate/sphere10out/attachPhantomSD
/gate/outershell/attachPhantomSD
  
  
  # F A S T   P R O D U C T I O N   M O D U L E   F O R   F - 1 8   I S
O T O P E S---"source.mac"
/gate/source/addSource BackgroundSource
/gate/source/BackgroundSource/setActivity 50000. becquerel
/gate/source/BackgroundSource/gps/particle e+
/gate/source/BackgroundSource/setForcedUnstableFlag true
/gate/source/BackgroundSource/setForcedHalfLife 6586 s
/gate/source/BackgroundSource/gps/energytype Fluor18
/gate/source/BackgroundSource/gps/type Volume
/gate/source/BackgroundSource/gps/shape Cylinder
/gate/source/BackgroundSource/gps/radius 10 cm
/gate/source/BackgroundSource/gps/halfz 20 cm
/gate/source/BackgroundSource/gps/confine interior_P
/gate/source/BackgroundSource/gps/angtype iso
/gate/source/BackgroundSource/gps/centre 0.0 0.0 0. cm
  /gate/source/addSource SphereSource
/gate/source/SphereSource/setActivity 50000. becquerel
/gate/source/SphereSource/gps/particle e+
/gate/source/SphereSource/setForcedUnstableFlag true
/gate/source/SphereSource/setForcedHalfLife 6586 s
/gate/source/SphereSource/gps/energytype Fluor18
/gate/source/SphereSource/gps/type Volume
/gate/source/SphereSource/gps/shape Sphere
/gate/source/SphereSource/gps/radius 1 cm
/gate/source/SphereSource/gps/confine sphere10_P
/gate/source/SphereSource/gps/angtype iso
/gate/source/SphereSource/gps/centre 0.0 0.0 0. cm

  When I run the simulate,It shows the error. I think the sphere source
and the blackground sources are overlapped.But how to solve this 
problem
  
  
  Thanks in advance!
  


抢注雅虎免费邮箱-3.5G容量,20M附件!