ogl_beamforming

Ultrasound Beamforming Implemented with OpenGL
git clone anongit@rnpnr.xyz:ogl_beamforming.git
Log | Files | Refs | Feed | Submodules | LICENSE

Commit: bd95ac21657528e45a0935fbd116f281eff07d15
Parent: cc2ead117a8cba6d549c4949d744efa52bf58c80
Author: Randy Palamar
Date:   Fri,  2 Aug 2024 11:55:05 -0600

add a parameter for UFORCES vs FORCES operation

The only difference is whether or not you should skip the first rf aquisition.

Diffstat:
Mbeamformer_parameters.h | 3++-
Mshaders/hadamard.glsl | 1+
Mshaders/lpf.glsl | 1+
Mshaders/uforces.glsl | 9+++++----
4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/beamformer_parameters.h b/beamformer_parameters.h @@ -20,5 +20,6 @@ typedef struct { f32 center_frequency; /* [Hz] */ f32 focal_depth; /* [m] */ f32 time_offset; /* pulse length correction time [s] */ - f32 _pad[2]; + u32 uforces; /* mode is UFORCES (1) or FORCES (0) */ + f32 _pad[1]; } BeamformerParameters; diff --git a/shaders/hadamard.glsl b/shaders/hadamard.glsl @@ -32,6 +32,7 @@ layout(std140, binding = 0) uniform parameters { float center_frequency; /* [Hz] */ float focal_depth; /* [m] */ float time_offset; /* pulse length correction time [s] */ + uint uforces; /* mode is UFORCES (1) or FORCES (0) */ }; void main() diff --git a/shaders/lpf.glsl b/shaders/lpf.glsl @@ -32,6 +32,7 @@ layout(std140, binding = 0) uniform parameters { float center_frequency; /* [Hz] */ float focal_depth; /* [m] */ float time_offset; /* pulse length correction time [s] */ + uint uforces; /* mode is UFORCES (1) or FORCES (0) */ }; //layout(location = 1) uniform uint u_lpf_order; diff --git a/shaders/uforces.glsl b/shaders/uforces.glsl @@ -24,6 +24,7 @@ layout(std140, binding = 0) uniform parameters { float center_frequency; /* [Hz] */ float focal_depth; /* [m] */ float time_offset; /* pulse length correction time [s] */ + uint uforces; /* mode is UFORCES (1) or FORCES (0) */ }; layout(rg32f, location = 1) uniform image3D u_out_data_tex; @@ -81,10 +82,10 @@ void main() float time_scale = radians(360) * center_frequency; uint ridx = dec_data_dim.y * dec_data_dim.x; - /* NOTE: skip first acquisition since its garbage */ - for (uint i = 1; i < dec_data_dim.z; i++) { - uint base_idx = (i - 1) / 4; - uint sub_idx = (i - 1) - base_idx * 4; + /* NOTE: skip first acquisition in uforces since its garbage */ + for (uint i = uforces; i < dec_data_dim.z; i++) { + uint base_idx = (i - uforces) / 4; + uint sub_idx = (i - uforces) - base_idx * 4; vec3 focal_point = vec3(uforces_channels[base_idx][sub_idx] * dx, 0, focal_depth); float transmit_dist = focal_depth + dzsign * distance(image_point, focal_point);