Skip to content

Commit

Permalink
Change the segmentation loader to know which keys to set
Browse files Browse the repository at this point in the history
  • Loading branch information
frisograce committed Jul 31, 2024
1 parent cbda565 commit db59c9f
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit db59c9f

Please sign in to comment.