Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T115 include bvf #182

Merged
merged 17 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
included blood volume fraction in output file:
- new Tags.DATA_FIELD_BLOOD_VOLUME_FRACTION
- this tag is added to TissueProperties
- new function calculate_bvf
- calculate_bvf used in MolecularComposition
  • Loading branch information
mschllnbrg committed Aug 17, 2022
commit 1f399a887e7b40e917e2e391519a4a44ec1536ea
24 changes: 24 additions & 0 deletions simpa/utils/calculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ def calculate_oxygenation(molecule_list):
return hbO2 / (hb + hbO2)


def calculate_bvf(molecule_list):
"""
jnoelke marked this conversation as resolved.
Show resolved Hide resolved
:return: the blood volume fraction value between 0 and 1, or 0, if oxy and deoxy not present.
"""
hb = None
hbO2 = None

for molecule in molecule_list:
if molecule.spectrum.spectrum_name == "Deoxyhemoglobin":
hb = molecule.volume_fraction
if molecule.spectrum.spectrum_name == "Oxyhemoglobin":
jnoelke marked this conversation as resolved.
Show resolved Hide resolved
hbO2 = molecule.volume_fraction

if hb is None and hbO2 is None:
return 0

if hb is None:
return hbO2
elif hbO2 is None:
return hb

return (hb + hbO2)


def create_spline_for_range(xmin_mm=0, xmax_mm=10, maximum_y_elevation_mm=1, spacing=0.1):
"""
Creates a functional that simulates distortion along the y position
Expand Down
3 changes: 2 additions & 1 deletion simpa/utils/libraries/molecule_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from simpa.utils.libraries.literature_values import OpticalTissueProperties, StandardProperties
from simpa.utils.libraries.spectrum_library import AnisotropySpectrumLibrary, ScatteringSpectrumLibrary
from simpa.utils import Spectrum
from simpa.utils.calculate import calculate_oxygenation, calculate_gruneisen_parameter_from_temperature
from simpa.utils.calculate import calculate_oxygenation, calculate_gruneisen_parameter_from_temperature, calculate_bvf
from simpa.utils.serializer import SerializableSIMPAClass
from simpa.utils.libraries.spectrum_library import AbsorptionSpectrumLibrary

Expand All @@ -35,6 +35,7 @@ def update_internal_properties(self):
self.internal_properties = TissueProperties()
self.internal_properties[Tags.DATA_FIELD_SEGMENTATION] = self.segmentation_type
self.internal_properties[Tags.DATA_FIELD_OXYGENATION] = calculate_oxygenation(self)
self.internal_properties[Tags.DATA_FIELD_BLOOD_VOLUME_FRACTION] = calculate_bvf(self)
for molecule in self:
self.internal_properties.volume_fraction += molecule.volume_fraction
self.internal_properties[Tags.DATA_FIELD_GRUNEISEN_PARAMETER] += \
Expand Down
7 changes: 7 additions & 0 deletions simpa/utils/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,13 @@ class Tags:
Usage: SIMPA package, naming convention
"""


DATA_FIELD_BLOOD_VOLUME_FRACTION = "bvf"
"""
Blood volume fraction of the generated volume/structure.\n
Usage: SIMPA package, naming convention
"""

DATA_FIELD_SEGMENTATION = "seg"
"""
Segmentation of the generated volume/structure.\n
Expand Down
1 change: 1 addition & 0 deletions simpa/utils/tissue_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class TissueProperties(dict):
Tags.DATA_FIELD_GRUNEISEN_PARAMETER,
Tags.DATA_FIELD_SEGMENTATION,
Tags.DATA_FIELD_OXYGENATION,
Tags.DATA_FIELD_BLOOD_VOLUME_FRACTION,
Tags.DATA_FIELD_DENSITY,
Tags.DATA_FIELD_SPEED_OF_SOUND,
Tags.DATA_FIELD_ALPHA_COEFF]
Expand Down