Hello AFNI Nation,
When the LDRR Philips 3T magnet was using research export tool version 4, I used the following script to convert the PAR/REC files into HEAD/BRIK files via to3d. I believe this script was written by one of the AFNI folks and modified by Dr. Butman and then again (slightly) modified by myself.
# /bin/csh
# Usage:
#
# PAR_to4d.csh oufile(afni) infile(PAR/REC)
#
# do not give filename extentions
#
set parFile = $2.PAR
set recFile = $2.REC
set NT = `cat $parFile | grep dynamics | cut -d: -f2 | sed 's/^[ \t]*//' | tr -d "\r"`
set NP = `cat $parFile | grep phases | cut -d: -f2 | sed 's/^[ \t]*//' | tr -d "\r"`
set NS = `cat $parFile | grep locations | cut -d: -f2 | sed 's/^[ \t]*//' | tr -d "\r"`
set XFOV = `cat $parFile | grep FOV | cut -d: -f2 | sed 's/^[ \t]*//' | tr -d "\r" | cut -d' ' -f3`
set ZFOV = `cat $parFile | grep FOV | cut -d: -f2 | sed 's/^[ \t]*//' | tr -d "\r" | cut -d' ' -f5`
# To get resolution from image line
set NX = `cat $parFile | head -92 | tail -1 | sed 's/^ *//g' | sed 's/ */ /g' | cut -d' ' -f10`
@ N2Dslices = ${NS} * ${NT} * ${NP}
set target = "3D:0:0:"${NX}":"${NX}":"${N2Dslices}":"${recFile}
set temporal = "time:tz "${NT}" "${NS}" 20s simult"
echo "Converting -${temporal} $target"
to3d -prefix $1 \
-in:1\
-skip_outliers \
-xFOV ${XFOV}S-I\
-yFOV ${XFOV}R-L\
-zFOV ${ZFOV}A-P\
-$temporal \
$target
Now that Philips has upgraded to research export tool version 4.1, the .PAR files have a slightly different layout which prevents the above script from teasing out the necessary information to convert the files. The AFNI error that the screen reads is as follows...
Converting -time:tz 1 45 20s simult 3D:0:0:::45:DBIEX_5_1.REC
++ to3d: AFNI version=AFNI_2007_05_29_1644 (Jun 1 2007) [32-bit]
++ Authored by: RW Cox
** Illegal value of nt after -time: option
** Can't find file 3D:0:0:::45:DBIEX_5_1.REC
** NO INPUT IMAGE FILES?
try 'to3d -help'
The problem clearly is that the above series of three colons between 0 and 45 should contain numbers, which I'm guessing the above script is calling $NX (the image resolution). Unfortunately, I am not familiar enough with "sed" (UNIX's non-interactive text manipulater), to modify the script to work with the new PAR format. I'll try and force feed this to myself, but someone more familiar with UNIX might be better equiped to answer this. For a copy of a version 4 PAR file and a version 4.1 PAR file, just email me at
kanevskya@mail.nih.gov and I'll happily provide you with them. Thanks in advance!!
-Ariel
kanevskya@mail.nih.gov