Skip to content

AFNI and NIfTI Server for NIMH/NIH/PHS/DHHS/USA/Earth

Sections
Personal tools
You are here: Home » SSCC » dglen's Home » McRetroTS - Matlab compiled version of retroTS.m

McRetroTS - Matlab compiled version of retroTS.m

Document Actions
Use McRetroTS for cardio-respiratory regression with fMRI data as standalone application without Matlab

Compiled Matlab code for RETROICORR

Document Actions
Compiled versions of RetroTS.m that do not require Matlab to be installed. The code takes as input the respiration movement and pulse oximetry data and provides as output a series of curves that are appropriate as regressors for RETROICORR processing (now handled in afni_proc.py). Linux (64-bit), Mac Intel and Mac PPC versions are available.

Compiled versions of RetroTS.m that do not require Matlab to be installed are available here. These can be used in cases where either Matlab is not installed or Matlab toolboxes are missing. The program, McRetroTS, is provided as a wrapper to the RetroTS.m program. The RetroTS.m program requires both the Statistical toolbox and the Signal Processing toolbox in addition to Matlab while the compiled version provides a stand-alone solution (with no additional cost). The code takes as input the respiration movement and pulse oximetry data and provides as output a series of curves that are appropriate as regressors for RETROICORR processing (now handled in afni_proc.py). Linux (64-bit), Mac Intel and Mac PPC versions are available.

This is an example of the usage of the program, McRetroTS:

  McRetroTS resp.dat pulsox.dat 4 50 20 0

 or generally

  McRetroTS Respdatafile ECGdatafile VolTR Nslices SamplingFreq(PhysFS) ShowGraphs 

The output is a file named oba.slibase.1D. The ShowGraphs option here is new allowing you to turn off figures from appearing. Setting that to 0 turns off the figures. Setting it to 1 turns the figures on, so graphs will appear. With the graphs on, the program waits for user input before exiting. With the graphs off, the program does not wait and continues, making it more appropriate for use in scripts. The number of options is limited compared to the Matlab version because they need to be explicily set. Also because the compilation is not yet automated, the compiled versions will not be updated frequently and will lag behind the Matlab version distributed with AFNI's Matlab library. If options or features are missing that you need, please let us know.

In a script, this program can be repeated called like this:

foreach run ( `count -digits 2 0 8`)
    McRetroTS Resp_${run}.dat ECG_${run}.dat 2.3 38 50 0 
    mv oba.slibase.1D r${run}.slibase.1D
end

Then use the -ricor_regress_option for afni_proc.py to use these regressor files.

The installation of the compiled program requires several environment variables to be set so that the program knows where to find the dynamic libraries required for Matlab compiled code, the MCR (Matlab Compiler Runtime) libraries.

For the Mac versions, install the MCR libraries by using the DMG package installer included in the distribution. If Matlab is already installed, then this step is not necessary. A script is supplied to set the environment variables and run the McRetroTS program, but setting the environment variables separately can done also, as for the Linux version.

For the Linux version, untar the package from the distribution link, run MCRinstaller.bin the first time you run this and then run the setMcRetro.csh script (included in the distribution and copied below) to setup the environment variables for the appropriate directories.

http://afni.nimh.nih.gov/sscc/staff/glend/matlab_compiler/

tar xzvf McRetro_Linux.tgz

cd McRetro

unzip McRetroTS_pkg

./MCRInstaller.bin

# edit the setMcRetro.csh script to point to the correct directories

#   updating the mcr_root directory to the location where it was downloaded

#   and the version to the version of Matlab (V76). If there is no preexisting version

#   of Matlab, keep the version the same.

# alternatively, add the environment variable definitions to your .cshrc file

source ./setMcRetro.csh

You can then add the McRetroTS directory to your path or copy the McRetroTS program to your afni directory.


#!/bin/tcsh
# setMcRetro.csh
# set up environment variables for call Matlab compiled code
# usage:
# run MCR installer.bin once to get this to work
# Install into the directory that you will specify as mcr_root below
# call this with source./setMcRetro.csh
#  or put these environment variable settings in the .cshrc file or equivalent for your shell
 
# may want to put these files in a separate directory,
# mkdir McRetro; cd McRetro
# tar xzvf McRetroTS.tgz
 
# unzip McRetroTS_pkg
 
# install Matlab compiler runtime libraries
# install using GUI (there are options to do this silently and no user interaction though)
# ./MCRInstaller.bin
 
set mcr_root = "/misc/tungsten2/dglen/McRetro"
set version  = v76
 
# slightly different from the Matlab help - also need bin/glnxa64
setenv LD_LIBRARY_PATH \
${mcr_root}/${version}/runtime/glnxa64:${mcr_root}/${version}/bin/glnxa64:${mcr_root}/${version}/sys/os/glnxa64:${mcr_root}/${version}/sys/java/jre/glnxa64/jre1.5.0/lib/amd64/native_threads:${mcr_root}/${version}/sys/java/jre/glnxa64/jre1.5.0/lib/amd64/server:${mcr_root}/${version}/sys/java/jre/glnxa64/jre1.5.0/lib/amd64
 
setenv XAPPLRESDIR ${mcr_root}/${version}/X11/app-defaults
Created by Daniel Glen
Last modified 2010-06-30 17:08
 

Powered by Plone

This site conforms to the following standards: