Troubleshooting
Common issues, diagnostic commands, and solutions for HINEC pipeline problems.
FSL Not Found
Error: 'fsl command not found' or 'flirt: command not found' during preprocessing.
FSL is not installed or not initialized in the current MATLAB session's environment.
system('which flirt')system('echo $FSLDIR')# Add to ~/.bashrc before launching MATLABexport FSLDIR=/usr/local/fslsource $FSLDIR/etc/fslconf/fsl.shexport PATH=$FSLDIR/bin:$PATH # Or set within MATLAB:setenv('FSLDIR', '/usr/local/fsl');setenv('PATH', [getenv('FSLDIR') '/bin:' getenv('PATH')]);Out of Memory
MATLAB crashes or throws 'Out of memory' error during tensor estimation or tractography.
Large datasets exceed available RAM. Typical datasets require 2-4 GB; very large volumes may need more.
memory % Check MATLAB memory usagewhos nim % Check nim structure size% Reduce memory usage:% 1. Close other applications% 2. Use single precision where possible% 3. Reduce seed_density in YAML config% 4. Process in smaller chunks if possible % Check available memory before processing:[~, sys] = memory;fprintf('Available: %.1f GB\n', sys.PhysicalMemory.Available/1e9);String vs Char Array Errors
Error involving string indexing or 'Conversion to char from string is not possible'.
MATLAB's string type (double quotes) and char array type (single quotes) behave differently. HINEC expects char arrays for file paths.
class(my_path) % Should return 'char', not 'string'% Use single quotes for all file paths:main('data/sample', 'output.mat'); % Correctmain("data/sample", "output.mat"); % May cause issues % Convert string to char if needed:my_path = char(my_string);No Tracks Generated
runTractography completes but produces zero or very few tracks.
Seed mask is empty, FA values are too low, or termination criteria are too strict.
% Check seed maskload('output.mat');sum(nim.FA(:) > 0.15) % Count voxels above FA thresholdsum(nim.mask(:) > 0) % Count brain mask voxels% Adjust parameters in YAML config:tractography: termination_fa: 0.10 # Lower from default 0.15 angle_thresh: 45 # More permissive curvature min_length: 20 # Accept shorter tracks seed_density: 8 # More seed pointsPreprocessing Fails
nim_preprocessing produces errors or incomplete output.
Missing input files, incorrect file naming convention, or FSL tool failures.
% Check all required files exist:ls data/prefix_raw.nii.gzls data/prefix.bvalls data/prefix.bvec% Verify file naming convention:% Required: {prefix}_raw.nii.gz, {prefix}.bval, {prefix}.bvec% Optional: {prefix}_T1.nii.gz, {prefix}_acqp.txt % If FSL tools fail individually:system('bet input.nii.gz output -f 0.3 -v');% Check for specific error messagesPoor Registration Quality
Atlas regions appear misaligned with brain structures. Parcellation labels don't match anatomy.
Registration failed or used suboptimal fallback method. T1 data was not available for T1-guided registration.
% Visual check:nim_plot(nim, 'mode', 'parcels');% Look for regions that appear shifted or misaligned% Provide T1 data for enhanced registration:main('data/prefix_raw', 'output.mat', 't1_file', 'data/prefix_T1.nii.gz'); % Or in YAML:preprocessing: t1_available: true use_t1_registration: true