Skip to content
Snippets Groups Projects
Commit 6691da87 authored by Matthew Webster's avatar Matthew Webster
Browse files

This commit was manufactured by cvs2svn to create tag 'fsl-5_0_11'.

Sprout from master 2017-07-05 14:45:27 UTC Saad Jbabdi <saad@fmrib.ox.ac.uk> 'small bug fix'
Cherrypick from master 2013-07-09 11:06:37 UTC Moises Fernandez <moisesf@fmrib.ox.ac.uk> 'Change FSLDEVDIR path with FSLDIR':
    CUDA/bedpostx_multigpu_LSF
Delete:
    CUDA/bedpostx_multigpu_PBS.sh
    RLR_MAP_routines.cpp
    RLR_MAP_routines.h
    doc/fdt_bedpostx.html
    doc/fdt_bedpostx_parallel.html
    doc/fdt_biggest.html
    doc/fdt_display.html
    doc/fdt_dtifit.html
    doc/fdt_eddy.html
    doc/fdt_images/eddy.gif
    doc/fdt_images/eddy.tif
    doc/fdt_images/eddy2.gif
    doc/fdt_images/fdt_bedpost.gif
    doc/fdt_images/fdt_bedpost.tiff
    doc/fdt_images/fdt_bedpostx.gif
    doc/fdt_images/fdt_fa.gif
    doc/fdt_images/fdt_fa_big.png
    doc/fdt_images/fdt_gui.gif
    doc/fdt_images/fdt_gui.tiff
    doc/fdt_images/fdt_l1.gif
    doc/fdt_images/fdt_lines.gif
    doc/fdt_images/fdt_lines_subs.gif
    doc/fdt_images/fdt_probtrackx.gif
    doc/fdt_images/fdt_rgb.gif
    doc/fdt_images/fdt_rgb_subs.gif
    doc/fdt_images/fdt_seeds2targets_quant_eg.gif
    doc/fdt_images/fdt_seeds2targets_thal.gif
    doc/fdt_images/fdt_simple_tract3.gif
    doc/fdt_images/fdt_spherical_polars.gif
    doc/fdt_images/fdt_twomasks_tracts.gif
    doc/fdt_images/fdt_vecreg.gif
    doc/fdt_images/fdt_vectors.jpg
    doc/fdt_images/fdt_vectorsx.jpg
    doc/fdt_images/fdt_xfibres_axial.png
    doc/fdt_images/fdt_xfibres_coronal.png
    doc/fdt_images/fsl-bg.jpg
    doc/fdt_images/fsl-logo.jpg
    doc/fdt_images/fslview_dti.gif
    doc/fdt_images/fslview_x.gif
    doc/fdt_images/gui_intro.gif
    doc/fdt_images/gui_intro.tif
    doc/fdt_images/qboot.gif
    doc/fdt_pipeline.html
    doc/fdt_probtrackx.html
    doc/fdt_reg.html
    doc/fdt_surface.html
    doc/fdt_thresh.html
    doc/fdt_top.html
    doc/fdt_utils.html
    doc/fdt_vecreg.html
    doc/index.html
    nldtifit.cpp
    nldtifit.h
    rubix.cc
    rubix.h
    rubix_parallel.sh
    rubix_postproc.sh
    rubix_preproc.sh
    rubixoptions.cc
    rubixoptions.h
    rubixvox.cc
    rubixvox.h
