BRAINSTools

A suite of tools for medical image processing focused on brain analysis

View the Project on GitHub

Tool Catalog

BRAINSTools provides the following command-line tools, grouped by the category each declares in its Slicer module descriptor.

Diffusion.GTRACT

Anisotropy Map

This program will generate a scalar map of anisotropy, given a tensor representation. Anisotropy images are used for fiber tracking, but the anisotropy scalars are not defined along the path. Instead, the tensor representation is included as point data allowing all of these metrics to be computed using only the fiber tract point data. The images can be saved in any ITK supported format, but it is suggested that you use an image format that supports the definition of the image origin. This includes NRRD, NifTI, and Meta formats. These images can also be used for scalar analysis including regional anisotropy measures or VBM style analysis.

gtractAnisotropyMap · version 5.8.0 · documentation · source

Average B-Values

This program will directly average together the baseline gradients (b value equals 0) within a DWI scan. This is usually used after gtractCoregBvalues.

gtractAverageBvalues · version 5.8.0 · documentation · source

B-Spline Transform Inversion

This program will invert a B-Spline transform using a thin-plate spline approximation.

gtractInvertBSplineTransform · version 5.8.0 · documentation · source

Clip Anisotropy

This program will zero the first and/or last slice of an anisotropy image, creating a clipped anisotropy image.

gtractClipAnisotropy · version 5.8.0 · documentation · source

Compare Tracts

This program will halt with a status code indicating whether a test tract is nearly enough included in a standard tract in the sense that every fiber in the test tract has a low enough sum of squares distance to some fiber in the standard tract modulo spline resampling of every fiber to a fixed number of points.

compareTractInclusion · version 5.8.0 · documentation · source

Concat DWI Images

This program will concatenate two DTI runs together.

gtractConcatDwi · version 5.8.0 · documentation · source

Copy Image Orientation

This program will copy the orientation from the reference image into the moving image. Currently, the registration process requires that the diffusion weighted images and the anatomical images have the same image orientation (i.e. Axial, Coronal, Sagittal). It is suggested that you copy the image orientation from the diffusion weighted images and apply this to the anatomical image. This image can be subsequently removed after the registration step is complete. We anticipate that this limitation will be removed in future versions of the registration programs.

gtractCopyImageOrientation · version 5.8.0 · documentation · source

Coregister B-Values

This step should be performed after converting DWI scans from DICOM to NRRD format. This program will register all gradients in a NRRD diffusion weighted 4D vector image (moving image) to a specified index in a fixed image. It also supports co-registration with a T2 weighted image or field map in the same plane as the DWI data. The fixed image for the registration should be a b0 image. A mutual information metric cost function is used for the registration because of the differences in signal intensity as a result of the diffusion gradients. The full affine allows the registration procedure to correct for eddy current distortions that may exist in the data. If the eddyCurrentCorrection is enabled, relaxationFactor (0.25) and maximumStepSize (0.1) should be adjusted.

gtractCoregBvalues · version 5.8.0 · documentation · source

Coregister B0 to Anatomy

This program will register a Nrrd diffusion weighted 4D vector image to a fixed anatomical image. Two registration methods are supported for alignment with anatomical images: Rigid and B-Spline. The rigid registration performs a rigid body registration with the anatomical images and should be done as well to initialize the B-Spline transform. The B-SPline transform is the deformable transform, where the user can control the amount of deformation based on the number of control points as well as the maximum distance that these points can move. The B-Spline registration places a low dimensional grid in the image, which is deformed. This allows for some susceptibility related distortions to be removed from the diffusion weighted images. In general the amount of motion in the slice selection and read-out directions direction should be kept low. The distortion is in the phase encoding direction in the images. It is recommended that skull stripped (i.e. image containing only brain with skull removed) images shoud be used for image co-registration with the B-Spline transform.

gtractCoRegAnatomy · version 5.8.0 · documentation · source

Cost Fast Marching

This program will use a fast marching fiber tracking algorithm to identify fiber tracts from a tensor image. This program is the first portion of the algorithm. The user must first run gtractFastMarchingTracking to generate the actual fiber tracts. This algorithm is roughly based on the work by G. Parker et al. from IEEE Transactions On Medical Imaging, 21(5): 505-512, 2002. An additional feature of including anisotropy into the vcl_cost function calculation is included.

