[gate-users] SPblurring

Christian Wietholt cwietholt at nhri.org.tw
Fri Jul 22 05:28:46 CEST 2005


Dear fellow GATE users, 

I am working on this problem already for a while. I am trying to 
simulate a basic pinhole SPECT system, and at the moment I am mainly 
interested in projection images using the Interfile output. So far I can
generate projection images of a point source, but for some reason, not
matter what SPblurring parameter I set (0mm, 5mm, 10mm) I don't get
any change in the resulting projection images. In the end I would like
to use digigate to simulate different detector responses. 

I would greatly appreciate any help you can provide, since I already 
exhausted all other sources. 

Thanks, 

chris

Here is a  snapshot of my .mac file:

#############################################
# V I S U A L I S A T I O N
/control/execute visu.mac

/tracking/storeTrajectory 1
/gate/geometry/enableAutoUpdate

#############################################
# V E R B O S I T Y
/gate/output/verbose 2

#############################################
# W O R L D
# Define the world dimensions
/gate/world/geometry/setXLength 1000 mm
/gate/world/geometry/setYLength 1000 mm
/gate/world/geometry/setZLength 1000 mm

#############################################
# S C A N N E R   H E A D 
# Create a new box representing the main 
# head-volume SPECThead is the name of the 
# predefined SPECT system Create the SPECT 
# system, which will yield an Interfile output 
# of projection data
/gate/world/daughters/name SPECThead
/gate/world/daughters/insert box

# Define the dimensions of the main volume
/gate/SPECThead/geometry/setXLength 300. mm
/gate/SPECThead/geometry/setYLength 300. mm
/gate/SPECThead/geometry/setZLength 300. mm

# Define the position of the main volume
# Move the head 9 cm away from the Z axis, 
# which is the rotation axis and the 
# replication axis
/gate/SPECThead/placement/setTranslation  200. 0. 0. mm

# Set the material associated with the main volume
/gate/SPECThead/setMaterial Air
/gate/SPECThead/attachPhantomSD

# Define the rotation speed of the head 
# Define the orbiting around the Z axis
/gate/SPECThead/moves/insert orbiting
/gate/SPECThead/orbiting/setSpeed 0.5625 deg/s
/gate/SPECThead/orbiting/setPoint1 0. 0. 0. mm
/gate/SPECThead/orbiting/setPoint2 0. 0. 1. mm

# Define some visualisation options
/gate/SPECThead/vis/forceWireframe

# Shielding
# Create the shielding volume
/gate/SPECThead/daughters/name shielding
/gate/SPECThead/daughters/insert box

# Define the dimensions of the shielding volume
/gate/shielding/geometry/setXLength 300. mm
/gate/shielding/geometry/setYLength 300. mm
/gate/shielding/geometry/setZLength 300. mm

# Define the position of the shielding volume
/gate/shielding/placement/setTranslation  0. 0. 0. mm

# Set the material corresponding to the 
# shielding volume
/gate/shielding/setMaterial Lead

# Define some visualisation options
/gate/shielding/vis/setColor red
/gate/shielding/vis/forceWireframe

# Attach phantom SD to record Compton 
# interactions in the shielding volume
# Needed to discriminate between scattered 
# and unscattered photons
/gate/shielding/attachPhantomSD


#############################################
# C O L L I M A T O R
# Create a full volume defining the shape 
# of the collimator
/gate/SPECThead/daughters/name collimator
/gate/SPECThead/daughters/insert box

/gate/collimator/geometry/setXLength 20. mm 
/gate/collimator/geometry/setYLength 300. mm 
/gate/collimator/geometry/setZLength 300. mm 

/gate/collimator/setMaterial Lead
/gate/collimator/placement/setTranslation -140. 0. 0. mm

/gate/collimator/vis/forceWireframe
/gate/collimator/vis/setColor red

# Attach PhantomSD to record Compton 
# interactions in the collimator volume
/gate/collimator/attachPhantomSD

#############################################
# P I N H O L E
# Insert the pinhole in the collimator
/gate/collimator/daughters/name hole
/gate/collimator/daughters/insert cylinder
/gate/hole/geometry/setHeight 20. mm
/gate/hole/geometry/setRmax 2.5 mm
/gate/hole/placement/alignToX
/gate/hole/setMaterial Air
/gate/hole/vis/forceSolid

/gate/collimator/daughters/name cone1
/gate/collimator/daughters/insert cone
#/gate/cone1/geometry/setHeight 7.5 mm
/gate/cone1/geometry/setHeight 9 mm
/gate/cone1/geometry/setRmax1 10. mm
/gate/cone1/geometry/setRmax2 2.5 mm
#/gate/cone1/placement/setTranslation -6.25 0 0 mm
/gate/cone1/placement/setTranslation -5.5 0 0 mm
/gate/cone1/placement/alignToX
/gate/cone1/setMaterial Air
/gate/cone1/vis/forceSolid

