beamformer_parameters.h (7127B)
1 /* See LICENSE for license details. */ 2 3 /* TODO(rnp): 4 * [ ]: Have a method for the library caller to take ownership of a "compute context" 5 * [ ]: Upload previously exported data for display. maybe this is a UI thing but doing it 6 * programatically would be nice. 7 */ 8 9 /* X(enumarant, number, shader file name, needs header, pretty name) */ 10 #define COMPUTE_SHADERS \ 11 X(CUDA_DECODE, 0, "", 0, "CUDA Decoding") \ 12 X(CUDA_HILBERT, 1, "", 0, "CUDA Hilbert") \ 13 X(DAS, 2, "das", 1, "DAS") \ 14 X(DECODE, 3, "decode", 1, "Decoding") \ 15 X(DECODE_FLOAT, 4, "", 1, "Decoding (F32)") \ 16 X(DECODE_FLOAT_COMPLEX, 5, "", 1, "Decoding (F32C)") \ 17 X(DEMOD, 6, "demod", 1, "Demodulation") \ 18 X(MIN_MAX, 7, "min_max", 0, "Min/Max") \ 19 X(SUM, 8, "sum", 0, "Sum") 20 21 typedef enum { 22 #define X(e, n, s, h, pn) CS_ ##e = n, 23 COMPUTE_SHADERS 24 #undef X 25 CS_LAST 26 } ComputeShaderID; 27 28 /* X(type, id, pretty name) */ 29 #define DECODE_TYPES \ 30 X(NONE, 0, "None") \ 31 X(HADAMARD, 1, "Hadamard") 32 33 /* X(type, id, pretty name) */ 34 #define IMAGE_PLANE_TAGS \ 35 X(XZ, 0, "XZ") \ 36 X(YZ, 1, "YZ") \ 37 X(XY, 2, "XY") \ 38 X(ARBITRARY, 3, "Arbitrary") 39 40 typedef enum { 41 #define X(type, id, pretty) IPT_ ##type = id, 42 IMAGE_PLANE_TAGS 43 #undef X 44 IPT_LAST 45 } ImagePlaneTag; 46 47 /* X(type, id, pretty name, fixed transmits) */ 48 #define DAS_TYPES \ 49 X(FORCES, 0, "FORCES", 1) \ 50 X(UFORCES, 1, "UFORCES", 0) \ 51 X(HERCULES, 2, "HERCULES", 1) \ 52 X(RCA_VLS, 3, "VLS", 0) \ 53 X(RCA_TPW, 4, "TPW", 0) \ 54 X(UHERCULES, 5, "UHERCULES", 0) \ 55 X(ACE_HERCULES, 6, "ACE-HERCULES", 1) 56 57 #define DAS_LOCAL_SIZE_X 32 58 #define DAS_LOCAL_SIZE_Y 1 59 #define DAS_LOCAL_SIZE_Z 32 60 61 #define DAS_VOXEL_OFFSET_UNIFORM_LOC 2 62 #define DAS_CYCLE_T_UNIFORM_LOC 3 63 64 #define MAX_BEAMFORMED_SAVED_FRAMES 16 65 66 /* TODO(rnp): actually use a substruct but generate a header compatible with MATLAB */ 67 /* X(name, type, size, gltype, glsize, comment) */ 68 #define BEAMFORMER_UI_PARAMS \ 69 X(output_min_coordinate, v4, , vec4, , "/* [m] Back-Top-Left corner of output region */") \ 70 X(output_max_coordinate, v4, , vec4, , "/* [m] Front-Bottom-Right corner of output region */") \ 71 X(output_points, uv4, , uvec4, , "/* Width * Height * Depth * (Frame Average Count) */") \ 72 X(sampling_frequency, f32, , float, , "/* [Hz] */") \ 73 X(center_frequency, f32, , float, , "/* [Hz] */") \ 74 X(speed_of_sound, f32, , float, , "/* [m/s] */") \ 75 X(off_axis_pos, f32, , float, , "/* [m] Position on screen normal to beamform in TPW/VLSHERCULES */") \ 76 X(beamform_plane, i32, , int, , "/* Plane to Beamform in TPW/VLS/HERCULES */") \ 77 X(f_number, f32, , float, , "/* F# (set to 0 to disable) */") \ 78 X(interpolate, b32, , bool, , "/* Perform Cubic Interpolation of RF Samples */") 79 80 #define BEAMFORMER_PARAMS_HEAD_V0 \ 81 X(channel_mapping, u16, [256], uvec4, [32], "/* Transducer Channel to Verasonics Channel */") \ 82 X(uforces_channels, u16, [256], uvec4, [32], "/* Channels used for virtual UFORCES elements */") \ 83 X(focal_depths, f32, [256], vec4, [64], "/* [m] Focal Depths for each transmit of a RCA imaging scheme*/") \ 84 X(transmit_angles, f32, [256], vec4, [64], "/* [degrees] Transmit Angles for each transmit of a RCA imaging scheme*/") \ 85 X(xdc_transform, f32, [16] , mat4, , "/* IMPORTANT: column major order */") \ 86 X(dec_data_dim, uv4, , uvec4, , "/* Samples * Channels * Acquisitions; last element ignored */") \ 87 X(xdc_element_pitch, f32, [2] , vec2, , "/* [m] Transducer Element Pitch {row, col} */") \ 88 X(rf_raw_dim, uv2, , uvec2, , "/* Raw Data Dimensions */") \ 89 X(transmit_mode, i32, , int, , "/* Method/Orientation of Transmit */") \ 90 X(decode, u32, , uint, , "/* Decode or just reshape data */") \ 91 X(das_shader_id, u32, , uint, , "") \ 92 X(time_offset, f32, , float, , "/* pulse length correction time [s] */") 93 94 #define BEAMFORMER_PARAMS_HEAD \ 95 X(xdc_transform, f32, [16] , mat4, , "/* IMPORTANT: column major order */") \ 96 X(dec_data_dim, uv4, , uvec4, , "/* Samples * Channels * Acquisitions; last element ignored */") \ 97 X(xdc_element_pitch, f32, [2] , vec2, , "/* [m] Transducer Element Pitch {row, col} */") \ 98 X(rf_raw_dim, uv2, , uvec2, , "/* Raw Data Dimensions */") \ 99 X(transmit_mode, i32, , int, , "/* Method/Orientation of Transmit */") \ 100 X(decode, u32, , uint, , "/* Decode or just reshape data */") \ 101 X(das_shader_id, u32, , uint, , "") \ 102 X(time_offset, f32, , float, , "/* pulse length correction time [s] */") 103 104 #define BEAMFORMER_PARAMS_TAIL \ 105 X(readi_group_id, u32, , uint, , "/* Which readi group this data is from */") \ 106 X(readi_group_size, u32, , uint, , "/* Size of readi transmit group */") 107 108 #define X(name, type, size, gltype, glsize, comment) type name size; 109 typedef struct { BEAMFORMER_UI_PARAMS } BeamformerUIParameters; 110 typedef struct { BEAMFORMER_PARAMS_HEAD } BeamformerParametersHead; 111 typedef struct { BEAMFORMER_PARAMS_TAIL } BeamformerParametersTail; 112 113 typedef struct { 114 BEAMFORMER_PARAMS_HEAD_V0 115 BEAMFORMER_UI_PARAMS 116 BEAMFORMER_PARAMS_TAIL 117 f32 _pad[3]; 118 } BeamformerParametersV0; 119 120 /* NOTE: This struct follows the OpenGL std140 layout. DO NOT modify unless you have 121 * read and understood the rules, particulary with regards to _member alignment_ */ 122 typedef struct { 123 BEAMFORMER_PARAMS_HEAD 124 BEAMFORMER_UI_PARAMS 125 BEAMFORMER_PARAMS_TAIL 126 f32 _pad[3]; 127 } BeamformerParameters; 128 #undef X 129 130 /* NOTE(rnp): keep this header importable for old C versions */ 131 #if __STDC_VERSION__ >= 201112L 132 _Static_assert((offsetof(BeamformerParameters, output_min_coordinate) & 15) == 0, 133 "BeamformerParameters.output_min_coordinate must lie on a 16 byte boundary"); 134 _Static_assert((sizeof(BeamformerParameters) & 15) == 0, 135 "sizeof(BeamformerParameters) must be a multiple of 16"); 136 #endif