-
Notifications
You must be signed in to change notification settings - Fork 59
/
geometry_testing.py
40 lines (32 loc) · 1.09 KB
/
geometry_testing.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
29
30
31
32
33
34
35
36
37
38
39
40
import deepdrr
from deepdrr import geo
from deepdrr.utils import test_utils
import numpy as np
import logging
log = logging.getLogger(__name__)
def test_scatter_geometry():
file_path = test_utils.download_sampledata("CT-chest")
volume = deepdrr.Volume.from_nrrd(file_path)
carm = deepdrr.MobileCArm(isocenter=volume.center_in_world)
print(f"volume center in world: {volume.center_in_world}")
print(f"volume spacing: {volume.spacing}")
print(f"volume ijk_from_world\n{volume.ijk_from_world}")
with deepdrr.Projector(
volume=volume,
carm=carm,
step=0.1,
mode="linear",
max_block_index=200,
spectrum="90KV_AL40",
photon_count=100000,
scatter_num=10e7,
threads=8,
neglog=True,
) as projector:
image = projector.project()
image = (image * 255).astype(np.uint8)
#Image.fromarray(image).save("output/test_multivolume.png")
output_dir = test_utils.get_output_dir()
if __name__ == "__main__":
logging.getLogger("deepdrr").setLevel(logging.DEBUG)
test_scatter_geometry()