parent 939b301f
No related branches found
No related merge requests found
Showing
with 1 addition and 2058 deletions
......@@ -22,7 +22,7 @@ Usage() {
echo "-b (burnin period, default 1000)"
echo "-j (number of jumps, default 1250)"
echo "-s (sample every, default 25)"
echo "-model (Deconvolution model. 1: with sticks (default), 2: with sticks with a range of diffusivities, 3: with zeppelins)"
echo "-model (1 for monoexponential, 2 for multiexponential, default 1)"
echo "-g (consider gradient nonlinearities, default off)"
echo ""
echo ""
......
#!/bin/sh
# Copyright (C) 2004 University of Oxford
#
# SHCOPYRIGHT
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${FSLDIR}/lib:${CUDA}/lib64:
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH
Usage() {
echo ""
echo "Usage: bedpostx <subject directory> [options]"
echo ""
echo "expects to find bvals and bvecs in subject directory"
echo "expects to find data and nodif_brain_mask in subject directory"
echo "expects to find grad_dev in subject directory, if -g is set"
echo ""
echo "<options>:"
echo "-NJOBS (number of jobs to queue, the data is divided in NJOBS parts, usefull for a GPU cluster, default 1)"
echo "-n (number of fibres per voxel, default 2)"
echo "-w (ARD weight, more weight means less secondary fibres per voxel, default 1)"
echo "-b (burnin period, default 1000)"
echo "-j (number of jumps, default 1250)"
echo "-s (sample every, default 25)"
echo "-model (Deconvolution model. 1: with sticks (default), 2: with sticks with a range of diffusivities, 3: with zeppelins)"
echo "-g (consider gradient nonlinearities, default off)"
echo ""
echo ""
echo "ALTERNATIVELY: you can pass on xfibres options onto directly bedpostx"
echo " For example: bedpostx <subject directory> --noard --cnonlinear"
echo " Type 'xfibres --help' for a list of available options "
echo " Default options will be bedpostx default (see above), and not xfibres default."
echo ""
echo "Note: Use EITHER old OR new syntax."
exit 1
}
make_absolute(){
dir=$1;
if [ -d ${dir} ]; then
OLDWD=`pwd`
cd ${dir}
dir_all=`pwd`
cd $OLDWD
else
dir_all=${dir}
fi
echo ${dir_all}
}
[ "$1" = "" ] && Usage
subjdir=`make_absolute $1`
subjdir=`echo $subjdir | sed 's/\/$/$/g'`
echo subjectdir is $subjdir
#parse option arguments
njobs=1
nfibres=2
fudge=1
burnin=1000
njumps=1250
sampleevery=25
model=1
gflag=0
shift
while [ ! -z "$1" ]
do
case "$1" in
-NJOBS) njobs=$2;shift;;
-n) nfibres=$2;shift;;
-w) fudge=$2;shift;;
-b) burnin=$2;shift;;
-j) njumps=$2;shift;;
-s) sampleevery=$2;shift;;
-model) model=$2;shift;;
-g) gflag=1;;
*) break;;
esac
shift
done
opts="--nf=$nfibres --fudge=$fudge --bi=$burnin --nj=$njumps --se=$sampleevery --model=$model"
defopts="--cnonlinear"
opts="$opts $defopts $*"
#check that all required files exist
if [ ! -d $subjdir ]; then
echo "subject directory $1 not found"
exit 1
fi
if [ ! -e ${subjdir}/bvecs ]; then
echo "${subjdir}/bvecs not found"
exit 1
fi
if [ ! -e ${subjdir}/bvals ]; then
echo "${subjdir}/bvals not found"
exit 1
fi
if [ `${FSLDIR}/bin/imtest ${subjdir}/data` -eq 0 ]; then
echo "${subjdir}/data not found"
exit 1
fi
if [ ${gflag} -eq 1 ]; then
if [ `${FSLDIR}/bin/imtest ${subjdir}/grad_dev` -eq 0 ]; then
echo "${subjdir}/grad_dev not found"
exit 1
fi
fi
if [ `${FSLDIR}/bin/imtest ${subjdir}/nodif_brain_mask` -eq 0 ]; then
echo "${subjdir}/nodif_brain_mask not found"
exit 1
fi
echo Making bedpostx directory structure
mkdir -p ${subjdir}.bedpostX/
mkdir -p ${subjdir}.bedpostX/diff_parts
mkdir -p ${subjdir}.bedpostX/logs
mkdir -p ${subjdir}.bedpostX/logs/logs_gpu
mkdir -p ${subjdir}.bedpostX/logs/pid_${$}
mkdir -p ${subjdir}.bedpostX/xfms
if [ ${gflag} -eq 1 ]; then
echo "bedpostx_multigpu_LSF "${subjdir} $opts "-g" >> ${subjdir}.bedpostX/commands.txt
else
echo "bedpostx_multigpu_LSF "${subjdir} $opts >> ${subjdir}.bedpostX/commands.txt
fi
echo Copying files to bedpost directory
cp ${subjdir}/bvecs ${subjdir}/bvals ${subjdir}.bedpostX
${FSLDIR}/bin/imcp ${subjdir}/nodif_brain_mask ${subjdir}.bedpostX
if [ `${FSLDIR}/bin/imtest ${subjdir}/nodif` = 1 ] ; then
${FSLDIR}/bin/fslmaths ${subjdir}/nodif -mas ${subjdir}/nodif_brain_mask ${subjdir}.bedpostX/nodif_brain
fi
part=0
echo "Submitting parts (jobs) to GPUs"
post="qsub -V -l nodes=1:ppn=1:gpus=1,walltime=8:00:00 -q dque_gpu -W depend=afterok"
while [ $part -lt $njobs ];do
partzp=`$FSLDIR/bin/zeropad $part 4`
if [ ${gflag} -eq 1 ]; then
gopts="$opts --gradnonlin=${subjdir}/grad_dev"
else
gopts=$opts
fi
echo "#!/bin/sh" > ${subjdir}.bedpostX/xfibres.sh
echo "#PBS -e ${subjdir}.bedpostX/logs/error$partzp" >> ${subjdir}.bedpostX/xfibres.sh
echo "#PBS -o ${subjdir}.bedpostX/logs/log$partzp" >> ${subjdir}.bedpostX/xfibres.sh
echo "${FSLDIR}/bin/xfibres_gpu --data=${subjdir}/data --mask=$subjdir.bedpostX/nodif_brain_mask -b ${subjdir}.bedpostX/bvals -r ${subjdir}.bedpostX/bvecs --forcedir --logdir=$subjdir.bedpostX/diff_parts/data_part_$partzp $gopts ${subjdir} $part $njobs" >> ${subjdir}.bedpostX/xfibres.sh
jobid=`qsub -V -l nodes=1:ppn=1:gpus=1,walltime=8:00:00 -q dque_gpu ${subjdir}.bedpostX/xfibres.sh`
#echo $jobid
post=$post":${jobid}"
part=$(($part + 1))
done
rm ${subjdir}.bedpostX/xfibres.sh
nvox=`${FSLDIR}/bin/fslstats $subjdir.bedpostX/nodif_brain_mask -V | cut -d ' ' -f1 `
echo "#!/bin/sh" > ${subjdir}.bedpostX/post_proc.sh
echo "#PBS -e ${subjdir}.bedpostX/logs/error_post_proc.log" >> ${subjdir}.bedpostX/post_proc.sh
echo "#PBS -o ${subjdir}.bedpostX/logs/log_post_proc.log" >> ${subjdir}.bedpostX/post_proc.sh
echo "${FSLDIR}/bin/bedpostx_postproc_gpu.sh --data=${subjdir}/data --mask=$subjdir.bedpostX/nodif_brain_mask -b ${subjdir}.bedpostX/bvals -r ${subjdir}.bedpostX/bvecs --forcedir --logdir=$subjdir.bedpostX/diff_parts $opts $nvox $njobs ${subjdir}" >> ${subjdir}.bedpostX/post_proc.sh
post=$post" "${subjdir}.bedpostX/post_proc.sh
#echo $post
$post
rm ${subjdir}.bedpostX/post_proc.sh
echo "All parts (jobs) submitted"
finished=0
logdir=${subjdir}.bedpostX/logs
while [ $finished -eq 0 ] ; do
nfin=0
part=0
while [ $part -lt $njobs ];do
partzp=`${FSLDIR}/bin/zeropad $part 4`
if [ -f ${subjdir}.bedpostX/diff_parts/data_part_$partzp/mean_S0samplesJ ];then
nfin=$(($nfin + 1))
fi
part=$(($part + 1))
done
echo $nfin "parts processed of "$njobs
if [ -f ${subjdir}.bedpostX/xfms/eye.mat ] ; then
finished=1
echo "All parts processed"
fi
sleep 60;
done
This diff is collapsed.
// Nonlinear estimation of diffusion tensor
// using a Gaussian or Rician noise model
//
// RLR_MAP_routines.h
//
// Jesper Andersson, FMRIB Image Analysis Group
//
// Copyright (C) 2011 University of Oxford
//
// These routines were originally written so as to
// be compiled into a mex-file callable from within
// Matlab. Hence it was written using Matlab/FORTRAN
// style "matrices", was written in "pure" C (i.e. did
// not use any C++ features), used LAPACK for matrix
// inversion etc etc. Since the project was considered
// a "dead end" but the software still useful I
// decided on a minimal re-write. Hence all the
// original C quirkiness has been retained and a minmal
// interface has been added.
//
namespace NLDTIFIT {
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#endif
/* Need macros for different platforms here. */
#define DGESV dgesv_
/* Used to index Hessian/Information matrix. */
#ifndef Hindx
#define Hindx(R,C,SZ) ((C)*(SZ) + (R)) /* Column first for Fortran (and Matlab). */
#endif
/* Used to index rotation matrix R. */
#ifndef Rindx
#define Rindx(R,C) ((C)*3 + (R)) /* Column first for Fortran (and Matlab). */
#endif
/* Used to index gradient matrix g. */
#ifndef gindx
#define gindx(R,C,M) (((C)*(M)) + (R)) /* Column first for Fortran (and Matlab). */
#endif
/* Used to index eigenvalue matrix L. */
#ifndef Lindx
#define Lindx(R,C) ((C)*3 + (R)) /* Column first for Fortran (and Matlab). */
#endif
#ifndef SQR
#define SQR(A) ((A)*(A))
#endif
#ifndef S2_I
#define S2_I 0
#define S0_I 1
#define PHI_I 2
#define L_I 5
#endif
#ifndef MLEN /* Longest "time-series" we ever expect. */
#define MLEN 1024
#endif
#ifndef MVOX /* Largest # of voxels estimated together. */
#define MVOX 27
#endif
#ifndef MAXITER
#define MAXITER 100
#endif
#ifndef GAUSS
#define GAUS 1
#define RICE 2
#endif
int get_ric_ll_info(/* Input */
double *theta,
double *y,
double *g,
double *b,
int n,
/* Input/output */
double *ll,
double *grad,
double *info,
double *ey);
int get_gaus_ll_info(/* Input */
double *theta,
double *y,
double *g,
double *b,
int n,
/* Input/output */
double *ll,
double *grad,
double *info,
double *ey);
void make_ric_grad(/* Input */
double *theta, /* Parameters. */
double *g, /* Gradient vectors. */
double *L, /* L matrix, diagonal represented as 3x1. */
double *R, /* Rotation matrix. */
double *b, /* b-values. */
double *y, /* data. */
double *z, /* z_l as defined in paper. */
double *ei, /* Expected intensities. */
int n, /* # of data points. */
int npar, /* Total # of parameters. */
int *indx, /* Indicies into grad and finf. */
/* Output */
double *grad, /* Gradient, 8x1. */
double *finf); /* Information matrix, 8x8. */
void make_gauss_grad(/* Input */
double *theta, /* Parameters. */
double *g, /* Gradient vectors. */
double *L, /* L matrix, diagonal represented as 3x1. */
double *R, /* Rotation matrix. */
double *b, /* b-values. */
double *y, /* data. */
double *ei, /* Expected intensities. */
double *ef, /* exp(-fl). */
double *e2f, /* exp(-2*fl). */
int n, /* # of data points. */
/* Output */
double *grad, /* Gradient, 8x1. */
double *finf); /* Information matrix, 8x8. */
double priors_ll(/* Input. */
double *theta, /* Parameters. */
double *mu, /* Means of priors. */
double *var, /* Variance of priors. */
int *indx, /* Indicies (into theta) of priors. */
int n); /* # of parameters that have priors. */
void priors_grad(/* Input. */
double *theta, /* Parameters. */
double *mu, /* Means of priors. */
double *var, /* Variance of priors. */
int *tindx, /* Indicies (into theta) of priors. */
int *indx, /* Indicies (into grad) of priors. */
int n, /* # of parameters that have priors. */
int npar, /* Total # of parameters. */
/* Output. */
double *grad, /* Gradient vector npar*1. */
double *finf); /* Information matrix npar*npar. */
double *make_R(/* Input */
double *phi, /* Angles in radians. */
/* Output */
double *R); /* Rotation matrix. */
void make_dR(/* Input */
double *phi, /* Angles in radians. */
/* Output */
double *dRdx,
double *dRdy,
double *dRdz);
double *make_gR(/* Input */
double *g, /* 3x1 vector. */
double *R, /* 3x3 matrix. */
/* Output. */
double *gR); /* g'*R or R'*g */
double make_gRLRg(/* Input */
double *g,
double *L,
double *R);
double make_gR1LR2g(/* Input */
double *g,
double *L,
double *R1,
double *R2);
double make_gRdLRg(/* Input */
double *g,
double *R,
double l,
int li);
double make_f(/* Input */
double *g,
double *L,
double *R,
double b);
double *make_z(/* Input */
double *ei, /* Expected intensities */
double *y, /* Data (observed intensities). */
double es2, /* The estimate of the variance.*/
int n, /* Length of the data. */
/* Output. */
double *z);
double make_dfdphi(/* Input */
double *g,
double *L,
double *R,
double *dRdphi,
double b);
double make_dfdl(/* Input */
double *g,
double dRdl,
double *R,
double b,
int dRdl_i);
double log_like_ric(/* Input */
double *theta, /* Parameters. */
double *y, /* Data. */
double *z, /* z_l as defined in paper. */
double *ei, /* Expected intensities. */
int n); /* Number of data points. */
double log_like_gauss(/* Input */
double *theta, /* Parameters. */
double *y, /* Data. */
double *ei, /* Expected intensities. */
int n); /* Number of data points. */
double *make_ei(/* Input */
double *theta,
double *fl,
int n,
/* Output */
double *ei);
void make_ei_ef_e2f(/* Input */
double *theta,
double *fl,
int n,
/* Output */
double *ei,
double *ef,
double *e2f);
double logI0(double x);
double logI1(double x);
double make_I1I0(double x);
double make_tricky(double A,
double s2);
void fix_phi2(double *theta,
int nvox);
} // end namespace NLDTIFIT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><meta http-equiv="Content-Type"
content="text/html;charset=utf-8">
<link REL="stylesheet" TYPE="text/css"
href="../fsl.css"><TITLE>FSL</TITLE></HEAD>
<BODY><IFRAME width="100%" scrolling="no" frameborder="0" src="fdt_top.html">Broken</IFRAME>
<IMG ALIGN=RIGHT hspace=20 vspace=20 SRC="fdt_images/fdt_bedpostx.gif" ALT="Bedpost GUI view">
<h3>BEDPOSTX</h3>
<p>BEDPOSTX stands for Bayesian Estimation of Diffusion Parameters Obtained using Sampling Techniques. The X stands for modelling Crossing Fibres. <b>bedpostx</b> runs Markov Chain Monte Carlo sampling to build up distributions on diffusion parameters at each voxel. It creates all the files necessary for running probabilistic tractography. For an overview of the modelling carried out within <b>bedpostx</b> see the <ahref="http://www.fmrib.ox.ac.uk/analysis/techrep/tr03tb1/tr03tb1/">appendix.</a>
<p><b>bedpostx</b> now allows to model crossing fibres within each voxel on the brain. Crucially, <b>bedpostx</b> allows to automatically determine the number of crossing fibres per voxel. For details on the model used in this case, see Behrens et al, NeuroImage 2007, 34:144-55.
<p><b>bedpostx</b> takes about 24 hours to run but will automatically batch if run on an SGE-capable system..
<p>To call the FDT GUI, either run <b>Fdt</b>, or run <b>fsl</b> and press the <b>FDT</b> button. Use the top left drop down menu to select <b>BEDPOSTX</b>.
<p>
<b>Input directory:</b> Use the browse button to select an input directory. That directory must contain the following files:
<ul>
<li><b>data</b>: A 4D series of data volumes. This will include diffusion-weighted volumes and volume(s) with no diffusion weighting.</li>
<li><b>nodif_brain_mask</b>: 3D binary brain mask volume derived from running <a href="../bet2/index.html" target="_top">bet</a> on nodif (i.e. on a volume with no diffusion weighting).</li>
<li><b>bvecs</b>: A text file containing a list of gradient directions applied during diffusion weighted volumes. The order of entries in this file must match the order of volumes in <b>data</b>.
<br>
The format is<pre>
x_1 x_2 x_3 ... x_n
y_1 y_2 y_3 ... y_n
z_1 z_2 z_3 ... z_n<br></pre>
Vectors are normalised to unit length within the <b>bedpostx</b> code. For volumes in which there was no diffusion weighting, the entry should still be present, although the
direction of the vector does not matter! </li>
<li><b>bvals</b>: A text file containing a list of bvalues applied during each volume acquisition. The order of entries in this file must match the
order of volumes in the input data and entries in the gradient directions text file.
<br>
The format is <br><pre>
b_1 b_2 b_3 ... b_n<br></pre>
The order of <b>bvals</b> must match the order of <b>data.</b></li>
</ul>
<br><br>
<i>Tip: Run <b>bedpostx_datacheck</b> in command line to check if your input directory contains the correct files required for <b>bedpostx</b>.</i>
<br><br>
<p><h4>Outputs of BEDPOSTX</h4>
<b>bedpostx</b> creates a new directory at the same level as the input directory
called &lt;indir&gt;.bedpostX which contains all the files you need for probabilistic
tractography. Highlights are (&#60;i&#62; indicates the i-th fibre. It ranges from 1 to the maximum number of fibres set in the advanced options.):
<ul>
<li><b>merged_th&#60;i&#62;samples</b> - 4D volume - Samples from the distribution on theta </li>
<li><b>merged_ph&#60;i&#62;samples</b> - Samples from the distribution on phi
</li><ul><li>theta and phi together represent the principal diffusion
direction in <a href="fdt_images/fdt_spherical_polars.gif">spherical polar co-ordinates</a></li></ul>
<li><b>merged_f&#60;i&#62;samples</b> - 4D volume - Samples from the distribution
on anisotropic volume fraction (see <a
href="http://www.fmrib.ox.ac.uk/analysis/techrep/tr03tb1/tr03tb1/">technical
report</a>).</li>
<li><b>mean_th&#60;i&#62;samples</b> - 3D Volume - Mean of distribution on theta </li>
<li><b>mean_ph&#60;i&#62;samples</b> - 3D Volume - Mean of distribution on phi </li>
<li><b>mean_f&#60;i&#62;samples</b> - 3D Volume - Mean of distribution on <i>f</i>
anisotropy </li>
<ul><li>Note that in each voxel, fibres are ordered according to a decreasing mean f-value</li></ul>
<li><b>mean_dsamples</b> - 3D Volume - Mean of
distribution on diffusivity d</li>
<li><b>mean_S0samples</b> - 3D Volume - Mean of
distribution on S0 intensity</li>
<li><b>dyads&#60;i&#62;</b> - Mean of PDD distribution in vector form.
Note that this file can be loaded into fslview for easy <a href="fdt_display.html">viewing of diffusion directions</a></li>
<li><b>dyads&#60;i&#62;_dispersion</b> - 3D Volume - Uncertainty on
the estimated fibre orientation. Characterizes how wide the
orientation distribution is around the respective dyad.
<li><b>nodif_brain</b> - brain extracted version of nodif - copied
from input directory</li>
<li><b>nodif_brain_mask</b> - binary mask created from nodif_brain -
copied from input directory
</li>
</ul>
<p><h4>Advanced Options</h4>
You may change some options before running <b>bedpostx</b>, depending on the questions you want to ask or the quality of your diffusion data. The default values of these parameters are the ones used in the corresponding paper (Behrens et al, NeuroImage 2007, 34:144-55).
<ul>
<li><b>Fibres</b>: Number of fibres modelled per voxel.
<li><b>Weight</b>: Multiplicative factor for the prior on the additional modelled fibres. A smaller factor means more weighting for the additional fibres.
<li><b>Burnin</b>: Number of iterations before starting the sampling. These might be increased if the data are noisy, and the MCMC needs more iterations to converge.
</ul>
<p><h4>Command line utility</h4>
<verb>bedpostx &#60;indir&#62; [-n &#60;nfibres&#62;] [-w &#60;weight&#62;] [-b &#60;niter&#62;]</verb>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><meta http-equiv="Content-Type"
content="text/html;charset=utf-8">
<link REL="stylesheet" TYPE="text/css"
href="../fsl.css"><TITLE>FSL</TITLE></HEAD>
<BODY><IFRAME width="100%" scrolling="no" frameborder="0" src="fdt_top.html">Broken</IFRAME>
<h3>Parallelising bedpost</h3> Bedpost runs Markov Chain Monte
Carlo sampling to build up distributions on diffusion parameters at
each voxel. This is a very slow process, so bedpost is very processor
hungry (a typical bedpost run might take around 20hrs for 60
direction 2.5mm isotropic data!). However, fortunately bedpost
processes every voxel independently, so it is very easy to
parallelise.
<br><br> In order to parallelise bedpost you need
multiple processors which can see the same data directory, and which
you can log onto using a remote call which does not require a
password.
<br><br>
When you have this, you need to set the following environment variables:
<br><br>
<table><TR> <TD> <code>FSLMACHINELIST</code>:</TD><TD> a list of
machines on which bedpost should be run. Each machine can be included
more than once to make use of multiple processor machines.</TD></TR>
<TD> <code>FSLREMOTECALL</code>:</TD><TD>The program you want to use
to make the remote calls, e.g. ssh or rsh</TD></table>
<br>
e.g. for a <code>bash </code> user:<br>
<code>FSLMACHINELIST="machine1 machine1 machine2 machine3 machine5"</code><br>
<code> FSLREMOTECALL=ssh</code><br>
<code> export FSLMACHINELIST FSLREMOTECALL</code><br><br>
This will enable <code>bedpost</code> to use <code>ssh</code> to send jobs to two processors on <code>machine1</code>, and one each on <code>machine2 machine3 machine5</code>.<br><br>
You also need to make a file called <code>fsl.sh</code>, on each
machine listed, in one of the following places.<br>
<code>/usr/local/etc/fslconf/fsl.sh</code><br>
<code>/etc/fslconf/fsl.sh</code><br>
<code>${HOME}/.fslconf/fsl.sh</code><br><br>
in this file you need to set your <code>FSLDIR</code> in <code>sh</code> language. e.g.:<br>
<code>FSLDIR=/usr/local/fsl</code><br>
<code>export FSLDIR</code><br><br>
NB(1): you may already have this file, and it may set other config
variables (e.g. <code>FSLMACHINELIST</code> and <code>FSLREMOTECALL</code>). This is absolutely fine, as long as it also sets FSLDIR<br><br>
NB(2): If you are a <code>csh</code> or <code>tcsh</code> user you may
already have an equivalent <code>fsl.csh</code> in one of the above
directories. Note that you still need to specify the
<code>fsl.sh</code> file as above. Parallel bedpost uses
<code>sh</code> not <code>csh</code>.<br><br>
NB(3): If you have this file in more than one of
the above locations, bedpost will read them in the order specified
above, hence the the last setting of FSLDIR will be the one that
stands in the case of conflicts.
<p><h3>Locking bedpost</h3> You may want to set up a system whereby
only one person can use bedpost at any one time (thus keeping the
system load down). In order to do this, set the
<code>FSLLOCKDIR</code> environment variable to a directory which is
writeable by all users. Every time a bedpost starts, it will write
<code>${FSLLOCKDIR}/.bedpost.lock</code> which will be removed when
bedpost completes. If this file is present, new bedpost processes will
not start.
<p><h3>Cleaning up bedpost</h3> Bedpost should be relatively well
behaved in most circumstances. e.g. If bedpost is cancelled from the
keyboard, then it first logs onto all machines in the list and kills
its child processes, leaving no trace. However, there are some
circumstances where bedpost might not behave so well - e.g. if the
master machine (from where bedpost is called) crashes, the processes
on the other machines will probably not be stopped. If this situation
occurs, there is a program called <code>bedpost_cleanup</code>, which
will kill all <code>bedpost</code> related processes owned by the user
on all machines in <code>$FSLMACHINELIST</code>.
</BODY></HTML>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><meta http-equiv="Content-Type"
content="text/html;charset=utf-8">
<link REL="stylesheet" TYPE="text/css"
href="../fsl.css"><TITLE>FSL</TITLE></HEAD>
<BODY><IFRAME width="100%" scrolling="no" frameborder="0" src="fdt_top.html">Broken</IFRAME>
<h3>find_the_biggest</h3>
<b>find_the_biggest</b> is a command line utility that performs hard
segmentation of a seed region on the basis of outputs of <a
href="fdt_probtrackx.html"><b>probtrackx</b></a> when <b>classification targets</b> are being used.
<p>The output of <b>Connectivity-based seed classification</b> is a single volume for
each target mask, named <b>seeds_to_{target}</b> where {target} is replaced
by the file name of the relevant target mask. In these output images, the
value of each voxel within the seed mask is the number of samples seeded
from that voxel reaching the target mask. <b>find_the_biggest</b> classifies
seed voxels according to the target mask with which they show the highest
probability of connection. It is run as follows:
<p><b>find_the_biggest list_of_volumes outputname</b>
Where the list of volumes is the outputs of <b>Connectivity-based seed
classification</b> (i.e., files named seeds_to_target1 etc etc).
<p><IMG ALIGN=RIGHT height=300 SRC="fdt_images/fdt_seeds2targets_thal.gif"
ALT="connectivity-based classification of thalamus">
<p>The example on the right uses <a href="fdt_probtrackx.html"><b>probtrackx</b></a> and find_the_biggest to perform hard segmentation
of the thalamus on the basis of its connections to cortex.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><meta http-equiv="Content-Type"
content="text/html;charset=utf-8">
<link REL="stylesheet" TYPE="text/css"
href="../fsl.css"><TITLE>FSL</TITLE></HEAD>
<BODY><IFRAME width="100%" scrolling="no" frameborder="0" src="fdt_top.html">Broken</IFRAME>
<IMG ALIGN=MIDDLE hspace=10 vspace=20 SRC="fdt_images/fdt_vectorsx.jpg" ALT="Visualising vector data">
<h3>Displaying DWI images in fslview</h3>
Outputs of <a href="fdt_bedpostx.html"><b>bedpostx</b></a> or <a href="fdt_dtifit.html"><b>dtifit</b></a> can be conveniently displayed in fslview.
If you open an image of diffusion vectors (e.g., dtifit_V1 output of <b>dtifit</b> or dyads&#60;i&#62; output of <b>bedpostx</b>) then it is
possible to display these vectors using <b>RGB</b> coding (where the colours red,green and blue represent diffusion in the x,y,z axes respectively) or
using <b>lines</b> where a line at each voxel represents the principle
diffusion direction at that voxel. <br><br>
It is also possible to display multiple lines per voxel. Each line will be displayed in a different colour. In the example above, the red lines represent the main fibre orientation, and the blue lines represent the secondary fibre orientations (thresholded at an f-value of 0.05), as calculated by bedpostx.<br>
If you only want to visualise fibres within voxels where multiple fibres are supported (e.g. above a certain threshold for the corresponding mean_f&#60;i&#62;samples), then you first have to create a vector file where the voxels below a certain f-threshold are zeroed. You may use the two following command for that:<br><br>
<code>
<verb>maskdyads dyads&#60;i&#62; mean_f&#60;i&#62;samples 0.05</verb><br>
</code>
<p>
For more details see the relevant fslview
<a href="http://www.fmrib.ox.ac.uk/fsl/fslview/dti.html" target="_top">tutorial</a>.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><meta http-equiv="Content-Type"
content="text/html;charset=utf-8">
<link REL="stylesheet" TYPE="text/css"
href="../fsl.css"><TITLE>FSL</TITLE></HEAD>
<BODY><IFRAME width="100%" scrolling="no" frameborder="0" src="fdt_top.html">Broken</IFRAME>
<h3>DTIFIT</h3>
<b>DTIFIT</b> fits a diffusion tensor model at each voxel. You would
typically run <b>dtifit</b> on data that has been pre-processed and
eddy current corrected. Note that <b>dtifit</b> is not necessary in order to
use the probabilistic tractography (which depends on the output of
BEDPOSTX not DTIFIT).
<p>To call the FDT GUI, either run <b>Fdt</b>, or run <b>fsl</b> and press the
<b>FDT</b> button. Use the top left drop down menu to select <b>DTIFIT</b>.
<p><b>Input:</b> You can specify an input directory containing all the required files
with standardized filenames,
or alternatively you can specify input files manually by turning on the
<b>specify input files manually</b> switch. If an input directory is specified then all files must be named as shown in
parentheses below. If input files are specified manually they can have any
filename. Required files are:
<ul>
<li><b>Diffusion weighted data</b> (data): A 4D series of data volumes. This will
include diffusion-weighted volumes and volume(s) with no diffusion weighting.</li>
<li><b>BET binary brain mask</b> (nodif_brain_mask): A single binarised
volume in diffusion space containing ones inside the brain and zeroes outside
the brain.</li>
<li><b>Output basename:</b> User specifies a basename that will be used to name the
outputs of <b>dtifit</b>. If the directory input option is used then the basename
will be dti</li>
<li><b>Gradient directions</b> (bvecs): An ASCII text file containing a list
of gradient directions applied during diffusion weighted volumes. The
order of entries in this file must match the order of volumes in the
input data series.
<br>
The format is <br>
<pre>
x_1 x_2 x_3 ... x_n
y_1 y_2 y_3 ... y_n
z_1 z_2 z_3 ... z_n<br>
</pre>
Vectors are normalised to unit length within the <b>dtifit</b> code. For volumes in which there was no
diffusion weighting, the entry should still be present, although the
direction of the vector does not matter! </li>
<li><b>b values</b> (bvals): An ASCII text file containing a list of b values applied during
each volume acquisition. The order of entries in this file must match the
order of volumes in the input data and entries in the gradient directions text
file.
<br>
The format is <br> <pre>
b_1 b_2 b_3 ... b_n<br></pre>
<br>
</li>
</ul>
<h4>Outputs of <b>dtifit</b></h3.
<ul>
<li><b>&lt;basename&gt;_V1</b> - 1st eigenvector</li>
<li><b>&lt;basename&gt;_V2</b> - 2nd eigenvector</li>
<li><b>&lt;basename&gt;_V3</b> - 3rd eigenvector</li>
<li><b>&lt;basename&gt;_L1</b> - 1st eigenvalue</li>
<li><b>&lt;basename&gt;_L2</b> - 2nd eigenvalue</li>
<li><b>&lt;basename&gt;_L3</b> - 3rd eigenvalue</li>
<li><b>&lt;basename&gt;_MD</b> - mean diffusivity</li>
<li><b>&lt;basename&gt;_FA</b> - fractional anisotropy</li>
<li><b>&lt;basename&gt;_MO</b> - mode of the anisotropy (oblate ~ -1; isotropic ~ 0; prolate ~ 1)</li>
<li><b>&lt;basename&gt;_S0</b> - raw T2 signal with no diffusion weighting</li>
</ul>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0>
</TR><TR>
<TD ALIGN=CENTER VALIGN=CENTER>
<IMG SRC=fdt_images/fdt_lines_subs.gif HEIGHT=200>
<TD ALIGN=CENTER>
<IMG SRC=fdt_images/fdt_rgb_subs.gif HEIGHT=200>
<TD ALIGN=CENTER>
<IMG SRC=fdt_images/fdt_l1.gif HEIGHT=200>
<TD ALIGN=CENTER>
<IMG SRC=fdt_images/fdt_fa.gif HEIGHT=200>
</TR><TR>
<TD ALIGN=CENTER VALIGN=CENTER>
V1 Lines
<TD ALIGN=CENTER>
V1 RGB
<TD ALIGN=CENTER>
L1
<TD ALIGN=CENTER>
FA
</TR>
</TABLE>
Click <a href="fdt_display.html">here</a> for information on viewing these images
in fslview
<p>
<b>command line utility</b><br>
<pre>
dtifit
Compulsory arguments (You MUST set one or more of):
-k,--data dti data file
-o,--out Output basename
-m,--mask Bet binary mask file
-r,--bvecs b vectors file
-b,--bvals b values file
Optional arguments (You may optionally specify one or more of):
-V,--verbose switch on diagnostic messages
-h,--help display this message
--cni Input counfound regressors
--sse Output sum of squared errors
--littlebit Only process small area of brain
--save_tensor Save the elements of the tensor
-z,--zmin min z
-Z,--zmax max z
-y,--ymin min y
-Y,--ymax max y
-x,--xmin min x
-X,--xmax max x
</pre>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><meta http-equiv="Content-Type"
content="text/html;charset=utf-8">
<link REL="stylesheet" TYPE="text/css"
href="../fsl.css"><TITLE>FSL</TITLE></HEAD>
<BODY><IFRAME width="100%" scrolling="no" frameborder="0" src="fdt_top.html">Broken</IFRAME>
<h3>Eddy Current Correction</h3>
Eddy currents in the gradient coils induce (approximate) stretches and shears
in the diffusion weighted images. These distortions are different for
different gradient directions. Eddy Current Correction corrects for these
distortions, and for simple head motion, using affine registration to a
reference volume.
<p>To call the FDT GUI, either run <b>Fdt</b>, or run <b>fsl</b> and press the
<b>FDT</b> button. Use the top left drop down menu to select <b>Eddy current correction</b>.
<p><b>Diffusion weighted data:</b> Use the browse button to select
your diffusion weighted dataset (a 4D image).
<br><b>Corrected output data:</b> Use the browse button to specify a filename for
the corrected 4D dataset.
<br><b>Reference volume:</b> (default 0). Set the volume number for the reference volume
that will be used as a target to register all other volumes to. <br><br>
<b>command line utility</b><br>
<code>eddy_correct &#60;4dinput&#62; &#60;4doutput&#62; &#60;reference_no&#62;</code>
<!-- <h3>Rotating the bvecs after eddy current correction</h3> -->
<!-- Applying eddy current correction to diffusion data implies rotating (slightly) the data. In order to fit -->
<!-- a directional model to this data (e.g. DTIFIT or BEDPOSTX), you need to rotate the gradient orientations (bvecs) -->
<!-- using the rotations estimated by the eddy current correction. <br><br> -->
<!-- The following command line utility allow you to do that (modified from a script written by Martin Kavec): -->
<!-- <br><br> -->
<!-- <code>rotate_bvecs &lt;4doutput&gt;.ecclog &lt;bvecs&gt;</code> -->
doc/fdt_images/eddy.gif

7.49 KiB

File deleted
doc/fdt_images/eddy2.gif

122 KiB

doc/fdt_images/fdt_bedpost.gif

31.1 KiB

doc/fdt_images/fdt_bedpost.tiff

18.4 KiB

doc/fdt_images/fdt_bedpostx.gif

31.1 KiB

doc/fdt_images/fdt_fa.gif

23.2 KiB

doc/fdt_images/fdt_fa_big.png

24.3 KiB

doc/fdt_images/fdt_gui.gif

82.8 KiB

doc/fdt_images/fdt_gui.tiff

29.8 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment