Home > fmri > utils > GE2SPM > GE_readHeaderSeries.m

GE_readHeaderSeries

PURPOSE ^

SYNOPSIS ^

function se_hdr = GE_readHeaderSeries(fid, byte_align)

DESCRIPTION ^

 se_hdr = read_series_header(fid, byte_align)

 Loads the series header from a file with filed id fid
 and returns it as a structure. 
 if byte_align = 1 then 32-bit alignment (SGI, LX2 format)
 if byte_align = 0 then 16-bit alignment (Sun, 5.X format)


 Souheil J. Inati
 Dartmouth College
 May 2000
 souheil.inati@dartmouth.edu

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function se_hdr = GE_readHeaderSeries(fid, byte_align)
0002 %
0003 % se_hdr = read_series_header(fid, byte_align)
0004 %
0005 % Loads the series header from a file with filed id fid
0006 % and returns it as a structure.
0007 % if byte_align = 1 then 32-bit alignment (SGI, LX2 format)
0008 % if byte_align = 0 then 16-bit alignment (Sun, 5.X format)
0009 %
0010 %
0011 % Souheil J. Inati
0012 % Dartmouth College
0013 % May 2000
0014 % souheil.inati@dartmouth.edu
0015 %
0016 
0017 % define the structure and read in the data
0018 % to overcome the byte alignment problems
0019 % break up the assignment into pieces using the setfield function
0020 se_hdr = struct('se_suid', fread(fid,4,'uchar'));                       %Suite ID for this Series%
0021 se_hdr = setfield(se_hdr, 'se_uniq', fread(fid,1,'int16'));            %The Make-Unique Flag%
0022 se_hdr = setfield(se_hdr, 'se_diskid', fread(fid,1,'uchar'));          %Disk ID for this Series%
0023 fseek(fid,1,0); % 16-bit alignment
0024 se_hdr = setfield(se_hdr, 'se_exno', fread(fid,1,'uint16'));            %Exam Number%
0025 se_hdr = setfield(se_hdr, 'se_no ', fread(fid,1,'int16'));              %Series Number%
0026 se_hdr = setfield(se_hdr, 'se_datetime', fread(fid,1,'int32'));        %Allocation Series Data/Time stamp%
0027 se_hdr = setfield(se_hdr, 'se_actual_dt', fread(fid,1,'int32'));       %Actual Series Data/Time stamp%
0028 se_hdr = setfield(se_hdr, 'se_desc', fread(fid,30,'uchar'));       %Series Description%
0029 se_hdr = setfield(se_hdr, 'pr_sysid', fread(fid,9,'uchar'));       %Primary Receiver Suite and Host%
0030 se_hdr = setfield(se_hdr, 'pansysid', fread(fid,9,'uchar'));       %Archiver Suite and Host%
0031 se_hdr = setfield(se_hdr, 'se_typ ', fread(fid,1,'int16'));             %Series Type%
0032 se_hdr = setfield(se_hdr, 'se_source ', fread(fid,1,'int16'));          %Series from which prescribed%
0033 se_hdr = setfield(se_hdr, 'se_plane ', fread(fid,1,'int16'));           %Most-like Plane (for L/S)%
0034 se_hdr = setfield(se_hdr, 'scan_type ', fread(fid,1,'int16'));          %Scout or Axial (for CT)%
0035 se_hdr = setfield(se_hdr, 'position', fread(fid,1,'int32'));           %Patient Position%
0036 se_hdr = setfield(se_hdr, 'entry', fread(fid,1,'int32'));              %Patient Entry%
0037 se_hdr = setfield(se_hdr, 'anref', fread(fid,3,'uchar'));          %Anatomical reference%
0038 fseek(fid,1,0); % 16-bit alignment
0039 se_hdr = setfield(se_hdr, 'lmhor', fread(fid,1,'float32'));              %Horizontal Landmark%
0040 se_hdr = setfield(se_hdr, 'prtcl', fread(fid,25,'uchar'));         %Scan Protocol Name%
0041 fseek(fid,1,0); % 16-bit alignment
0042 se_hdr = setfield(se_hdr, 'se_contrast ', fread(fid,1,'int16'));        %Non-zero if > 0 image used contrast(L/S)%
0043 se_hdr = setfield(se_hdr, 'start_ras', fread(fid,1,'uchar'));          %RAS letter for first scan location (L/S)%
0044 fseek(fid,1,0); % 16-bit alignment
0045 if byte_align; fseek(fid,2,0); end % 32-bit alignment
0046 se_hdr = setfield(se_hdr, 'start_loc', fread(fid,1,'float32'));          %First scan location (L/S)%
0047 se_hdr = setfield(se_hdr, 'end_ras', fread(fid,1,'uchar'));            %RAS letter for last scan location (L/S)%
0048 fseek(fid,1,0); % 16-bit alignment
0049 if byte_align; fseek(fid,2,0); end % 32-bit alignment
0050 se_hdr = setfield(se_hdr, 'end_loc', fread(fid,1,'float32'));            %Last scan location (L/S)%
0051 se_hdr = setfield(se_hdr, 'se_pseq ', fread(fid,1,'int16'));            %Last Pulse Sequence Used (L/S)%
0052 se_hdr = setfield(se_hdr, 'se_sortorder ', fread(fid,1,'int16'));       %Image Sort Order (L/S)%
0053 se_hdr = setfield(se_hdr, 'se_lndmrkcnt', fread(fid,1,'int32'));       %Landmark Counter%
0054 se_hdr = setfield(se_hdr, 'se_nacq ', fread(fid,1,'int16'));            %Number of Acquisitions%
0055 se_hdr = setfield(se_hdr, 'xbasest ', fread(fid,1,'int16'));            %Starting number for baselines%
0056 se_hdr = setfield(se_hdr, 'xbaseend', fread(fid,1,'int16'));            %Ending number for baselines%
0057 se_hdr = setfield(se_hdr, 'xenhst', fread(fid,1,'int16'));             %Starting number for enhanced scans%
0058 se_hdr = setfield(se_hdr, 'xenhend', fread(fid,1,'int16'));            %Ending number for enhanced scans%
0059 if byte_align; fseek(fid,2,0); end % 32-bit alignment
0060 se_hdr = setfield(se_hdr, 'se_lastmod', fread(fid,1,'int32'));         %Date/Time of Last Change%
0061 se_hdr = setfield(se_hdr, 'se_alloc_key', fread(fid,13,'uchar'));  %Process that allocated this record%
0062 fseek(fid,1,0); % 16-bit alignment
0063 if byte_align; fseek(fid,2,0); end % 32-bit alignment
0064 se_hdr = setfield(se_hdr, 'se_delta_cnt', fread(fid,1,'int32'));       %Indicates number of updates to header%
0065 se_hdr = setfield(se_hdr, 'se_verscre', fread(fid,2,'uchar'));     %Genesis Version - Created%
0066 se_hdr = setfield(se_hdr, 'se_verscur', fread(fid,2,'uchar'));     %Genesis Version - Now%
0067 se_hdr = setfield(se_hdr, 'se_pds_a', fread(fid,1,'float32'));           %PixelData size - as stored%
0068 se_hdr = setfield(se_hdr, 'se_pds_c', fread(fid,1,'float32'));           %PixelData size - Compressed%
0069 se_hdr = setfield(se_hdr, 'se_pds_u', fread(fid,1,'float32'));           %PixelData size - UnCompressed%
0070 se_hdr = setfield(se_hdr, 'se_checksum', fread(fid,1,'uint32'));        %Series Record checksum%
0071 se_hdr = setfield(se_hdr, 'se_complete', fread(fid,1,'int32'));        %Series Complete Flag%
0072 se_hdr = setfield(se_hdr, 'se_numarch', fread(fid,1,'int32'));         %Number of Images Archived%
0073 se_hdr = setfield(se_hdr, 'se_imagect', fread(fid,1,'int32'));         %Last Image Number Used%
0074 se_hdr = setfield(se_hdr, 'se_numimages', fread(fid,1,'int32'));       %Number of Images Existing%
0075 se_hdr = setfield(se_hdr, 'se_images', struct('length', fread(fid,1,'uint32'), ...
0076                                                'data', fread(fid,1,'uint32'))); %Image Keys for this Series%
0077 se_hdr = setfield(se_hdr, 'se_numunimg', fread(fid,1,'int32'));        %Number of Unstored Images%
0078 se_hdr = setfield(se_hdr, 'se_unimages', struct('length', fread(fid,1,'uint32'), ...
0079                                                'data', fread(fid,1,'uint32'))); %Unstored Image Keys for this Series%
0080 se_hdr = setfield(se_hdr, 'se_toarchcnt', fread(fid,1,'int32'));       %Number of Unarchived Images%
0081 se_hdr = setfield(se_hdr, 'se_toarchive', struct('length', fread(fid,1,'uint32'), ...
0082                                                'data', fread(fid,1,'uint32'))); %Unarchived Image Keys for this Series%
0083 se_hdr = setfield(se_hdr, 'echo1_alpha', fread(fid,1,'float32'));        %Echo 1 Alpha Value%
0084 se_hdr = setfield(se_hdr, 'echo1_beta', fread(fid,1,'float32'));         %Echo 1 Beta Value%
0085 se_hdr = setfield(se_hdr, 'echo1_window', fread(fid,1,'uint16'));       %Echo 1 Window Value%
0086 se_hdr = setfield(se_hdr, 'echo1_level', fread(fid,1,'int16'));        %Echo 1 Level Value%
0087 se_hdr = setfield(se_hdr, 'echo2_alpha', fread(fid,1,'float32'));        %Echo 2 Alpha Value%
0088 se_hdr = setfield(se_hdr, 'echo2_beta', fread(fid,1,'float32'));         %Echo 2 Beta Value%
0089 se_hdr = setfield(se_hdr, 'echo2_window', fread(fid,1,'uint16'));       %Echo 2 Window Value%
0090 se_hdr = setfield(se_hdr, 'echo2_level', fread(fid,1,'int16'));        %Echo 2 Level Value%
0091 se_hdr = setfield(se_hdr, 'echo3_alpha', fread(fid,1,'float32'));        %Echo 3 Alpha Value%
0092 se_hdr = setfield(se_hdr, 'echo3_beta', fread(fid,1,'float32'));         %Echo 3 Beta Value%
0093 se_hdr = setfield(se_hdr, 'echo3_window', fread(fid,1,'uint16'));       %Echo 3 Window Value%
0094 se_hdr = setfield(se_hdr, 'echo3_level', fread(fid,1,'int16'));        %Echo 3 Level Value%
0095 se_hdr = setfield(se_hdr, 'echo4_alpha', fread(fid,1,'float32'));        %Echo 4 Alpha Value%
0096 se_hdr = setfield(se_hdr, 'echo4_beta', fread(fid,1,'float32'));         %Echo 4 Beta Value%
0097 se_hdr = setfield(se_hdr, 'echo4_window', fread(fid,1,'uint16'));       %Echo 4 Window Value%
0098 se_hdr = setfield(se_hdr, 'echo4_level', fread(fid,1,'int16'));        %Echo 4 Level Value%
0099 se_hdr = setfield(se_hdr, 'echo5_alpha', fread(fid,1,'float32'));        %Echo 5 Alpha Value%
0100 se_hdr = setfield(se_hdr, 'echo5_beta', fread(fid,1,'float32'));         %Echo 5 Beta Value%
0101 se_hdr = setfield(se_hdr, 'echo5_window', fread(fid,1,'uint16'));       %Echo 5 Window Value%
0102 se_hdr = setfield(se_hdr, 'echo5_level', fread(fid,1,'int16'));        %Echo 5 Level Value%
0103 se_hdr = setfield(se_hdr, 'echo6_alpha', fread(fid,1,'float32'));        %Echo 6 Alpha Value%
0104 se_hdr = setfield(se_hdr, 'echo6_beta', fread(fid,1,'float32'));         %Echo 6 Beta Value%
0105 se_hdr = setfield(se_hdr, 'echo6_window', fread(fid,1,'uint16'));       %Echo 6 Window Value%
0106 se_hdr = setfield(se_hdr, 'echo6_level', fread(fid,1,'int16'));        %Echo 6 Level Value%
0107 se_hdr = setfield(se_hdr, 'echo7_alpha', fread(fid,1,'float32'));        %Echo 7 Alpha Value%
0108 se_hdr = setfield(se_hdr, 'echo7_beta', fread(fid,1,'float32'));         %Echo 7 Beta Value%
0109 se_hdr = setfield(se_hdr, 'echo7_window', fread(fid,1,'uint16'));       %Echo 7 Window Value%
0110 se_hdr = setfield(se_hdr, 'echo7_level', fread(fid,1,'int16'));        %Echo 7 Level Value%
0111 se_hdr = setfield(se_hdr, 'echo8_alpha', fread(fid,1,'float32'));        %Echo 8 Alpha Value%
0112 se_hdr = setfield(se_hdr, 'echo8_beta', fread(fid,1,'float32'));         %Echo 8 Beta Value%
0113 se_hdr = setfield(se_hdr, 'echo8_window', fread(fid,1,'uint16'));       %Echo 8 Window Value%
0114 se_hdr = setfield(se_hdr, 'echo8_level', fread(fid,1,'int16'));        %Echo 8 Level Value%
0115 se_hdr = setfield(se_hdr, 'series_uid', fread(fid,32,'uchar'));    %Series Entity Unique ID%
0116 se_hdr = setfield(se_hdr, 'landmark_uid', fread(fid,32,'uchar'));  %Landmark Unique ID%
0117 se_hdr = setfield(se_hdr, 'equipmnt_uid', fread(fid,32,'uchar'));  %Equipment Unique ID%
0118 se_hdr = setfield(se_hdr, 'se_padding', fread(fid,588,'uchar'));   %Spare Space%
0119 
0120 return

Generated on Wed 20-Mar-2019 04:00:51 by m2html © 2003