fslmaths
#!/bin/sh
# Any image containing NANs may not be read correctly
# by fslmaths or fslstats.
# -nan : replace NaNs (improper numbers) with 0
fslmaths img -nan img_no_nans
fslmaths
#!/bin/sh
# Any image containing NANs may not be read correctly
# by fslmaths or fslstats.
# -nan : replace NaNs (improper numbers) with 0
fslmaths img -nan img_no_nans
fslmaths
# FSL: fsl dilate or fsl erode:
# Kernel operations (set BEFORE filtering operation if desired):
# -kernel 3D : 3x3x3 box centered on target voxel (set as default kernel)
# -kernel 2D : 3x3x1 box centered on target voxel
# Spatial Filtering operations:
# N.B. all options apart from -s use the default kernel or that
# previously specified by -kernel
# -dilM : Mean Dilation of non-zero voxels
# -dilD : Modal Dilation of non-zero voxels
# -dilF : Maximum filtering of all voxels
# -dilall : Apply -dilM repeatedly until the entire FOV is covered
# -ero : Erode by zeroing non-zero voxels when zero voxels found in kernel
# -eroF : Minimum filtering of all voxels
# dilation example
# -odt sets the output data type.
# odt options are char short int float double
fslmaths mask -kernel 3D -dilM mask -odt short
# erosion example
fslmaths mask -kernel 2D -ero mask -odt short
fslmaths
#!/bin/sh
# Make a 5 percent mask (default choice for fdt results).
# fdt is FSL's diffusion toolbox.
# Use following percentage (0-100) of ROBUST RANGE of
# non-zero voxels and threshold below that percentage
fslmaths img -thrp img_5p
fslmaths
#!/bin/sh
# Add 100 to every voxel in image (making the image uniformly brighter)
fslmaths img -add 100 img_bright
fslmaths
#!/bin/sh
# Make an inverse binary image mask (switch the 1s and 0’s)
# Create the inverse mask (Mark Jenkinson's approach. Very clever:
# Multiply by negative 1, then add 1). Make sure you pass in a binary mask)
fslmaths mask -mul -1 -add 1 -bin mask_inverse
# OR use -binv flag
fslmaths mask -binv mask_inverse
fslmaths
#!/bin/sh
# Make an outline from a mask (using the -edge flag)
fslmaths mask -edge mask_outline
fslmaths
#!/bin/sh
# Subtract one mask from another. Binarize the resulting difference
# with -bin to get rid of negative numbers. See the jaccard index to expand on this use.
fslmaths mask1 -sub mask2 -bin mask_diff
fslmaths
#!/bin/sh
# Make image containing positive values only by thresholding at 0
fslmaths img -thr 0 img_pos
fslmaths
#!/bin/sh
# Make an empty image (same dimensions as input image).
# See also fslhd.
fslmaths img -sub img empty_img # subtract the image from itself
# OR
fslmaths img -mul 0 empty_img # mulitply the image by 0
fslmaths
#!/bin/sh
# Multiply image by mask to extract just those voxels
# from image that are in the mask (see also -mas):
fslmaths img -mul mask img_in_mask
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us