~brenthuisman/phd_tools

e80c93ef2c808fdcfcddf38955810eceb1cf3fc3 — Brent Huisman 8 months ago 4e0faad master
.
1 files changed, 24 insertions(+), 3 deletions(-)

M image.zero.x.py
M image.zero.x.py => image.zero.x.py +24 -3
@@ 1,7 1,28 @@
import image

im=image.image("/home/brent/data/phd/art2_lyso_box/stage2_box15_ibacuts/data/source-160.mhd")
im.imdata[0:50,:,:,:] = 0
im.saveas("/home/brent/data/phd/art2_lyso_box/stage2_box15_ibacuts/data/source-160-0.mhd")
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")