garf 2.4__tar.gz → 2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {garf-2.4/garf.egg-info → garf-2.6}/PKG-INFO +9 -11
  2. garf-2.6/garf/__init__.py +4 -0
  3. garf-2.6/garf/bin/__init__.py +0 -0
  4. garf-2.4/bin/garf_plot_training_dataset → garf-2.6/garf/bin/garf_plot_training_dataset.py +5 -9
  5. garf-2.6/garf/bin/pytorch_info.py +38 -0
  6. garf-2.6/garf/garf_detector.py +851 -0
  7. garf-2.6/garf/garf_train.py +260 -0
  8. {garf-2.4 → garf-2.6/garf.egg-info}/PKG-INFO +9 -11
  9. garf-2.6/garf.egg-info/SOURCES.txt +22 -0
  10. garf-2.6/garf.egg-info/entry_points.txt +7 -0
  11. garf-2.6/garf.egg-info/not-zip-safe +1 -0
  12. {garf-2.4 → garf-2.6}/garf.egg-info/requires.txt +0 -1
  13. {garf-2.4 → garf-2.6}/garf.egg-info/top_level.txt +1 -0
  14. garf-2.6/pyproject.toml +45 -0
  15. garf-2.6/readme.md +14 -0
  16. garf-2.4/bin/garf_build_arf_image_with_nn +0 -144
  17. garf-2.4/bin/garf_convert_pth_to_pt +0 -72
  18. garf-2.4/bin/garf_merge_images +0 -59
  19. garf-2.4/bin/garf_scale +0 -77
  20. garf-2.4/bin/pytorch_info +0 -38
  21. garf-2.4/garf/__init__.py +0 -3
  22. garf-2.4/garf/nn.py +0 -635
  23. garf-2.4/garf.egg-info/SOURCES.txt +0 -21
  24. garf-2.4/setup.py +0 -34
  25. {garf-2.4 → garf-2.6}/LICENSE +0 -0
  26. /garf-2.4/bin/garf_compare_image_profile → /garf-2.6/garf/bin/garf_compare_image_profile.py +0 -0
  27. /garf-2.4/bin/garf_nn_info → /garf-2.6/garf/bin/garf_nn_info.py +0 -0
  28. /garf-2.4/bin/garf_plot_test_dataset → /garf-2.6/garf/bin/garf_plot_test_dataset.py +0 -0
  29. /garf-2.4/bin/garf_train → /garf-2.6/garf/bin/garf_train.py +0 -0
  30. /garf-2.4/garf/nn_model.py → /garf-2.6/garf/garf_model.py +0 -0
  31. {garf-2.4 → garf-2.6}/garf/helpers.py +0 -0
  32. {garf-2.4 → garf-2.6}/garf.egg-info/dependency_links.txt +0 -0
  33. {garf-2.4 → garf-2.6}/setup.cfg +0 -0
@@ -1,17 +1,19 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: garf
3
- Version: 2.4
3
+ Version: 2.6
4
4
  Summary: Utility tools for GATE ARF simulations
5
- Home-page: https://github.com/dsarrut/garf
6
- Author: David Sarrut
7
- Author-email: david.sarrut@creatis.insa-lyon.fr
8
- License: UNKNOWN
9
- Platform: UNKNOWN
5
+ Author-email: David Sarrut <david.sarrut@creatis.insa-lyon.fr>
10
6
  Classifier: Programming Language :: Python :: 3
11
7
  Classifier: License :: OSI Approved :: Apache Software License
12
8
  Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
13
10
  Description-Content-Type: text/markdown
14
11
  License-File: LICENSE
12
+ Requires-Dist: itk
13
+ Requires-Dist: numpy
14
+ Requires-Dist: pre-commit
15
+ Requires-Dist: torch>=2.1.0
16
+ Requires-Dist: tqdm
15
17
 
16
18
 
17
19
  GARF = GATE ARF
@@ -24,10 +26,6 @@ Learning SPECT detector angular response function with neural network for accele
24
26
  Sarrut D, Krah N, Badel JN, Létang JM.
25
27
  https://www.ncbi.nlm.nih.gov/pubmed/30238925
26
28
 
