Working with log files

First, you need to copy subject's log files from the network to somewhere you can process them with Matlab (presumaly your home or imaging space). For each subject two files are relevant:

  1. Pulse data: .PULS file, as in SUBJECTCODE_STUDYCODE.PULS
  2. Respiratory data: .RESP file, as in SUBJECTCODE_STUDYCODE.RESP

There are two more files (.ECG and .MAT) but currently neither contain relevant data.

Next, data relevant to the scanning runs needs to be extarcted from the log files. This is not trivial since physiological recording starts before scanning (as the equipment is attached to the participant's body) and continues without pause until the scanning is over (plus some time it takes the radiographers to detach the equipment). As a result direct syncing between scans and physiological data is not possible. The pulse data files have two timestamps - one from the PMU, and one from the MCPU, which is the same clock also used to timestamp the dicom files. I have written a matlab function which extracts relevant data based on dicom headers. It takes four inputs:

  1. Logfile (.PULS or .RESP file) full path
  2. Dicom folder full path
  3. TR used in the scanning run (seconds)
  4. Hz - frequency at which log files were recorded (at CBU this is by default 50, though the script will estimate and display this frequency from data alone as well).

The code can be downloaded from here and should be quite self-explanatory -- any questions send me an email: kristjan.kalm@mrc-cbu.cam.ac.uk

You can also use Exvolt
(https://cfn.upenn.edu/aguirre/wiki/public:pulse-oximetry_during_fmri_scanning#exvolt), though it's written in C and I wasn't able to compile this successfully on CBU machines without admin rights.