gtractCostFastMarching · version 5.8.0 · documentation · source

Create Displacement Field

This program will compute forward deformation from the given Transform. The size of the DF is equal to MNI space

gtractTransformToDisplacementField · version 5.8.0 · documentation · source

Create Guide Fiber

This program will create a guide fiber by averaging fibers from a previously generated tract.

gtractCreateGuideFiber · version 5.8.0 · documentation · source

Extract Nrrd Index

This program will extract a 3D image (single vector) from a vector 3D image at a given vector index.

extractNrrdVectorIndex · version 5.8.0 · documentation · source

Fast Marching Tracking

This program will use a fast marching fiber tracking algorithm to identify fiber tracts from a tensor image. This program is the second portion of the algorithm. The user must first run gtractCostFastMarching to generate the vcl_cost image. The second step of the algorithm implemented here is a gradient descent soplution from the defined ending region back to the seed points specified in gtractCostFastMarching. This algorithm is roughly based on the work by G. Parker et al. from IEEE Transactions On Medical Imaging, 21(5): 505-512, 2002. An additional feature of including anisotropy into the vcl_cost function calculation is included.

gtractFastMarchingTracking · version 5.8.0 · documentation · source

Fiber Tracking

This program implements four fiber tracking methods (Free, Streamline, GraphSearch, Guided). The output of the fiber tracking is vtkPolyData (i.e. Polylines) that can be loaded into Slicer3 for visualization. The poly data can be saved in either old VTK format files (.vtk) or in the new VTK XML format (.xml). The polylines contain point data that defines ther Tensor at each point along the fiber tract. This can then be used to rendered as glyphs in Slicer3 and can be used to define severeal scalar measures without referencing back to the anisotropy images. (1) Free tracking is a basic streamlines algorithm. This is a direct implementation of the method original proposed by Basser et al. The tracking follows the primarty eigenvector. The tracking begins with seed points in the starting region. Only those voxels above the specified anisotropy threshold in the starting region are used as seed points. Tracking terminates either as a result of maximum fiber length, low ansiotropy, or large curvature. This is a great way to explore your data. (2) The streamlines algorithm is a direct implementation of the method originally proposed by Basser et al. The tracking follows the primary eigenvector. The tracking begins with seed points in the starting region. Only those voxels above the specified anisotropy threshold in the starting region are used as seed points. Tracking terminates either by reaching the ending region or reaching some stopping criteria. Stopping criteria are specified using the following parameters: tracking threshold, curvature threshold, and max length. Only paths terminating in the ending region are kept in this method. The TEND algorithm proposed by Lazar et al. (Human Brain Mapping 18:306-321, 2003) has been instrumented. This can be enabled using the –useTend option while performing Streamlines tracking. This utilizes the entire diffusion tensor to deflect the incoming vector instead of simply following the primary eigenvector. The TEND parameters are set using the –tendF and –tendG options. (3) Graph Search tracking is the first step in the full GTRACT algorithm developed by Cheng et al. (NeuroImage 31(3): 1075-1085, 2006) for finding the tracks in a tensor image. This method was developed to generate fibers in a Tensor representation where crossing fibers occur. The graph search algorithm follows the primary eigenvector in non-ambigous regions and utilizes branching and a graph search algorithm in ambigous regions. Ambiguous tracking regions are defined based on two criteria: Branching Al Threshold (anisotropy values below this value and above the traching threshold) and Curvature Major Eigen (angles of the primary eigenvector direction and the current tracking direction). In regions that meet this criteria, two or three tracking paths are considered. The first is the standard primary eigenvector direction. The second is the seconadary eigenvector direction. This is based on the assumption that these regions may be prolate regions. If the Random Walk option is selected then a third direction is also considered. This direction is defined by a cone pointing from the current position to the centroid of the ending region. The interior angle of the cone is specified by the user with the Branch/Guide Angle parameter. A vector contained inside of the cone is selected at random and used as the third direction. This method can also utilize the TEND option where the primary tracking direction is that specified by the TEND method instead of the primary eigenvector. The parameter ‘–maximumBranchPoints’ allows the tracking to have this number of branches being considered at a time. If this number of branch points is exceeded at any time, then the algorithm will revert back to a streamline alogrithm until the number of branches is reduced. This allows the user to constrain the computational complexity of the algorithm. (4) The second phase of the GTRACT algorithm is Guided Tracking. This method incorporates anatomical information about the track orientation using an initial guess of the fiber track. In the originally proposed GTRACT method, this would be created from the fibers resulting from the Graph Search tracking. However, in practice this can be created using any method and could be defined manually. To create the guide fiber the program gtractCreateGuideFiber can be used. This program will load a fiber tract that has been generated and create a centerline representation of the fiber tract (i.e. a single fiber). In this method, the fiber tracking follows the primary eigenvector direction unless it deviates from the guide fiber track by a angle greater than that specified by the ‘–guidedCurvatureThreshold’ parameter. The user must specify the guide fiber when running this program.