27
- A method to speed up Monte-Carlo simulations of single photon emission computed tomography (SPECT) imaging is proposed. It uses an artificial neural network (ANN) to learn the angular response function (ARF) of a collimator-detector system. The ANN is trained once from a complete simulation including the complete detector head with collimator, crystal, and digitization process. In the simulation, particle tracking inside the SPECT head is replaced by a plane. Photons are stopped at the plane and the energy and direction are used as input to the ANN, which provides detection probabilities in each energy window. Compared to histogram-based ARF, the proposed method is less dependent on the statistics of the training data, provides similar simulation efficiency, and requires less training data. The implementation is available within the GATE platform.
29
+ A method to speed up Monte-Carlo simulations of single photon emission computed tomography (SPECT) imaging is proposed. It uses an artificial neural network (ANN) to learn the angular response function (ARF) of a collimator-detector system. The ANN is trained once from a complete simulation including the complete detector head with collimator, crystal, and digitization process. In the simulation, particle tracking inside the SPECT head is replaced by a plane. Photons are stopped at the plane, and the energy and direction are used as input to the ANN, which provides detection probabilities in each energy window. Compared to histogram-based ARF, the proposed method is less dependent on the statistics of the training data, provides similar simulation efficiency, and requires less training data. The implementation is available within the GATE platform.
28
30
 
29
- - Benchmark: https://github.com/OpenGATE/GateBenchmarks/tree/master/t7_garf
30
31
  - Gate10 test: https://github.com/OpenGATE/opengate/blob/master/opengate/tests/src/test043_garf.py
31
- - Example: https://github.com/OpenGATE/GateContrib/tree/master/imaging_deprecated/garf
32
-
33
-
@@ -0,0 +1,4 @@
1
+ # import files
2
+ from .helpers import *
3
+ from .garf_train import *
4
+ from .garf_detector import *
File without changes
@@ -26,19 +26,15 @@ def garf_plot_training_dataset(data, rr):
26
26
  filename = data
27
27
  data, theta, phi, E, w = garf.load_training_dataset(filename)
28
28
 
29
- ## histo binning
29
+ # histo binning
30
30
  b = 100
31
31
 
32
32
  f, ax = plt.subplots(2, 2, figsize=(10, 10))
33
33
 
34
- n, bins, patches = ax[0, 0].hist(theta, b, density=True, facecolor="g", alpha=0.35)
35
- n, bins, patches = ax[0, 1].hist(phi, b, density=True, facecolor="g", alpha=0.35)
36
- n, bins, patches = ax[1, 0].hist(
37
- E * 1000, b, density=True, facecolor="b", alpha=0.35
38
- )
39
- n, bins, patches = ax[1, 1].hist(
40
- w[w > 0], b, density=False, facecolor="r", alpha=0.35
41
- )
34
+ ax[0, 0].hist(theta, b, density=True, facecolor="g", alpha=0.35)
35
+ ax[0, 1].hist(phi, b, density=True, facecolor="g", alpha=0.35)
36
+ ax[1, 0].hist(E * 1000, b, density=True, facecolor="b", alpha=0.35)
37
+ ax[1, 1].hist(w[w > 0], b, density=False, facecolor="r", alpha=0.35)
42
38
 
43
39
  ax[0, 0].set_xlabel("Theta angle (deg)")
44
40
  ax[0, 1].set_xlabel("Phi angle (deg)")
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import torch
5
+ import click
6
+
7
+ CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
8
+
9
+
10
+ @click.command(context_settings=CONTEXT_SETTINGS)
11
+ def pytorch_info():
12
+ """
13
+ \b
14
+ Print pytorch version
15
+ """
16
+
17
+ print("pytorch version", torch.__version__)
18
+
19
+ cuda_mode = torch.cuda.is_available()
20
+ if cuda_mode:
21
+ print("CUDA GPU mode is available")
22
+ print("CUDA version:", torch.version.cuda)
23
+ print("CUDA current device:", torch.cuda.current_device())
24
+ print("CUDA device counts:", torch.cuda.device_count())
25
+ print("CUDA device name:", torch.cuda.get_device_name(0))
26
+ else:
27
+ print("No CUDA GPU")
28
+
29
+ mps_mode = torch.backends.mps.is_available()
30
+ if mps_mode:
31
+ print("MPS GPU mode is available")
32
+ else:
33
+ print("No MPS GPU")
34
+
35
+
36
+ # -----------------------------------------------------------------------------
37
+ if __name__ == "__main__":
38
+ pytorch_info()