Skip to content

Instantly share code, notes, and snippets.

@azhylka
azhylka / gist:274120799d1c3a5aa2df214c17ef8f0d
Created May 7, 2026 18:41
DIPY INR Tractography Example
#!/usr/bin/env python3
"""INR-based whole-brain tractography on BIDS wmfod files.
Pipeline per subject / session / FOD variant
--------------------------------------------
1. Train an ImageINR on the wmfod volume (skipped when checkpoint exists).
2. Export the checkpoint as a TorchScript ``.ts`` file (skipped when it
already exists alongside the checkpoint).
3. Run :func:`~dipy.tracking.tracker.deterministic_tracking` with
``inr_model`` pointing at the ``.ts`` file.
@azhylka
azhylka / subject_tck_in_template_space.sh
Created October 28, 2025 13:47 — forked from maxpietsch/subject_tck_in_template_space.sh
generate and warp subject streamlines to template space
#/bin/env bash
do_nonlinear_registration=false
tmp_dir=$(mktemp -d -t tcktransform-XXXXXXXXXX)
cd $tmp_dir
# ____ 0. get DWI data and create two ODFs ____
for sub in sub-02 sub-03; do
wget --quiet https://github.com/MRtrix3/script_test_data/raw/master/BIDS/"${sub}"/dwi/"${sub}"_dwi.bval
@azhylka
azhylka / volume2surface.py
Created May 3, 2021 14:58
Segmantion-to-mesh conversion using VTK, Marching Cubes. Result is saved in PLY format.
import nibabel as nib
import vtk
import numpy as np
import vtk.util.numpy_support
import os
def volume2surface(segmentation, out_ply, labels):
for label in labels:
print('Label', label)