Functional Magnetic Resonance Imaging Lab

Faculty of Medicine and Dentistry, Palacký University
University Hospital Olomouc

Tools

List of custom tools used in fMRI Lab Olomouc:

analyzeICA.sh (v13-03-2013)

Usage:analyzeICA.sh [OPTIONS]

Options:
-i <path> Path to the *.ica directory. Defaults to ./
-n <number> The component number to be analyzed. All components will be analyzed by default.
-c Comprehensive output. Prints out mean jump, mean amplitude and IC evaluation.
-d Prints out mean jump.
-a Prints out mean amplitude (absolute value).
-A Same as -a. With -f parameter, the fractional amplitudes are de-meaned. More sensitive to flat time courses, but less specific.
-r Prints out mean relative amplitude.
-e Prints out IC verbal evaluation according to empirical thresholds.
-o Adds comprehensive output to report.html. Saves original to report.html.orig if run for the first time.
-f # Performs fractional comparison. IC is decomposed into blocks cosisting of # volumes. Default is 36.
-v Verbose mode.
-s Performs segmentation analysis. Runs segICA.sh without -f parameter.
-S Performs segmentation analysis. Runs segICA.sh with -f parameter.
-t Set the path of segmentated T1.
-p <path> Path to the segICA.sh script. Uses ./segICA.sh or system path by default.
--help Prints out this help.
Description:Analyze MELODIC report. Evaluates timecourse of the components and segments the component probability map using the segICA.sh script. Run analyzeICA.sh --help for more details.
Author:Pavel Hok

cleanupMRdir.sh

Usage:cleanupMRdir.sh
Description:After incomplete Process.script run, move data back to original place (tmp) before running (fixed) Process.script again.
Author:Petr Hluštík

clusterMask.sh (v13-09-2012)

Usage:clusterMask.sh -m <file> -i <file> -r <file> -d <num> [OPTIONS]

Options:
-m <file> Brain volume mask.
-i <file> Z-stat input file.
-t <num> Z-stat threshold. Defaults to 2.3.
-r <file> Path to res4d file.
-o Outputs the thresholded file with _thr sufix.
-k Keep masked output. Turned off by default.
--help Prints out this help.
Description:Perform post-stats with pre-threshold contrast masking. Useful for higher-level analysis. Run clusterMask.sh --help for more details.

WARNING: Stats from FLAME1+2 require the same or higher Z-threshold!

WARNING: Some unsolved issues remain concerning the “smoothest” (smoothness estimation) subroutine. The main Feat script uses different inputs for volume and DLH estimation!
Author:Pavel Hok

concatenateTS.sh (v14-09-2012)

Usage:concatenateTS.sh [OPTIONS]

WARNING: This script is NOT fully interactive and some modifications may be necessary before use!

Options:
-s concatenate swapped files
-o concatenate odd files instead of even
-a concatenate all (for DM-CDP)
-h NM-RMV specific concatenation of HeelStimulation sessions
--help Print this help
Description:Concatenate two time series into one file using AFNI 3dTcat tool. Run concatenateTS.sh --help for more details.

WARNING: This script is NOT fully interactive and some modifications may be necessary before use!
Author:Pavel Hok

cpcd

Usage:cpcd
Description:From CD-ROM, copy a single DICOM image directory to /md4/dicom, a usual deposit place.
Author:Petr Hluštík

dcmConvert.sh (v06-08-2013)

Usage:dcmConvert.sh [OPTIONS]

Options:
-s flip the left and right side of functional data
-u do not compress nifti and dcm files (does not affect swapped data)
-f force dcm to nifti conversion even though Results directory already exists *WARNING: This will rewrite all previously converted data!*
-m delete fieldmap
-q quiet mode (ouput only on error)
-v verbose mode (show also subroutine output), overrides quiet mode
-o keep orthogonalised T1 image (deleted by default)
-c delete cropped T1 image (kept by default)
-i show acquisition numbers only and do not convert anything (overrides force), unpacks and compresses the data if compressed
-p compress the data only (overrides force, works with -i)
-b use Bet on Mprage.nii and create Mprage_brain.nii
--fmap use fsl_prepare_fieldmap to prepare fieldmaps for B0 unwarping and BBR
--dicom copy Mprage dicom files to separate mpr folder
--src <dir> set source directory (defaults to ./tmp)
--out <dir>
set output directory (defaults to ./Results)
--boldplugin consider BOLD Plugin as a functional series
--help or -h print this help
Description:Convert DICOM files contained in a “tmp” subdirectory into NIFTI using dcm2nii and move output to <STUDY_FODLER>/Results. View the acquisition labels and series numbers when -i parameter set. Unpack or gzip input DICOM files and/or output NIFTI files. Run dcmConvert.sh --help for more details.
Author:Pavel Hok

dicomRename.sh

Usage:dicomRename.sh <study-name-num>
Description:Rename and move DICOM images from the current directory to a designated "study" directory (e.g., VM-CVP-088), subdirectory “tmp”.
Author:Petr Hluštík

fmriStats.sh (v18-09-2013)

Usage:featStats.sh [OPTIONS]

Options:
-n <study name> Enter study name (AA-BBB-###)
-p <protocol name> Enter protocol name (e.g. motor).
-o <task order> Each letter represents one task as specified by --tasks option.
-f Use Fieldmaps to B0 unwarping and registraion.
-b <filename base> "Re-burn" Z-stats to Mprage.
-r Re-run feat on all functionals (post stats only) (re-burn with -d).
-rr Re-run feat on all functionals (post stats + registration only) (re-burn with -d).
-R Re-run feat on all functionals (full stats) (re-burn with -d).
-x Do NOT binarize DICOM ouput.
-z <Z threshold> Set Z threshold (2.3 by default).
-c <P threshold> Set cluster P threshold (0.05 by default).
-d Export the Z-stats to DICOM.
-L Selective side swapping: Use left-sided task as is, swap right-sided task.
-l Selective side swapping: Use right-sided task as is, swap left-sided task.
--flirt Use FLIRT only.
--swapall Swapp all files.
--mprage <dir/file> Use custom Mprage, enter either directory containing DICOM files, or converted Mprage.nii.gz
--merge <list/range> Merge Z-stats into one output using simple addition.
--average <list/range> Average Z-stats using Feat and Fixed effects.
--boldplugin Enable --boldplugin in dcmConvert.sh.
--addmotionparam Add motion parameters to the GLM.
--phase # Use # as phase encoding direction for BBR.
-i or --tasks List available design templates.
-q Quiet mode.
-h or --help Prints out this help.

Description:To perform a simple analysis of pre-surgical examination, follow the guide in the Process page.

Process fMRI data using FEAT (a part of FSL) and custom design templates. Export Z-maps to DICOM on demand. FEAT output is stored in the Results directory in the study root directory. DICOM Output is stored in the study root directory in the ###-conv folder (where ### is replaced by time series label). There are 3 modes available:

1) Complete analysis
- calls dcmConvert.sh and feat (and nidicom when called with -d)
- invoked by -p or -o argument: -p uses same design for all time series (use design label, e.g. -p motor), whereas -o sets different design for each time series (use design code, e.g. -o hF for left hand followed by right foot), run --tasks to see possible design labels and codes
- can be run either from /md4/dicom with -n argument followed by study code (e.g. -n AB-CDE-001, dcmConvert.sh will be preceded by dicomRename.sh) or directly from the study folder
- optionally set -d (export Z-maps to DICOM), -z #.# (Z threshold), -x (do not binarize DICOM output), -c 0.## (cluster p threshold) or -f (use B0 unwarping and BBR registration)