gtractFiberTracking · version 5.8.0 · documentation · source

Image Conformity

This program will straighten out the Direction and Origin to match the Reference Image.

gtractImageConformity · version 5.8.0 · documentation · source

Invert Displacement Field

This program will invert a deformatrion field. The size of the deformation field is defined by an example image provided by the user

gtractInvertDisplacementField · version 5.8.0 · documentation · source

Resample Anisotropy

This program will resample a floating point image using either the Rigid or B-Spline transform. You may want to save the aligned B0 image after each of the anisotropy map co-registration steps with the anatomical image to check the registration quality with another tool.

gtractResampleAnisotropy · version 5.8.0 · documentation · source

Resample B0

This program will resample a signed short image using either a Rigid or B-Spline transform. The user must specify a template image that will be used to define the origin, orientation, spacing, and size of the resampled image.

gtractResampleB0 · version 5.8.0 · documentation · source

Resample Code Image

This program will resample a short integer code image using either the Rigid or Inverse-B-Spline transform. The reference image is the DTI tensor anisotropy image space, and the input code image is in anatomical space.

gtractResampleCodeImage · version 5.8.0 · documentation · source

Resample DWI In Place

Resamples DWI image to structural image.

gtractResampleDWIInPlace · version 5.8.0 · documentation · source

Resample Fibers

This program will resample a fiber tract with respect to a pair of deformation fields that represent the forward and reverse deformation fields.

gtractResampleFibers · version 5.8.0 · documentation · source

Rigid Transform Inversion

This program will invert a Rigid transform.

gtractInvertRigidTransform · version 5.8.0 · documentation · source

Tensor Estimation

This step will convert a b-value averaged diffusion tensor image to a 3x3 tensor voxel image. This step takes the diffusion tensor image data and generates a tensor representation of the data based on the signal intensity decay, b values applied, and the diffusion difrections. The apparent diffusion coefficient for a given orientation is computed on a pixel-by-pixel basis by fitting the image data (voxel intensities) to the Stejskal-Tanner equation. If at least 6 diffusion directions are used, then the diffusion tensor can be computed. This program uses itk::DiffusionTensor3DReconstructionImageFilter. The user can adjust background threshold, median filter, and isotropic resampling.

gtractTensor · version 5.8.0 · documentation · source

Diffusion.Import and Export

Diffusion-weighted DICOM Import (DWIConvert)

Converts diffusion weighted MR images in DICOM series into NRRD format for analysis in Slicer. This program has been tested on only a limited subset of DTI DICOM formats available from Siemens, GE, and Philips scanners. Work in progress to support DICOM multi-frame data. The program parses DICOM header to extract necessary information about measurement frame, diffusion weighting directions, b-values, etc, and write out a NRRD image. For non-diffusion weighted DICOM images, it loads in an entire DICOM series and writes out a single dicom volume in a .nhdr/.raw pair.

DWIConvert · version 5.8.0 · documentation · source

Diffusion.Utilities

DWI Cleanup (BRAINS)

Remove bad gradients/volumes from DWI NRRD file.

BRAINSDWICleanup · version 5.8.0 · documentation · source

Filtering

Edge Map Generator (BRAINS)

Inverse of Maximum Gradient Image

GenerateEdgeMapImage · version 5.8.0 · source

Percentile Rescaling

Computes the percentile rescaling of an image

BRAINSIntensityNormalize · version 5.8.0 · source

