syncphysio - Synchronise time between MR Image acquisition and scanner log files of Physiological Measurements

blue bar

MR scanners usually allow monitoring of the basic patient's vital signs, typically electrocardiagram, peripheral pulse, and respiration. Contemporary scanners also allow these signals to be saved in a log file on the scanner's computer hard disk. These log files may be retrieved and integrated into the off-line analysis of the MR images. However, the duration of recordings in the log files does not usually span exactly the same period as the image acquisition, and so one initial step is to regain synchronisity between the physiological timecourses and the image acquisition.

syncphysio is a command line program which attempts to synchronise the data in the physiological log files with the time of the image acquisition. Currently it only works with physiological log files generated by Siemens Medical MR scanners. It saves the trigger points in the physiological time courses, as detected by the MR scanner, to text files suitable for import into Chris Rorden's Physiological Artifact Removal Tool or PhysioNoise.

syncphysio [-ds <num>] [-splf siemens_log_file] [-tf image_acquisition_times_file] [-sof synchronised_output_filename] [-d]
-ds <num>
Downsamples the timecourse by an integer factor of num. Currently not implemented.
-splf <filename>
Specifies the filename of the physiological log file copied from the scanner. If this option is not specified, the user will be prompted for the filename in the terminal window.
-tf <filename>
Specifies the filename containing the volume acquisition times (the time of acquisition of the first image in each volume). This is a text file containing the date and time of the image acquisition, as stored in the DICOM header message 0008,0032. The date and time of each image acquisition is stored, one image per line. The format of each line is the date and time in the format YYYYMMDD HHMMSS with the SS seconds containing fractions of a second after the decimal point. For example, three images acquired with a volume TR of just under eight seconds, acquired just after 2pm on the 4th March 2009 would be represented in this text file as
20090304 140040.157500
20090304 140048.137500
20090304 140044.147500
If the DICOM images are to be converted to Analyze of NIFTI using my dtoa software, then the image acquisition timings text file can also be created by the program by specifying the -itime command line flag.
If this -tf option is not specified, the user will be prompted for the filename in the terminal window, or can choose to enter the time of acquisition of the first image and the volume TR manually.
-sof <filename>
The output filename base containing the triggers from the physiological log file in the formats required for Chris Rorden's Physiological Artifact Removal Tool or PhysioNoise, with timings relative to the acquisition time of the first image.

-d
Displays additional diagnostic output.

Download

The C source code for syncphysio can be downloaded. It was last updated on 15th August 2010.

Compiling

syncphysio.c should compile fine on a number of operating systems and using a range of C compilers, under 32 bit or 64 bit environments. Below are a few suggestions for compiling the software from a command line terminal window, into an executable named syncphysio.

Linux, MacOSX, or Cygwin using GNU compiler
gcc -O syncphysio.c -o syncphysio
Solaris, Sun compiler
cc -O -Xa -s syncphysio.c -o syncphysio
HPUX, bundled compiler
cc -O -Ae +Onolimit -s syncphysio.c -o syncphysio
IRIX, SGI compiler
cc -O -signed syncphysio.c -o syncphysio
Windows, Visual Studio compiler
cl /O2 syncphysio.c
Check you know how to set the path and relevant environment cariables, or start a pre-configured command line window from the Visual Studio Tools menu.
Windows, Borland C compiler
bcc32 -O2 -N syncphysio.c