OpenwaterHealth / OpenLIFU-python

focused ultrasound toolbox
GNU Affero General Public License v3.0
11 stars 2 forks source link

Regressions with minimal solution analysis #141

Open ltetrel opened 1 month ago

ltetrel commented 1 month ago

After testing the functionality from https://github.com/OpenwaterHealth/OpenLIFU-python/pull/140 and comparing with the expected solution analysis output from Matlab (only mainlobe_pnp_MPa ATM) , there are some regressions. This can come from two sources:

  1. Simulation output: there are some differences in the k-wave simulations output between the matlab and python generated-one.
  2. Incorrect mask computation: and more specifically when we define the mask in the transducer reference, This depends on geo.py which was not tested previously.

tests/test_mask_focus.py and tests/test_offset_grid.py would need to be updated accordingly.

ebrahimebrahim commented 3 weeks ago

Can test directly that the mailobe pnp is computed correctly by creating a fake pnp volume with two peaks, with a smaller peak closer to the focus, and make sure it's producing the peak value around the focus

ltetrel commented 2 weeks ago

After some digging, the issue is not in the simulation output values:

  1. There are indeed differences in the simulation output values but it is negligible, the general shape is coherent (we see an oblong-shaped spot where the focus is).
  2. When checking the maximum value of p_min (which is a coherent method for the location of the mainlobe) in both matlab and python, there are close.

The issue is on the implementation of the focus mask, which is currently not valid (mask is too far from the focus region). Probably in src/openlifu/bf/offset_grid.py (to compare with offset_grid.m in matlab).