/gate/collimator/daughters/name cone2
/gate/collimator/daughters/insert cone
#/gate/cone2/geometry/setHeight 7.5 mm
/gate/cone2/geometry/setHeight 9 mm
/gate/cone2/geometry/setRmax1 2.5 mm
/gate/cone2/geometry/setRmax2 10. mm
#/gate/cone2/placement/setTranslation 6.25 0 0 mm
/gate/cone2/placement/setTranslation 5.5 0 0 mm
/gate/cone2/placement/alignToX
/gate/cone2/setMaterial Air
/gate/cone2/vis/forceSolid

############################################
# C A M  H E A D  A I R
# insert air behind the collimator
/gate/SPECThead/daughters/name aircomp
/gate/SPECThead/daughters/insert box
/gate/aircomp/geometry/setXLength 170 mm
/gate/aircomp/geometry/setYLength 260 mm
/gate/aircomp/geometry/setZLength 260 mm
/gate/aircomp/placement/setTranslation -45 0 0 mm
/gate/aircomp/vis/forceWireframe

############################################
# C R Y S T A L
# Create the crystal volume
/gate/SPECThead/daughters/name crystal
/gate/SPECThead/daughters/insert box

# Define the dimensions of the crystal volume
/gate/crystal/geometry/setXLength   6. mm
/gate/crystal/geometry/setYLength 260. mm
/gate/crystal/geometry/setZLength 260. mm

# Define the position of the crystal volume
/gate/crystal/placement/setTranslation  43. 0. 0. mm

# Set the material associated with the crystal 
# volume
/gate/crystal/setMaterial NaI

# Define some visualisation options
/gate/crystal/vis/setColor yellow

###########################################
# B A C K - C O M P A R T M E N T
# Create the back-compartment volume
/gate/SPECThead/daughters/name compartment
/gate/SPECThead/daughters/insert box

# Define the dimensions of the back-compartment volume
/gate/compartment/geometry/setXLength  30. mm
/gate/compartment/geometry/setYLength 260. mm
/gate/compartment/geometry/setZLength 260. mm

# Define the position of the back-compartment volume
/gate/compartment/placement/setTranslation 61. 0. 0. mm

# Set the material of the  back-compartment volume
/gate/compartment/setMaterial Glass

# Define some visualisation options
/gate/compartment/vis/setColor grey

# Attach PhantomSD to record Compton 
# interactions in the back-compartment volume
/gate/compartment/attachPhantomSD


#############################################
# P H A N T O M
# Create the phantom volume
/gate/world/daughters/name Phantom
/gate/world/daughters/insert cylinder

# Define the dimensions of the phantom 
# volume
/gate/Phantom/geometry/setRmax 0.5  mm
/gate/Phantom/geometry/setRmin 0. mm
/gate/Phantom/geometry/setHeight 0.5 mm
/gate/Phantom/placement/setTranslation 0 0 0 mm

# Set the material corresponding to the 
# phantom volume
/gate/Phantom/setMaterial Water

# Define some visualisation options
/gate/Phantom/vis/setColor blue
/gate/Phantom/vis/forceWireframe 

# Attach PhantomSD to record Compton
# interactions in the phantom volume
/gate/Phantom/attachPhantomSD


#############################################
# M O V I N G   S O U R C E
# Add an extra object for source confinement
/gate/Phantom/daughters/name movsource
/gate/Phantom/daughters/insert cylinder

# Define the dimensions of the source volume
/gate/movsource/geometry/setRmax 0.5  mm
/gate/movsource/geometry/setRmin 0. mm
/gate/movsource/geometry/setHeight 0.5 mm

# Set the material corresponding to the
# phantom volume
/gate/movsource/setMaterial Water

# Define some visualisation options
/gate/movsource/vis/setColor magenta
/gate/movsource/attachPhantomSD

/control/execute timing.mac

#################################
# 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

#############################################
# D I G I T I Z E R
# The digitizer tracks what happens in the 
# detection system and in the electronics
# Build a digitizer that first computes the 
# centroid of interactions

/gate/digitizer/Singles/insert adder

/gate/digitizer/Singles/insert blurring
/gate/digitizer/Singles/blurring/setResolution 0.15
/gate/digitizer/Singles/blurring/setEnergyOfReference 140. keV

/gate/digitizer/Singles/insert spblurring
/gate/digitizer/Singles/spblurring/setSpresolution 10.0 mm
/gate/digitizer/Singles/spblurring/verbose 1

/gate/digitizer/Singles/insert thresholder
/gate/digitizer/Singles/thresholder/setThreshold 20. keV

/gate/digitizer/Singles/insert upholder
/gate/digitizer/Singles/upholder/setUphold 190. keV

#############################################
# S Y S T E M
# The system acts as an interpretor between 
# the GATE geometry and data outputs for 
# reconstruction in our case, the Interfile 
# writer. A system must know which components 
# of the geometry are parts of the scanner, 
# and what their role are. For the moment, 
# there is only a system SPECThead, which 
# was built when the SPECThead volume was
# inserted. 

