-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathimage.zero.x.py
28 lines (22 loc) · 882 Bytes
/
image.zero.x.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import image
orig=image.image("/home/brent/phd/art2_lyso_box/stage2_box15/data/source-160.mhd")
###########
try:
im0=orig.copy()
except:
im0=image.image("/home/brent/phd/art2_lyso_box/stage2_box15/data/source-160.mhd")
im0.imdata[0:50,:,:,:] = 0
#im0.saveas("/home/brent/phd/art2_lyso_box/tmp/source-160-0.mhd")
#this image has FOP at x=+50mm. We want to zero out in a window of +/-5cm around this point. Since we dont have to zero out post FOP (is already zero), we just need to zero all negative X voxels. NOTE, image is 4D.
###########
energy_cuttoff = 1 #in MEV
orig.imdata[:,:,:,:int(250/10*energy_cuttoff)] = 0
im0.imdata[:,:,:,:int(250/10*energy_cuttoff)] = 0
try:
print(orig.getsum())
print(im0.getsum())
except:
print(orig.sum())
print(im0.sum())
im0.saveas("/home/brent/phd/art2_lyso_box/tmp/im0.mhd")
orig.saveas("/home/brent/phd/art2_lyso_box/tmp/orig.mhd")