IMSY-DKFZ / simpa

The Simulation and Image Processing for Photonics and Acoustics (SIMPA) toolkit.
https://simpa.readthedocs.io/en/main/
Other
74 stars 18 forks source link

[1, 1, 1] origin used in MCX #257

Open faberno opened 1 year ago

faberno commented 1 year ago

Describe the bug In the MCX adapter, we set the origintype to 0, which corresponds to the origin [1.0, 1.0, 1.0] (MCX documentation: "1 if the origin is [0 0 0], 0 if it is [1.0,1.0,1.0]"). Maybe I overlooked something, but I would have guessed we should start at [0, 0, 0].

https://github.com/IMSY-DKFZ/simpa/blob/78d1f8bd1d9a7a22defae5de4874f2b3beec4e94/simpa/core/simulation_modules/optical_simulation_module/optical_forward_model_mcx_adapter.py#L142

faberno commented 6 months ago

Seems like this bug could have a higher extend than expected. All illuminations add 0.5 to their voxel positiions, like this device_position = list(self.device_position_mm / spacing + 0.5). But the correct configuration seems to be OriginType=1 ([0, 0, 0] origin) and remove the +0.5. Here is the output of such configuration with a pencil beam illumination at different positions: 0_00 For the position 4.5 and 5.5 the laser seems to lie exactly in the middle of the voxel, as the fluence spreads evenly to its neighbors. For the position 5 the laser lies at the border between voxels as the peak changes voxels when slightly moved.

In contrast the current configuration in Simpa is OriginType=0 ([1, 1, 1] origin) and pos+0.5, which looks like this 1_05 Here when the laser has position 5, the peak is at 4.5.