Skip to main content

Module transform

Module transform 

Source
Expand description

Apply spatial transforms to streamline coordinates.

Streamlines are stored as a single contiguous Vec<[f32; 3]> of vertices in RAS+ mm. Spatially transforming them is a pointwise operation: for each vertex p, compute chain.map_point(p) and overwrite. There is no notion of “pull”-style resampling — streamlines aren’t a sampled image, they’re a list of mm coordinates — so the transform’s chain must map source-coords → target-coords (i.e., the direction the points are moving). For ANTs paired h5s in BIDS naming, that means the inverse-named file: e.g. to warp streamlines ACPC → MNI, pass from-MNI_to-ACPC.h5.

Use apply_transform_in_place to mutate a Tractogram in situ, or apply_transform for the consuming variant. With the parallel crate feature enabled (default), the per-point loop is rayon-parallel across streamline vertices.

Functions§

apply_transform
Consuming variant of apply_transform_in_place. Returns the transformed Tractogram.
apply_transform_in_place
Apply chain to every vertex of tractogram in place.