# The SPECThead system is made of three 
# levels: base (for the head), crystal (for 
# the crystal and crystal matrix) and pixel 
# (for individual crystals for pixellated 
# gamma camera) For now, only the base of 
# the system is attached to a volume: the 
# volume SPECThead. For the system to get
# information about your crystal, the level
# crystal must be attached to the volume that 
# has been defined for the scintillating 
# crystal (crystal) 
/gate/systems/SPECThead/crystal/attach crystal
# Look at the system
/gate/systems/SPECThead/describe

#############################################
# P H Y S I C S
# Select the processes to consider
/gate/physics/gamma/selectRayleigh lowenergy
/gate/physics/gamma/selectPhotoelectric lowenergy
/gate/physics/gamma/selectCompton lowenergy
/gate/physics/gamma/selectGammaConversion inactive
/gate/physics/gamma/listProcesses

# Set some cuts to speed up the simulation
# X-rays are tracked until their energy fell 
# under 20 keV
/gate/physics/setXRayCut 20. keV
# Cut in order not to follow the secondary 
# electrons
/gate/physics/setElectronCut 1. km
/gate/physics/setDeltaRayCut 1. GeV


# Physics initialization
/run/initialize

#############################################
# S O U R C E
# Setting up the source
/gate/source/addSource SourceConfinement

# Define the shape of the source
/gate/source/SourceConfinement/gps/type Volume
/gate/source/SourceConfinement/gps/shape Cylinder

# Define the dimensions of the source
/gate/source/SourceConfinement/gps/radius 0.5 mm
/gate/source/SourceConfinement/gps/halfz  0.25 mm

# Define the placement of the source
/gate/source/SourceConfinement/gps/centre 0. 0. 0. mm

# Define the source as a gamma source
/gate/source/SourceConfinement/gps/particle gamma

# Define the gamma energy 
#/gate/source/SourceConfinement/gps/energytype Mono
/gate/source/SourceConfinement/gps/energy 140. keV

# Set the activity of the source
/gate/source/SourceConfinement/setActivity 500000. Bq

# Define a confinement
# the activity cannot move with time so the attenuating 
# medium is moved and the activity is forced to be in the 
# attenuating medium
/gate/source/SourceConfinement/gps/confine movsource_P

# Define the emission direction (4 str)
/gate/source/SourceConfinement/gps/angtype iso
/gate/source/SourceConfinement/gps/mintheta 0. deg
/gate/source/SourceConfinement/gps/maxtheta 180. deg
/gate/source/SourceConfinement/gps/minphi 0. deg
/gate/source/SourceConfinement/gps/maxphi 360. deg



#############################################
# R A N D O M 
# Change the root of the random module to run different simulations
/gate/output/root/setSaveRndmFlag 1

#############################################
# O U T P U T
# Select the options of the data output
# As there are several modules, settings have 
# to be defined for each module, especially in
# SPECT, where there are a lots of hits for 
# only a few counts, so it's better to limit 
# the amount of data produced Here the 
# SingleDigi output can be used if you have 
# your own program to process the data

/gate/output/root/setFileName pinholeSPECT
/gate/output/root/setRootSinglesAdderFlag 1
/gate/output/root/setRootSinglesBlurringFlag 1
/gate/output/root/setRootSinglesSpblurringFlag 1
/gate/output/root/setRootSinglesThresholderFlag 1
/gate/output/root/setRootSinglesUpholderFlag 1

#/gate/output/root/setRootHitFlag 0
#/gate/output/root/setRootSinglesFlag 0
#/gate/output/root/setRootCoincidencesFlag 0
#/gate/output/root/setRootNtupleFlag 0

#/gate/output/ascii/disable
/gate/output/ascii/setOutFileSinglesAdderFlag 0
/gate/output/ascii/setOutFileSinglesSpblurringFlag 0
/gate/output/ascii/setOutFileSinglesBlurringFlag 0
/gate/output/ascii/setOutFileSinglesThresholderFlag 0
/gate/output/ascii/setOutFileSinglesUpholderFlag 0

#############################################
# P R O J E C T I O N
# Makes a set of projections from the crystal 
# hits Define the binning the projection module 
# to be used
/gate/output/projection/pixelSizeX 2.03125 mm
/gate/output/projection/pixelSizeY 2.03125 mm
/gate/output/projection/pixelNumberX 128
/gate/output/projection/pixelNumberY 128

# Specify the projection plane (XY, YZ or ZX)
/gate/output/projection/projectionPlane YZ

#############################################
# E X P E R I M E N T
# Define the parameters of the experiment  
# (start time, stop time and time slice)
# The number of projections depends on the 
# number of time slice, the rotation speed of 
# the system and the number of heads
/gate/application/setTimeSlice       10.  s
/gate/application/setTimeStart        0.  s
/gate/application/setTimeStop        10.  s

#############################################
# V E R B O S I T Y
/control/verbose 0
/grdm/verbose 0
/run/verbose 0
/event/verbose 0
/tracking/verbose 0
/gate/application/verbose 0
/gate/generator/verbose 0
/gate/stacking/verbose 0
/gate/event/verbose 0
/gate/source/verbose 0
/gate/output/projection/verbose 0
/gate/output/verbose 0

# LET'S RUN THE SIMULATION!
/gate/application/startDAQ


More information about the Gate-users mailing list