MR Inbox

From BrainImagingCenter
Revision as of 15:18, 31 October 2012 by Jed.dobson (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The conversion utility for PAR/REC data is now a Matlab script (or rather, a series of Matlab scripts). I've added these to everyone's Matlab path. If you have a custom startup.m you will need to addpath this directory: /afs/

par_convert is able to output a variety of image formats (ANALYZE, AFNI, NIfTI) the default format is Analyze.

  • Connect to
jed@dexter ~]$ ssh rolando.cns

    Dartmouth College, Department of Psychology and Brain Sciences
                      Authorized access only

jed@rolando.cns's password: 
Last login: Fri Jun 26 08:29:41 2009 from
[jed@rolando ~]$ 
  • Navigate to your study directory and launch Matlab
[jed@rolando ~]$ cd /inbox/INTERA/dtiamyg/
[jed@rolando dtiamyg]$ matlab
  • Execute par_convert function:
>> par_convert('04may06dh','outputdir/04may06dh');

To convert an entire subject to AFNI format use the following syntax:

>> par_convert('04may06dh','outputdir/04may06dh','afni');

Sense Volumes

The conversion (and subsequent failure) of Sense Ref volumes will no longer be attempted.

>> par_boil('24feb09ro')
Scan: 24feb09ro_01_1.PAR  Modality: scout (Scout)
Scan: 24feb09ro_02_1.PAR  Modality: sense (Sense Ref)
Scan: 24feb09ro_03_1.PAR  Modality: mprage (Hi Res SENSE)
Scan: 24feb09ro_04_1.PAR  Modality: bold1 (fMRI_SSh SENSE)
Scan: 24feb09ro_06_1.PAR  Modality: dti (DTI_32_tensors SENSE)
Scan: 24feb09ro_07_1.PAR  Modality: bold2 (fMRI_SSh SENSE)
Scan: 24feb09ro_10_1.PAR  Modality: bold3 (fMRI_SSh SENSE)
>> par_convert('24feb09ro','/tmp/24feb09ro')
Writing data as: analyze
Writing file: /tmp/24feb09ro/ANATOMY/scout
Writing file: /tmp/24feb09ro/ANATOMY/mprage
Writing file: /tmp/24feb09ro/FUNCTIONAL/bold1 volume:0001
Writing file: /tmp/24feb09ro/FUNCTIONAL/bold1 volume:0002
Writing file: /tmp/24feb09ro/FUNCTIONAL/bold1 volume:0003
Writing file: /tmp/24feb09ro/FUNCTIONAL/bold1 volume:0004

The arguments are input directory and output directory. There is help available for all three of the functions (par_convert, r2a_convert, r2agui) The output directory is created for you if it doesn't exist. Your output directory will look just like our previous directories:

[jed at dbic-mrinbox 04may06dh]$ ls
[jed at dbic-mrinbox 04may06dh]$ ls ANATOMY/
mprage.hdr  mprage.img  scout.hdr   scout.img

The orientation will be the correct SPM/ANALYZE convention for the hires, coplanar, bold, and dti data. The scout isn't reorientated to save time.

Your functional data will be named with a 'bold' basename followed by the run number (starting with 1). The first volume will be named 'bold1_0001'. You will find these volumes in the FUNCTIONAL directory.

Your DTI data will also follow the above convention with a basename of 'dti1_0001' through 'dti1_0034'.

To convert a single PAR/REC file you can use the r2a_convert script. This script is called by the par_convert script (and uses the r2agui for all the heavy lifting).

>> help r2a_convert
  Usage: r2convert(parfile,subdir,modality)

  valid modality values:
  bold[n], mprage[n], coplanar[n], scout[n]

>> r2a_convert('22apr06ac_3_1.PAR','/tmp','mprage');
Write file: /tmp/mprage

You will need to reorient these volumes yourself if you use r2a_convert manually. For our standard MPRAGE hires volume:

reorient mprage mprage xz o
reorient mprage mprage yz o

For our standard EPI/BOLD data (note that you will need to do this for each volume you collect):

reorient bold1_0001 bold1_0001 y o
reorient bold1_0001 bold1_0001 x o

If you have any problems with conversion or locating your data please contact me. The par_convert script may have trouble figuring out what is what if you do something slightly different. The basic logic is as follows:

  • single volume, high slice count (>90) == hires
  • single volume, real low slice count (<15) == scout
  • single volume, mid slice count (>15 <90) == coplanar
  • many volumes, bigger voxels (>2) == functional
  • many volumes, smaller voxels(<2) == dti

This appears to do the job, but may need some tweaking.


All NIFTI-T1 files are stored in /inbox/NIFTI/YEAR/MONTH/DAY/SUBJECT. Example:

[jed@rolando]:/inbox/NIFTI/2012/10/31$ ls

You can either use these directly or convert to your preferred format using any one of a number of utilities.