Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
generate and warp subject streamlines to template space
tmp_dir=$(mktemp -d -t tcktransform-XXXXXXXXXX)
cd $tmp_dir
# ____ get DWI data and create two ODFs ____
for sub in sub-02 sub-03; do
for sub in sub-02 sub-03; do
tail -1 "${sub}"_tissue-WM_response.txt > rf.tmp
dwi2fod csd "${sub}"_dwi.nii.gz rf.tmp -fslgrad "${sub}"_dwi.bvec "${sub}"_dwi.bval -mask "${sub}"_brainmask.nii.gz "${sub}".mif -lmax 4
# ____ create subject and template files ____
echo "0.8 0.1 0 -100
-0.1 1 0 20
0 0 1.2 4" > A.txt
transformcalc A.txt rigid R.txt
mrtransform sub-02.mif -linear R.txt -reorient no subject.mif -force
mrfilter sub-03.mif smooth -std 3 template.mif -force
# ____ co-register subject and template ____
mrregister subject.mif template.mif -nl_warp_full warp_full.mif
# ____ create template to subject warp ____
warpconvert warp_full.mif warpfull2deformation w_t2s.mif -from 2 -template subject.mif
# ____ create subject tck and warp to template space ____
tckgen subject.mif subject.tck -seed_dynamic subject.mif -select 5k -cutoff 0.4
tcktransform subject.tck w_t2s.mif subject_at_template.tck
# ____ create subject tck in template space ____
mrview template.mif -tractography.load subject_at_template.tck
echo "please delete content of $tmp_dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.