3D PA simulation question
Whenever I use the L-system to generate simulated blood vessels and then perform three-dimensional photoacoustic simulation with SIMPA, errors always occur. Below are some basic codes that I wrote: import os import numpy as np os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"
import tifffile from scipy.ndimage import zoom
import simpa as sp from simpa import Tags
TIFF_PATH = "./raw_data/15.tiff" # Path to your 3D TIFF (mask stack) OUTPUT_DIR = "./output" # Where HDF5 and logs will be stored
input_spacing_mm = 1 target_spacing_mm = 1
DO_ACOUSTIC = True
RANDOM_SEED = 1234
path_manager = sp.PathManager()
def load_tiff_as_segmentation(path, assume_binary=True): vol_zyx = tifffile.imread(path) # common shape: (Z, Y, X) if vol_zyx.ndim != 3: raise ValueError(f"Expected a 3D TIFF, got shape {vol_zyx.shape}")
seg_xyz = np.transpose(vol_zyx, (2, 1, 0))
if assume_binary and np.unique(seg_xyz).size > 2:
# Heuristic threshold for binary: Otsu is available in skimage, but to reduce deps, use percentile
thr = np.percentile(seg_xyz, 50) # median threshold
seg_xyz = (seg_xyz > thr).astype(np.uint8)
elif assume_binary and np.unique(seg_xyz).size <= 2:
mn, mx = int(seg_xyz.min()), int(seg_xyz.max())
if mn == mx:
raise ValueError("Segmentation is constant; please check your TIFF data.")
seg_xyz = (seg_xyz > mn).astype(np.uint8)
else:
seg_xyz = seg_xyz.astype(np.int32)
return seg_xyz
def resample_segmentation_nearest(seg_xyz, in_spacing, out_spacing): if in_spacing == out_spacing: return seg_xyz scale = in_spacing / out_spacing # zoom takes per-axis zoom. Our seg is (X, Y, Z). zoom_factors = (scale, scale, scale) seg_resampled = sp.round_x5_away_from_zero(zoom(seg_xyz, zoom_factors, order=0)).astype(int) return seg_resampled
def make_segmentation_class_mapping(unique_labels): mapping = dict() for label in unique_labels: if label == 0: mapping[label] = sp.TISSUE_LIBRARY.heavy_water() else: # Treat any non-zero as blood by default mapping[label] = sp.TISSUE_LIBRARY.blood() return mapping
def build_device(volume_transducer_dim_mm, volume_planar_dim_mm): import numpy as _np
pitch_mm = 0.25
min_elements = 4
margin_mm = 0.5
CENTER_FREQ_HZ = 3.96e6
BANDWIDTH_PERCENT = 55
element_width_u_mm = 0.24
element_width_v_mm = 0.5
fov_half = max((volume_transducer_dim_mm / 2.0) - margin_mm, 1.0)
number_detector_elements = int(_np.floor((2 * fov_half) / pitch_mm)) + 1
number_detector_elements = max(number_detector_elements, min_elements)
number_detector_elements = min(number_detector_elements, 128)
device_pos = _np.array([volume_transducer_dim_mm / 2,
volume_planar_dim_mm / 2,
1.0])
z_extent = min(5.0, max(1.0, volume_transducer_dim_mm / 4.0))
fov = _np.asarray([-fov_half, fov_half, 0.0, 0.0, 0.0, z_extent])
device = sp.PhotoacousticDevice(
device_position_mm=device_pos,
field_of_view_extent_mm=fov,
)
detection_geom = sp.PlanarArrayDetectionGeometry(
device_position_mm=device_pos,
field_of_view_extent_mm=fov,
center_frequency_hz=CENTER_FREQ_HZ,
bandwidth_percent=BANDWIDTH_PERCENT,
)
device.set_detection_geometry(detection_geom)
slit_length = min(20.0, volume_transducer_dim_mm)
device.add_illumination_geometry(sp.SlitIlluminationGeometry(
slit_vector_mm=[slit_length, 0.0, 0.0]
))
print(f"[DEBUG] Planar array (as Linear) with {number_detector_elements}x1 elements created.")
print(f"[DEBUG] Acoustic props: F_center={CENTER_FREQ_HZ / 1e6} MHz, BW={BANDWIDTH_PERCENT}%")
print(f"[DEBUG] Element size: {element_width_u_mm} mm (U) x {element_width_v_mm} mm (V)")
return device
def run_from_tiff(): os.makedirs(OUTPUT_DIR, exist_ok=True)
# 1) Load TIFF -> (X,Y,Z) labels
seg_xyz = load_tiff_as_segmentation(TIFF_PATH, assume_binary=True)
# 2) Optional resampling to target spacing
seg_xyz = resample_segmentation_nearest(seg_xyz, input_spacing_mm, target_spacing_mm)
# 3) SIMPA settings following official examples
np.random.seed(RANDOM_SEED)
# Dimensions in mm are derived from voxel count * spacing (X,Y,Z)
dim_x_mm = seg_xyz.shape[0] * target_spacing_mm
dim_y_mm = seg_xyz.shape[1] * target_spacing_mm
dim_z_mm = seg_xyz.shape[2] * target_spacing_mm
# General/global settings
general_settings = {
Tags.RANDOM_SEED: RANDOM_SEED,
Tags.VOLUME_NAME: "TIFFSegmentation_" + str(RANDOM_SEED),
Tags.SIMULATION_PATH: path_manager.get_hdf5_file_save_path() if hasattr(path_manager, "get_hdf5_file_save_path") else OUTPUT_DIR,
Tags.SPACING_MM: target_spacing_mm,
Tags.DIM_VOLUME_X_MM: dim_x_mm,
Tags.DIM_VOLUME_Y_MM: dim_y_mm,
Tags.DIM_VOLUME_Z_MM: dim_z_mm,
Tags.GPU: True,
Tags.WAVELENGTHS: [800],
Tags.DO_FILE_COMPRESSION: True,
# You can enable IPASC export if desired
Tags.DO_IPASC_EXPORT: True,
}
settings = sp.Settings(general_settings)
# Volume creation settings via segmentation-based adapter
settings.set_volume_creation_settings({
Tags.INPUT_SEGMENTATION_VOLUME: seg_xyz,
Tags.SEGMENTATION_CLASS_MAPPING: make_segmentation_class_mapping(np.unique(seg_xyz)),
# You can also set: Tags.VOLUME_CREATOR: Tags.VOLUME_CREATOR_SEGMENTATION_BASED,
})
# Optical settings (MCX)
settings.set_optical_settings({
Tags.OPTICAL_MODEL_NUMBER_PHOTONS: 1e7,
Tags.OPTICAL_MODEL_BINARY_PATH: path_manager.get_mcx_binary_path(),
# Example illumination (MSOT Acuity Echo style)
Tags.ILLUMINATION_TYPE: Tags.ILLUMINATION_TYPE_MSOT_ACUITY_ECHO,
Tags.LASER_PULSE_ENERGY_IN_MILLIJOULE: 50,
Tags.MCX_ASSUMED_ANISOTROPY: 0.9,
# Optional: print GPU info
# Tags.ADDITIONAL_FLAGS: ['--printgpu']
})
# Acoustic settings (k-Wave) - only used if DO_ACOUSTIC
if DO_ACOUSTIC:
settings.set_acoustic_settings({
Tags.ACOUSTIC_SIMULATION_3D: True, # set True for 3D k-Wave (much slower)
Tags.ACOUSTIC_MODEL_BINARY_PATH: path_manager.get_matlab_binary_path(),
Tags.KWAVE_PROPERTY_ALPHA_POWER: 0.00,
Tags.KWAVE_PROPERTY_SENSOR_RECORD: "p",
Tags.KWAVE_PROPERTY_PMLInside: False,
Tags.KWAVE_PROPERTY_PMLSize: [31, 32],
Tags.KWAVE_PROPERTY_PMLAlpha: 1.5,
Tags.KWAVE_PROPERTY_PlotPML: False,
Tags.RECORDMOVIE: False,
Tags.MOVIENAME: "kwave_log",
Tags.ACOUSTIC_LOG_SCALE: True,
})
# Reconstruction settings (Time Reversal) similar to example
settings.set_reconstruction_settings({
Tags.RECONSTRUCTION_PERFORM_BANDPASS_FILTERING: False,
Tags.ACOUSTIC_MODEL_BINARY_PATH: path_manager.get_matlab_binary_path(),
Tags.ACOUSTIC_SIMULATION_3D: True,
Tags.KWAVE_PROPERTY_ALPHA_POWER: 0.00,
Tags.TUKEY_WINDOW_ALPHA: 0.5,
Tags.BANDPASS_CUTOFF_LOWPASS_IN_HZ: int(8e6),
Tags.BANDPASS_CUTOFF_HIGHPASS_IN_HZ: int(0.1e4),
Tags.RECONSTRUCTION_BMODE_AFTER_RECONSTRUCTION: False,
Tags.RECONSTRUCTION_BMODE_METHOD: Tags.RECONSTRUCTION_BMODE_METHOD_HILBERT_TRANSFORM,
Tags.RECONSTRUCTION_APODIZATION_METHOD: Tags.RECONSTRUCTION_APODIZATION_BOX,
Tags.RECONSTRUCTION_MODE: Tags.RECONSTRUCTION_MODE_PRESSURE,
Tags.KWAVE_PROPERTY_SENSOR_RECORD: "p",
Tags.KWAVE_PROPERTY_PMLInside: False,
Tags.KWAVE_PROPERTY_PMLSize: [31, 32],
Tags.KWAVE_PROPERTY_PMLAlpha: 1.5,
Tags.KWAVE_PROPERTY_PlotPML: False,
Tags.RECORDMOVIE: False,
Tags.MOVIENAME: "recon_log",
Tags.ACOUSTIC_LOG_SCALE: True,
Tags.DATA_FIELD_SPEED_OF_SOUND: 1540,
Tags.DATA_FIELD_ALPHA_COEFF: 0.01,
Tags.DATA_FIELD_DENSITY: 1000,
Tags.SPACING_MM: target_spacing_mm
})
# Noise settings (optional, like in example)
settings["noise_initial_pressure"] = {
Tags.NOISE_MEAN: 1,
Tags.NOISE_STD: 0.01,
Tags.NOISE_MODE: Tags.NOISE_MODE_MULTIPLICATIVE,
Tags.DATA_FIELD: Tags.DATA_FIELD_INITIAL_PRESSURE,
Tags.NOISE_NON_NEGATIVITY_CONSTRAINT: True
}
settings["noise_time_series"] = {
Tags.NOISE_STD: 1,
Tags.NOISE_MODE: Tags.NOISE_MODE_ADDITIVE,
Tags.DATA_FIELD: Tags.DATA_FIELD_TIME_SERIES_DATA
}
# Build a device (geometry + illumination)
device = build_device(volume_transducer_dim_mm=dim_x_mm, volume_planar_dim_mm=dim_y_mm)
if DO_ACOUSTIC:
pipeline = [
sp.SegmentationBasedAdapter(settings),
sp.MCXAdapter(settings),
sp.GaussianNoise(settings, "noise_initial_pressure"),
sp.KWaveAdapter(settings),
sp.GaussianNoise(settings, "noise_time_series"),
sp.TimeReversalAdapter(settings),
sp.FieldOfViewCropping(settings)
]
else:
pipeline = [
sp.SegmentationBasedAdapter(settings),
sp.MCXAdapter(settings)
]
# Run simulation
sp.simulate(pipeline, settings, device)
# Visualisation
# Determine default wavelength to display
if Tags.WAVELENGTH in settings:
wl = settings[Tags.WAVELENGTH]
else:
wl = settings[Tags.WAVELENGTHS][0]
# Show results: segmentation map + initial pressure; if acoustic on, also show time series & reconstruction
sp.visualise_data(
path_to_hdf5_file=settings[Tags.SIMPA_OUTPUT_FILE_PATH],
wavelength=wl,
show_segmentation_map=True,
show_initial_pressure=True,
show_time_series_data=DO_ACOUSTIC,
show_reconstructed_data=DO_ACOUSTIC,
log_scale=False,
show_xz_only=False
)
if name == "main": print("[SIMPA] Starting simulation from TIFF segmentation...") print(f" TIFF_PATH = {TIFF_PATH}") print(f" input_spacing_mm = {input_spacing_mm} -> target_spacing_mm = {target_spacing_mm}") print(f" DO_ACOUSTIC = {DO_ACOUSTIC}") run_from_tiff() print("[SIMPA] Done.")
Could you give me some example to show how the code build?
It is difficult to say what could be the problem. Could you send the log of the error message? If possible, you can also send the tiff file that you use as segmentation input.
It is difficult to say what could be the problem. Could you send the log of the error message? If possible, you can also send the tiff file that you use as segmentation input.
Thank you for your reply. When I use the 14.tiff [256,256,256], it will report this error: D:\Anaconda\envs\simpa\python.exe E:\simpa-main\simpa_from_tiff_pipeline.py 2025-11-04 09:06:29,890 - DEBUG - Using $HOME$ path to search for config file: C:\Users\BMICT\path_config.env 2025-11-04 09:06:29,890 - DEBUG - Did not find path config in $HOME$: C:\Users\BMICT\path_config.env 2025-11-04 09:06:29,891 - DEBUG - Searching for path config in current working directory... 2025-11-04 09:06:29,891 - DEBUG - Found path_config.env in current working directory: E:\simpa-main\path_config.env [SIMPA] Starting simulation from TIFF segmentation... TIFF_PATH = ./raw_data/14.tiff input_spacing_mm = 1 -> target_spacing_mm = 1 DO_ACOUSTIC = True 2025-11-04 09:06:30,605 - DEBUG - Retrieved SIMPA_SAVE_DIRECTORY=E:/raw_data/ 2025-11-04 09:06:30,892 - DEBUG - Retrieved MCX_BINARY_PATH=E:/mcx/bin/mcx.exe 2025-11-04 09:06:30,892 - DEBUG - Retrieved MATLAB_BINARY_PATH=D:/Matlab/bin/matlab.exe 2025-11-04 09:06:30,892 - DEBUG - Retrieved MATLAB_BINARY_PATH=D:/Matlab/bin/matlab.exe 2025-11-04 09:06:30,892 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('sos', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have. The key 'sos' has been given the value 1540 2025-11-04 09:06:30,892 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('alpha_coeff', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have. The key 'alpha_coeff' has been given the value 0.01 2025-11-04 09:06:30,892 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('density', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have. The key 'density' has been given the value 1000 2025-11-04 09:06:30,892 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('noise_initial_pressure', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have. The key 'noise_initial_pressure' has been given the value {'noise_mean': 1, 'noise_std': 0.01, 'noise_mode': 'noise_mode_multiplicative', 'data_field': 'initial_pressure', 'noise_non_negativity_constraint': True} 2025-11-04 09:06:30,892 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('noise_time_series', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have. The key 'noise_time_series' has been given the value {'noise_std': 1, 'noise_mode': 'noise_mode_additive', 'data_field': 'time_series_data'} [DEBUG] Planar array (as Linear) with 128x1 elements created. [DEBUG] Acoustic props: F_center=3.96 MHz, BW=55% [DEBUG] Element size: 0.24 mm (U) x 0.5 mm (V) 2025-11-04 09:06:30,914 - DEBUG - Processing is done on cuda 2025-11-04 09:06:30,914 - DEBUG - Processing is done on cuda 2025-11-04 09:06:30,914 - DEBUG - Processing is done on cuda 2025-11-04 09:06:30,914 - DEBUG - Processing is done on cuda 2025-11-04 09:06:30,914 - DEBUG - Processing is done on cuda 2025-11-04 09:06:30,914 - DEBUG - Processing is done on cuda 2025-11-04 09:06:30,914 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('data_field', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have. The key 'data_field' has been given the value ['mua', 'mus', 'g', 'gamma', 'seg', 'oxy', 'bvf', 'density', 'sos', 'alpha_coeff', 'sensor_mask', 'directivity_angle', 'fluence', 'initial_pressure'] 2025-11-04 09:06:30,914 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('FieldOfViewCropping', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have. The key 'FieldOfViewCropping' has been given the value {'data_field': ['mua', 'mus', 'g', 'gamma', 'seg', 'oxy', 'bvf', 'density', 'sos', 'alpha_coeff', 'sensor_mask', 'directivity_angle', 'fluence', 'initial_pressure']} 2025-11-04 09:06:30,915 - DEBUG - Processing is done on cuda 2025-11-04 09:06:30,915 - DEBUG - Saving settings dictionary... 2025-11-04 09:06:31,166 - DEBUG - Saving settings dictionary...[Done] 2025-11-04 09:06:31,166 - DEBUG - Running pipeline for wavelength 800nm... 2025-11-04 09:06:31,166 - DEBUG - Running <class 'simpa.core.simulation_modules.volume_creation_module.segmentation_based_adapter.SegmentationBasedAdapter'> 2025-11-04 09:06:31,167 - INFO - VOLUME CREATION 2025-11-04 09:06:43,553 - DEBUG - Running <class 'simpa.core.simulation_modules.optical_module.mcx_adapter.MCXAdapter'> 2025-11-04 09:06:43,554 - INFO - Simulating the optical forward process... 2025-11-04 09:06:45,195 - DEBUG - [118.5 128.5 1.5] {'Session': {'ID': 'E:/raw_data//TIFFSegmentation_1234_output', 'DoAutoThread': 1, 'Photons': 10000000.0, 'DoMismatch': 0, 'RNGSeed': 1234}, 'Forward': {'T0': 0, 'T1': 5e-09, 'Dt': 5e-09}, 'Optode': {'Source': {'Type': 'slit', 'Pos': [np.float64(118.5), np.float64(128.5), np.float64(1.5)], 'Dir': [np.float64(0.0), np.float64(0.0), np.float64(1.0)], 'Param1': [20.0, 0.0, 0.0, 0], 'Param2': [0, 0, 0, 0]}}, 'Domain': {'OriginType': 0, 'LengthUnit': 1, 'Media': [{'mua': 0, 'mus': 0, 'g': 1, 'n': 1}, {'mua': 1, 'mus': 1, 'g': 0.9, 'n': 1}], 'MediaFormat': 'muamus_float', 'Dim': [256, 256, 256], 'VolumeFile': 'E:/raw_data//TIFFSegmentation_1234.bin'}} 2025-11-04 09:06:45,196 - INFO - ['E:/mcx/bin/mcx.exe', '-f', 'E:/raw_data//TIFFSegmentation_1234.json', '-O', 'F', '-a', '1', '-F', 'jnii'] ###############################################################################
Monte Carlo eXtreme (MCX) -- CUDA
Copyright (c) 2009-2025 Qianqian Fang <q.fang at neu.edu>
https://mcx.space/ & https://neurojson.io
Computational Optics & Translational Imaging (COTI) Lab- http://fanglab.org
Department of Bioengineering, Northeastern University, Boston, MA, USA
###############################################################################
The MCX Project is funded by the NIH/NIGMS under grant R01-GM114365
###############################################################################
Open-source codes and reusable scientific data are essential for research,
MCX proudly developed human-readable JSON-based data formats for easy reuse.#
#Please visit our free scientific data sharing portal at https://neurojson.io #
and consider sharing your public datasets in standardized JSON/JData format
############################################################################### $Rev::4f953a$v2025.10$Date::2025-10-14 18:22:03 -04$ by $Author::Qianqian Fang$ ###############################################################################
- code name: [Kilo-Kelvin] compiled by nvcc [10.2] for CUDA-arch [350] on [Oct 14 2025]
- compiled with: RNG [xorshift128+] seed length [4]
GPU=1 (NVIDIA GeForce GTX 1650) threadph=348 extra=22144 np=10000000 nthread=28672 maxgate=1 repetition=1 initializing streams ... init complete : 15 ms requesting shared memory: 1280 bytes launching MCX simulation for time window [0.00e+00ns 5.00e+00ns] ... simulation run# 1 ... kernel complete: 5340 ms retrieving fields ... transfer complete: 5381 ms normalizing raw data ... source 1, normalization factor alpha=0.000000 data normalization complete : 5622 ms saving data to file ... compressing data [zlib] ...compression ratio: 1.3% after encoding: 1.7% saving data complete : 5786 ms
simulated 10000000 photons (10000000) with 28672 threads (repeat x1)
MCX simulation speed: 1880.05 photon/ms
total simulated energy: 10000000.00 absorbed: 77.03378%
(loss due to initial specular reflection is excluded in the total)
fluence.shape (256, 256, 256, 1, 1)
fluence.shape (256, 256, 256)
2025-11-04 09:06:54,638 - INFO - Simulating the optical forward process...[Done]
2025-11-04 09:06:54,696 - DEBUG - Running <class 'simpa.core.processing_components.monospectral.noise.gaussian_noise.GaussianNoise'>
2025-11-04 09:06:54,696 - INFO - Applying Gaussian Noise Model...
2025-11-04 09:06:54,696 - DEBUG - Noise model mode: noise_mode_multiplicative
2025-11-04 09:06:54,696 - DEBUG - Noise model mean: 1
2025-11-04 09:06:54,697 - DEBUG - Noise model std: 0.01
2025-11-04 09:06:54,697 - DEBUG - Noise model non-negative: True
2025-11-04 09:06:56,156 - INFO - Applying Gaussian Noise Model...[Done]
2025-11-04 09:06:56,165 - DEBUG - Running <class 'simpa.core.simulation_modules.acoustic_module.k_wave_adapter.KWaveAdapter'>
2025-11-04 09:06:56,165 - INFO - Simulating the acoustic forward process...
2025-11-04 09:06:56,165 - DEBUG - OPTICAL_PATH: /simulations/optical_forward_model_output/
2025-11-04 09:06:56,671 - DEBUG - field_of_view_extent: [-127.5 127.5 0. 0. 0. 5. ]
Traceback (most recent call last):
File "E:\simpa-main\simpa_from_tiff_pipeline.py", line 310, in
Process finished with exit code 1
And when I use the 15.tiff [25,70,20], it will report this error:
D:\Anaconda\envs\simpa\python.exe E:\simpa-main\simpa_from_tiff_pipeline.py
2025-11-04 09:12:38,855 - DEBUG - Using $HOME$ path to search for config file: C:\Users\BMICT\path_config.env
2025-11-04 09:12:38,855 - DEBUG - Did not find path config in $HOME$: C:\Users\BMICT\path_config.env
2025-11-04 09:12:38,855 - DEBUG - Searching for path config in current working directory...
2025-11-04 09:12:38,856 - DEBUG - Found path_config.env in current working directory: E:\simpa-main\path_config.env
[SIMPA] Starting simulation from TIFF segmentation...
TIFF_PATH = ./raw_data/15.tiff
input_spacing_mm = 1 -> target_spacing_mm = 1
DO_ACOUSTIC = True
2025-11-04 09:12:38,859 - DEBUG - Retrieved SIMPA_SAVE_DIRECTORY=E:/raw_data/
2025-11-04 09:12:38,885 - DEBUG - Retrieved MCX_BINARY_PATH=E:/mcx/bin/mcx.exe
2025-11-04 09:12:38,885 - DEBUG - Retrieved MATLAB_BINARY_PATH=D:/Matlab/bin/matlab.exe
2025-11-04 09:12:38,886 - DEBUG - Retrieved MATLAB_BINARY_PATH=D:/Matlab/bin/matlab.exe
2025-11-04 09:12:38,886 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('sos', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have.
The key 'sos' has been given the value 1540
2025-11-04 09:12:38,886 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('alpha_coeff', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have.
The key 'alpha_coeff' has been given the value 0.01
2025-11-04 09:12:38,886 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('density', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have.
The key 'density' has been given the value 1000
2025-11-04 09:12:38,886 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('noise_initial_pressure', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have.
The key 'noise_initial_pressure' has been given the value {'noise_mean': 1, 'noise_std': 0.01, 'noise_mode': 'noise_mode_multiplicative', 'data_field': 'initial_pressure', 'noise_non_negativity_constraint': True}
2025-11-04 09:12:38,886 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('noise_time_series', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have.
The key 'noise_time_series' has been given the value {'noise_std': 1, 'noise_mode': 'noise_mode_additive', 'data_field': 'time_series_data'}
[DEBUG] Planar array (as Linear) with 77x1 elements created.
[DEBUG] Acoustic props: F_center=3.96 MHz, BW=55%
[DEBUG] Element size: 0.24 mm (U) x 0.5 mm (V)
2025-11-04 09:12:38,907 - DEBUG - Processing is done on cuda
2025-11-04 09:12:38,907 - DEBUG - Processing is done on cuda
2025-11-04 09:12:38,907 - DEBUG - Processing is done on cuda
2025-11-04 09:12:38,907 - DEBUG - Processing is done on cuda
2025-11-04 09:12:38,907 - DEBUG - Processing is done on cuda
2025-11-04 09:12:38,907 - DEBUG - Processing is done on cuda
2025-11-04 09:12:38,907 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('data_field', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have.
The key 'data_field' has been given the value ['mua', 'mus', 'g', 'gamma', 'seg', 'oxy', 'bvf', 'density', 'sos', 'alpha_coeff', 'sensor_mask', 'directivity_angle', 'fluence', 'initial_pressure']
2025-11-04 09:12:38,907 - WARNING - The key for the Settings dictionary should be a tuple in the form of ('FieldOfViewCropping', (data_type_1, data_type_2, ...)). The tuple of data types specifies all possible types, the value can have.
The key 'FieldOfViewCropping' has been given the value {'data_field': ['mua', 'mus', 'g', 'gamma', 'seg', 'oxy', 'bvf', 'density', 'sos', 'alpha_coeff', 'sensor_mask', 'directivity_angle', 'fluence', 'initial_pressure']}
2025-11-04 09:12:38,908 - DEBUG - Processing is done on cuda
2025-11-04 09:12:38,908 - ERROR - Volume x dimension is too small to encompass RSOM device in simulation!Must be at least 51.0 mm but was 20 mm
2025-11-04 09:12:38,908 - CRITICAL - The simulation settings do not work with the digital device twin chosen.Please check the log for details.
Traceback (most recent call last):
File "E:\simpa-main\simpa_from_tiff_pipeline.py", line 310, in
Process finished with exit code 1
And I have uploaded two tiff files. Thanks for your reply again.
It looks like your setting in the simulation device dimensions do not match the dimensions of your simulation volume:
2025-11-04 09:12:38,908 - ERROR - Volume x dimension is too small to encompass RSOM device in simulation!Must be at least 51.0 mm but was 20 mm
To prevent undefined out-of-bounds behaviour in the simulations, we require all devices to fully reside in the simulation volume. Easy fix is to widen your tissue volume cube (e.g. by repeating the edges of your segmentation mask.