2) FEAT Full-stats or Post-stats
- calls feat (and nidicom when called with -d)
- requires previously finished fmriStats.sh!
- invoked by -r to re-run Post-stats and registration only, FEAT will run within each .feat folder in the Results directory
- invoked by -R to re-run complete Full-stats, FEAT will create new .feat folders for each time series and rename the old ones
- optionally set -z #.# (Z threshold), -x (do not binarize DICOM output) or -c 0.## (cluster p threshold)

3) Re-create combined MPRAGE and Z-stat image
- calls nidicom only
- requires a .feat folder, Mprage.nii.gz and mpr folder in the study root directory
- invoked by -b followed by the base name of the target feat folder (e.g. -b LHand1_1)
- optionally set -x (binarize Z-maps)
- creates one output folder in the study root directory

Side swapping [ --swapall | -L | -l ]:
- when invoked with -t each functional will be swapped, regardless the chosen swapping option
- when invoked with -o, swapping occurs according to the chosen swapping option:
--swapall swaps all functionals
-L swaps only right-sided tasks, so that all tasks are aligned as left-sided (based on extremity used)
-l swaps only left-sided tasks, so that all tasks are aligned as right-sided (based on extremity used)

Custom Mprage file:
- to use a custom Mprage (e.g. from previous study) call the script with --mprage <dir/file>
- use either absolute or relative path to the Mprage.nii.gz file or a directory containing DICOM T1 files
- to export data to DICOM, input in DICOM must be provided!
- the custom DICOM T1 will be copied first to the mpr directory in the current study root folder. Next it will be converted with dcmConvert.sh, with the Mprage.nii.gz stored in the Mprage folder.
- the path to custom Mprage.nii.gz will be stored in the design.fsf, so future analyses can be run without --mprage option

FAQ:
Q: My functional run has accidentally run longer then expected ending up with some extra volumes. How can I fix that?
A: Delete the extra volumes from tmp directory prior the fmriStats.sh.

Q: My MPRAGE ends up having the cerebellum cut out. How can I fix that?
A: This is caused by dcm2nii and cannot be directly fixed. To get around this run fmriStats.sh -R --mprage <path to MprageOrtho.nii.gz>
Author:Pavel Hok

icaDRegression.sh

Usage:icaDRegression.sh <input gica directory> [<output directory>]
Description:Run dual_regression within the specified gica folder, perform 5000 iterations and use design.mat and design.con files from the gica folder. By default, the output folder is derived from the input folder by appending '.dr'. Run icaDRegression.sh --help for more details.
Author:Pavel hok

loop (v31-05-2013)

Usage:loop [RANGE] [OPTIONS, ...]

[RANGE] A list of numbers representing study numbers in the study root folder. Each item should be seperated by comma without spaces. A range of numbers can be also specified. Example: loop.sh 1,2,4-10,5

[OPTIONS]
FILE OPERATION TASKS:
-l=<file> List the specified files/folders within Results directory with the full path
-m=<file_in>:<file_out> Rename/move the specified file/folder within Results directory. File_out can be also REGEXP seperated by '@'
-c=<file_in>:<file_out> Copy the specified file/folder within Results directory. File_out can be also REGEXP seperated by '@'
-r=<file> CAUTION: Delete files/folders within Results directory according to the specified pattern

