Vessel structure shouldn't vary (this much) as a function of the wavelength
Description
In the model-based volume creation, I added vessels with significant deformations (Tags.STRUCTURE_CURVATURE_FACTOR high, Tags.STRUCTURE_RADIUS_VARIATION_FACTOR high relatively to the vessel size, Tags.STRUCTURE_BIFURCATION_LENGTH_MM set within the lengths of most of the vessels). However, I simulated with different wavelengths and the deformations were different as a function of the wavelength used.
Priority High : the results for unmixing or comparison between wavelengths may therefore be flawed
Current Behavior
When running model-based volume creation with more than one wavelength on the same structure, the variation of radius and direction of vessels seems to be changing depending on the wavelength. As I understood it, although the settings are constant, ModelBasedAdapter is run multiple times and therefore the vessel structure is added the same number of times, but the script simpa/core/utils/libraries/structure_library/VesselStructure.py defines random parameters in a stochastic way:
l.105 : radius_array.append(np.random.uniform(-1, 1) * radius_variation + radius)
l.107 : step_vector = torch.rand(3).to(self.torch_device) * 2 - 1
Screenshots
$\mu_{a}$ map at the first slice of the volume at each wavelength (800, 850, 900 nm) :
$\mu_{a}$ map at the middle slice of the volume at each wavelength (800, 850, 900 nm) :
Expected behavior The values for $\mu_{a}$ inside each vessel should vary due to the spectral variation for each chromophores, but the map should look exactly the same.
The expected behavious is that we ensure having a consistent mask, or a consistent choice of the variation parameters along each vessel between successive scans in the scope of a unique simulation to account for the same structure.
Environment (please complete the following information):
- OS: Windows 11
- SIMPA version: 1.0.1.dev7+ga2f9a589.d20250205
- IDE: VSCode
Additional context I don't have sufficient knowledge of the package to do a PR right now, because the problem seems a bit complicated to me, but let's discuss it if needed.
The function calculate_vessel_samples computes a position_array and a radius_array for each vessel: setting these two parameters as wavelength independant properties of vessels in the setting dictionary could be one of the ways to explore... ?
Thank you! I just took a look and the problem is that we only set the numpy seed and not the torch seed, too. I will put a PR soon.
@kdreher are you still planning on following up on this?