diff --git a/simpa/core/device_digital_twins/pa_devices/ithera_msot_acuity.py b/simpa/core/device_digital_twins/pa_devices/ithera_msot_acuity.py index ba8c9b71..e6e2a2bf 100644 --- a/simpa/core/device_digital_twins/pa_devices/ithera_msot_acuity.py +++ b/simpa/core/device_digital_twins/pa_devices/ithera_msot_acuity.py @@ -108,7 +108,7 @@ def update_settings_for_use_of_model_based_volume_creator(self, global_settings) mediprene_layer_height_mm = self.mediprene_membrane_height_mm heavy_water_layer_height_mm = probe_size_mm - mediprene_layer_height_mm spacing_mm = global_settings[Tags.SPACING_MM] - old_volume_height_pixels = int(global_settings[Tags.DIM_VOLUME_Z_MM] / spacing_mm) + old_volume_height_pixels = round(global_settings[Tags.DIM_VOLUME_Z_MM] / spacing_mm) if Tags.US_GEL in volume_creator_settings and volume_creator_settings[Tags.US_GEL]: us_gel_thickness = np.random.normal(0.4, 0.1) @@ -143,12 +143,9 @@ def update_settings_for_use_of_model_based_volume_creator(self, global_settings) for molecule in structure_dict[Tags.MOLECULE_COMPOSITION]: old_volume_fraction = getattr(molecule, "volume_fraction") if isinstance(old_volume_fraction, torch.Tensor): - struc_start_vox = torch.tensor(structure_dict[Tags.STRUCTURE_START_MM]) - struc_end_vox = torch.tensor(structure_dict[Tags.STRUCTURE_END_MM]) - structure_size = (struc_end_vox - struc_start_vox) / spacing_mm if old_volume_fraction.shape[2] == old_volume_height_pixels: - width_shift_pixels = int(width_shift_for_structures_mm / spacing_mm) - z_shift_pixels = int(z_dim_position_shift_mm / spacing_mm) + width_shift_pixels = round(width_shift_for_structures_mm / spacing_mm) + z_shift_pixels = round(z_dim_position_shift_mm / spacing_mm) padding_height = (z_shift_pixels, 0, 0, 0, 0, 0) padding_width = ((width_shift_pixels, width_shift_pixels), (0, 0), (0, 0)) padded_up = F.pad(old_volume_fraction, padding_height, mode='constant', value=0) diff --git a/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_model_based_adapter.py b/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_model_based_adapter.py index 3c8a451c..f9bdde26 100644 --- a/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_model_based_adapter.py +++ b/simpa/core/simulation_modules/volume_creation_module/volume_creation_module_model_based_adapter.py @@ -64,9 +64,8 @@ def create_simulation_volume(self) -> dict: dtype=torch.float, device=self.torch_device) max_added_fractions = torch.zeros((x_dim_px, y_dim_px, z_dim_px), dtype=torch.float, device=self.torch_device) wavelength = self.global_settings[Tags.WAVELENGTH] - volume_size = torch.tensor([x_dim_px, y_dim_px, z_dim_px]) - for structure in priority_sorted_structures(self.global_settings, self.component_settings, volume_size): + for structure in priority_sorted_structures(self.global_settings, self.component_settings): self.logger.debug(type(structure)) structure_properties = structure.properties_for_wavelength(self.global_settings, wavelength) diff --git a/simpa/utils/libraries/structure_library/__init__.py b/simpa/utils/libraries/structure_library/__init__.py index dd286312..db527a4a 100644 --- a/simpa/utils/libraries/structure_library/__init__.py +++ b/simpa/utils/libraries/structure_library/__init__.py @@ -25,7 +25,7 @@ define_vessel_structure_settings -def priority_sorted_structures(settings: Settings, volume_creator_settings: dict, volume_size: torch.Tensor): +def priority_sorted_structures(settings: Settings, volume_creator_settings: dict): """ A generator function to lazily construct structures in descending order of priority """