COMPLEX FSL COMMAND SHORTCUTS:
-f=<file>:<options> OR -f=<dir>:<options> Run feat on specified file or use a design from an existing .feat folder. Options (delimited by commas without spaces): d=design_file, o=output_appendix, mpa - update MPRAGE path (use mpr or mps to explicitly select original or swapped, respectively), r=string1@string - replace input files using REGEXP, ev=timecourse_file (within Results/seeds/run/file), mp - add motion parameters to the model (add as a first option when using multiple regressors), wm, swm, csf, scsf, gs - use (prefix)_timecourse_demeaned as regressor, accordingly.
-s=<dir> Transform and segmentate the reg/highres.nii.gz within the specified folder.
-i=<file> Run analyzeICA.sh using the selected pattern
-fq=<file> Collapse the feat_query output using the selected pattern
-seed=<dir>:<options> Get the signal of the seed region. Dir can be feat or ica folder within the Results folder. Options (delimited by commas): m=mask_file, b - binary mask (default), p - probabilistic mask, l=label.
-wm=<dir>:<mask> Get the signal of the white matter. Dir can be feat or ica folder within the Results folder. Mask should be probabilistic mask with values between 0 and 100.
-swm=<dir> Get the signal of the white matter (based on segmentation). Dir can be feat or ica folder within the Results folder. Mask is created automatically in a separate step by loop -s command.
-csf=<dir>:<mask> Get the signal of the CSF. Dir can be feat or ica folder within the Results folder. Mask should be probabilistic mask with values between 0 and 100.
-scsf=<dir> Get the signal of the CSF (based on segmentation). Dir can be feat or ica folder within the Results folder. Mask is created automatically in a separate step by loop -s command.
-gs=<dir> Get the global signal. Dir can be feat or ica folder within the Results folder. Mask should be binary mask with values 0 and 1.

OTHER SHORTCUTS:
-n2v=<file> Convert nifti file to lipsia vista format using vvindi (Lipsia).
-a=<name> Run AFNI's 3dDeconvolve on NM-RMV stimulation data. Set HeelStim or AnkleStim as input.
-e=<dir>:<command> Execute a custom command within the specified folder (relative to the Results directory).
-e=<command> Execute a custom command within the Results directory (or the study directory, if the Results does not exist).
-d Run dcmConvert.sh
-ds Run dcmConvert.sh -s
-b Run bet Mprage Mprage_brain
-bs Run bet MprageS MprageS_brain

MISCELLANEOUS:
--help|-h Print out this help
Description:This script loops through the study folders to automate multiple processes. The unlisted functions are NOT fully interactive and might need some modifications before use! You can specify more than one task to chain the commands. Run loop.sh --help for more details.
Author:Pavel hok

multiAtlas.sh

Usage:multiAtlas.sh
Description:Run atlas.sh with -l option on each lmax_zstat#_std.txt within current folder.
Author:Pavel Hok

patname.sh

Usage:patname.sh <dir>
Description:Print out patient name and ID from DICOM header.
Author:Petr Hluštík

rcvdicom

Usage:rcvdicom
Description:Start a DICOM image transfer client, receiving images in the current directory – will create one subdirectory “dir_YYYYMMDD_HHMM*” per patient (stop with Ctrl-C).
Author:Petr Hluštík

restoreMRDir.sh

Usage:restoreMRDir.sh
Description:Rename Results folder in current directory as Results.old, run cleanupMRDir.sh and dcmConvert.sh with -v option.
Author:Pavel Hok

segICA.sh (v12-09-2012)

Usage:segICA.sh -m <path> [OPTIONS]

Options:
-m <path> Set the path to the folder containing segmentated T1 image.
-M <path> Set the path to the T1 image.
-v Verbose, print out the progress details.
-f Forces overwriting the previous output instead of skipping it.
-i <path> Set the path to the *.ica folder. Defaults to current folder.
-d Delete the output folder seg completely prior to any calculation.
-c Clean up the NIFTI files from output folder after the process is done.
--help Prints out this help.
Description:Segment MELODIC output with the mask from high-resolution T1. Used as a subroutine of analyzeICA.sh. Run segICA.sh --help for more details.
Author:Pavel Hok

sortSeries.sh (obsolete)

Usage:sortSeries.sh
Description:Obsolete: Show image series contained in "tmp" and their descriptions. Will not uncompress images, is superseded by dcmConvert.sh -i.
Author:Petr Hluštík

Contact us

Phone: +420 588 443 418

E-mail: phlustik(at)upol.cz