Dr. Glen,
I tried using your script on our dynamic scan, and while it was able to produce an 4D BRIK with the proper space and time dimensions, most of the voxels are messed up (either too dark or bright). When the script was running, AFNI gave me the following warning.
[kanevskya@drdb55 HSRat.106CP.2007.06.23.PARREC]$ csh ~/scripts/PARREC_to_HEADBRIK.csh hi_test DBIEX_7_1
Converting -time:zt 32 360 8.100ms simult 3D:0:0:256:256:11520:DBIEX_7_1.REC
++ to3d: AFNI version=AFNI_2007_05_29_1644 (Jun 1 2007) [32-bit]
++ Authored by: RW Cox
*+ WARNING: TR expressed in milliseconds will be converted to TR=0.008100s
++ Counting images: total=11520 2D slices
++ Each 2D slice is 256 X 256 pixels
++ Image data type = short
++ Reading images: ++ Executing -2swap on input image [DBIEX_7_1.REC...]
..........................................
++ to3d WARNING: 28837331 negative voxels (3.81964%) were read in images of shorts.
++ It is possible the input images need byte-swapping.
++ 3D dataset written to disk
Something seems still seems to be wrong.
Instead of trying to be slick, I was able to determine the to3d command my original script generated using data from before the Philips upgrade and kind of fooled around with the command until I was able to produce a comparable HEAD/BRIK file from data collected since the upgrade. For my dynamic scan, I used the following command and it seemed to do exactly what I wanted...
to3d -prefix output -in:1 -skip_outliers -xFOV 76.8I-S -yFOV 76.8R-L -zFOV 16P-A -time:zt 32 360 20s simult 3D:0:0:256:256:11520:input.REC
I have gone ahead an uploaded the HEAD/BRIK generated by your script and the HEAD/BRIK generated from my above command, both using the same dynamic scan. The difference is clear from visual inspection (though I'm not sure why its happening).