Debian Codegraph @

matlab/+ismrmrd/+util/AcquisitionHeaderToBytes.m

raw
1 function bytes = AcquisitionHeaderToBytes(hdr)
2 % Convert to an ISMRMRD AcquisitionHeader struct to a byte array.
3
4 % TODO: physiology_time_stamp should be 3.
5 %bytes = zeros(340,1,'int8');
6 bytes = zeros(360,1,'int8');
7 off = 1;
8 bytes(off:off+1) = typecast(hdr.version ,'int8'); off=off+2;
9 bytes(off:off+7) = typecast(hdr.flags ,'int8'); off=off+8;
10 bytes(off:off+3) = typecast(hdr.measurement_uid ,'int8'); off=off+4;
11 bytes(off:off+3) = typecast(hdr.scan_counter ,'int8'); off=off+4;
12 bytes(off:off+3) = typecast(hdr.acquisition_time_stamp,'int8'); off=off+4;
13
14 % TODO: physiology_time_stamp should be 3.
15 % but the C struct has a bug, so convert to padding.
16 bytes(off:off+11) = typecast(hdr.physiology_time_stamp ,'int8'); off=off+12;
17 off = off+20; % Discard 5*uint32;
18
19 bytes(off:off+1) = typecast(hdr.number_of_samples ,'int8'); off=off+2;
20 bytes(off:off+1) = typecast(hdr.available_channels ,'int8'); off=off+2;
21 bytes(off:off+1) = typecast(hdr.active_channels ,'int8'); off=off+2;
22 bytes(off:off+127) = typecast(hdr.channel_mask ,'int8'); off=off+128;
23 bytes(off:off+1) = typecast(hdr.discard_pre ,'int8'); off=off+2;
24 bytes(off:off+1) = typecast(hdr.discard_post ,'int8'); off=off+2;
25 bytes(off:off+1) = typecast(hdr.center_sample ,'int8'); off=off+2;
26 bytes(off:off+1) = typecast(hdr.encoding_space_ref ,'int8'); off=off+2;
27 bytes(off:off+1) = typecast(hdr.trajectory_dimensions ,'int8'); off=off+2;
28 bytes(off:off+3) = typecast(hdr.sample_time_us ,'int8'); off=off+4;
29 bytes(off:off+11) = typecast(hdr.position ,'int8'); off=off+12;
30 bytes(off:off+11) = typecast(hdr.read_dir ,'int8'); off=off+12;
31 bytes(off:off+11) = typecast(hdr.phase_dir ,'int8'); off=off+12;
32 bytes(off:off+11) = typecast(hdr.slice_dir ,'int8'); off=off+12;
33 bytes(off:off+11) = typecast(hdr.patient_table_position,'int8'); off=off+12;
34 bytes(off:off+1) = typecast(hdr.idx.kspace_encode_step_1,'int8'); off=off+2;
35 bytes(off:off+1) = typecast(hdr.idx.kspace_encode_step_2,'int8'); off=off+2;
36 bytes(off:off+1) = typecast(hdr.idx.average ,'int8'); off=off+2;
37 bytes(off:off+1) = typecast(hdr.idx.slice ,'int8'); off=off+2;
38 bytes(off:off+1) = typecast(hdr.idx.contrast ,'int8'); off=off+2;
39 bytes(off:off+1) = typecast(hdr.idx.phase ,'int8'); off=off+2;
40 bytes(off:off+1) = typecast(hdr.idx.repetition ,'int8'); off=off+2;
41 bytes(off:off+1) = typecast(hdr.idx.set ,'int8'); off=off+2;
42 bytes(off:off+1) = typecast(hdr.idx.segment ,'int8'); off=off+2;
43 bytes(off:off+15) = typecast(hdr.idx.user ,'int8'); off=off+16;
44 bytes(off:off+31) = typecast(hdr.user_int ,'int8'); off=off+32;
45 bytes(off:off+31) = typecast(hdr.user_float ,'int8');
46
47 end