IMAGE RECONSTRUCTION

Image reconstruction from E-files, P-files and I-files is done by programs
provided by the Lucas center (Gary Glover and John Desmond) or by mricro. 
All these programs run at the Linux prompt (or Windows exe) outside of Matlab.

What are these files?
     I      - slices of anatomical images
     P      - all the functional data
     P.hdr  - header of the functional data
     P.mag  - files are reconstructed and compressed, header has been removed.
     E      - file header in a text readable form

There are several image reconstruction programs:

     mricro
             Good for anatomical data.
             Reads I-files, converts into AnalyzeFormat volume.
             Available on Linux and Windows. 
             Free public software which can be downloaded from the Web.
     makevols
             Reads E-file, expects P.mag in same directory, writes AnalyzeFormat volumes.
             Available on Linux
             type "makevols" for usage
     makevols_batch
             Performs the actions of makevols for multiple P.mag files.
             Reads the Efile name and scan name from a text file.
             Available on Linux
             type "makevols_batch" for usage
     grecon
             Reads k-files. This is a support program for makevols.
             Available on Linux
             type "grecons" for usage
     mk_spm.sh
             Converts anatomical I-files into an AnalyzeFormat volume
             Available on Linux
             type "mk_spm.sh" for usage
     spm_convert.pl
             Converts anatomical I-files into an AnalyzeFormat volume
             Available on Linux
             type "spm_convert.pl" for usage
     writeihdr
             Extracts the header off a P-file, or P.hdr file, and writes an E-file.
             Available on Linux
             type "writeihdr"  for usage
             

             
VERSIONS - IMPORTANT
The programs can be finicky to use, because they depend on proprietary binary code that
reads the headers of files. The binary code may be different for the 3T and 1.5T
scanner and it changes occasionally with software updates from GE. 
The code version MUST be appropriate
for the date when the images were collected, and the scanner that was used.

The recommendation is to convert the files when the data is collected, then
the software is up to date. If this was not possible,
the older program versions are kept in /usr/fmri_progs/bin. The program names
are modified to reflect the old version, e.g.  makevols.021003  
is the version of makevols used up until Feb. 2003.
So, if the current version doesn't work on your files, check in that
folder to see if an older version of the program will work.



COMPRESSION FORMATS
Image files are huge. It's good to compress them when not in use.
  bzip2    - writes .bz2 compressed file
  bunzip2  - reads .bz2 compressed file
  compress - writes .Z compressed file.
  uncompress -reads .Z compressed file.
For one sample of data, compress reduced size by 1/3, and bzip2 by 1/2. bzip2 was a little slower.
bzip2 with the -9 argument gives better compression. Another compression program is gzip.



FIRST AND EARLY SCANS NEED SPECIAL PROCESSING
The early scans are needed to "warm up" the NMR equilibrium so the magnetization stabilizes and
thereby the signal stabilizes, too. The warm up is about 3 times the T1 decay time. 
For 3T, 3*T1 = ~4 sec; for 1.5T, 3*T1 = ~3 sec.  When the TR is less than 3*T1 seconds, the signal 
intensity of the first several shots will be greater than the equilibrium value attained after 
pulsing several times. 

The parameter 'nextra' is used to avoid acquiring and storing these warm-up scans.
You should use enough nextra scans (sometimes called
disdaqs, 'disabled data acqisitions') to achieve equilibrium: 
    nextra >= round((3*T1)/TR)
e.g. TR = 2s, 3T.  Use nextra of 2 or more.
For these nextra scans, the scanner is running and it sounds like you're getting data, but this data
will not be in your data set, i.e. the data will not be acquired.

The first acquired volume is indeed different than all subsequent ones, 
independent of whether nextra is used or not.  It has an echo time that 
is 2 ms longer than your protocol TE, and together with the second 
time frame is used to compute a magnetic field map, which in turn 
is used to correct the reconstruction for field heterogeneity. If nextra = 0, this correction
is being done on data that is not yet magnetically stable, which is not optimal.
Note the scanner pulse sequence knows about nextra, e.g. if nextra = 2, the third volume
run by the scanner, which is the first volume acquired by you, will have the 2 ms increment.

The consequence of having TE + 2ms is that the signal will be globally 
weaker in the first acquired volume by as much as several percent.  This will not be an issue if 
global scaling is used; if global scaling is not used it might slightly alter the analysis.  
The degree to which inclusion of the first volume affects your activation will depend on the total
number of frames.  

For the best analysis, use nextra, so the scanner is stablized for the heterogeneity calculation,
and skip volume 1 in the analysis, even if nextra is used.