Quantification

Label Statistics (BRAINS)

Compute image statistics within each label of a label map.

BRAINSLabelStats · version 5.8.0 · documentation · source

Registration

General Registration (BRAINS)

Register a three-dimensional volume to a reference volume (Mattes Mutual Information by default). Method described in BRAINSFit: Mutual Information Registrations of Whole-Brain 3D Images, Using the Insight Toolkit, Johnson H.J., Harris G., Williams K., The Insight Journal, 2007. https://hdl.handle.net/1926/1291

BRAINSFit · version 5.8.0 · documentation · source

Registration Metric Test (BRAINS)

Compare Mattes/MSQ metric value for two input images and a possible input BSpline transform.

PerformMetricTest · version 5.8.0 · documentation · source

Resample Image (BRAINS)

This program collects together three common image processing tasks that all involve resampling an image volume: Resampling to a new resolution and spacing, applying a transformation (using an ITK transform IO mechanisms) and Warping (using a vector image deformation field).

BRAINSResample · version 5.8.0 · documentation · source

Resize Image (BRAINS)

This program is useful for downsampling an image by a constant scale factor.

BRAINSResize · version 5.8.0 · documentation · source

Registration.Specialized

Fiducial Registration (BRAINS)

Computes a rigid, similarity or affine transform from a matched list of fiducials

BRAINSTransformFromFiducials · version 5.8.0 · documentation · source

Segmentation.Specialized

BRAINS Binary Mask Editor Based On Landmarks(BRAINS)

Edit a binary mask by cutting it with planes defined by three landmarks or by a landmark and an axis direction, clearing voxels on the specified side of each plane.

BinaryMaskEditorBasedOnLandmarks · version 5.8.0 · documentation · source

Brain Landmark Constellation Detector (BRAINS)

This program will find the mid-sagittal plane, a constellation of landmarks in a volume, and create an AC/PC aligned data set with the AC point at the center of the voxel lattice (labeled at the origin of the image physical space.) Part of this work is an extention of the algorithms originally described by Dr. Babak A. Ardekani, Alvin H. Bachman, Model-based automatic detection of the anterior and posterior commissures on MRI scans, NeuroImage, Volume 46, Issue 3, 1 July 2009, Pages 677-682, ISSN 1053-8119, DOI: 10.1016/j.neuroimage.2009.02.030. (http://www.sciencedirect.com/science/article/B6WNP-4VRP25C-4/2/8207b962a38aa83c822c6379bc43fe4c)

BRAINSConstellationDetector · version 5.8.0 · documentation · source

Clean Contiguous Label Map (BRAINS)

From a range of label map values, extract the largest contiguous region of those labels

ESLR · source

Create Label Map From Probability Maps (BRAINS)

Given A list of Probability Maps, generate a LabelMap.

BRAINSCreateLabelMapFromProbabilityMaps · source

Create best representative label map)

given a list of label map images, create a representative/average label map.

BRAINSMultiSTAPLE · source

Foreground masking (BRAINS)

This program is used to create a mask over the most prominent foreground region in an image. This is accomplished via a combination of otsu thresholding and a closing operation.

BRAINSROIAuto · version 5.8.0 · documentation · source

Intra-subject registration, bias Correction, and tissue classification (BRAINS)

Atlas-based tissue segmentation method. This is an algorithmic extension of work performed at UNC and Utah, with significant contributions from Marcel Prastawa and the NAMIC project.

BRAINSABC · source

Mask Hole Filling (BRAINS)

Cleans up a mask image by filling any holes

BRAINSCleanMask · source

Pure Plugs Mask

This program gets several modality image files and returns a binary mask that defines the pure plugs.

GeneratePurePlugMask · version 5.8.0 · source

Tissue Classification

This program will generate an 8-bit continuous tissue classified image based on BRAINSABC posterior images.

BRAINSPosteriorToContinuousClass · version 5.8.0 · documentation · source

Utilities

Strip Rotation (BRAINS)

Read an Image, write out same image with identity rotation matrix plus an ITK transform file

BRAINSStripRotation · version 5.8.0 · documentation · source

Utilities.BRAINS

ACPC-Aligned Landmark Conversion

This program converts the original landmark files to the acpc-aligned landmark files

