Skip to content
Snippets Groups Projects
Commit f4d9dd7a authored by Simon Wittl's avatar Simon Wittl
Browse files

added fly by example

parent eae0f83f
No related branches found
No related tags found
No related merge requests found
......@@ -11,4 +11,5 @@ dist
*.aRTist
*.ply
/build/
/examples/
\ No newline at end of file
/examples/
/temp/
\ No newline at end of file
import h5py
import numpy as np
from artist_pythonlib import API
from tqdm import tqdm
from h5schemas.projection_geometry.overwrite_projection_geometry import overwrite_projection_geometry_at_index
FOD = 1000.
FDD = 2000.
DISTANCE = 20
DELTA = 0.01
def set_source_detector(api: API, z: float):
api.translate('S', 0., FOD, z)
api.translate('D', 0., FOD-FDD, z)
api.rotate('D', 90, 0, 0)
def add_error(api: API, error_source, error_detector):
error_source += (np.random.random(3) - 0.5) * 2 * 0.01
error_detector += (np.random.random(3) - 0.5) * 2 * 0.01
source = api.get_position('S')
api.translate('S', *(source + error_source))
detector = api.get_position('D')
api.translate('D', *(detector + error_detector))
return error_source, error_detector
def main():
file = h5py.File('./temp/fly_by_linear.h5', 'a')
api = API()
error_source, error_detector = np.zeros((3,)), np.ones((3,))
z_steps = np.linspace(-DISTANCE / 2, DISTANCE / 2, int(DISTANCE / DELTA))
for i in tqdm(range(z_steps.shape[0])):
z = z_steps[i]
set_source_detector(api, z)
error_source, error_detector = add_error(api, error_source, error_detector)
api.save_hdf5(file)
overwrite_projection_geometry_at_index(
file['projection_geometry_nominal'],
i,
[0., FOD-FDD, z],
api.get_orientation('D'),
[0., FOD, z],
api.get_orientation('S'))
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -14,6 +14,7 @@ dependencies = [
"pillow>=10.0",
"scipy>=1.10",
"thd-json>=0.1.11",
"tqdm>=4.67.1",
"xraydb>=4.5.4",
]
......
......@@ -12,6 +12,7 @@ dependencies = [
{ name = "pillow" },
{ name = "scipy" },
{ name = "thd-json" },
{ name = "tqdm" },
{ name = "xraydb" },
]
......@@ -29,6 +30,7 @@ requires-dist = [
{ name = "scipy", specifier = ">=1.10" },
{ name = "thd-json", git = "https://mygit.th-deg.de/roboct-public/roboct-schemas" },
{ name = "thd-json", marker = "extra == 'thd'", git = "https://mygit.th-deg.de/roboct-public/roboct-schemas" },
{ name = "tqdm", specifier = ">=4.67.1" },
{ name = "xraydb", specifier = ">=4.5.4" },
]
......@@ -41,6 +43,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl", hash = "sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3", size = 63815 },
]
[[package]]
name = "colorama"
version = "0.4.6"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },
]
[[package]]
name = "contourpy"
version = "1.3.1"
......@@ -248,8 +259,8 @@ wheels = [
[[package]]
name = "h5schemas"
version = "0.1.0"
source = { git = "https://mygit.th-deg.de/roboct-public/roboct-h5#3624c61163e3230bd2ac42884aa7b39d2cfcdeb8" }
version = "0.1.17"
source = { git = "https://mygit.th-deg.de/roboct-public/roboct-h5#4dda0165c77752ea0fdeb38b61c8c9abbd8eb857" }
dependencies = [
{ name = "h5py" },
{ name = "jsonref" },
......@@ -274,16 +285,16 @@ wheels = [
[[package]]
name = "hypothesis"
version = "6.129.4"
version = "6.130.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "attrs" },
{ name = "exceptiongroup", marker = "python_full_version < '3.11'" },
{ name = "sortedcontainers" },
]
sdist = { url = "https://files.pythonhosted.org/packages/bb/98/0051e770d36f7e0a55bcfa3590790448d57ed2f355da9adbb957b1f545d9/hypothesis-6.129.4.tar.gz", hash = "sha256:e9fd66c25b8f0aa6395ce6728360892c3af22529cc16cae7512a4672776d4781", size = 425235 }
sdist = { url = "https://files.pythonhosted.org/packages/25/01/3cca6316aaa0474e109f93c8fda2a31c23de92d86f4826f79ea0c0e6d011/hypothesis-6.130.0.tar.gz", hash = "sha256:274050b4518611500a55f7a5d0247a5359dce0107cb20f10323d6b587cc522d2", size = 425943 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/8d/7c/7266143385cbd19c839f9b61cc660d74c5ce2626fea41d8b215ccc5cfba3/hypothesis-6.129.4-py3-none-any.whl", hash = "sha256:45a31fe2b936688b2954f375c7f87e9dfefa4f2cddfa31cdeba15d77600e1286", size = 489542 },
{ url = "https://files.pythonhosted.org/packages/46/2b/638b52450e44d83230a12b1dd366c1c5c315b171432d4b1e8213e0cb5e04/hypothesis-6.130.0-py3-none-any.whl", hash = "sha256:b75e6fc4738d2e2a1b75d151432cb06e1303de3142905cd7060ba293c18376ce", size = 490230 },
]
[[package]]
......@@ -871,8 +882,8 @@ wheels = [
[[package]]
name = "thd-json"
version = "0.1.11"
source = { git = "https://mygit.th-deg.de/roboct-public/roboct-schemas#549627970741441756a671333ac8e5f949241eb3" }
version = "0.1.13"
source = { git = "https://mygit.th-deg.de/roboct-public/roboct-schemas#0f378205d14a78c744808eba8b5523e9ed2d075f" }
dependencies = [
{ name = "hatchling" },
{ name = "hypothesis" },
......@@ -923,6 +934,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/6e/c2/61d3e0f47e2b74ef40a68b9e6ad5984f6241a942f7cd3bbfbdbd03861ea9/tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc", size = 14257 },
]
[[package]]
name = "tqdm"
version = "4.67.1"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "colorama", marker = "platform_system == 'Windows'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/a8/4b/29b4ef32e036bb34e4ab51796dd745cdba7ed47ad142a9f4a1eb8e0c744d/tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2", size = 169737 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/d0/30/dc54f88dd4a2b5dc8a0279bdd7270e735851848b762aeb1c1184ed1f6b14/tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2", size = 78540 },
]
[[package]]
name = "trove-classifiers"
version = "2025.3.19.19"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment