App-AFNI-SiemensPhysio
view release on metacpan or search on metacpan
lib/App/AFNI/SiemensPhysio.pm view on Meta::CPAN
App::AFNI:SiemensPhysio - Physio from Siemens into format suitable for AFNI's RetroTS retroicor routine
=head1 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();
lib/App/AFNI/SiemensPhysio.pm view on Meta::CPAN
$self->{$k} = $defaults{$k} unless $self and $self->{$k};
}
return bless $self, $class;
}
=head2 readPhysio
after intializing p, provide a file name
$p->readPhysio('10824/20111108/wpc4951_10824_20111108_110811.puls');
=head3 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
lib/App/AFNI/SiemensPhysio.pm view on Meta::CPAN
$self->{physEnd},
$#{$self->{measures}},
$self->{PhRate} ) unless $self->{trustIdx}=~/All|Phys/i;
}
=head2 readMRdir
after intializing p, read in MR info from raw DICOM directory
$p->readMRdir('MRRaw/10824_20111108/rest_384x384.21/');
sets
=over
=item timing (MRstart and MRend)
=item protcol info (protocol,TR,ET,nslices,Series)
=back
=head3 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*
prepareForDemo.bash view on Meta::CPAN
done
fi
# make an output directory to save files to
# (git wont track empty folders)
[ ! -d data/phys ] && mkdir data/phys/
# exvolt (extract voltage) is a c++ program that should do about the same thing
# it is shifted by 340 msecs (17 samples)?
[ ! -r exvolt ] && wget https://cfn.upenn.edu/aguirre/public/exvolt/exvolt
# ./exvolt ../App-AFNI-SiemensPhysio/data/MR ../App-AFNI-SiemensPhysio/data/wpc4951_10824_20111108_110811.resp test.dat
echo "
TRY:
perl -Ilib lib/bin/siemphysdat -o data/phys/ data/wpc4951_10824_20111108_110811.* data/MR/
Then look in data/phys/
"
readme.mkdn view on Meta::CPAN
# siemphysdat <img height=100 widht=100 align=right src=https://raw.githubusercontent.com/LabNeuroCogDevel/siemphysdat/master/icon.png>
Utility to chop physio measures (voltages) from Siemens Physiologic Monitoring Unit (PMU) and generate respiration volume per time (RVT) regressors for a single MR protocol with AFNI's `RetroTS.m`
This is for you if you want `1D` inputs for `3dretroicor` or `afni_proc.py` (`ricor` block) and have physio recordings (`*.resp` and `*.puls`) files the look like [this](data/wpc4951_10824_20111108_110811.puls):
```
1 2 40 280 ...
ECG Freq Per: 0 0
PULS Freq Per: 74 807
RESP Freq Per: 20 2860
....
6003
```
( run in 2.112 seconds using v1.01-cache-2.11-cpan-7add2cbd662 )