landmarksConstellationAligner · version 5.8.0 · source

Align Mid Saggital Brain (BRAINS)

Resample an image into ACPC alignment ACPCDetect

BRAINSAlignMSP · source

Average Fiducials

This program gets several fcsv file each one contains several landmarks with the same name but slightly different coordinates. For EACH landmark we compute the average coordination.

GenerateAverageLmkFile · version 5.8.0 · source

Brain Deface from T1/T2 image (BRAINS)

This program: 1) will deface images from a set of images. Inputs must be ACPC aligned, and AC, PC, LE, RE provided.

BRAINSDeface · version 5.8.0 · documentation · source

Brain Extraction from T1/T2 image (BRAINS)

This program: 1) generates a weighted mixture image optimizing the mean and variance and 2) produces a mask of the brain volume

BRAINSMush · version 5.8.0 · documentation · source

Clip Inferior of Center of Brain (BRAINS)

This program will read the inputVolume as a short int image, write the BackgroundFillValue everywhere inferior to the lower bound, and write the resulting clipped short int image in the outputVolume.

BRAINSClipInferior · version 5.8.0 · source

ConstellationDetectorGUI (BRAINS)

This program provides the user with a GUI tool to view/manipulate landmarks for an input volume.

BRAINSConstellationDetectorGUI · version 5.8.0 · documentation · source

Eye Detector (BRAINS)

Locate left and right eye centers in a T1 head image using a Hough radial-voting transform seeded by the center of head mass, and write the eye-aligned resampled volume.

BRAINSEyeDetector · version 5.8.0 · documentation · source

Generate Landmarks Model (BRAINS)

Train up a model for BRAINSConstellationDetector

BRAINSConstellationModeler · source

Generate Landmarks Weights (BRAINS)

Train up a list of Weights for the Landmarks in BRAINSConstellationDetector

landmarksConstellationWeights · source

Initialized Control Points (BRAINS)

Outputs bspline control points as landmarks

BRAINSInitializedControlPoints · version 5.8.0 · source

Label Map from Probability Images

Given a list of probability maps for labels, create a discrete label map where only the highest probability region is used for the labeling.

GenerateLabelMapFromProbabilityMap · version 5.8.0 · source

Landmark FCSV to HDF5 Converter (BRAINS)

Convert a collection of fcsv files to a HDF5 format file

fcsv_to_hdf5 · source

Landmark Linear Modeler (BRAINS)

Training linear model using EPCA. Implementation based on my MS thesis, “A METHOD FOR AUTOMATED LANDMARK CONSTELLATION DETECTION USING EVOLUTIONARY PRINCIPAL COMPONENTS AND STATISTICAL SHAPE MODELS”

BRAINSLinearModelerEPCA · version 5.8.0 · documentation · source

Landmark Transform (BRAINS)

This utility program estimates the affine transform to align the fixed landmarks to the moving landmarks, and then generate the resampled moving image to the same physical space as that of the reference image.

BRAINSLmkTransform · version 5.8.0 · documentation · source

Landmark Transform Initializer (BRAINS)

Create transformation file (.h5) from a pair of landmarks (fcsv) files.

BRAINSLandmarkInitializer · version 5.8.0 · source

Landmarks Transformation

This program converts the original landmark file to the target landmark file using the input transform.

BRAINSConstellationLandmarksTransform · version 5.8.0 · source

MidACPC Landmark Insertion

This program gets a landmark fcsv file and adds a new landmark as the midpoint between AC and PC points to the output landmark fcsv file

insertMidACPCpoint · version 5.8.0 · source

Segment based on rectangular region of joint histogram (BRAINS)

This tool creates binary regions based on segmenting multiple image modalitities at once.

BRAINSMultiModeSegment · version 5.8.0 · source

Snapshot Writer (BRAINS)

Create 2D snapshot of input images. Mask images are color-coded

BRAINSSnapShotWriter · version 5.8.0 · source

Transform Convert (BRAINS)

Convert ITK transforms to higher order transforms

BRAINSTransformConvert · version 5.8.0 · documentation · source

Trim Foreground In Direction (BRAINS)

This program will trim off the neck and also air-filling noise from the inputImage.

BRAINSTrimForegroundInDirection · version 5.8.0 · documentation · source