-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbeamformer_parameters.h
97 lines (90 loc) · 4.69 KB
/
beamformer_parameters.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* See LICENSE for license details. */
/* X(enumarant, number, shader file name, needs header, pretty name) */
#define COMPUTE_SHADERS \
X(CUDA_DECODE, 0, "", 0, "CUDA Decoding") \
X(CUDA_HILBERT, 1, "", 0, "CUDA Hilbert") \
X(DAS, 2, "das", 1, "DAS") \
X(DEMOD, 3, "demod", 1, "Demodulation") \
X(HADAMARD, 4, "hadamard", 1, "Decoding") \
X(MIN_MAX, 5, "min_max", 0, "Min/Max") \
X(SUM, 6, "sum", 0, "Sum")
enum compute_shaders {
#define X(e, n, s, h, pn) CS_ ##e = n,
COMPUTE_SHADERS
#undef X
CS_LAST
};
#define DECODE_MODE_NONE 0
#define DECODE_MODE_HADAMARD 1
#define DAS_ID_FORCES 0
#define DAS_ID_UFORCES 1
#define DAS_ID_HERCULES 2
#define DAS_ID_RCA_VLS 3
#define DAS_ID_RCA_TPW 4
#define MAX_BEAMFORMED_SAVED_FRAMES 16
/* NOTE: This struct follows the OpenGL std140 layout. DO NOT modify unless you have
* read and understood the rules, particulary with regards to _member alignment_ */
typedef struct {
u16 channel_mapping[256]; /* Transducer Channel to Verasonics Channel */
u16 uforces_channels[256]; /* Channels used for virtual UFORCES elements */
f32 focal_depths[256]; /* [m] Focal Depths for each transmit of a RCA imaging scheme*/
f32 transmit_angles[256]; /* [radians] Transmit Angles for each transmit of a RCA imaging scheme*/
f32 xdc_transform[16]; /* IMPORTANT: column major order */
uv4 dec_data_dim; /* Samples * Channels * Acquisitions; last element ignored */
uv4 output_points; /* Width * Height * Depth * (Frame Average Count) */
v4 output_min_coordinate; /* [m] Back-Top-Left corner of output region (w ignored) */
v4 output_max_coordinate; /* [m] Front-Bottom-Right corner of output region (w ignored)*/
f32 xdc_element_pitch[2]; /* [m] Transducer Element Pitch {row, col} */
uv2 rf_raw_dim; /* Raw Data Dimensions */
i32 transmit_mode; /* Method/Orientation of Transmit */
u32 decode; /* Decode or just reshape data */
f32 speed_of_sound; /* [m/s] */
f32 sampling_frequency; /* [Hz] */
f32 center_frequency; /* [Hz] */
f32 time_offset; /* pulse length correction time [s] */
f32 off_axis_pos; /* [m] Position on screen normal to beamform in 2D HERCULES */
i32 beamform_plane; /* Plane to Beamform in 2D HERCULES */
f32 f_number; /* F# (set to 0 to disable) */
u32 das_shader_id;
f32 _pad[2];
} BeamformerParameters;
/* NOTE: garbage to get the prepocessor to properly stringize the value of a macro */
#define str_(x) #x
#define str(x) str_(x)
#define COMPUTE_SHADER_HEADER "\
#version 460 core\n\
\n\
layout(std140, binding = 0) uniform parameters {\n\
uvec4 channel_mapping[32]; /* Transducer Channel to Verasonics Channel */\n\
uvec4 uforces_channels[32]; /* Channels used for virtual UFORCES elements */\n\
vec4 focal_depths[64]; /* [m] Focal Depths for each transmit of a RCA imaging scheme*/\n\
vec4 transmit_angles[64]; /* [radians] Transmit Angles for each transmit of a RCA imaging scheme*/\n\
mat4 xdc_transform; /* IMPORTANT: column major order */\n\
uvec4 dec_data_dim; /* Samples * Channels * Acquisitions; last element ignored */\n\
uvec4 output_points; /* Width * Height * Depth * (Frame Average Count) */\n\
vec4 output_min_coord; /* [m] Top left corner of output region */\n\
vec4 output_max_coord; /* [m] Bottom right corner of output region */\n\
vec2 xdc_element_pitch; /* [m] Transducer Element Pitch {row, col} */\n\
uvec2 rf_raw_dim; /* Raw Data Dimensions */\n\
int transmit_mode; /* Method/Orientation of Transmit */\n\
uint decode; /* Decode or just reshape data */\n\
float speed_of_sound; /* [m/s] */\n\
float sampling_frequency; /* [Hz] */\n\
float center_frequency; /* [Hz] */\n\
float time_offset; /* pulse length correction time [s] */\n\
float off_axis_pos; /* [m] Position on screen normal to beamform in 2D HERCULES */\n\
int beamform_plane; /* Plane to Beamform in 2D HERCULES */\n\
float f_number; /* F# (set to 0 to disable) */\n\
uint das_shader_id;\n\
};\n\
\n\
#define DECODE_MODE_NONE " str(DECODE_MODE_NONE) "\n\
#define DECODE_MODE_HADAMARD " str(DECODE_MODE_HADAMARD) "\n\
\n\
#define DAS_ID_FORCES " str(DAS_ID_FORCES) "\n\
#define DAS_ID_UFORCES " str(DAS_ID_UFORCES) "\n\
#define DAS_ID_HERCULES " str(DAS_ID_HERCULES) "\n\
#define DAS_ID_RCA_VLS " str(DAS_ID_RCA_VLS) "\n\
#define DAS_ID_RCA_TPW " str(DAS_ID_RCA_TPW) "\n\
\n\
#line 0\n"