HomeDocumentationGetting Started

Getting Started

Install HINEC, prepare your data, and run your first tractography pipeline in minutes.

Prerequisites

MATLAB

HINEC requires MATLAB R2020b or later with two toolboxes:

  • Image Processing Toolbox
  • Statistics and Machine Learning Toolbox
matlab
ver('images') % Image Processing Toolbox
ver('stats') % Statistics and Machine Learning Toolbox

Verify required toolboxes are installed.

FSL (FMRIB Software Library)

Required for preprocessing raw diffusion data. Not needed if you provide already-preprocessed files.

bash
# Add to your shell profile (~/.bashrc or ~/.zshrc)
export FSLDIR=/usr/local/fsl
source $FSLDIR/etc/fslconf/fsl.sh
export PATH=$FSLDIR/bin:$PATH
# Verify installation
flirt -version

SPM12

Included in the repository at lib/spm12/. No separate installation is needed — main.m automatically adds it to the MATLAB path.

Python (Optional)

Required only for the fast distributed slice viewer:

  • Python 3.7+
  • pip install Pillow numpy
  • tkinter (usually included with Python)

Installation

bash
# Clone the repository
git clone https://github.com/uicneuro/hinec
cd hinec
# Verify sample data exists
ls data/original_sample/
ls data/parcellation_sample/

No build step is required. MATLAB source files are used directly.

Quick Start

# Process sample data with default configuration
./bin/run_hinec.sh data/parcellation_sample/sample sample.mat

# Export visualization figures
./bin/run_visualization.sh hinec_runs/run_*_hinec_default/ figures/sample

The simplest way to run HINEC end-to-end — preprocessing, DTI, and tractography in one command.

Data prefix convention
The first argument is a data prefix — the shared path and name common to all input files, without any suffix or extension. For example, given files sample_raw.nii.gz, sample.bval, and sample.bvec, the prefix is data/parcellation_sample/sample.
Tip
If your files end in _raw.nii.gz, HINEC runs FSL preprocessing automatically. Files ending in just .nii.gz (no _raw) are assumed to be already preprocessed.

Input Data Requirements

HINEC uses a prefix-based file discovery system. All input files share a common prefix.

Required and optional input files
ParameterTypeRequiredDefaultDescription
{prefix}_raw.nii.gzNIfTIYesRaw diffusion-weighted MRI data (triggers preprocessing)
{prefix}.bvaltextYesB-values for each diffusion-weighted volume
{prefix}.bvectextYesB-vectors (gradient directions) for each volume
{prefix}_M.nii.gzNIfTINoPre-computed brain mask (skips mask extraction)
{prefix}_T1.nii.gzNIfTINoT1-weighted structural image for enhanced registration
{prefix}_fmap_Hz.nii.gzNIfTINoB0 field map in Hz for distortion correction
{prefix}_acqp.txttextNoAcquisition parameters for FSL eddy
{prefix}_index.txttextNoVolume index file for FSL eddy
text|Example directory structure
data/parcellation_sample/
├── sample_raw.nii.gz # Raw diffusion data
├── sample.bval # B-values
├── sample.bvec # B-vectors
├── sample_T1.nii.gz # T1 anatomical (optional)
└── sample_acqp.txt # Acquisition parameters (optional)

Expected Output

After main() completes, the output .mat file contains a nim struct with:

ParameterTypeRequiredDefaultDescription
.img4D arrayYesOriginal image data [X, Y, Z, N]
.DT4D arrayYesDiffusion tensors (6 components per voxel)
.evec5D arrayYesEigenvectors — fiber directions
.eval4D arrayYesEigenvalues — diffusion magnitudes
.FA3D arrayYesFractional anisotropy map
.parcellation_mask3D arrayYesBrain region labels
.labelsMapYesRegion names from atlas

After runTractography(), a tracks file appears in tractography_results/ containing:

  • tracks — Cell array of fiber pathways (each track is an Nx3 matrix)
  • options — Parameters used during tracking
  • elapsed_time — Computation time
  • algorithm — Algorithm name

Configuration Presets

HINEC ships with four configuration presets that balance speed and quality for different use cases.

PresetPurposeSpeedQuality
hinec_default.ymlBalanced performanceMediumGood
high_precision.ymlPublication qualitySlowExcellent
fast_exploration.ymlQuick testingFastModerate
irontract.ymlIronTract challengeMediumHigh