Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pytheranostics/dicomtools/dicomtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,22 @@ def make_bqml_suv(
if "siemens" in self.ds.Manufacturer.lower():
self.ds.SeriesTime = self.ds.AcquisitionTime
self.ds.ContentTime = self.ds.AcquisitionTime
elif "ge" in self.ds.Manufacturer.lower(): # i think it applies to ge as well
self.ds.SeriesTime = self.ds.AcquisitionTime
self.ds.ContentTime = self.ds.AcquisitionTime

# Get the frame duration in seconds
frame_duration = (
self.ds.RotationInformationSequence[0].ActualFrameDuration / 1000
)
# get number of projections because manufacturers scale by this in the dicomfile
n_proj = (
self.ds.RotationInformationSequence[0].NumberOfFramesInRotation
* n_detectors
)
if "siemens" in self.ds.Manufacturer.lower():
n_proj = (
self.ds.RotationInformationSequence[0].NumberOfFramesInRotation
* n_detectors
)
elif "ge" in self.ds.Manufacturer.lower():
n_proj = self.ds.RotationInformationSequence[0].NumberOfFramesInRotation
# get voxel volume in ml
vox_vol = np.append(
np.asarray(self.ds.PixelSpacing), float(self.ds.SliceThickness)
Expand Down
20 changes: 13 additions & 7 deletions pytheranostics/dosimetry/base_dosimetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,14 +645,20 @@ def calculate_bed(self, kinetic: str) -> None:
) # Gy

if kinetic == "monoexp":
t_eff = numpy.log(2) / (
(
self.results.loc["Kidney_Left"]["Fit_params"][1]
+ self.results.loc["Kidney_Right"]["Fit_params"][1]
)
/ 2
)
# gather existing kidneys dynamically
kidney_labels = [
s for s in self.results.index if s.startswith("Kidney_")
]

# extract alpha parameters for those that exist
alphas = [self.results.loc[k]["Fit_params"][1] for k in kidney_labels]

# compute effective half-time using the mean alpha
alpha_mean = numpy.mean(alphas)
t_eff = numpy.log(2) / alpha_mean

bed[organ] = AD + 1 / alpha_beta * t_repair / (t_repair + t_eff) * AD**2

elif kinetic == "biexp":
mean_lambda_washout = (
self.results.loc["Kidney_Left"]["Fit_params"][1]
Expand Down
8 changes: 5 additions & 3 deletions pytheranostics/dosimetry/organ_s_dosimetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def check_mandatory_fields_organ(self) -> None:

return None

@staticmethod
# @staticmethod
def _load_human_mass_target_organs_table(self) -> pandas.DataFrame:
"""Load the reference human phantom masses."""
with resource_path(
Expand Down Expand Up @@ -180,7 +180,9 @@ def prepare_data(self) -> None:
].apply(lambda x: numpy.mean(x))

# Combine Kidneys.
kidneys = ["Kidney_Left", "Kidney_Right"]
kidneys = [
s for s in self.results_fitting.index if s.startswith("Kidney_")
] # e.g., Kidney_Left, Kidney_Right, or one kidney only
self.results_fitting.loc["Kidneys"] = self.results_fitting.loc[
kidneys
].sum()
Expand Down Expand Up @@ -231,7 +233,7 @@ def prepare_data(self) -> None:

self.results_fitting.loc["Red Marrow"][
"Volume_CT_mL"
] = 1170 # TODO volume hardcoded, think about alternatives
] = 1170 # TODO volume hardcoded, think about alternatives #this one works for blood based method only; for imaging method it should be scaled # EANM Dosimetry Committee guidelines for bone marro and whole-body dosimetry

self.results_fitting.loc["RemainderOfBody"]["Volume_CT_mL"] = (
self.config["PatientWeight_g"]
Expand Down
Loading
Loading