FSL Workshop 10/27/09

Prepared by Jeff Rudie:

FSL UTILITIES
FSL TUTORIAL
FSL EMAIL LIST
NITRC Neuroimaging Tools and Resources: Quicklook Viewer Plugin (Mac OSX 10.5+)

fslview

fslview –h (documentation for fslview command)

Usage: fslview [-m 3d|ortho|lightbox] <baseimage> [-l lutname] [-b low,hi] [ <overlay> [-l lutname] [-b low,hi] ] ...
Example: fslview -m ortho,lightbox filtered_func_data thresh_zstat1 -t 0.5 thresh_zstat2 -l "Cool" -t 0.5
Optional arguments (You may optionally specify one or more of):

-V,--verboseswitch on diagnostic messages
-h,--helpdisplay this message
-m,--modeInitial viewer mode. Comma separated list of: 3d; single, ortho; lightbox

Per-image options Usage:

-l,--lutLookup table name. As per GUI, one of: Greyscale; "Red-Yellow"; "Blue-Lightblue"; Red; Green;
-b,--briconInitial bricon range, e.g., 2.3,6
-t,--transInitial transparency, e.g., 0.2

fslinfo/fslhd

Goal: Get some basic information about your file
Usage:- fslinfo <input>
Info:- dim1, dim2, dim3, dim4 => correspond to x, y, z, and time dimension of file (# of voxels or # of time-points)
- pixdim1, pixdim2, pixdim3, pixdim4 => correspond to x, y, z, and time dimensions of file (#mm per voxel or TR) other stuff like data type and file type
Notes:- can get more detailed information using fslhd

Raw fMRI data fslview example
cd Desktop/Example/subjects/AM/func
fslview &
-File add raw.nii.gz (x,y,z orientation, tools, brightness, movie)
-fslinfo raw
-Tools  Timeseries
-Tools  Lightbox
-Tools  Histogram

Structural MRI and processed fMRI overlay example
fslview ../anat_mprage/head
View Overlay – thresholded zstat maps on mprage
fslview ../anat_mprage/head feats/no_model_rest/thresh_zstat1.nii.gz (Error?)
fslview func_task_pp.nii.gz feats/no_model_rest.feat/thresh_zstat1.nii.gz
View functional data overlayed on MPRAGE?
-Different Dimensions must register (FLIRT)
flirt -in feats/no_model_rest.feat/thresh_zstat1 -ref 2_reg/highres.nii.gz -applyxfm -init 2_reg/example_func2highres.mat -out thresh_zstat1_2_mprage
fslview 2_reg/highres.nii.gz -b 0,600 thresh_zstat1_2_mprage.nii.gz -b 2.3,12.5 -t .5 -l "Red-Yellow" &
View functional data overlayed on MPRAGE registered to standard space?
flirt -in feats/no_model_rest.feat/thresh_zstat1 -ref 2_reg/standard.nii.gz -applyxfm -init 2_reg/example_func2standard.mat -out thresh_zstat1_2_standard
fslview 2_reg/highres2standard.nii.gz -b 0,600 thresh_zstat1_2_standard.nii.gz -b 2.3,12.5 -t .5 -l "Red-Yellow" &
-Tools  Toolbars  Atlas Tools…

fslsplit/fslmerge
Goal: Separate or merge image(s) in one of 4 dimensions (time, x, y, z)

fslsplit <input> [output_basename] [-t/x/y/z]
-t : separate images in time (default behaviour)
-x : separate images in the x direction
-y : separate images in the y direction
-z : separate images in the z direction

fslmerge <-x/y/z/t/a> <output> <file1 file2 ...... >
-t : concatenate images in time
-x : concatenate images in the x direction
-y : concatenate images in the y direction
-z : concatenate images in the z direction
-a : auto-choose: single slices -> volume, volumes -> 4D (time series)

Fslsplit/fslmerge example:
cd ../../../
fslsplit raw raw_split_t –t
fslsplit raw raw_split_z –z
delete some files…
fslmerge -t HalfT raw_split_t*
fslmerge -z HalfZ raw_split_z*

fslchfiletype

Usage: /usr/local/fsl/bin/fslchfiletype <filetype> <filename> [filename2]

Info: Changes the file type of the image file, or copies to new files
Valid values of filetype are ANALYZE, NIFTI, NIFTI_PAIR,
ANALYZE_GZ, NIFTI_GZ, NIFTI_PAIR_GZ

Example:
cd Face_Observe_96i_7/
fslinfo Face_Imitate_96i_6_096.img
fslmerge -t Imitate *.img
fslinfo Imitate
fslchfiletype NIFTI_GZ Imitate Imitate_Nifty
fslinfo Imitate_Nifty.nii.gz

fslswapdim

Usage:fslswapdim <input> <a> <b> <c> [output]

where a,b,c represent the new x,y,z axes in terms of theold axes. They can take values of -x,x,y,-y,z,-zor RL,LR,AP,PA,SI,IS (in the case of nifti inputs)

e.g. fslswapdim invol y x -z outvol
or fslswapdim invol RL PA IS outvol
where the latter will convert to axial slicing (to match the avg152 images)
Example:
fslview head
fslswapdim head.nii.gz -x y z head_flipped.nii.gz
fslview head_flipped.nii.gz

fslmaths (introduction)
Functions: fslmaths is a very general image calculator and can be used to perform a great variety of manipulations on images. (type fslmaths for all the different usages)

Usage: fslmaths [-dt <datatype>] <first_input> [operations and inputs] <output> [-odt <datatype>]

Examples:
1. Calculate difference between two consecutive timepoint images:
cd Face_Observe_96i_7/fslmaths

fslmaths Face_Observe_96i_7_007.img -sub Face_Observe_96i_7_008.img voldiff
fslview voldiff
(change brightness/contrast intensity to see better)
2. Calculate the percent difference between twp timepoint images
fslmaths voldiff -div Face_Observe_96i_7_007 -mul 100 voldiffpercent
fslview voldiffpercent.nii.gz

3. Create an ROI from the probabilistic atlas
fslview (add Pars Opercularis and Right Cortex and save as…)
Create your own mask: File  Create mask… Save As
4. Threshold the probabilistic atlas to 25, mask it by the right cortex, and binarize it to create a right pars opercularis mask
fslmaths ParsOpercularis -thr 25 -bin -mas RightCortex RightParsOpercularis_thr25_bin
easythresh
Usage: easythresh <stat> <stat_thresh> <background_image> <output_root>
e.g.: easythresh stats/zstat1 2.3 example_func grot

OR (multiple comparisons correction
Usage: easythresh <raw_zstat> <brain_mask> <cluster_z_thresh> <cluster_prob_thresh> <background_image> <output_root> [--mm]
e.g.: easythresh stats/zstat1 mask 2.3 0.01 example_func grot

Example: Rethreshold any zstat file:
cd subjects/L201_628188/faces/observe/feats/simplemodel.feat
fslview rendered_thresh_zstat1 &
easythresh stats/zstat1 2.3 example_func thresh_2.3_zstat3
fslview rendered_thresh_3.0_zstat1.nii.gz

easythresh stats/zstat1 mask 3.0 .01 example_func thresh_3.0_c_.01_zstat1
fslview rendered_thresh_thresh_3.0_c_.01_zstat1.nii.gz