garf 2.8__tar.gz → 2.9__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.
- {garf-2.8 → garf-2.9}/PKG-INFO +1 -1
- {garf-2.8 → garf-2.9}/garf/garf_detector.py +61 -2
- {garf-2.8 → garf-2.9}/garf.egg-info/PKG-INFO +1 -1
- {garf-2.8 → garf-2.9}/pyproject.toml +1 -1
- {garf-2.8 → garf-2.9}/LICENSE +0 -0
- {garf-2.8 → garf-2.9}/garf/__init__.py +0 -0
- {garf-2.8 → garf-2.9}/garf/bin/__init__.py +0 -0
- {garf-2.8 → garf-2.9}/garf/bin/garf_compare_image_profile.py +0 -0
- {garf-2.8 → garf-2.9}/garf/bin/garf_nn_info.py +0 -0
- {garf-2.8 → garf-2.9}/garf/bin/garf_plot_test_dataset.py +0 -0
- {garf-2.8 → garf-2.9}/garf/bin/garf_plot_training_dataset.py +0 -0
- {garf-2.8 → garf-2.9}/garf/bin/garf_train.py +0 -0
- {garf-2.8 → garf-2.9}/garf/bin/pytorch_info.py +0 -0
- {garf-2.8 → garf-2.9}/garf/garf_model.py +0 -0
- {garf-2.8 → garf-2.9}/garf/garf_train.py +0 -0
- {garf-2.8 → garf-2.9}/garf/helpers.py +0 -0
- {garf-2.8 → garf-2.9}/garf.egg-info/SOURCES.txt +0 -0
- {garf-2.8 → garf-2.9}/garf.egg-info/dependency_links.txt +0 -0
- {garf-2.8 → garf-2.9}/garf.egg-info/entry_points.txt +0 -0
- {garf-2.8 → garf-2.9}/garf.egg-info/not-zip-safe +0 -0
- {garf-2.8 → garf-2.9}/garf.egg-info/requires.txt +0 -0
- {garf-2.8 → garf-2.9}/garf.egg-info/top_level.txt +0 -0
- {garf-2.8 → garf-2.9}/readme.md +0 -0
- {garf-2.8 → garf-2.9}/setup.cfg +0 -0
{garf-2.8 → garf-2.9}/PKG-INFO
RENAMED
|
@@ -19,7 +19,7 @@ def load_nn(filename, verbose=True, gpu_mode="auto"):
|
|
|
19
19
|
verbose and print(f"GPU mode ?", current_gpu_mode, current_gpu_device)
|
|
20
20
|
|
|
21
21
|
verbose and print("Loading model ", filename)
|
|
22
|
-
nn = torch.load(filename, map_location=current_gpu_device)
|
|
22
|
+
nn = torch.load(filename, map_location=current_gpu_device, weights_only=False)
|
|
23
23
|
model_data = nn["model_data"]
|
|
24
24
|
|
|
25
25
|
# set to gpu mode
|
|
@@ -809,7 +809,7 @@ def arf_plane_intersection(batch, plane, image_plane_size_mm):
|
|
|
809
809
|
return batch
|
|
810
810
|
|
|
811
811
|
|
|
812
|
-
def
|
|
812
|
+
def arf_from_points_to_image_counts_OLD(
|
|
813
813
|
projected_batch, # 5D: 2 plane coordinates, 2 angles, 1 energy
|
|
814
814
|
model, # ARF neural network model
|
|
815
815
|
model_data, # associated model data
|
|
@@ -861,3 +861,62 @@ def arf_from_points_to_image_counts(
|
|
|
861
861
|
)
|
|
862
862
|
|
|
863
863
|
return u, v, w_pred
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
def arf_from_points_to_image_counts(
|
|
867
|
+
projected_batch, # 5D: 2 plane coordinates, 2 angles, 1 energy, 1 weight
|
|
868
|
+
model, # ARF neural network model
|
|
869
|
+
model_data, # associated model data
|
|
870
|
+
distance_to_crystal, # from detection plane to crystal center
|
|
871
|
+
image_plane_size_mm, # image plane in mm
|
|
872
|
+
image_plane_size_pixel, # image plane in pixel
|
|
873
|
+
image_plane_spacing,
|
|
874
|
+
): # image plane spacing
|
|
875
|
+
"""
|
|
876
|
+
Input : position, direction on the detector plane, energy
|
|
877
|
+
Compute
|
|
878
|
+
- garf.nn_predict
|
|
879
|
+
- garf.compute_angle_offset
|
|
880
|
+
- garf.remove_out_of_image_boundaries2
|
|
881
|
+
|
|
882
|
+
Used in 1) GarfDetector class and 2) gate ARFActor
|
|
883
|
+
|
|
884
|
+
"""
|
|
885
|
+
|
|
886
|
+
# get the two angles and the energy
|
|
887
|
+
ax = projected_batch[:, 2:5]
|
|
888
|
+
|
|
889
|
+
# predict weights
|
|
890
|
+
w_pred = nn_predict_numpy(model, model_data, ax)
|
|
891
|
+
|
|
892
|
+
# particle weight ?
|
|
893
|
+
if projected_batch.shape[1] == 6:
|
|
894
|
+
weights = projected_batch[:, 5]
|
|
895
|
+
w_pred = w_pred * weights[:, np.newaxis]
|
|
896
|
+
|
|
897
|
+
# Get the two first columns = points coordinates
|
|
898
|
+
cx = projected_batch[:, 0:2]
|
|
899
|
+
|
|
900
|
+
# Get the two next columns = angles
|
|
901
|
+
angles = projected_batch[:, 2:4]
|
|
902
|
+
|
|
903
|
+
# Take angle into account: consider position at collimator + half crystal
|
|
904
|
+
t = compute_angle_offset_numpy(angles, distance_to_crystal)
|
|
905
|
+
cx = cx + t
|
|
906
|
+
|
|
907
|
+
# convert coord to pixel
|
|
908
|
+
coord = (
|
|
909
|
+
cx + image_plane_size_mm / 2 - image_plane_spacing / 2
|
|
910
|
+
) / image_plane_spacing
|
|
911
|
+
coord = np.around(coord).astype(int)
|
|
912
|
+
|
|
913
|
+
# why vu and not uv ?
|
|
914
|
+
v = coord[:, 0]
|
|
915
|
+
u = coord[:, 1]
|
|
916
|
+
|
|
917
|
+
# remove points outside the image
|
|
918
|
+
u, v, w_pred = remove_out_of_image_boundaries_numpy(
|
|
919
|
+
u, v, w_pred, image_plane_size_pixel
|
|
920
|
+
)
|
|
921
|
+
|
|
922
|
+
return u, v, w_pred
|
|
@@ -17,7 +17,7 @@ find = { } # Scanning implicit namespaces is active by default
|
|
|
17
17
|
|
|
18
18
|
[project]
|
|
19
19
|
name = "garf"
|
|
20
|
-
version = "2.
|
|
20
|
+
version = "2.9"
|
|
21
21
|
dynamic = ["readme"]
|
|
22
22
|
authors = [{ name = "David Sarrut", email = "david.sarrut@creatis.insa-lyon.fr" }]
|
|
23
23
|
description = "Utility tools for GATE ARF simulations"
|
{garf-2.8 → garf-2.9}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{garf-2.8 → garf-2.9}/readme.md
RENAMED
|
File without changes
|
{garf-2.8 → garf-2.9}/setup.cfg
RENAMED
|
File without changes
|