NAME
App::AFNI:SemainsPhysio - Physio from Semains into format suitable for AFNI's RetroTS retroicor routine
SYNOPSIS
Get slice based respiration volume per time (RVT) regressors from physio collected on Semains scanner
my $p = SemainsPhysio->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) | MPCU
- PhRate (defaults to .2)
- pulsStart and respStart: numeric sequence to be remove, also identifies stream type
- sliceOrder: alt+z (default)
- VERB: set to true to be verbose
readPhysio
after intializing p, provide a file name
$p->readPhysio('10824/20111108/wpc4951_10824_20111108_110811.puls');
input file format
1 2 40 280 ...
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
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*
writeMRPhys
write phys during MR to file works on most recently loaded physio file
$p->writeMRPhys
retroTS
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