From db59c9fe6c9eaa3ccc0cbdf8fac2b0512542a625 Mon Sep 17 00:00:00 2001 From: Friso Grace Date: Wed, 31 Jul 2024 14:55:46 +0200 Subject: [PATCH 1/2] Change the segmentation loader to know which keys to set --- ...olume_creation_module_segmentation_based_adapter.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_segmentation_based_adapter.py b/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_segmentation_based_adapter.py index 490ce2eb..41f531ec 100644 --- a/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_segmentation_based_adapter.py +++ b/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_segmentation_based_adapter.py @@ -4,7 +4,7 @@ from simpa.core.simulation_modules.volume_creation_module import VolumeCreatorModuleBase from simpa.utils import Tags -from simpa.utils.constants import property_tags +from simpa.utils.constants import wavelength_dependent_properties from simpa.io_handling import save_hdf5 import numpy as np import torch @@ -42,13 +42,11 @@ def create_simulation_volume(self) -> dict: for seg_class in segmentation_classes: class_properties = class_mapping[seg_class].get_properties_for_wavelength(wavelength) - for prop_tag in property_tags: - assigned_prop = class_properties[prop_tag] + for volume_key in volumes.keys(): + assigned_prop = class_properties[volume_key] if assigned_prop is None: assigned_prop = torch.nan - volumes[prop_tag][segmentation_volume == seg_class] = assigned_prop - - save_hdf5(self.global_settings, self.global_settings[Tags.SIMPA_OUTPUT_PATH], "/settings/") + volumes[volume_key][segmentation_volume == seg_class] = assigned_prop # convert volumes back to CPU for key in volumes.keys(): From a6ed04358b041e64d627535eb34f4d9a1ab35e59 Mon Sep 17 00:00:00 2001 From: Friso Grace Date: Wed, 31 Jul 2024 15:01:50 +0200 Subject: [PATCH 2/2] remove unnecessary imports --- .../volume_creation_module_segmentation_based_adapter.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_segmentation_based_adapter.py b/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_segmentation_based_adapter.py index 41f531ec..e2663804 100644 --- a/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_segmentation_based_adapter.py +++ b/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_segmentation_based_adapter.py @@ -4,8 +4,6 @@ from simpa.core.simulation_modules.volume_creation_module import VolumeCreatorModuleBase from simpa.utils import Tags -from simpa.utils.constants import wavelength_dependent_properties -from simpa.io_handling import save_hdf5 import numpy as np import torch