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

Implemented #144, partial volume via settings #145

Merged
merged 3 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,19 @@ def update_settings_for_use_of_model_based_volume_creator(self, global_settings)
structure_dict[Tags.STRUCTURE_END_MM][2] = structure_dict[Tags.STRUCTURE_END_MM][
2] + z_dim_position_shift_mm

if Tags.CONSIDER_PARTIAL_VOLUME_IN_DEVICE in volume_creator_settings:
consider_partial_volume = volume_creator_settings[Tags.CONSIDER_PARTIAL_VOLUME_IN_DEVICE]
else:
consider_partial_volume = False

if Tags.US_GEL in volume_creator_settings and volume_creator_settings[Tags.US_GEL]:
us_gel_layer_settings = Settings({
Tags.PRIORITY: 5,
Tags.STRUCTURE_START_MM: [0, 0,
heavy_water_layer_height_mm + mediprene_layer_height_mm],
Tags.STRUCTURE_END_MM: [0, 0,
heavy_water_layer_height_mm + mediprene_layer_height_mm + us_gel_thickness],
Tags.CONSIDER_PARTIAL_VOLUME: True,
Tags.CONSIDER_PARTIAL_VOLUME: consider_partial_volume,
Tags.MOLECULE_COMPOSITION: TISSUE_LIBRARY.ultrasound_gel(),
Tags.STRUCTURE_TYPE: Tags.HORIZONTAL_LAYER_STRUCTURE
})
Expand All @@ -163,7 +168,7 @@ def update_settings_for_use_of_model_based_volume_creator(self, global_settings)
Tags.PRIORITY: 5,
Tags.STRUCTURE_START_MM: [0, 0, heavy_water_layer_height_mm],
Tags.STRUCTURE_END_MM: [0, 0, heavy_water_layer_height_mm + mediprene_layer_height_mm],
Tags.CONSIDER_PARTIAL_VOLUME: True,
Tags.CONSIDER_PARTIAL_VOLUME: consider_partial_volume,
Tags.MOLECULE_COMPOSITION: TISSUE_LIBRARY.mediprene(),
Tags.STRUCTURE_TYPE: Tags.HORIZONTAL_LAYER_STRUCTURE
})
Expand Down
4 changes: 3 additions & 1 deletion simpa/utils/libraries/structure_library/StructureBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def __init__(self, global_settings: Settings,
if Tags.PRIORITY in single_structure_settings:
self.priority = single_structure_settings[Tags.PRIORITY]

self.partial_volume = single_structure_settings[Tags.CONSIDER_PARTIAL_VOLUME]
if Tags.CONSIDER_PARTIAL_VOLUME in single_structure_settings:
self.partial_volume = single_structure_settings[Tags.CONSIDER_PARTIAL_VOLUME]
else: self.partial_volume = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think our coding convention is to have if else block statements on a new line unless it is an inline if-else. Apart from that the changes look reasonable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I changed this.


self.molecule_composition = single_structure_settings[Tags.MOLECULE_COMPOSITION]
self.molecule_composition.update_internal_properties()
Expand Down
6 changes: 6 additions & 0 deletions simpa/utils/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ class Tags:
If True, the structure will be generated with its edges only occupying a partial volume of the voxel.\n
Usage: adapter versatile_volume_creation
"""
CONSIDER_PARTIAL_VOLUME_IN_DEVICE = ("consider_partial_volume_in_device", bool)
"""
If True, the structures inside the device (i.e. US gel and membrane) will be generated with its edges
only occupying a partial volume of the voxel. \n
Usage: adapter versatile_volume_creation
"""

STRUCTURE_START_MM = ("structure_start", (list, tuple, np.ndarray))
"""
Expand Down