NAME

App::AFNI:SiemensPhysio - Physio from Siemens into format suitable for AFNI's RetroTS retroicor routine

SYNOPSIS

Get slice based respiration volume per time (RVT) regressors from physio collected on Siemens scanner

  my $p = SiemensPhysio->new({VERB=>1});
  # read MR data (get times, TR, nslices)
  #  looks at all files in this directory with "dicom_hinfo"
  $p->readMRdir('MRRaw/10824_20111108/rest_384x384.21/');

  # read pulse
  $p->readPhysio('10824/20111108/wpc4951_10824_20111108_110811.puls');
  # write card: $protocol_$sessionTime.puls.dat
  $p->writeMRPhys;

  # read card
  $p->readPhysio('10824/20111108/wpc4951_10824_20111108_110811.resp');
  # write resp: $protocol_$sessionTime.resp.dat
  $p->writeMRPhys;

  # 
  $p->retroTS('matlab')

  # we could get the raw data 
  #   in this case, card was resp was loaded last
  #   thats what will be returned)
  my @pval = $p->getMRPhys();

DESCRIPTION

Pipeline

read Siemens physio files
read timing from MR DICOM files
snip physio files relative to MR
prepare/run AFNI's RetroTS

prior art

https://cfn.upenn.edu/aguirre/public/exvolt/
https://cfn.upenn.edu/aguirre/wiki/public:pulse-oximetry_during_fmri_scanning

new

initialize object

OPTIONS

timetype

MDH (default) or MPCU

PhRate

Physio sample rate defaults to .2

pulsStart and respStart numeric sequence to be remove, also identifies stream type

defaults:

  pulsStart =>'1 2 40 280'
  respStart =>'1 2 20 2'
sliceOrder

alt+z (default) other options: alt-z,seq+z,seq-z,filename # slice order

VERB

set to true to be verbose, defaults false

trustIdx

don't check sample rate and index count against end-start time none=> check both MR => trust MR (TR) phys=> trust physio (PhRate as set by init) all => trust both

Note: just have to match reg exp, so MRphys is same as all

readPhysio

after intializing p, provide a file name

 $p->readPhysio('10824/20111108/wpc4951_10824_20111108_110811.puls');

input file format

 1 2 40 280 ... [long space delimn. list of measurements, maybe 5000 for trigger?]
 ECG  Freq Per: 0 0
 PULS Freq Per: 74 807
 RESP Freq Per: 20 2860
 EXT  Freq Per: 0 0
 ECG  Min Max Avg StdDiff: 0 0 0 0
 PULS Min Max Avg StdDiff: 527 1586 828 4
 RESP Min Max Avg StdDiff: 2380 6700 3477 86
 EXT  Min Max Avg StdDiff: 0 0 0 0
 NrTrig NrMP NrArr AcqWin: 0 0 0 0
 LogStartMDHTime:  66439690
 LogStopMDHTime:   71116595
 LogStartMPCUTime: 66439512
 LogStopMPCUTime:  71114802
 6003

readMRdir

after intializing p, read in MR info from raw DICOM directory

  $p->readMRdir('MRRaw/10824_20111108/rest_384x384.21/');

sets

timing (MRstart and MRend)
protcol info (protocol,TR,ET,nslices,Series)

Example Info

dicom header info

  dicom_hdr MRRaw/10824_20111108/rest_384x384.21/MR* |egrep 'protocol|acquisition Time|Echo Time|Repetition Time' -i
    0008 0031       14 [620     ] //                 ID Series Time//164627.359000
    0008 0032       14 [642     ] //            ID Acquisition Time//164932.315000 
    0018 0080        4 [1418    ] //            ACQ Repetition Time//1500
    0018 0081        2 [1430    ] //                  ACQ Echo Time//29
    0018 1030        4 [1612    ] //              ACQ Protocol Name//rest
    0019 100a        2 [1788    ] //                               // 29

shortend to

  dicom_hinfo -tag 0008,0032 0008,0031 0018,0080 0018,0081 0018,1030 MR*

readBIDSJson read TR MRstart and crate MRend from BIDS style json output (e.g. created by dcm2niix).

must already have nDcms (number of volumes in 4d) set

writeMRPhys

write phys during MR to file works on most recently loaded physio file

  $p->writeMRPhys
use getMRphys to get values
use writeDat to write values

retroTS

This is kludgy code hacked together and untested :) =over

use a bunch of hacks to find the matlab binary
construct a matlab call using options in self object
execute matlab or McRetroTS
move outputs to fit local naming convention

get/run command to get Resp. Vol./Time (RVT) via AFNI's retroTS a la http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2715870/ MUST have already read MR and written card and resp dat files

  $p->retroTS('matlab')

how this step is handled is defined by the first argument

matlab: use RetroTS.m
McRetroTs: use compiled matlab verson of RetroTS.m
show: print commands for both matlab and McRetroTS
none: do nothing (why'd you call me then!?)

External Commands

see

http://afni.nimh.nih.gov/afni/matlab/
http://afni.nimh.nih.gov/sscc/dglen/McRetroTS
http://fieldtrip.googlecode.com/svn/trunk/external/afni/RetroTS.m

if using matlab+retroTS, the path to retroTS.m should be in your MATLABPATH export MATLABPATH="$HOME/afni_matlab/matlab/:$MATLABPATH"

1 POD Error

The following errors were encountered while parsing the POD:

Around line 439:

'=item' outside of any '=over'