Skip to content

tractogram_math

This module performs mathematical operations on tractograms. It can be used to concatenate multiple tractograms into a single file, compute the union of multiple tractograms, or perform other operations. The available operations are:

  • Concatenate: Combine multiple tractograms into a single file.
  • Union: Compute the union of multiple tractograms.
  • Intersection: Compute the intersection of multiple tractograms.
  • Difference: Compute the difference between two tractograms.
  • Lazy Concatenate: Concatenate multiple tractograms without loading them into memory.

Keywords : tractogram, math, concatenate


Format : tuple val(meta), path(trks), path(reference)

TypeDescriptionMandatoryPattern
metamapGroovy Map containing sample information e.g. [ id:'sample1', single_end:false ]True
trksfileList of tractograms to perform the operation on. e.g. [ path(trk1), path(trk2), path(trk3), ...]True*.trk
referencefileReference tractogram to use for the operation. e.g. [ path(reference) ]False*.{nii,nii.gz}

Format : tuple val(meta), path(*.trk)

TypeDescriptionMandatoryPattern
metamapGroovy Map containing sample information e.g. [ id:'sample1', single_end:false ]True
*.trkfileResulting tractogram after the operation. e.g. [ path(trk) ]True*.trk

Format : path(versions.yml)

TypeDescriptionMandatoryPattern
versions.ymlfileFile containing software versionsTrueversions.yml

TypeDescriptionDefaultChoices
operationstringThe mathematical operation to perform on the tractograms. e.g. concatenate, union, intersection, difference, lazy_concatenate- concatenate
- union
- intersection
- difference
- lazy_concatenate
suffixstringSuffix to add to the output tractogram file name.
precisionnumberPrecision used to compare streamlines.4
robustbooleanUse version robust to small rotations/translations.False
no_metadatabooleanStrip the streamline metadata from the output.False
fake_metadatabooleanSkip the metadata verification, create fake metadata if missing, can lead to unexpected behavior.False
save_indicesstringSave the streamline indices to the supplied json file. The string in this argument will be used as the prefix of the output .json file.
save_emptybooleanIf set, we will save all results, even if tractogram if empty.False
no_bbox_checkbooleanActivate to ignore validity of the bounding box during loading / saving of tractograms (ignores the presence of invalid streamlines).False

DescriptionDOI
scilpyThe Sherbrooke Connectivity Imaging Lab (SCIL) Python dMRI processing toolbox.


Last updated : 2025-10-30