Title: | Wrapper Functions for 'FSL' ('FMRIB' Software Library) from Functional MRI of the Brain ('FMRIB') |
---|---|
Description: | Wrapper functions that interface with 'FSL' <http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/>, a powerful and commonly-used 'neuroimaging' software, using system commands. The goal is to be able to interface with 'FSL' completely in R, where you pass R objects of class 'nifti', implemented by package 'oro.nifti', and the function executes an 'FSL' command and returns an R object of class 'nifti' if desired. |
Authors: | John Muschelli [aut, cre] |
Maintainer: | John Muschelli <[email protected]> |
License: | GPL-3 |
Version: | 2.25.3 |
Built: | 2024-11-05 04:13:07 UTC |
Source: | https://github.com/muschellij2/fslr |
A tool for applying and correcting estimated susceptibility induced distortions
applytopup( infile, datain, index, topup_files, out = NULL, method = c("lsr", "jac"), interp = c("spline", "trilinear"), verbose = TRUE ) apply_topup(...) fsl_applytopup(...)
applytopup( infile, datain, index, topup_files, out = NULL, method = c("lsr", "jac"), interp = c("spline", "trilinear"), verbose = TRUE ) apply_topup(...) fsl_applytopup(...)
infile |
list of names of input image (to be corrected) |
datain |
name of text file with PE directions/times |
index |
list of indices into –datain of the input image (to be corrected) |
topup_files |
name of field/movements (from topup) |
out |
basename for output (warped) image |
method |
Use jacobian modulation (jac) or least-squares resampling (lsr), default=lsr. |
interp |
Image interpolation model, trilinear or spline. Default spline |
verbose |
Print diagnostic information while running |
... |
arguments passed to |
aux_file method for character types
## S4 method for signature 'character' aux.file(object)
## S4 method for signature 'character' aux.file(object)
object |
is a filename to pass to fslval |
bitpix method for character types
## S4 method for signature 'character' bitpix(object)
## S4 method for signature 'character' bitpix(object)
object |
is a filename to pass to fslval |
cal_max method for character types
## S4 method for signature 'character' cal.max(object)
## S4 method for signature 'character' cal.max(object)
object |
is a filename to pass to fslval |
cal_min method for character types
## S4 method for signature 'character' cal.min(object)
## S4 method for signature 'character' cal.min(object)
object |
is a filename to pass to fslval |
Checking the q/s-forms for a header
check_file(file, ...)
check_file(file, ...)
file |
(character) filename of image to be checked |
... |
options passed to |
result of checkout
library(fslr) if (have.fsl()){ mnifile = mni_fname("2") check_file(mnifile) }
library(fslr) if (have.fsl()){ mnifile = mni_fname("2") check_file(mnifile) }
This function determines if the determinants of the sform and qform have the same sign
checkout(hd)
checkout(hd)
hd |
(list) sforms from |
logical indicating if sform and qform consistent
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") forms = getForms(mnifile) checkout(forms) }
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") forms = getForms(mnifile) checkout(forms) }
data_type method for character types
## S4 method for signature 'character' data_type(object)
## S4 method for signature 'character' data_type(object)
object |
is a filename to pass to fslval |
datatype method for character types
## S4 method for signature 'character' datatype(object)
## S4 method for signature 'character' datatype(object)
object |
is a filename to pass to fslval |
descrip method for character types
## S4 method for signature 'character' descrip(object)
## S4 method for signature 'character' descrip(object)
object |
is a filename to pass to fslval |
dim_
method for class character
## S4 method for signature 'character' dim_(object)
## S4 method for signature 'character' dim_(object)
object |
is a filename to pass to fslval |
Download FSL Tarball
download_fsl( os = c("macosx", "redhat5", "redhat6", "centos5", "centos6", "debian", "ubuntu"), outdir = tempdir(), overwrite = TRUE, ... )
download_fsl( os = c("macosx", "redhat5", "redhat6", "centos5", "centos6", "debian", "ubuntu"), outdir = tempdir(), overwrite = TRUE, ... )
os |
Operating system |
outdir |
Output directory for tarball |
overwrite |
If |
... |
Arguments to pass to |
Filename of destination file
Calls dtifit
from FSL
dtifit( infile, bvecs, bvals, mask = NULL, outprefix = NULL, opts = "", bet.opts = "", verbose = TRUE, sse = FALSE, save_tensor = FALSE, grad_image = NULL )
dtifit( infile, bvecs, bvals, mask = NULL, outprefix = NULL, opts = "", bet.opts = "", verbose = TRUE, sse = FALSE, save_tensor = FALSE, grad_image = NULL )
infile |
Input filename |
bvecs |
b-vectors: matrix of 3 columns or filename of ASCII text file |
bvals |
b-values: vector of same length as number of rows of b-vectors or filename of ASCII text file |
mask |
Mask filename |
outprefix |
Output prefix |
opts |
Additional options for |
bet.opts |
Options for |
verbose |
print diagnostic messages |
sse |
Save sum of squared errors |
save_tensor |
Save tensor file out |
grad_image |
Gradient Nonlinearity Tensor file |
Vector of character filenames of output. See Note
On successful completion of the command, the following files
will be output, which are:
mask
- the mask used in the analysis
outprefix
_V1 - 1st eigenvector
outprefix
_V2 - 2nd eigenvector
outprefix
_V3 - 3rd eigenvector
outprefix
_L1 - 1st eigenvalue
outprefix
_L2 - 2nd eigenvalue
outprefix
_L3 - 3rd eigenvalue
outprefix
_MD - mean diffusivity
outprefix
_FA - fractional anisotropy
outprefix
_MO - mode of the anisotropy (oblate ~ -1; isotropic ~ 0; prolate ~ 1)
outprefix
_S0 - raw T2 signal with no diffusion weighting
optional output
If sse = TRUE
, then the additional file will be present:
outprefix
_sse - Sum of squared error
If save_tensor = TRUE
, then the additional file will be present:
outprefix
_tensor - tensor as a 4D file in this order: Dxx,Dxy,Dxz,Dyy,Dyz,Dzz
This function calls eddy
from FSL for
DTI Processing
eddy( infile, mask, acq_file, index_file, bvecs, bvals, topup = NULL, outfile = NULL, retimg = TRUE, opts = "", verbose = TRUE, eddy_cmd = c("eddy", "eddy_openmp", "eddy_cuda"), ... )
eddy( infile, mask, acq_file, index_file, bvecs, bvals, topup = NULL, outfile = NULL, retimg = TRUE, opts = "", verbose = TRUE, eddy_cmd = c("eddy", "eddy_openmp", "eddy_cuda"), ... )
infile |
input filename of 4D image. |
mask |
Mask filename (or class nifti) |
acq_file |
A text-file describing the acquisition parameters for the
different images in |
index_file |
A text-file that determines the relationship between
on the one hand the images in |
bvecs |
A text file with normalised vectors describing the direction of the diffusion weighting. |
bvals |
A text file with b-values describing the "amount of" diffusion weighting |
topup |
This should only be specified if you have previously run 'topup' on your data and should be the same name that you gave as an argument to the –out parameter when you ran topup, aka the base name for output files from topup. |
outfile |
Output file basename |
retimg |
(logical) return image of class nifti |
opts |
Additional options to pass to arguments
passed to |
verbose |
print diagnostic messages |
eddy_cmd |
The version of |
... |
Not currently used |
Result from system command currently
This function calls eddy_correct
from FSL for
DTI Processing
eddy_correct(infile, outfile = NULL, retimg = TRUE, reference_no = 0, ...)
eddy_correct(infile, outfile = NULL, retimg = TRUE, reference_no = 0, ...)
infile |
input filename of 4D image. |
outfile |
Output filename |
retimg |
(logical) return image of class nifti |
reference_no |
Set the volume number for the reference volume that will be used as a target to register all other volumes to. (default=0, i.e. the first volume) |
... |
Additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Enforce Either Qform or Sform is set
enforce_form(file, ...)
enforce_form(file, ...)
file |
(character) image filename or character of class nifti |
... |
additional arguments to pass to
|
A character filename
if (have_fsl()) { res = enforce_form(mni_fname()) }
if (have_fsl()) { res = enforce_form(mni_fname()) }
Face Removal Mask
face_removal_mask( file, template = mni_fname(mm = "1"), face_mask = mni_face_fname(mm = "1"), outfile = NULL, dof = 12, cost = "mutualinfo", retimg = FALSE ) deface_image(file, ...)
face_removal_mask( file, template = mni_fname(mm = "1"), face_mask = mni_face_fname(mm = "1"), outfile = NULL, dof = 12, cost = "mutualinfo", retimg = FALSE ) deface_image(file, ...)
file |
input image |
template |
Template image to register input image to. Set
to |
face_mask |
Mask of image, in same space as |
outfile |
Output file name |
dof |
(numeric) degrees of freedom (default 6 - rigid body) |
cost |
Cost function passed to |
retimg |
(logical) return image of class nifti |
... |
not used |
An image or filename depending on retimg
if (have_fsl()) { file = "~/Downloads/sample_T1_input.nii.gz" if (file.exists(file)) { mask = face_removal_mask(file = file, template = NULL, face_mask = NULL) image = fslmask(file, mask) } }
if (have_fsl()) { file = "~/Downloads/sample_T1_input.nii.gz" if (file.exists(file)) { mask = face_removal_mask(file = file, template = NULL, face_mask = NULL) image = fslmask(file, mask) } }
This function calls fast
from FSL
fast( file, outfile = NULL, bias_correct = TRUE, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", type = c("T1", "T2", "PD"), out_type = c("seg", "mixeltype", "pve_0", "pve_1", "pve_2", "pveseg"), verbose = TRUE, all_images = FALSE, ... ) fast_all(..., all_images = TRUE) fast_nobias_all(..., bias_correct = FALSE, all_images = FALSE) fsl_fast(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslfast(...) fsl_fast_nobias( ..., bias_correct = FALSE, outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE ) fast_nobias(..., bias_correct = FALSE) fslfast_nobias(..., bias_correct = FALSE)
fast( file, outfile = NULL, bias_correct = TRUE, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", type = c("T1", "T2", "PD"), out_type = c("seg", "mixeltype", "pve_0", "pve_1", "pve_2", "pveseg"), verbose = TRUE, all_images = FALSE, ... ) fast_all(..., all_images = TRUE) fast_nobias_all(..., bias_correct = FALSE, all_images = FALSE) fsl_fast(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslfast(...) fsl_fast_nobias( ..., bias_correct = FALSE, outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE ) fast_nobias(..., bias_correct = FALSE) fslfast_nobias(..., bias_correct = FALSE)
file |
(character) image to be manipulated |
outfile |
(character) resultant image name (optional) |
bias_correct |
(logical) if |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
type |
type of image T1, T2, or PD. |
out_type |
(character) Suffix to grab from outfile. For
example, output filename is |
verbose |
(logical) print out command before running |
all_images |
If |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fast
's help
fast.help()
fast.help()
Prints help output and returns output as character vector
if (have.fsl()){ fast.help() }
if (have.fsl()){ fast.help() }
This function calls flirt
to register infile to reffile
and either saves the image or returns an object of class nifti, along with the
transformation matrix omat
flirt( infile, reffile, omat = NULL, dof = 6, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
flirt( infile, reffile, omat = NULL, dof = 6, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
infile |
(character) input filename |
reffile |
(character) reference image to be registered to |
omat |
(character) Output matrix name |
dof |
(numeric) degrees of freedom (default 6 - rigid body) |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
opts |
(character) additional options to FLIRT |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
character or logical depending on intern
This function applies a matrix from flirt
to other images
flirt_apply( infile, reffile, initmat, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
flirt_apply( infile, reffile, initmat, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
infile |
(character) input filename |
reffile |
(character) reference image to be registered to |
initmat |
(character) Matrix of transformation |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
opts |
(character) additional options to FLIRT |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
character or logical depending on intern
This function calls flirt
's help
flirt.help()
flirt.help()
Prints help output and returns output as character vector
if (have.fsl()){ flirt.help() }
if (have.fsl()){ flirt.help() }
This function calls fnirt
to register infile to reffile
and either saves the image or returns an object of class nifti
fnirt( infile, reffile, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
fnirt( infile, reffile, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
infile |
(character) input filename |
reffile |
(character) reference image to be registered to |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
opts |
(character) additional options to FLIRT |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
character or logical depending on intern
This function calls fnirt
to register infile to reffile
and either saves the image or returns an object of class nifti, but does
the affine registration first
fnirt_with_affine( infile, reffile, flirt.omat = NULL, flirt.outfile = NULL, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, flirt.opts = "", opts = "", verbose = TRUE, ... )
fnirt_with_affine( infile, reffile, flirt.omat = NULL, flirt.outfile = NULL, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, flirt.opts = "", opts = "", verbose = TRUE, ... )
infile |
(character) input filename |
reffile |
(character) reference image to be registered to |
flirt.omat |
(character) Filename of output affine matrix |
flirt.outfile |
(character) Filename of output affine-registered image |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
flirt.opts |
(character) additional options to FLIRT |
opts |
(character) additional options to FNIRT |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
character or logical depending on intern
Applies an affine transformation with FLIRT then the warp image with FNIRT
fnirt_with_affine_apply( infile, reffile, flirt.omat = NULL, flirt.outfile = NULL, fnirt.warpfile = NULL, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, flirt.opts = "", opts = "", verbose = TRUE, ... )
fnirt_with_affine_apply( infile, reffile, flirt.omat = NULL, flirt.outfile = NULL, fnirt.warpfile = NULL, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, flirt.opts = "", opts = "", verbose = TRUE, ... )
infile |
(character) input filename |
reffile |
(character) reference image to be registered to |
flirt.omat |
(character) Filename of output affine matrix |
flirt.outfile |
(character) Filename of output affine-registered image |
fnirt.warpfile |
(character) Filename of warp image from
|
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
flirt.opts |
(character) additional options to FLIRT |
opts |
(character) additional options to FNIRT |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
character or logical depending on intern
fnirt_with_affine
This function calls fnirt
's help
fnirt.help()
fnirt.help()
Prints help output and returns output as character vector
This function calls fslmaths -abs
.
The R functions wraps fslmaths
fsl_abs(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslabs( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_abs(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslabs( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to absolute value |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -acos
.
The R functions wraps fslmaths
fsl_acos(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslacos( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_acos(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslacos( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to arc cosine transform |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -add
.
The R functions wraps fslmaths
fsl_add(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsladd( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_add(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsladd( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image |
file2 |
(character) image to be added |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fsl_anat
from FSL
fsl_anat( file, modality = c("T1", "T2", "PD"), outdir = NULL, intern = FALSE, opts = "", verbose = TRUE, ... )
fsl_anat( file, modality = c("T1", "T2", "PD"), outdir = NULL, intern = FALSE, opts = "", verbose = TRUE, ... )
file |
(character) image to be manipulated, should be full path |
modality |
(character) Modality of Image to be run |
outdir |
(character) output directory, if none specified, will
default to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
... |
options passed to |
Result from system command, depends if intern is TRUE or FALSE.
This function calls fsl_anat
's help
fsl_anat.help()
fsl_anat.help()
Prints help output and returns output as character vector
if (have.fsl()){ fsl_anat.help() }
if (have.fsl()){ fsl_anat.help() }
This function applies a coefficient map from fnirt
to other images
fsl_applywarp( infile, reffile, warpfile, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
fsl_applywarp( infile, reffile, warpfile, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
infile |
(character) input filename |
reffile |
(character) reference image to be registered to |
warpfile |
(character) reference image to be registered to |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
opts |
(character) additional options to FLIRT |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
character or logical depending on intern
This function calls applywarp
's help
fsl_applywarp.help()
fsl_applywarp.help()
Prints help output and returns output as character vector
This function calls fslmaths -asin
.
The R functions wraps fslmaths
fsl_asin(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslasin( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_asin(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslasin( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to arc sine transform |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -atan
.
The R functions wraps fslmaths
fsl_atan(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslatan( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_atan(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslatan( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to arc tangent transform |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
Finds the FSLDIR from system environment or getOption("fsl.path")
and pastes on “data/standard”
fsl_atlas_dir()
fsl_atlas_dir()
Character path
avscale
This function calls avscale
to get individual
matrices for FSL
fsl_avscale(file, volume = NULL, parsed = TRUE, verbose = TRUE) avscale(...)
fsl_avscale(file, volume = NULL, parsed = TRUE, verbose = TRUE) avscale(...)
file |
(character) matrix filename |
volume |
(character) non-reference volume filename or nifti image |
parsed |
(logical) should |
verbose |
(logical) print out command before running |
... |
not used, but used for duplicating |
Character of information from avscale
This function calls bet
to extract a brain
from an image, usually for skull stripping.
fsl_bet(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslbet( infile, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", betcmd = c("bet2", "bet"), verbose = TRUE, ... )
fsl_bet(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslbet( infile, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", betcmd = c("bet2", "bet"), verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
infile |
(character) input filename |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
opts |
(character) additional options to |
betcmd |
(character) Use |
verbose |
(logical) print out command before running |
character or logical depending on intern
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function wraps a call to fast
that performs bias
correction
fsl_biascorrect( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, remove.seg = TRUE, ... )
fsl_biascorrect( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, remove.seg = TRUE, ... )
file |
(character) image to be manipulated |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
remove.seg |
(logical) Should segmentation from FAST be removed? |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
This function calls fslmaths -bin
. The R functions wraps
fslmaths
fsl_bin(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslbin( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_bin(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslbin( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) image to be binarized |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
set.seed(5) dims = rep(10, 3) arr = array(rnorm(prod(dims)), dim = dims) nim = oro.nifti::nifti(arr) if (have.fsl()){ fslbin(nim) fsl_bin(nim) }
set.seed(5) dims = rep(10, 3) arr = array(rnorm(prod(dims)), dim = dims) nim = oro.nifti::nifti(arr) if (have.fsl()){ fslbin(nim) fsl_bin(nim) }
Creates a 2 by 2 table for
fsl_bin_tab(x, y, dnames = c("x", "y"), verbose = FALSE)
fsl_bin_tab(x, y, dnames = c("x", "y"), verbose = FALSE)
x |
filename of logical or 0/1 image |
y |
filename of logical or 0/1 image |
dnames |
names for table |
verbose |
Should fsl commands be printed? |
table of x vs y
fsl_bin
will be run to make these images binary before running
This function calls fslmaths -binv
.
The R functions wraps fslmaths
fsl_binv(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslbinv( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_binv(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslbinv( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to take the binarized inverse |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
cluster
Form clusters, report information about clusters
and/or perform cluster-based inference. Wrapper for cluster
fsl_cluster( file, threshold, retimg = FALSE, reorient = FALSE, opts = "", cope_image = NULL, pthresh = NULL, peakdist = 0, volume = FALSE, smooth_est = NULL, voxel_resel = NULL, fractional = FALSE, connectivity = 26, mm = FALSE, find_minima = FALSE, standard_image = NULL, verbose = TRUE, ... ) fslcluster(..., retimg = TRUE) read_cluster_table(file)
fsl_cluster( file, threshold, retimg = FALSE, reorient = FALSE, opts = "", cope_image = NULL, pthresh = NULL, peakdist = 0, volume = FALSE, smooth_est = NULL, voxel_resel = NULL, fractional = FALSE, connectivity = 26, mm = FALSE, find_minima = FALSE, standard_image = NULL, verbose = TRUE, ... ) fslcluster(..., retimg = TRUE) read_cluster_table(file)
file |
filename of input volume |
threshold |
threshold for input volume |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
opts |
(character) operations to be passed to |
cope_image |
filename of input cope volume |
pthresh |
p-threshold |
peakdist |
minimum distance between local maxima/minima, in mm (default 0) |
volume |
number of voxels in the mask |
smooth_est |
smoothness estimate = sqrt(det(Lambda)) |
voxel_resel |
Size of one resel in voxel units |
fractional |
interprets the threshold as a fraction of the robust range |
connectivity |
the connectivity of voxels (default 26) |
mm |
use mm, not voxel, coordinates |
find_minima |
find minima instead of maxima |
standard_image |
filename for standard-space volume |
verbose |
(logical) print out command before running |
... |
additional arguments to pass to |
A list of filenames of outputs and tables:
opvals
filename for image output of log pvals
oindex
filename for output of cluster index (in size order)
othresh
filename for output of thresholded image
olmax
filename for output of local maxima text file
olmaxim
filename for output of local maxima volume
osize
filename for output of size image
omax
filename for output of max image
omean
filename for output of mean image
if (have_fsl()) { file = mni_fname(brain = TRUE, mask = FALSE) threshold = 6000 clus = fsl_cluster(file, threshold) }
if (have_fsl()) { file = mni_fname(brain = TRUE, mask = FALSE) threshold = 6000 clus = fsl_cluster(file, threshold) }
This function calls fslmaths -cos
.
The R functions wraps fslmaths
fsl_cos(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslcos( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_cos(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslcos( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to cosine transform |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
Finds the FSLDIR from system environment or getOption("fsl.path")
and pastes on “data”
fsl_data_dir()
fsl_data_dir()
Character path
Tool to deface a structural T1w image.
fsl_deface( file, outfile = NULL, retimg = TRUE, opts = "", deface_cropped = FALSE, bet_fractional_intensity = NULL, bias_correct = FALSE, shift_xyz = NULL, cog_xyz = NULL, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
fsl_deface( file, outfile = NULL, retimg = TRUE, opts = "", deface_cropped = FALSE, bet_fractional_intensity = NULL, bias_correct = FALSE, shift_xyz = NULL, cog_xyz = NULL, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
file |
(character) input image to estimate edge strength |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
opts |
(character) operations to be passed to |
deface_cropped |
apply the defacing to the cropped image instead of the original image |
bet_fractional_intensity |
fractional intensity for bet (0->1); default=0.5; |
bias_correct |
Bias-correct the input image (with fast); |
shift_xyz |
Shift, in mm, x-, y- and z-directions, to shift face mask by; |
cog_xyz |
centre-of-gravity for bet (voxels, not mm); |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
verbose |
print diagnostic messages |
... |
additional arguments passed to |
if (have_fsl()) { file = mni_fname(mm = 1, brain = FALSE) out = fsl_deface(file, retimg = FALSE) }
if (have_fsl()) { file = mni_fname(mm = 1, brain = FALSE) out = fsl_deface(file, retimg = FALSE) }
Creates a 2 by 2 table for
fsl_dice(x, y, ...)
fsl_dice(x, y, ...)
x |
filename of logical or 0/1 image |
y |
filename of logical or 0/1 image |
... |
arguments passed to |
Single number of the dice coefficient
This function calls fslmaths -ero
after inverting the image
to dilate an image with either
the default FSL kernel or the kernel specified in kopts
. The function
either saves the image or returns an object of class nifti.
fsl_dilate(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsldilate( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, kopts = "", opts = "", verbose = TRUE, ... )
fsl_dilate(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsldilate( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, kopts = "", opts = "", verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) resultant dilated image name |
retimg |
(logical) return image of class nifti |
file |
(character) image to be dilated |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
kopts |
(character) options for kernel |
opts |
(character) additional options to be passed to fslmaths |
verbose |
(logical) print out command before running |
Result from system command, depends if intern is TRUE or FALSE. If retimg is TRUE, then the image will be returned.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = img > .5 dilated = fsldilate(mask, kopts = "-kernel boxv 5", retimg=TRUE) }) }
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = img > .5 dilated = fsldilate(mask, kopts = "-kernel boxv 5", retimg=TRUE) }) }
This function calls fslmaths -div
.
The R functions wraps fslmaths
fsl_div(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsldiv( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_div(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsldiv( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image |
file2 |
(character) image to be divided |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -edge
.
The R functions wraps fslmaths
fsl_edge(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsledge( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_edge(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsledge( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to estimate edge strength |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -ero
to erode an image with either
the default FSL kernel or the kernel specified in kopts
. The function
either saves the image or returns an object of class nifti.
fsl_erode(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslerode( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, kopts = "", opts = "", verbose = TRUE, ... )
fsl_erode(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslerode( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, kopts = "", opts = "", verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) resultant eroded image name |
retimg |
(logical) return image of class nifti |
file |
(character) image to be eroded |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
kopts |
(character) options for kernel |
opts |
(character) additional options to be passed to fslmaths |
verbose |
(logical) print out command before running |
Result from system command, depends if intern is TRUE or FALSE. If retimg is TRUE, then the image will be returned.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = img > .5 eroded = fslerode(mask, kopts = "-kernel boxv 5", retimg=TRUE) }) }
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = img > .5 eroded = fslerode(mask, kopts = "-kernel boxv 5", retimg=TRUE) }) }
This function calls fslmaths -exp
.
The R functions wraps fslmaths
fsl_exp(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslexp( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_exp(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslexp( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to exponentiated |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -fillh
to fill in image holes
and either saves the image or returns an object of class nifti
fsl_fill(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslfill( file, outfile = NULL, bin = TRUE, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
fsl_fill(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslfill( file, outfile = NULL, bin = TRUE, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) name of resultant filled file |
retimg |
(logical) return image of class nifti |
file |
(character) filename of image to be filled |
bin |
(logical) binarize the image before filling |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
verbose |
(logical) print out command before running |
character or logical depending on intern
Functions with underscores have different defaults and will return an output filename, so to be used for piping
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = img > .5 eroded = fslerode(mask, kopts = "-kernel boxv 5", retimg=TRUE) filled = fslfill(eroded, retimg= TRUE) }) }
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = img > .5 eroded = fslerode(mask, kopts = "-kernel boxv 5", retimg=TRUE) filled = fslfill(eroded, retimg= TRUE) }) }
This function calls fslmaths -index
.
The R functions wraps fslmaths
fsl_index(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslindex( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_index(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslindex( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to have non-zero entries replaced with index |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -log
.
The R functions wraps fslmaths
fsl_log(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsllog( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_log(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsllog( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to log transform |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -mas
to mask an image from
an image mask and either saves the image or returns an object of class nifti
fsl_mask(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslmask( file, mask, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
fsl_mask(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslmask( file, mask, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) resultant masked image name |
retimg |
(logical) return image of class nifti |
file |
(character) image to be masked |
mask |
(character) mask given for image |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) additional options to be passed to fslmask |
verbose |
(logical) print out command before running |
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
if (have.fsl()){ system.time({ x = array(rnorm(1e5), dim = c(100, 100, 10)) img = nifti(x, dim= c(100, 100, 10), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = img > .5 masked = fslmask(img, mask = mask, retimg=TRUE) }) }
if (have.fsl()){ system.time({ x = array(rnorm(1e5), dim = c(100, 100, 10)) img = nifti(x, dim= c(100, 100, 10), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = img > .5 masked = fslmask(img, mask = mask, retimg=TRUE) }) }
This function calls fslmaths
fsl_maths(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslmaths( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
fsl_maths(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslmaths( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) image to be manipulated |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmerge
to merge files on some dimension
and either saves the image or returns an object of class nifti
fsl_merge(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslmerge( infiles, direction = c("x", "y", "z", "t", "a"), outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
fsl_merge(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslmerge( infiles, direction = c("x", "y", "z", "t", "a"), outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
infiles |
(character) input filenames |
direction |
(character) direction to merge over, x, y, z, t (time), a (auto) |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
verbose |
(logical) print out command before running |
character or logical depending on intern
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -mul
.
The R functions wraps fslmaths
fsl_mul(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslmul( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_mul(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslmul( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image |
file2 |
(character) image to be multiplied |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -nan
.
The R functions wraps fslmaths
fsl_nan(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslnan( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_nan(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslnan( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to replace NaNs (improper numbers) with 0 |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -nanm
.
The R functions wraps fslmaths
fsl_nanm(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslnanm( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_nanm(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslnanm( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to set to 1 for NaN voxels, 0 otherwise |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -rand
.
The R functions wraps fslmaths
fsl_rand(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslrand( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_rand(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslrand( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to add random uniform noise to |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -randn
.
The R functions wraps fslmaths
fsl_randn(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslrandn( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_randn(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslrandn( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to add random standard to Gaussian noise |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -recip
.
The R functions wraps fslmaths
fsl_recip(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslrecip( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_recip(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslrecip( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to take the reciprocal (1/image) |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -rem
.
The R functions wraps fslmaths
fsl_rem(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslrem( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_rem(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslrem( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image |
file2 |
(character) image to divide the current image by and take remainder |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
Resample an Image to Specific Voxel Size
fsl_resample( file, voxel_size, outfile = NULL, retimg = TRUE, reorient = FALSE, opts = NULL, verbose = TRUE )
fsl_resample( file, voxel_size, outfile = NULL, retimg = TRUE, reorient = FALSE, opts = NULL, verbose = TRUE )
file |
Input file to resample |
voxel_size |
Voxel size (in mm). This should be a scalar number. |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
opts |
options to pass to |
verbose |
(logical) print out command before running |
If retimg
then object of class nifti. Otherwise,
the output file.
if (have_fsl()) { file = mni_fname(mm = 1, brain = TRUE) est2 = fsl_resample(file = file, voxel_size = 1, retimg = FALSE) pixdim(est2) est = fsl_resample(file = file, voxel_size = 1) pixdim(est) }
if (have_fsl()) { file = mni_fname(mm = 1, brain = TRUE) est2 = fsl_resample(file = file, voxel_size = 1, retimg = FALSE) pixdim(est2) est = fsl_resample(file = file, voxel_size = 1) pixdim(est) }
This function calls fslmaths -s
to smooth an image and either
saves the image or returns an object of class nifti
fsl_smooth(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsmooth( file, sigma = 10, mask = NULL, smooth_mask = TRUE, smoothed_mask = NULL, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
fsl_smooth(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsmooth( file, sigma = 10, mask = NULL, smooth_mask = TRUE, smoothed_mask = NULL, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) resultant smoothed image name (optional) if not give, will be the stub of the filename then _sigma |
retimg |
(logical) return image of class nifti |
file |
(character or nifti) image to be smoothed |
sigma |
(numeric) sigma (in mm) of Gaussian kernel for smoothing |
mask |
(character) optional mask given for image |
smooth_mask |
(logical) Smooth mask? If TRUE, the masked image will be divided by the smoothed mask. |
smoothed_mask |
(character or nifti) If specified and
|
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
verbose |
(logical) print out command before running |
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) s.img = fslsmooth(img, retimg=TRUE) }) }
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) s.img = fslsmooth(img, retimg=TRUE) }) }
smoothest
Smoothness Estimation using smoothest
fsl_smoothest( file, residual_image, z_image, dof = NULL, opts = "", verbose = TRUE, ... )
fsl_smoothest( file, residual_image, z_image, dof = NULL, opts = "", verbose = TRUE, ... )
file |
filename of input brain mask |
residual_image |
4d residual image. If specified, then
|
z_image |
z-statistic image. Cannot be specified if
|
dof |
number of degrees of freedom |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
... |
additional arguments to pass to |
An output of smoothness estimate
if (have_fsl()) { file = mni_fname(mm = 2, brain = TRUE, mask = TRUE) img = mni_img(mm = 2, brain = TRUE, mask = FALSE) mask = mni_img(mm = 2, brain = TRUE, mask = TRUE) img = zscore_img(img = img, mask = mask) est = fsl_smoothest(file = file, z_image = img) }
if (have_fsl()) { file = mni_fname(mm = 2, brain = TRUE, mask = TRUE) img = mni_img(mm = 2, brain = TRUE, mask = FALSE) mask = mni_img(mm = 2, brain = TRUE, mask = TRUE) img = zscore_img(img = img, mask = mask) est = fsl_smoothest(file = file, z_image = img) }
This function calls fslmaths -sqr
.
The R functions wraps fslmaths
fsl_sqr(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsqr( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_sqr(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsqr( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to square |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -sqrt
.
The R functions wraps fslmaths
fsl_sqrt(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsqrt( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_sqrt(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsqrt( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to square root |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
Finds the FSLDIR from system environment or getOption("fsl.path")
and pastes on “data/standard”
fsl_std_dir() fsl_std_file(file = NULL)
fsl_std_dir() fsl_std_file(file = NULL)
file |
A file from the standard data file |
Character path
This function calls fslmaths -sub
.
The R functions wraps fslmaths
fsl_sub(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsub( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_sub(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsub( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image |
file2 |
(character) image to be subtracted |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -subsamp2
to subsample an image
and either saves the image or returns an object of class nifti
fsl_sub2(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsub2( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
fsl_sub2(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslsub2( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) name of resultant subsampled file |
retimg |
(logical) return image of class nifti |
file |
(character) filename of image to be subsampled |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
verbose |
(logical) print out command before running |
character or logical depending on intern
Functions with underscores have different defaults and will return an output filename, so to be used for piping
if (have.fsl()){ system.time({ x = array(rnorm(1e6), dim = c(100, 100, 100)) img = nifti(x, dim= c(100, 100, 100), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) subsamp = fslsub2(img, retimg=TRUE) print(voxdim(subsamp)) }) }
if (have.fsl()){ system.time({ x = array(rnorm(1e6), dim = c(100, 100, 100)) img = nifti(x, dim= c(100, 100, 100), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) subsamp = fslsub2(img, retimg=TRUE) print(voxdim(subsamp)) }) }
This function calls fslswapdim
fsl_swapdim(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslswapdim( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, a = "x", b = "y", c = "z", verbose = TRUE, ... )
fsl_swapdim(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslswapdim( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, a = "x", b = "y", c = "z", verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) image to be manipulated |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
a |
(character) Option for x domain in |
b |
(character) Option for y domain in |
c |
(character) Option for z domain in |
verbose |
(logical) print out command before running |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -tan
.
The R functions wraps fslmaths
fsl_tan(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsltan( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fsl_tan(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fsltan( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
... |
additional arguments passed to |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
file |
(character) input image to tangent transform |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths -thr -uthr
to threshold an image
and either saves the image or returns an object of class nifti
fsl_thresh(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslthresh( file, outfile = NULL, thresh = 0, uthresh = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
fsl_thresh(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslthresh( file, outfile = NULL, thresh = 0, uthresh = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
... |
additional arguments passed to |
outfile |
(character) name of resultant thresholded file |
retimg |
(logical) return image of class nifti |
file |
(character) filename of image to be thresholded |
thresh |
(numeric) threshold (anything below set to 0) |
uthresh |
(numeric) upper threshold (anything above set to 0) |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
opts |
(character) additional options to be passed to fslmaths |
verbose |
(logical) print out command before running |
character or logical depending on intern
Functions with underscores have different defaults and will return an output filename, so to be used for piping
if (have.fsl()){ system.time({ x = array(rnorm(1e6), dim = c(100, 100, 100)) img = nifti(x, dim= c(100, 100, 100), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) thresh = fslthresh(img, thresh=0, uthresh = 2, retimg=TRUE) }) }
if (have.fsl()){ system.time({ x = array(rnorm(1e6), dim = c(100, 100, 100)) img = nifti(x, dim= c(100, 100, 100), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) thresh = fslthresh(img, thresh=0, uthresh = 2, retimg=TRUE) }) }
FSL Timeseries Plot using 'fsl_tsplot' (not 'tsplot')
fsl_tsplot( infile, outfile = tempfile(fileext = ".png"), plot_title = NULL, legend = NULL, labels = NULL, ymin = NULL, ymax = NULL, xlabel = NULL, ylabel = NULL, height = NULL, width = NULL, precision = NULL, unit = NULL, scientific_notation = FALSE, start_position = NULL, end_position = NULL, ... ) fsl_tsplot.help()
fsl_tsplot( infile, outfile = tempfile(fileext = ".png"), plot_title = NULL, legend = NULL, labels = NULL, ymin = NULL, ymax = NULL, xlabel = NULL, ylabel = NULL, height = NULL, width = NULL, precision = NULL, unit = NULL, scientific_notation = FALSE, start_position = NULL, end_position = NULL, ... ) fsl_tsplot.help()
infile |
comma-separated list of input file names (ASCII text matrix, one column per timecourse) |
outfile |
output filename for the PNG file |
plot_title |
plot title |
legend |
file name of ASCII text file, one row per legend entry |
labels |
comma-separated list of labels |
ymin |
minimum y-value |
ymax |
maximum y-value |
xlabel |
X-axis label |
ylabel |
Y-axis label |
height |
plot height in pixels (default 150) |
width |
plot width in pixels (default 600) |
precision |
precision of x-axis labels |
unit |
scaling units for x-axis (default 1...length of infile) |
scientific_notation |
switch on scientific notation |
start_position |
Position of first column to plot |
end_position |
Position of final column to plot |
... |
additional options to pass to |
Name of PNG file
Finds the FSL version from FSLDIR/etc/fslversion
fsl_version(full = FALSE) fslversion() fsl_version_gt5()
fsl_version(full = FALSE) fslversion() fsl_version_gt5()
full |
provide the full version, versus the numeric version |
If the version file does not exist, it will throw a warning, but it will return an empty string. Otherwise it will be a string of the version.
This will use fsldir()
to get the directory
if (have_fsl()) { fslversion() fsl_version() }
if (have_fsl()) { fslversion() fsl_version() }
This function calls fslmaths
's help, as
fslabs
is a wrapper for fslmaths
fslabs.help(...)
fslabs.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslabs.help() }
if (have.fsl()){ fslabs.help() }
This function calls fslmaths
's help, as
fslacos
is a wrapper for fslmaths
fslacos.help(...)
fslacos.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslacos.help() }
if (have.fsl()){ fslacos.help() }
This function calls fslmaths
's help, as
fsladd
is a wrapper for fslmaths
fsladd.help(...)
fsladd.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fsladd.help() }
if (have.fsl()){ fsladd.help() }
This function multiplies two images
using fslmul
) after
binarizing the images (using fslbin
fsland(file, file2, ...) fsl_and(file, file2, ...)
fsland(file, file2, ...) fsl_and(file, file2, ...)
file |
(character) input image |
file2 |
(character) image to be multiplied |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths
's help, as
fslasin
is a wrapper for fslmaths
fslasin.help(...)
fslasin.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslasin.help() }
if (have.fsl()){ fslasin.help() }
This function calls fslmaths
's help, as
fslatan
is a wrapper for fslmaths
fslatan.help(...)
fslatan.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslatan.help() }
if (have.fsl()){ fslatan.help() }
This function calls bet
's help
fslbet.help(betcmd = c("bet2", "bet"))
fslbet.help(betcmd = c("bet2", "bet"))
betcmd |
(character) Get help for |
Prints help output and returns output as character vector
if (have.fsl()){ fslbet.help() fslbet.help("bet") }
if (have.fsl()){ fslbet.help() fslbet.help("bet") }
This function calls fslmaths
's help, as
fslbin
is a wrapper for fslmaths
fslbin.help(...)
fslbin.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslbin.help() }
if (have.fsl()){ fslbin.help() }
This function calls fslmaths
's help, as
fslbinv
is a wrapper for fslmaths
fslbinv.help(...)
fslbinv.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslbinv.help() }
if (have.fsl()){ fslbinv.help() }
This function calls fslchfiletype
fslchfiletype( file, filetype = "NIFTI_GZ", outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
fslchfiletype( file, filetype = "NIFTI_GZ", outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
file |
(character) image to be manipulated |
filetype |
filetype to change image to |
outfile |
Output filename. If NULL, will overwrite input file |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If |
intern |
(logical) to be passed to |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
This function calls fslchfiletype
's help
fslchfiletype.help()
fslchfiletype.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslchfiletype.help() }
if (have.fsl()){ fslchfiletype.help() }
This function calls fsl command passed to func
fslcmd( func, file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, samefile = FALSE, opts_after_outfile = FALSE, frontopts = "", no.outfile = FALSE, trim_front = FALSE, run = TRUE, ... )
fslcmd( func, file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, samefile = FALSE, opts_after_outfile = FALSE, frontopts = "", no.outfile = FALSE, trim_front = FALSE, run = TRUE, ... )
func |
(character) FSL function |
file |
(character) image to be manipulated |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
samefile |
(logical) is the output the same file? |
opts_after_outfile |
(logical) should |
frontopts |
(character) options/character to put in before filename |
no.outfile |
(logical) is there an output file in the arguments of the FSL function? |
trim_front |
trim the whitespace from the front of the command. |
run |
(logical) Should the command just be printed (if |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Find Center of Gravity of Image from FSL
fslcog(img, mm = TRUE, verbose = TRUE, ts = FALSE)
fslcog(img, mm = TRUE, verbose = TRUE, ts = FALSE)
img |
Object of class nifti, or path of file |
mm |
Logical if the center of gravity (COG) would be in mm (default |
verbose |
(logical) print out command before running |
ts |
(logical) is the series a timeseries (4D), invoking |
Vector of length 3 unless ts option invoked
FSL uses a 0-based indexing system, which will give you a different
answer compared to cog
, but fslcog(img, mm = FALSE) +1
should be relatively close to cog(img)
if (have.fsl()){ x = array(rnorm(1e6), dim = c(100, 100, 100)) img = nifti(x, dim= c(100, 100, 100), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) fslcog(img) }
if (have.fsl()){ x = array(rnorm(1e6), dim = c(100, 100, 100)) img = nifti(x, dim= c(100, 100, 100), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) fslcog(img) }
This function calls fslmaths
's help, as
fslcos
is a wrapper for fslmaths
fslcos.help(...)
fslcos.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslcos.help() }
if (have.fsl()){ fslcos.help() }
This function calls fslcpgeom
fslcpgeom( file, file_with_header, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
fslcpgeom( file, file_with_header, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
file |
(character) image to be manipulated |
file_with_header |
image with header to be copied over |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
This function calls fslcpgeom
's help
fslcpgeom.help()
fslcpgeom.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslcpgeom.help() }
if (have.fsl()){ fslcpgeom.help() }
Finds the FSLDIR from system environment or getOption("fsl.path")
for location of FSL functions and returns it
fsldir() fsl_dir()
fsldir() fsl_dir()
Character path
This function calls fslmaths
's help, as
fsldiv
is a wrapper for fslmaths
fsldiv.help(...)
fsldiv.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fsldiv.help() }
if (have.fsl()){ fsldiv.help() }
This function calls fslmaths
's help, as
fsledge
is a wrapper for fslmaths
fsledge.help(...)
fsledge.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fsledge.help() }
if (have.fsl()){ fsledge.help() }
Estimates Mean Entropy of Image from FSL
fslentropy(img, nonzero = FALSE, verbose = TRUE, ts = FALSE)
fslentropy(img, nonzero = FALSE, verbose = TRUE, ts = FALSE)
img |
Object of class nifti, or path of file |
nonzero |
(logical) Should the statistic be taken over non-zero voxels |
verbose |
(logical) print out command before running |
ts |
(logical) is the series a timeseries (4D), invoking |
Vector of unless ts option invoked, then matrix
This uses option -e or -E in fslstats
This function calls epi_reg
, designed to
register EPI images (typically functional or diffusion) to structural
(e.g. T1-weighted) image.
fslepi_reg( epi, t1, t1_brain, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, fmap = NULL, fmap_mag = NULL, fmap_mag_brain = NULL, echo_spacing = NA, phase_enc_dir = c("x", "y", "z", "-x", "-y", "-z"), weight = NULL, verbose = TRUE, opts = "", ... ) fsl_epi_reg(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) epi_reg(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE)
fslepi_reg( epi, t1, t1_brain, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, fmap = NULL, fmap_mag = NULL, fmap_mag_brain = NULL, echo_spacing = NA, phase_enc_dir = c("x", "y", "z", "-x", "-y", "-z"), weight = NULL, verbose = TRUE, opts = "", ... ) fsl_epi_reg(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) epi_reg(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE)
epi |
EPI image, character or nifti object |
t1 |
whole head T1 image , character or nifti object |
t1_brain |
brain extracted T1 image |
outfile |
output registered image filename |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
fmap |
fieldmap image (in rad/s) |
fmap_mag |
fieldmap magnitude image - whole head extracted |
fmap_mag_brain |
fieldmap magnitude image - brain extracted |
echo_spacing |
Effective EPI echo spacing (sometimes called dwell time) - in seconds |
phase_enc_dir |
phase encoding direction, dir = x/y/z/-x/-y/-z |
weight |
weighting image (in T1 space) |
verbose |
(logical) print out command before running |
opts |
(character) operations to be passed to |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslmaths
's help, as
fslerode
is a wrapper for fslmaths
fslerode.help(...)
fslerode.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslerode.help() }
if (have.fsl()){ fslerode.help() }
This function calls fslmaths
's help, as
fslexp
is a wrapper for fslmaths
fslexp.help(...)
fslexp.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslexp.help() }
if (have.fsl()){ fslexp.help() }
This function calls fslmaths
's help, as
fslfill
is a wrapper for fslmaths
fslfill.help(...)
fslfill.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslfill.help() }
if (have.fsl()){ fslfill.help() }
This function calls fslmaths
to dilate an image, then calls
it again to erode it.
fslfill2( file, outfile = NULL, kopts = "", remove.ends = TRUE, refill = TRUE, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
fslfill2( file, outfile = NULL, kopts = "", remove.ends = TRUE, refill = TRUE, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... )
file |
(character) filename of image to be filled |
outfile |
(character) name of resultant filled file |
kopts |
(character) Options passed for kernel before erosion/dilation |
remove.ends |
(logical) Remove top and bottom dilation. |
refill |
(logical) Run |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) pass to |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
character or logical depending on intern
This function binarizes the image before running.
This function calls fslorient -get*
and is a
simple wrapper of fslorient
fslgetorient(file, verbose = TRUE) fslgetsform(file, verbose = TRUE) fslgetqform(file, verbose = TRUE) fslgetsformcode(file, verbose = TRUE) fslgetqformcode(file, verbose = TRUE)
fslgetorient(file, verbose = TRUE) fslgetsform(file, verbose = TRUE) fslgetqform(file, verbose = TRUE) fslgetsformcode(file, verbose = TRUE) fslgetqformcode(file, verbose = TRUE)
file |
(character) image to be manipulated |
verbose |
(logical) print out command before running |
Result from system command, output from FSL
This function calls fslhd
to obtain a nifti header
fslhd(file, opts = "", verbose = TRUE, ...)
fslhd(file, opts = "", verbose = TRUE, ...)
file |
(character) image filename or character of class nifti |
opts |
(character) additional options to be passed to fslhd |
verbose |
(logical) print out command before running |
... |
options passed to |
Character of information from fslhd
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") fslhd(mnifile) }
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") fslhd(mnifile) }
This function calls fslhd
's help
fslhd.help()
fslhd.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslhd.help() }
if (have.fsl()){ fslhd.help() }
This function takes in a FSL header and parses the components
fslhd.parse(hd)
fslhd.parse(hd)
hd |
(character) header from |
data.frame of information from FSL header
if (have.fsl()){ mnifile = mni_fname("2") hd = fslhd(mnifile) fslhd.parse(hd) }
if (have.fsl()){ mnifile = mni_fname("2") hd = fslhd(mnifile) fslhd.parse(hd) }
This function takes in the function and returns the help from FSL for that function
fslhelp(func_name, help.arg = "--help", extra.args = "")
fslhelp(func_name, help.arg = "--help", extra.args = "")
func_name |
FSL function name |
help.arg |
Argument to print help, usually "–help" |
extra.args |
Extra arguments to be passed other than
|
Prints help output and returns output as character vector
This function calls fslmaths
's help, as
fslindex
is a wrapper for fslmaths
fslindex.help(...)
fslindex.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslindex.help() }
if (have.fsl()){ fslindex.help() }
This function calls fslmaths
's help, as
fsllog
is a wrapper for fslmaths
fsllog.help(...)
fsllog.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fsllog.help() }
if (have.fsl()){ fsllog.help() }
This function calls fslmaths
's help, as
fslmask
is a wrapper for fslmaths
fslmask.help(...)
fslmask.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslmask.help() }
if (have.fsl()){ fslmask.help() }
This function calls fslmaths
's help
fslmaths.help()
fslmaths.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslmaths.help() }
if (have.fsl()){ fslmaths.help() }
This function calls the range or robust range functions from FSL and then extracts the min/max
fslmax(file, ...) fslmin(file, ...)
fslmax(file, ...) fslmin(file, ...)
file |
(character) filename of image to be checked |
... |
options passed to |
Numeric vector of mins/maxs or just one depending if ts = TRUE
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") fslmax(mnifile) }
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") fslmax(mnifile) }
Estimates Mean of Image from FSL
fslmean(img, nonzero = FALSE, verbose = TRUE, ts = FALSE)
fslmean(img, nonzero = FALSE, verbose = TRUE, ts = FALSE)
img |
Object of class nifti, or path of file |
nonzero |
(logical) Should the statistic be taken over non-zero voxels |
verbose |
(logical) print out command before running |
ts |
(logical) is the series a timeseries (4D), invoking |
Vector of unless ts option invoked, then matrix
This uses option -m or -M in fslstats
This function calls fslmerge
's help
fslmerge.help()
fslmerge.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslmerge.help() }
if (have.fsl()){ fslmerge.help() }
This function calls fslmaths
's help, as
fslmul
is a wrapper for fslmaths
fslmul.help(...)
fslmul.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslmul.help() }
if (have.fsl()){ fslmul.help() }
This function calls fslmaths
's help, as
fslnan
is a wrapper for fslmaths
fslnan.help(...)
fslnan.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslnan.help() }
if (have.fsl()){ fslnan.help() }
This function calls fslmaths
's help, as
fslnanm
is a wrapper for fslmaths
fslnanm.help(...)
fslnanm.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslnanm.help() }
if (have.fsl()){ fslnanm.help() }
This function calls fslmaths file -add file2 -bin
after binarizing file
and file2
using
fslbin
.
fslor( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, ... ) fsl_or(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE)
fslor( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, ... ) fsl_or(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE)
file |
(character) input image |
file2 |
(character) image to be unioned |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslorient
fslorient( file, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
fslorient( file, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
file |
(character) image to be manipulated |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
This function calls fslorient
's help
fslorient.help()
fslorient.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslorient.help() }
if (have.fsl()){ fslorient.help() }
This function calls fslorient -getorient
and is a
simple wrapper of fslorient
fslorienter(file, opts = "", verbose = TRUE)
fslorienter(file, opts = "", verbose = TRUE)
file |
(character) image to be manipulated |
opts |
option to send to fslorient |
verbose |
(logical) print out command before running |
Result from system command, output from FSL
This function calls fslmaths
's help, as
fslrand
is a wrapper for fslmaths
fslrand.help(...)
fslrand.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslrand.help() }
if (have.fsl()){ fslrand.help() }
This function calls fslmaths
's help, as
fslrandn
is a wrapper for fslmaths
fslrandn.help(...)
fslrandn.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslrandn.help() }
if (have.fsl()){ fslrandn.help() }
This function calls fslstats -R
to get the range of an image or fslstats -r
to
get the robust range
fslrange(file, robust = FALSE, verbose = TRUE, ts = FALSE, ...)
fslrange(file, robust = FALSE, verbose = TRUE, ts = FALSE, ...)
file |
(character) filename of image to be checked |
robust |
(logical) Should the range be robust ( |
verbose |
(logical) print out command before running |
ts |
(logical) is the series a timeseries (4D), invoking |
... |
options passed to |
numeric vector of length 2
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") fslrange(mnifile) }
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") fslrange(mnifile) }
This function calls fslmaths
's help, as
fslrecip
is a wrapper for fslmaths
fslrecip.help(...)
fslrecip.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslrecip.help() }
if (have.fsl()){ fslrecip.help() }
This function calls fslmaths
's help, as
fslrem
is a wrapper for fslmaths
fslrem.help(...)
fslrem.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslrem.help() }
if (have.fsl()){ fslrem.help() }
This function calls fslreorient2std
fslreorient2std( file, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, opts = "", ... ) fslreorient2std_mat( file, matfile = tempfile(fileext = ".mat"), verbose = TRUE, ... )
fslreorient2std( file, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, opts = "", ... ) fslreorient2std_mat( file, matfile = tempfile(fileext = ".mat"), verbose = TRUE, ... )
file |
(character) image to be manipulated |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If |
intern |
(logical) to be passed to |
verbose |
(logical) print out command before running |
opts |
additional options to pass to |
... |
additional arguments passed to |
matfile |
Output file for the matrix for reorientation |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
This function calls fslreorient2std
's help
fslreorient2std.help()
fslreorient2std.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslreorient2std.help() }
if (have.fsl()){ fslreorient2std.help() }
This function calls robustfov
to
automatically crop the image
fslrobustfov( file, brain_size = NULL, mat_name = NULL, roi_name = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... ) fsl_robustfov(retimg = FALSE, ...)
fslrobustfov( file, brain_size = NULL, mat_name = NULL, roi_name = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... ) fsl_robustfov(retimg = FALSE, ...)
file |
(character) image to be manipulated |
brain_size |
size of brain in z-dimension (default 150mm) |
mat_name |
matrix output name |
roi_name |
ROI volume output name |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If |
intern |
(logical) to be passed to |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
This function calls robustfov
help
fslrobustfov.help()
fslrobustfov.help()
This function calls fslroi
fslroi( file, xmin = 0, xsize = -1, ymin = 0, ysize = -1, zmin = 0, zsize = -1, tmin = NULL, tsize = NULL, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... ) fsl_roi(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslroi_time(file, tmin = NULL, tsize = NULL, ...)
fslroi( file, xmin = 0, xsize = -1, ymin = 0, ysize = -1, zmin = 0, zsize = -1, tmin = NULL, tsize = NULL, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, verbose = TRUE, ... ) fsl_roi(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE) fslroi_time(file, tmin = NULL, tsize = NULL, ...)
file |
(character) image to be manipulated |
xmin |
Minimum index for x-dimension |
xsize |
Size of ROI in x-dimension |
ymin |
Minimum index for y-dimension |
ysize |
Size of ROI in y-dimension |
zmin |
Minimum index for z-dimension |
zsize |
Size of ROI in z-dimension |
tmin |
Minimum index for t-dimension |
tsize |
Size of ROI in t-dimension |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE
or
FALSE
.
Indexing (in both time and space) starts with 0 not 1! Inputting -1 for a size will set it to the full image extent for that dimension.
Estimates Standard Deviation of Image from FSL
fslsd(img, nonzero = FALSE, verbose = TRUE, ts = FALSE)
fslsd(img, nonzero = FALSE, verbose = TRUE, ts = FALSE)
img |
Object of class nifti, or path of file |
nonzero |
(logical) Should the statistic be taken over non-zero voxels |
verbose |
(logical) print out command before running |
ts |
(logical) is the series a timeseries (4D), invoking |
Vector of unless ts option invoked, then matrix
This uses option -s or -S in fslstats
This function calls fslmaths -sin
.
The R functions wraps fslmaths
fslsin( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
fslsin( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", ... )
file |
(character) input image to sine transform |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
This function calls fslmaths
's help, as
fslsin
is a wrapper for fslmaths
fslsin.help(...)
fslsin.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslsin.help() }
if (have.fsl()){ fslsin.help() }
This function calls slicetimer
and performs
slice timing correction for fMRI data
fslslicetimer( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, tr = 3, direction = "z", indexing = c("up", "down"), acq_order = c("contiguous", "interleaved"), verbose = TRUE, ... ) fsl_slicetimer(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE)
fslslicetimer( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, tr = 3, direction = "z", indexing = c("up", "down"), acq_order = c("contiguous", "interleaved"), verbose = TRUE, ... ) fsl_slicetimer(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE)
file |
(character) image to be manipulated |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
tr |
(numeric) Repeat time in seconds |
direction |
(character) Direction of acquisition |
indexing |
(character) Whether indexing was bottom up (default) or
down using |
acq_order |
(character) Order of acquisition, either contiguous or interleaved |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function smooth an image within a mask and replaces the values of the original image with the smoothed values.
fslsmooth_in_mask(file, sigma = 10, mask = NULL, ...) fsl_smooth_in_mask(...)
fslsmooth_in_mask(file, sigma = 10, mask = NULL, ...) fsl_smooth_in_mask(...)
file |
(character) image to be smoothed |
sigma |
(numeric) sigma (in mm) of Gaussian kernel for smoothing |
mask |
(character) optional mask given for image |
... |
additional arguments passed to |
Object of class nifti
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = abs(img ) > 1 s.img = fslsmooth_in_mask(img, mask = mask) }) }
if (have.fsl()){ system.time({ dims = c(50, 50, 20) x = array(rnorm(prod(dims)), dim = dims) img = nifti(x, dim= dims, datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) mask = abs(img ) > 1 s.img = fslsmooth_in_mask(img, mask = mask) }) }
This function calls fslmaths
's help, as
fslsmooth
is a wrapper for fslmaths
fslsmooth.help(...)
fslsmooth.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslsmooth.help() }
if (have.fsl()){ fslsmooth.help() }
This function calls fslsplit
to merge files on some dimension
and either saves the image or returns an object of class nifti
fslsplit( infile, direction = c("t", "x", "y", "z"), output_basename = NULL, retimg = TRUE, reorient = FALSE, verbose = TRUE ) fsl_split(..., retimg = FALSE)
fslsplit( infile, direction = c("t", "x", "y", "z"), output_basename = NULL, retimg = TRUE, reorient = FALSE, verbose = TRUE ) fsl_split(..., retimg = FALSE)
infile |
(character) input filename |
direction |
(character) direction to split over: t (time), x, y, z |
output_basename |
(character) prefix to have for output |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
verbose |
(logical) print out command before running |
... |
not used |
List of output files
Functions with underscores have different defaults and will return an output filename, so to be used for piping
This function calls fslsplit
's help
fslsplit.help()
fslsplit.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslsplit.help() }
if (have.fsl()){ fslsplit.help() }
This function calls fslmaths
's help, as
fslsqr
is a wrapper for fslmaths
fslsqr.help(...)
fslsqr.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslsqr.help() }
if (have.fsl()){ fslsqr.help() }
This function calls fslmaths
's help, as
fslsqrt
is a wrapper for fslmaths
fslsqrt.help(...)
fslsqrt.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslsqrt.help() }
if (have.fsl()){ fslsqrt.help() }
This function calls fslstats
fslstats(file, opts = "", verbose = TRUE, ts = FALSE, ...)
fslstats(file, opts = "", verbose = TRUE, ts = FALSE, ...)
file |
(character) filename of image to be checked |
opts |
(character) operation passed to |
verbose |
(logical) print out command before running |
ts |
(logical) is the series a timeseries (4D), invoking |
... |
options passed to |
Result of fslstats command
if (have.fsl()){ system.time({ x = array(rnorm(1e6), dim = c(100, 100, 100)) img = nifti(x, dim= c(100, 100, 100), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) entropy = fslstats(img, opts='-E') }) }
if (have.fsl()){ system.time({ x = array(rnorm(1e6), dim = c(100, 100, 100)) img = nifti(x, dim= c(100, 100, 100), datatype = convert.datatype()$FLOAT32, cal.min = min(x), cal.max = max(x), pixdim = rep(1, 4)) entropy = fslstats(img, opts='-E') }) }
This function calls fslstats
's help
fslstats.help()
fslstats.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslstats.help() }
if (have.fsl()){ fslstats.help() }
This function calls fslmaths
's help, as
fslsub
is a wrapper for fslmaths
fslsub.help(...)
fslsub.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslsub.help() }
if (have.fsl()){ fslsub.help() }
This function calls fslmaths
's help, as
fslsub2
is a wrapper for fslmaths
fslsub2.help(...)
fslsub2.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslsub2.help() }
if (have.fsl()){ fslsub2.help() }
This function calls fslstats -M -V
to get product,
aka the approximate sum.
fslsum(file, opts = "", ts = FALSE, ...)
fslsum(file, opts = "", ts = FALSE, ...)
file |
(character) filename of image to be checked |
opts |
Additional options to pass to |
ts |
(logical) is the series a timeseries (4D), invoking |
... |
options passed to |
Numeric value
This may be approximate due to rounding
This function calls fslswapdim
's help
fslswapdim.help()
fslswapdim.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslswapdim.help() }
if (have.fsl()){ fslswapdim.help() }
This function calls fslmaths
's help, as
fsltan
is a wrapper for fslmaths
fsltan.help(...)
fsltan.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fsltan.help() }
if (have.fsl()){ fsltan.help() }
This function calls fslmaths
's help, as
fslthresh
is a wrapper for fslmaths
fslthresh.help(...)
fslthresh.help(...)
... |
passed to |
Prints help output and returns output as character vector
if (have.fsl()){ fslthresh.help() }
if (have.fsl()){ fslthresh.help() }
This function calls fslval
to obtain a nifti header
fslval(file, keyword = "", verbose = TRUE, ...)
fslval(file, keyword = "", verbose = TRUE, ...)
file |
(character) image filename or character of class nifti |
keyword |
(character) keyword to be taken from fslhd |
verbose |
(logical) print out command before running |
... |
options passed to |
Character of information from fslhd field specified in keyword
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") fslval(mnifile, keyword = "dim1") }
if (have.fsl()){ mnifile = file.path(fsldir(), "data", "standard", "MNI152_T1_2mm.nii.gz") fslval(mnifile, keyword = "dim1") }
This function calls fslval
's help
fslval.help()
fslval.help()
Prints help output and returns output as character vector
if (have.fsl()){ fslval.help() }
if (have.fsl()){ fslval.help() }
This function calls fslview
to view an image
in the FSL viewer
fslview(file, intern = TRUE, opts = "", verbose = TRUE, ...) fsleyes(file, intern = TRUE, opts = "", verbose = TRUE, ...)
fslview(file, intern = TRUE, opts = "", verbose = TRUE, ...) fsleyes(file, intern = TRUE, opts = "", verbose = TRUE, ...)
file |
(character) filename of image to be thresholded |
intern |
(logical) pass to |
opts |
(character) options for FSLView |
verbose |
(logical) print out command before running |
... |
options passed to |
character or logical depending on intern
As of FSL version 5.0.10, this is deprecated: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/WhatsNew
This function calls fslview
's help
fslview.help()
fslview.help()
Prints help output and returns output as character vector
library(fslr) if (have.fsl()){ print(fsl_version()) in_ci <- function() { nzchar(Sys.getenv("CI")) } if (!in_ci()) { fslview.help() } }
library(fslr) if (have.fsl()){ print(fsl_version()) in_ci <- function() { nzchar(Sys.getenv("CI")) } if (!in_ci()) { fslview.help() } }
This function wraps fslsum
and
voxdim
fslvol(file, ...)
fslvol(file, ...)
file |
(character) filename of image to be checked |
... |
options passed to |
Numeric value of volume in mL
This may be approximate due to rounding
Estimates Volume of Image from FSL
fslvolume(img, nonzero = FALSE, verbose = TRUE, ts = FALSE)
fslvolume(img, nonzero = FALSE, verbose = TRUE, ts = FALSE)
img |
Object of class nifti, or path of file |
nonzero |
(logical) Should the statistic be taken over non-zero voxels |
verbose |
(logical) print out command before running |
ts |
(logical) is the series a timeseries (4D), invoking |
Vector of unless ts option invoked, then matrix
This uses option -v or -V in fslstats
This function calls fslmaths file -add file2 -bin
after binarizing file
and file2
using
fslbin
and then uses fsl_thresh
to threshold any values greater than 1 back to zero.
fslxor( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, ... ) fsl_xor(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE)
fslxor( file, file2, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, ... ) fsl_xor(..., outfile = tempfile(fileext = ".nii.gz"), retimg = FALSE)
file |
(character) input image |
file2 |
(character) image to be XOR'd |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented
when read in?
Passed to |
intern |
(logical) to be passed to |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
Functions with underscores have different defaults and will return an output filename, so to be used for piping
Face Removal Mask using "Quickshear Defacing for Neuroimages" (Schimke et al. 2011)
get_quickshear_mask(brain_mask, buffer = 10, verbose = TRUE) quickshear_deface_image( file, brain_mask = NULL, buffer = 10, verbose = TRUE, ... )
get_quickshear_mask(brain_mask, buffer = 10, verbose = TRUE) quickshear_deface_image( file, brain_mask = NULL, buffer = 10, verbose = TRUE, ... )
brain_mask |
Brain mask image. If |
buffer |
buffer to add to intercept for face mask equation |
verbose |
print diagnostic messages |
file |
input image - same orientation as brain mask |
... |
additional arguments passed to |
A binary image of the non-face areas
adapted from https://github.com/nipy/quickshear/blob/master/quickshear.py
if (have_fsl()) { file = "~/Downloads/sample_T1_input.nii.gz" if (file.exists(file)) { res = quickshear_deface_image(file) brain_mask = fslbet(file) > 0 mask = get_quickshear_mask(brain_mask) image = fslmask(file, mask) } }
if (have_fsl()) { file = "~/Downloads/sample_T1_input.nii.gz" if (file.exists(file)) { res = quickshear_deface_image(file) brain_mask = fslbet(file) > 0 mask = get_quickshear_mask(brain_mask) image = fslmask(file, mask) } }
Finds the FSLDIR from system environment or getOption("fsl.path")
for location of FSL functions
get.fsl(add_bin = TRUE) get_fsl(add_bin = TRUE)
get.fsl(add_bin = TRUE) get_fsl(add_bin = TRUE)
add_bin |
Should |
NULL if FSL in path, or bash code for setting up FSL DIR
This will use Sys.getenv("FSLDIR")
before getOption("fsl.path")
.
If the directory is not found for FSL in Sys.getenv("FSLDIR")
and
getOption("fsl.path")
, it will try the default directory /usr/local/fsl
.
Finds the FSLOUTPUTTYPE from system environment or
getOption("fsl.outputtype")
for output type (nii.gz, nii, ANALYZE,etc)
get.fsloutput()
get.fsloutput()
FSLOUTPUTTYPE, such as NIFTI_GZ
. If none found, uses NIFTI_GZ as default
Runs get.fsloutput()
to extract FSLOUTPUTTYPE and then
gets corresponding extension (such as .nii.gz)
get.imgext()
get.imgext()
Extension for output type
This function obtains the s and q forms of an image transformation matrix
getForms(file, verbose = FALSE, ...)
getForms(file, verbose = FALSE, ...)
file |
(character) filename of image to pass to header |
verbose |
(logical) passed to |
... |
options passed to |
list with elements of sform and qform and their respective codes
if (have.fsl()){ mnifile = mni_fname("2") getForms(mnifile) }
if (have.fsl()){ mnifile = mni_fname("2") getForms(mnifile) }
Uses get.fsl
to check if FSLDIR is accessible or the option
fsl.path
is set and returns logical
have.fsl(...) have_fsl(...)
have.fsl(...) have_fsl(...)
... |
options to pass to |
Logical TRUE is FSL is accessible, FALSE if not
have.fsl()
have.fsl()
intent_code method for character types
## S4 method for signature 'character' intent_code(object)
## S4 method for signature 'character' intent_code(object)
object |
is a filename to pass to fslval |
intent_name method for character types
## S4 method for signature 'character' intent_name(object)
## S4 method for signature 'character' intent_name(object)
object |
is a filename to pass to fslval |
intent_p1 method for character types
## S4 method for signature 'character' intent_p1(object)
## S4 method for signature 'character' intent_p1(object)
object |
is a filename to pass to fslval |
intent_p2 method for character types
## S4 method for signature 'character' intent_p2(object)
## S4 method for signature 'character' intent_p2(object)
object |
is a filename to pass to fslval |
intent_p3 method for character types
## S4 method for signature 'character' intent_p3(object)
## S4 method for signature 'character' intent_p3(object)
object |
is a filename to pass to fslval |
Convert a Transformation
invert_xfm(inmat, omat = tempfile(fileext = ".mat"), verbose = TRUE) concat_xfm(inmat, inmat2, omat = tempfile(fileext = ".mat"), verbose = TRUE) fixscaleskew_xfm( inmat, inmat2, omat = tempfile(fileext = ".mat"), verbose = TRUE )
invert_xfm(inmat, omat = tempfile(fileext = ".mat"), verbose = TRUE) concat_xfm(inmat, inmat2, omat = tempfile(fileext = ".mat"), verbose = TRUE) fixscaleskew_xfm( inmat, inmat2, omat = tempfile(fileext = ".mat"), verbose = TRUE )
inmat |
input matrix transformation |
omat |
output matrix transformation |
verbose |
print diagnostic messages |
inmat2 |
second matrix filename to be concatenated or fixscaleskew to first |
A filename of the output matrix file
if (have_fsl()) { img = mni_fname() mat = fslreorient2std_mat(img) inverted = invert_xfm(mat) readLines(inverted) catted = concat_xfm(mat, mat) readLines(catted) fixed = fixscaleskew_xfm(mat, mat) readLines(fixed) }
if (have_fsl()) { img = mni_fname() mat = fslreorient2std_mat(img) inverted = invert_xfm(mat) readLines(inverted) catted = concat_xfm(mat, mat) readLines(catted) fixed = fixscaleskew_xfm(mat, mat) readLines(fixed) }
magic method for character types
## S4 method for signature 'character' magic(object)
## S4 method for signature 'character' magic(object)
object |
is a filename to pass to fslval |
This function calls mcflirt
mcflirt( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
mcflirt( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, opts = "", verbose = TRUE, ... )
file |
(character) image to be manipulated |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If |
intern |
(logical) to be passed to |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
it will have additional attributes in the additional_files
field.
This function calls mcflirt
's help
mcflirt.help()
mcflirt.help()
Prints help output and returns output as character vector
library(fslr) if (have.fsl()){ mcflirt.help() }
library(fslr) if (have.fsl()){ mcflirt.help() }
This function calls melodic
melodic( file, outdir = dirname(file), intern = FALSE, opts = "", verbose = TRUE, ... )
melodic( file, outdir = dirname(file), intern = FALSE, opts = "", verbose = TRUE, ... )
file |
(character) image to be run |
outdir |
(character) output directory.
(Default |
intern |
(logical) pass to |
opts |
(character) options for melodic |
verbose |
(logical) print out command before running |
... |
arguments passed to |
character or logical depending on intern
This function calls melodic
's help
melodic.help()
melodic.help()
Prints help output and returns output as character vector
if (have.fsl()){ melodic.help() }
if (have.fsl()){ melodic.help() }
This function takes in an image, flips the image over the left/right plane, registers that flipped image to the original image, then applies the half transformation
mid_sagittal_align( file, outfile = NULL, retimg = TRUE, opts = "", translation = TRUE, force_rpi = TRUE, verbose = TRUE )
mid_sagittal_align( file, outfile = NULL, retimg = TRUE, opts = "", translation = TRUE, force_rpi = TRUE, verbose = TRUE )
file |
(character) input filename or class nifti |
outfile |
(character) output filename |
retimg |
(logical) return image of class nifti |
opts |
(character) options passed to |
translation |
(logical) should the translation parameters be preserved (TRUE) or set to zero (FALSE) |
force_rpi |
Should |
verbose |
(logical) print diagnostic messages |
Filename of output or nifti depending on retimg
Finds the standard data directory for FSL and pastes together the string for an MNI template image
mni_fname(mm = c("1", "0.5", "2"), brain = FALSE, linear = FALSE, mask = FALSE) mni_face_fname(mm = c("1", "0.5", "2"))
mni_fname(mm = c("1", "0.5", "2"), brain = FALSE, linear = FALSE, mask = FALSE) mni_face_fname(mm = c("1", "0.5", "2"))
mm |
Resolution (in mm) of the brain image (isotropic) |
brain |
Should the brain be returned (default) or the T1 with the skull |
linear |
Should the linearized MNI template be used |
mask |
should the mask be given? Generally, only MNI152_T1_1mm_brain_mask exists. |
Character path of filename, warning if that file does not exist
Simple wrapper for reading in the MNI image constructed from
mni_fname
mni_img(...)
mni_img(...)
... |
Arguments passed to |
Object of class nifti
MRI Defacer
mridefacer(file, ..., verbose = TRUE) get_mridefacer_mask( file, brain_mask = NULL, bet_opts = "-f 0.5", search_radius = 90, opts = NULL, template_brain = NULL, template_brain_weight = NULL, template_biometric_mask = NULL, verbose = TRUE )
mridefacer(file, ..., verbose = TRUE) get_mridefacer_mask( file, brain_mask = NULL, bet_opts = "-f 0.5", search_radius = 90, opts = NULL, template_brain = NULL, template_brain_weight = NULL, template_biometric_mask = NULL, verbose = TRUE )
file |
input file image to remove face/ears |
... |
not used |
verbose |
print diagnostic messages. If |
brain_mask |
brain mask of file. If |
bet_opts |
options to pass to |
search_radius |
search radius option to pass to |
opts |
additional options to pass to |
template_brain |
template brain image, may be |
template_brain_weight |
template brain weight image, used
for registration may be |
template_biometric_mask |
template biometric mask. Everything that
is wanted should be |
A character filename of the output image
Adapted from https://github.com/mih/mridefacer
if (have_fsl()) { file = "~/Downloads/sample_T1_input.nii.gz" if (file.exists(file)) { res = mridefacer(file) } }
if (have_fsl()) { file = "~/Downloads/sample_T1_input.nii.gz" if (file.exists(file)) { res = mridefacer(file) } }
avscale
This function parses the output from
fsl_avscale
into something more manageable
parse_avscale(av_out)
parse_avscale(av_out)
av_out |
output from |
List of output values
Gets pixdim from a character
## S4 method for signature 'character' pixdim(object)
## S4 method for signature 'character' pixdim(object)
object |
is a filename to pass to fslval |
This function wraps probtrackx
from FSL
probtrackx( samples = "merged", mask, seed, outdir = "fdt_paths", verbose = TRUE, mode = NULL, targetmasks = NULL, mask2 = NULL, waypoints = NULL, network = FALSE, mesh = NULL, seedref = NULL, dir = FALSE, forcedir = FALSE, opd = FALSE, pd = FALSE, os2t = FALSE, avoid = NULL, stop = NULL, xfm = NULL, invxfm = NULL, nsamples = 5000, nsteps = 2000, distthresh = 0, cthr = 0.2, fibthresh = 0.01, sampvox = FALSE, steplength = 0.5, loopcheck = FALSE, usef = FALSE, randfib = c(0, 1, 2, 3), fibst = 1, modeuler = FALSE, rseed = NULL, s2tastext = FALSE, opts = "" )
probtrackx( samples = "merged", mask, seed, outdir = "fdt_paths", verbose = TRUE, mode = NULL, targetmasks = NULL, mask2 = NULL, waypoints = NULL, network = FALSE, mesh = NULL, seedref = NULL, dir = FALSE, forcedir = FALSE, opd = FALSE, pd = FALSE, os2t = FALSE, avoid = NULL, stop = NULL, xfm = NULL, invxfm = NULL, nsamples = 5000, nsteps = 2000, distthresh = 0, cthr = 0.2, fibthresh = 0.01, sampvox = FALSE, steplength = 0.5, loopcheck = FALSE, usef = FALSE, randfib = c(0, 1, 2, 3), fibst = 1, modeuler = FALSE, rseed = NULL, s2tastext = FALSE, opts = "" )
samples |
(nifti/character) Basename for samples files |
mask |
(nifti/character) Bet binary mask file in diffusion space |
seed |
(nifti/character) Seed volume, or voxel, or ascii file with multiple volumes, or freesurfer label file |
outdir |
(character) Output file (default='fdt_paths') |
verbose |
(logical/numeric) Verbose level, [0-2] |
mode |
(character) Use –mode=simple for single seed voxel |
targetmasks |
(character) File containing a list of target masks - required for seeds_to_targets classification |
mask2 |
(nifti/character) Second mask in twomask_symm mode. |
waypoints |
(nifti/character) Waypoint mask or ascii list of waypoint masks - only keep paths going through ALL the masks |
network |
(logical) Activate network mode - only keep paths going through at least one seed mask (required if multiple seed masks) |
mesh |
(character) Freesurfer-type surface descriptor (in ascii format) |
seedref |
(nifti/character) Reference vol to define seed space in simple mode - diffusion space assumed if absent |
dir |
(logical) Directory to put the final volumes in - code makes this directory - default='logdir' |
forcedir |
(logical) Use the actual directory name given - i.e. don't add + to make a new directory |
opd |
(logical) Output path distribution |
pd |
(logical) Correct path distribution for the length of the pathways |
os2t |
(logical) Output seeds to targets |
avoid |
(nifti/character) Reject pathways passing through locations given by this mask |
stop |
(nifti/character) Stop tracking at locations given by this mask file |
xfm |
(character) Transform taking seed space to DTI space (either FLIRT matrix or FNIRT warpfield) - default is identity |
invxfm |
(character) Transform taking DTI space to seed space (compulsory when using a warpfield for seeds_to_dti) |
nsamples |
(numeric) Number of samples - default=5000 |
nsteps |
(numeric) Number of steps per sample - default=2000 |
distthresh |
(numeric) Discards samples shorter than this threshold (in mm - default=0) |
cthr |
(numeric) Curvature threshold - default=0.2 |
fibthresh |
(numeric) Volume fraction before subsidiary fibre orientations are considered - default=0.01 |
sampvox |
(logical) Sample random points within seed voxels |
steplength |
(numeric) Steplength in mm - default=0.5 |
loopcheck |
(logical) Perform loopchecks on paths - slower, but allows lower curvature threshold |
usef |
(logical) Use anisotropy to constrain tracking |
randfib |
(numeric) Default 0. Set to 1 to randomly sample initial fibres (with f > fibthresh). Set to 2 to sample in proportion fibres (with f>fibthresh) to f. Set to 3 to sample ALL populations at random (even if f<fibthresh) |
fibst |
(numeric) Force a starting fibre for tracking - default=1, i.e. first fibre orientation. Only works if randfib==0 |
modeuler |
(logical) Use modified euler streamlining |
rseed |
(numeric) Random seed |
s2tastext |
(logical) Output seed-to-target counts as a text file (useful when seeding from a mesh) |
opts |
Additional options or way to specify things instead of command line arguments |
A filename of the output file
qform_code method for character types
## S4 method for signature 'character' qform_code(object)
## S4 method for signature 'character' qform_code(object)
object |
is a filename to pass to fslval |
Gets q/s-forms from a character
## S4 method for signature 'character' qform(object) ## S4 method for signature 'character' sform(object)
## S4 method for signature 'character' qform(object) ## S4 method for signature 'character' sform(object)
object |
is a |
Read FSL Transformation
read_xfm(file)
read_xfm(file)
file |
transformation file from |
A numeric matrix of numeric class
This function calls the readnii
function after
calling rpi_orient_file
to force RPI orientation.
readrpi(file, ..., verbose = TRUE)
readrpi(file, ..., verbose = TRUE)
file |
file name of the NIfTI file. |
... |
Arguments to pass to |
verbose |
print diagnostics, passed to |
if (have.fsl()){ print(fsl_version()) in_ci <- function() { nzchar(Sys.getenv("CI")) } if (in_ci()) { destfile = tempfile(fileext = ".nii.gz") url = paste0("https://ndownloader.figshare.com/", "files/18068546") old_url = paste0("https://github.com/muschellij2/", "Neurohacking/files/3454385/113-01-MPRAGE2.nii.gz") dl = tryCatch(download.file(url, destfile = destfile)) if (inherits(dl, "try-error") || dl != 0) { dl = download.file(old_url, destfile = destfile) } res = readrpi(destfile) } }
if (have.fsl()){ print(fsl_version()) in_ci <- function() { nzchar(Sys.getenv("CI")) } if (in_ci()) { destfile = tempfile(fileext = ".nii.gz") url = paste0("https://ndownloader.figshare.com/", "files/18068546") old_url = paste0("https://github.com/muschellij2/", "Neurohacking/files/3454385/113-01-MPRAGE2.nii.gz") dl = tryCatch(download.file(url, destfile = destfile)) if (inherits(dl, "try-error") || dl != 0) { dl = download.file(old_url, destfile = destfile) } res = readrpi(destfile) } }
This function uses fslswapdim
to reorient an image
reverse_rpi_orient( file, convention = c("NEUROLOGICAL", "RADIOLOGICAL"), orientation, verbose = TRUE ) reverse_rpi_orient_file( file, convention = c("NEUROLOGICAL", "RADIOLOGICAL"), orientation, verbose = TRUE )
reverse_rpi_orient( file, convention = c("NEUROLOGICAL", "RADIOLOGICAL"), orientation, verbose = TRUE ) reverse_rpi_orient_file( file, convention = c("NEUROLOGICAL", "RADIOLOGICAL"), orientation, verbose = TRUE )
file |
Object of class |
convention |
Convention of original image (usually from |
orientation |
Vector of length 3 from original image
(usually from |
verbose |
print diagnostic messages |
Object of class nifti
This function uses fslswapdim
to reorient an image
rpi_orient(file, verbose = TRUE) rpi_orient_file(file, verbose = TRUE) is_rpi(file, verbose = FALSE) is.rpi(file, verbose = FALSE)
rpi_orient(file, verbose = TRUE) rpi_orient_file(file, verbose = TRUE) is_rpi(file, verbose = FALSE) is.rpi(file, verbose = FALSE)
file |
Object of class |
verbose |
print diagnostic messages |
List of 3 elements
img
: Reoriented image of class nifti
convention
: Convention (Neurological/Radiological) of original image
orientation
: Original image orientations
'orient_rpi' and 'orient_rpi_file' uses 'RNifti' to ensure the reading orientation
lr_fname = system.file( "nifti", "mniLR.nii.gz", package = "oro.nifti") img = readnii(lr_fname) rl_fname = system.file( "nifti", "mniRL.nii.gz", package = "oro.nifti") rl_img = readnii(rl_fname) stopifnot(all(rl_img[nrow(rl_img):1,,] == img)) ## Not run: if (have_fsl()) { reor = rpi_orient(rl_fname) rev = reverse_rpi_orient(reor$img, convention = reor$convention, orientation = reor$orientation) stopifnot(all(rev == rl_img)) } ## End(Not run) reor = orient_rpi(rl_fname) stopifnot(all(img == reor$img)) rev = reverse_orient_rpi(reor$img, convention = reor$convention, orientation = reor$orientation) stopifnot(all(rev == rl_img))
lr_fname = system.file( "nifti", "mniLR.nii.gz", package = "oro.nifti") img = readnii(lr_fname) rl_fname = system.file( "nifti", "mniRL.nii.gz", package = "oro.nifti") rl_img = readnii(rl_fname) stopifnot(all(rl_img[nrow(rl_img):1,,] == img)) ## Not run: if (have_fsl()) { reor = rpi_orient(rl_fname) rev = reverse_rpi_orient(reor$img, convention = reor$convention, orientation = reor$orientation) stopifnot(all(rev == rl_img)) } ## End(Not run) reor = orient_rpi(rl_fname) stopifnot(all(img == reor$img)) rev = reverse_orient_rpi(reor$img, convention = reor$convention, orientation = reor$orientation) stopifnot(all(rev == rl_img))
Wrapper for run_first_all
from FSL for FIRST analysis
segmentation of subcortical structures
run_first_all( img, oprefix = tempfile(), brain_extracted = FALSE, structures = NULL, affine = NULL, opts = "", verbose = TRUE )
run_first_all( img, oprefix = tempfile(), brain_extracted = FALSE, structures = NULL, affine = NULL, opts = "", verbose = TRUE )
img |
specifies the input image (T1-weighted) |
oprefix |
specifies the output image basename (extensions will be added to this) |
brain_extracted |
specifies that the input image has been brain extracted |
structures |
a restricted set of structures to be segmented |
affine |
specifies the affine registration matrix to standard space (optional) |
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
List of results, including result of system
and some output files
This function calls run_first_all
's help
run_first_all.help()
run_first_all.help()
Prints help output and returns output as character vector
library(fslr) if (have.fsl()){ run_first_all.help() }
library(fslr) if (have.fsl()){ run_first_all.help() }
scl_inter method for character types
## S4 method for signature 'character' scl_inter(object)
## S4 method for signature 'character' scl_inter(object)
object |
is a filename to pass to fslval |
scl_slope method for character types
## S4 method for signature 'character' scl_slope(object)
## S4 method for signature 'character' scl_slope(object)
object |
is a filename to pass to fslval |
sform_code method for character types
## S4 method for signature 'character' sform_code(object)
## S4 method for signature 'character' sform_code(object)
object |
is a filename to pass to fslval |
'sizeof_hdr' method for character types
## S4 method for signature 'character' sizeof_hdr(object)
## S4 method for signature 'character' sizeof_hdr(object)
object |
is a filename to pass to fslval |
slice_code method for character types
## S4 method for signature 'character' slice_code(object)
## S4 method for signature 'character' slice_code(object)
object |
is a filename to pass to fslval |
slice_duration method for character types
## S4 method for signature 'character' slice_duration(object)
## S4 method for signature 'character' slice_duration(object)
object |
is a filename to pass to fslval |
slice_end method for character types
## S4 method for signature 'character' slice_end(object)
## S4 method for signature 'character' slice_end(object)
object |
is a filename to pass to fslval |
slice_start method for character types
## S4 method for signature 'character' slice_start(object)
## S4 method for signature 'character' slice_start(object)
object |
is a filename to pass to fslval |
Implements Smallest Univalue Segment Assimilating Nucleus (SUSAN) noise reduction technique from FSL
susan( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, bthresh = 0.1, sigma = 3, dimg = c(3, 2), use_median = FALSE, n_usans = c(0, 1, 2), extra.scans = list(), opts = "", verbose = TRUE, ... )
susan( file, outfile = NULL, retimg = TRUE, reorient = FALSE, intern = FALSE, bthresh = 0.1, sigma = 3, dimg = c(3, 2), use_median = FALSE, n_usans = c(0, 1, 2), extra.scans = list(), opts = "", verbose = TRUE, ... )
file |
(character) image to be manipulated |
outfile |
(character) resultant image name (optional) |
retimg |
(logical) return image of class nifti |
reorient |
(logical) If retimg, should file be reoriented when read in?
Passed to |
intern |
(logical) to be passed to |
bthresh |
brightness threshold and should be greater than noise level and less than contrast of edges to be preserved. |
sigma |
spatial size (sigma i.e. half-width) of smoothing in mm. |
dimg |
dimensionality (2 or 3) depending on whether smoothing is to be within-plane (2) or fully 3D (3). |
use_median |
determines whether to use a local median filter in the cases where single-point noise is detected (0 or 1). |
n_usans |
determines whether the smoothing area (USAN) is to be found from secondary images (0 1 or 2). |
extra.scans |
List of extra scans for USAN. List of
|
opts |
(character) operations to be passed to |
verbose |
(logical) print out command before running |
... |
additional arguments passed to |
If retimg
then object of class nifti. Otherwise,
Result from system command, depends if intern is TRUE or FALSE.
S.M. Smith and J.M. Brady. SUSAN -a new approach to low level image processing. International Journal of Computer Vision, 23(1):45-78, May 1997.
This function calls susan
's help
susan.help()
susan.help()
Prints help output and returns output as character vector
library(fslr) if (have.fsl()){ susan.help() }
library(fslr) if (have.fsl()){ susan.help() }
Gets toffset from a character
## S4 method for signature 'character' toffset(object)
## S4 method for signature 'character' toffset(object)
object |
is a filename to pass to fslval |
A tool for estimating and correcting susceptibility induced distortions
topup( infile, datain, out = NULL, fout = NULL, iout = NULL, logout = NULL, warpres = 10, subsamp = 1, fwhm = 8, config = NULL, miter = 5, lambda = NULL, ssqlambda = 1, regmod = c("bending_energy", "membrane_energy"), estmov = 1, minmet = c(0, 1), splineorder = c(3, 2), numprec = c("double", "float"), interp = c("spline", "linear"), scale = c(0, 1), regrid = c(0, 1), verbose = TRUE ) fsl_topup(...)
topup( infile, datain, out = NULL, fout = NULL, iout = NULL, logout = NULL, warpres = 10, subsamp = 1, fwhm = 8, config = NULL, miter = 5, lambda = NULL, ssqlambda = 1, regmod = c("bending_energy", "membrane_energy"), estmov = 1, minmet = c(0, 1), splineorder = c(3, 2), numprec = c("double", "float"), interp = c("spline", "linear"), scale = c(0, 1), regrid = c(0, 1), verbose = TRUE ) fsl_topup(...)
infile |
name of 4D file with images |
datain |
name of text file with PE directions/times |
out |
base-name of output files (spline coefficients (Hz) and movement parameters) |
fout |
name of image file with field (Hz) |
iout |
name of 4D image file with unwarped images |
logout |
Name of log-file |
warpres |
(approximate) resolution (in mm) of warp basis for the different sub-sampling levels, default 10 |
subsamp |
sub-sampling scheme, default 1 |
fwhm |
FWHM (in mm) of gaussian smoothing kernel, default 8 |
config |
Name of config file specifying command line arguments |
miter |
Max # of non-linear iterations, default 5 |
lambda |
Weight of regularisation, default depending on
|
ssqlambda |
If set (=1), lambda is weighted by current ssq, default 1 |
regmod |
Model for regularisation of warp-field [membrane_energy bending_energy], default bending_energy |
estmov |
Estimate movements if set, default 1 (true) |
minmet |
Minimisation method 0=Levenberg-Marquardt, 1=Scaled Conjugate Gradient, default 0 (LM) |
splineorder |
Order of spline, 2->Qadratic spline, 3->Cubic spline. Default=3 |
numprec |
Precision for representing Hessian, double or float. Default double |
interp |
Image interpolation model, linear or spline. Default spline |
scale |
If set (=1), the images are individually scaled to a common mean, default 0 (false) |
regrid |
If set (=1), the calculations are done in a different grid, default 1 (true) |
verbose |
Print diagnostic information while running |
... |
arguments passed to |
vox_offset method for character types
## S4 method for signature 'character' vox_offset(object)
## S4 method for signature 'character' vox_offset(object)
object |
is a filename to pass to fslval |
Calls xfibres
from FSL to fit, also known as
bedpostx
xfibres( infile, bvecs, bvals, mask = NULL, nfibres = 1, bet.opts = "", verbose = TRUE, njumps = NULL, burnin = NULL, burnin_noard = NULL, sampleevery = NULL, updateproposalevery = NULL, seed = NULL, noard = FALSE, allard = FALSE, nospat = FALSE, nonlinear = FALSE, cnonlinear = FALSE, rician = FALSE, f0 = FALSE, ardf0 = FALSE, opts = "" )
xfibres( infile, bvecs, bvals, mask = NULL, nfibres = 1, bet.opts = "", verbose = TRUE, njumps = NULL, burnin = NULL, burnin_noard = NULL, sampleevery = NULL, updateproposalevery = NULL, seed = NULL, noard = FALSE, allard = FALSE, nospat = FALSE, nonlinear = FALSE, cnonlinear = FALSE, rician = FALSE, f0 = FALSE, ardf0 = FALSE, opts = "" )
infile |
Input filename |
bvecs |
b-vectors: matrix of 3 columns or filename of ASCII text file |
bvals |
b-values: vector of same length as number of rows of b-vectors or filename of ASCII text file |
mask |
Mask filename |
nfibres |
Maximum number of fibres to fit in each voxel (default 1) |
bet.opts |
Options for |
verbose |
print diagnostic messages |
njumps |
num of jumps to be made by MCMC (default is 5000) |
burnin |
Total num of jumps at start of MCMC to be discarded (default is 0) |
burnin_noard |
num of burnin jumps before the ard is imposed (default is 0) |
sampleevery |
num of jumps for each sample (MCMC) (default is 1) |
updateproposalevery |
num of jumps for each update to the proposal density std (MCMC) (default is 40) |
seed |
for pseudo random number generator |
noard |
Turn ARD off on all fibres |
allard |
Turn ARD on on all fibres |
nospat |
Initialise with tensor, not spatially |
nonlinear |
Initialise with nonlinear fitting |
cnonlinear |
Initialise with constrained nonlinear fitting |
rician |
Use Rician noise modelling |
f0 |
Add to the model an unattenuated signal compartment |
ardf0 |
Use ard on f0 |
opts |
Additional options for |
Output from system