Skip to content

Commit 2a4b90a

Browse files
MingyeWuMingyeWu
authored andcommitted
Release v0.1.0, with EXE
1 parent 0b49fab commit 2a4b90a

File tree

12 files changed

+110
-4
lines changed

12 files changed

+110
-4
lines changed

EXE/catsim.exe

58.2 MB
Binary file not shown.

EXE/cfg/Phantom.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Phantom
2+
phantom.filename = 'CatSim_logo.json' # phantom filename
3+
phantom.centerOffset = [0.0, 0.0, 0.0] # offset of phantom center relative to origin (in mm)

EXE/cfg/Physics.cfg

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Geometric and energy sampling
2+
physics.energyCount = 20
3+
physics.monochromatic = -1
4+
physics.colSampleCount = 2
5+
physics.rowSampleCount = 2
6+
physics.srcXSampleCount = 2
7+
physics.srcYSampleCount = 2
8+
physics.viewSampleCount = 2
9+
10+
# Flags to determine what has to be recalculated each view
11+
physics.recalcDet = 0
12+
physics.recalcSrc = 0
13+
physics.recalcRayAngle = 0
14+
physics.recalcSpec = 0
15+
physics.recalcFilt = 0
16+
physics.recalcFlux = 0
17+
physics.recalcPht = 0
18+
physics.recalcDet = 0
19+
20+
# Noise on/off settings
21+
physics.enableQuantumNoise = 1
22+
physics.enableElectronicNoise = 1

EXE/cfg/Protocol.cfg

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
cfg.resultsName = "./results/simulation_test"
2+
protocol.scanTypes = [1, 1, 1] # flags for airscan, offset scan, phantom scan
3+
4+
# Table and gantry
5+
protocol.viewsPerRotation = 100 # total numbers of view per rotation
6+
protocol.viewCount = 100 # total number of views in scan
7+
protocol.startViewId = 0 # index of the first view in the scan
8+
protocol.stopViewId = protocol.startViewId+protocol.viewCount-1 # index of the last view in the scan
9+
protocol.airViewCount = 1 # number of views averaged for air scan
10+
protocol.offsetViewCount = 1 # number of views averaged for offset scan
11+
protocol.rotationTime = 1.0 # gantry rotation period (in seconds)
12+
protocol.rotationDirection = 1 # gantry rotation direction (1=CW, -1 CCW, seen from table foot-end)
13+
protocol.startAngle = 0 # relative to vertical y-axis (n degrees)
14+
protocol.tableSpeed = 0 # speed of table translation along positive z-axis (in mm/sec)
15+
protocol.startZ = 0 # start z-position of table
16+
protocol.tiltAngle = 0 # gantry tilt angle towards negative z-axis (in degrees)
17+
protocol.wobbleDistance = 0.0 # focalspot wobble distance
18+
protocol.focalspotOffset = [0, 0, 0] # focalspot position offset
19+
20+
# X-ray tube technique and filtration
21+
protocol.mA = 200 # tube current (in mA)
22+
protocol.spectrumFilename = "tungsten_tar7_120_unfilt.dat" # name of the spectrum file
23+
protocol.spectrumScaling = 1 # scaling factor such that spectrum is in photons / mA / s / mm^2 at 1000 mm
24+
protocol.bowtie = "sample_bowtie.dat" # name of the bowtie file (or [])
25+
protocol.flatFilter = ['al', 3.0] # additional filtration - materials and thicknesses (in mm)
26+
protocol.dutyRatio = 1.0 # tube ON time fraction (for pulsed tubes)

EXE/cfg/Recon.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Reconstruction
2+
recon.fov = 500.0 # diameter of the reconstruction field-of-view (in mm)
3+
recon.imageSize = 512 # number of columns and rows to be reconstructed (square)
4+
recon.sliceCount = 1 # number of slices to reconstruct
5+
recon.sliceThickness = 1.0 # reconstruction inter-slice interval (in mm)
6+
recon.centerOffset = [0.0,0.0,0.0] # reconstruction offset relative to center of rotation (in mm)

EXE/cfg/Scanner.cfg

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Scanner geometry
2+
scanner.sid = 540.0 # source-to-iso distance (in mm)
3+
scanner.sdd = 950.0 # source-to-detector distance (in mm)
4+
scanner.detectorColsPerMod = 1 # number of detector columns per module
5+
scanner.detectorRowsPerMod = 16 # number of detector rows per module
6+
scanner.detectorColOffset = 0.0 # detector column offset relative to centered position (in detector columns)
7+
scanner.detectorRowOffset = 0.0 # detector row offset relative to centered position (in detector rows)
8+
scanner.detectorColSize = 1.0 # detector column pitch or size (in mm)
9+
scanner.detectorRowSize = 1.0 # detector row pitch or size (in mm)
10+
scanner.detectorColCount = 900 # total number of detector columns
11+
scanner.detectorRowCount = scanner.detectorRowsPerMod # total number of detector rows
12+
scanner.detectorPrefilter = ['graphite', 1.0] # detector filter
13+
14+
# X-ray tube
15+
scanner.targetAngle = 7.0 # target angle relative to scanner XY-plane (in degrees)
16+
scanner.focalspotWidth = 1.0
17+
scanner.focalspotLength = 1.0
18+
19+
# Detector
20+
scanner.detectorMaterial = "lumex" # detector sensor material
21+
scanner.detectorDepth = 3.0 # detector sensor depth (in mm)
22+
scanner.detectionGain = 15.0 # factor to convert energy to electrons (electrons / keV)
23+
scanner.detectorColFillFraction = 0.9 # active fraction of each detector cell in the column direction
24+
scanner.detectorRowFillFraction = 0.9 # active fraction of each detector cell in the row direction
25+
scanner.eNoise = 5000.0 # standard deviation of Gaussian electronic noise (in electrons)

EXE/cfg/sim.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2020, General Electric Company. All rights reserved. See https://github.com/xcist/code/blob/master/LICENSE
2+
3+
4+
##--------- Make changes to parameters or load other cfg files (optional)
5+
# ct.resultsName = "./results/simulation_test"
6+
# ct.protocol.viewsPerRotation = 50
7+
# ct.protocol.viewCount = ct.protocol.viewsPerRotation
8+
# ct.protocol.stopViewId = ct.protocol.viewCount-1
9+
# ct.protocol.scanTypes = [1, 0, 0] # flags for airscan, offset scan, phantom scan
10+
# ct.load_cfg("Protocol_Sample_axial", "Physics_Sample", "Recon_Sample_2d") # new cfg overrides existing parameters
11+
12+
##--------- Run simulation
13+
ct.run_all() # run the scans defined by protocol.scanTypes
14+
15+
##--------- show results
16+
import matplotlib.pyplot as plt
17+
prep = xc.rawread(ct.resultsName+'.prep', [ct.protocol.viewCount, ct.scanner.detectorColCount, ct.scanner.detectorRowCount], 'float')
18+
prep = prep[-1, :, :]
19+
plt.plot(prep[:, 7])
20+
plt.show()
21+
22+
print()
23+
os.system('pause')

catsim/CatSim.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def run_all(self, *para):
2828
cfg = self.phantom_scan(cfg)
2929
if all(scanTypes):
3030
cfg = self.prep_view(cfg)
31+
print('Simulation is done')
3132
return cfg
3233

3334
def air_scan(self, *para):

catsim/CommonTools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def source_cfg(*para):
137137
return cfg
138138

139139
def vectornorm(xyz):
140-
if xyz.shape[0] is not 3:
140+
if xyz.shape[0]!=3:
141141
print('ERROR : argument of vectornorm has to be of size 3 x n');
142142
return
143143
else:

catsim/OneScan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def one_scan(cfg):
6363

6464
if cfg.sim.viewCount>10 and (viewId+1)%round(cfg.sim.viewCount/10)==0:
6565
print("Simulated view %d/%d, time: %.1f s" % (viewId+1, cfg.sim.viewCount, time.time()-cfg.sim.timer))
66-
print("Total sim time: %.1f s" % (time.time()-cfg.sim.timer))
66+
print("Scan sim time: %.1f s" % (time.time()-cfg.sim.timer))
6767

6868
return cfg
6969

0 commit comments

Comments
 (0)