Hou version - broken CLI action ana

45 views
Skip to first unread message

Reece Hill

unread,
Sep 17, 2025, 9:35:12 AM (8 days ago) Sep 17
to DSI Studio
Hi Frank,

Just reporting 2 bugs on your latest Hou version relating --action=ana.
Running on Ubuntu 22.04, WSL2. 

1) Cannot use --action=ana to save in current slice, if --tract<file> has been merged.
--action=ana ... --ref=<image> fails

Where --tract=<input> is the direct result of --action=trk - the "ref" parameter is recognised and all works fine:
reece@Legion-Laptop:~$ /usr/local/dsi-studio/dsi_studio
--action=trk
--source=<path>/automated.fib.gz
--thread_count=1
--method=1
--fa_threshold=0
--step_size=0.5
--turning_angle=60
--smoothing=0
--min_length=10
--max_length=300
--check_ending=1
--tip_iteration=16
--tract_count=100000
--output=<path>/L_1m0_thread0.tt.gz
--seed=<path>/dti_lh_precentral_paracentral.mask.nii.gz
--end=<path>/dti_lh_precentral_paracentral.mask.nii.gz
--end2=<path>/dti_lh_precentral_paracentral.mask.nii.gz
--random_seed=191664964

DSI Studio version: Hou "" Sep 17 2025
action=trk
├──CUDA Driver Version: 12080 CUDA Run Time Version: 11080
│  ├──device count: 1
│  ├──device number: 0
│  ├──arch: 120
│  ├──device name: NVIDIA GeForce RTX 5070 Laptop GPU
│  ├──memory clock rate (KHz): 12001000
│  ├──memory bus width (bits): 128
│  ├──peak memory bandwidth (GB/s): 384.032
CPU/GPU computation enabled
┌──📟command line
├──thread_count=1
├──source=<path>/automated.fib.gz
├──┬──📟run
│  ├──┬──📂opening <path>/automated.fib.gz
│  │  ├──fib_ver: 0
│  │  ├──dim: 145 174 145 vs: 1.25 1.25 1.25
│  │  ├──trans: -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──is qsdr: no
│  │  ├──mask created from the images
│  │  ├──mask voxels: 936256
│  │  ├──┬──📟loading image volumes
│  │  │  └──⏱147ms
│  │  ├──matched template: "human"
│  │  └──⏱908ms
│  ├──┬──📟tracking parameters:
│  │  ├──otsu_threshold=0.6
│  │  ├──fa_threshold=0
│  │  ├──dt_threshold=0
│  │  ├──turning_angle=60
│  │  ├──step_size=0.5
│  │  ├──smoothing=0
│  │  ├──min_length=10
│  │  ├──max_length=300
│  │  ├──track_voxel_ratio=2
│  │  ├──random_seed=191664964
│  │  ├──method=1
│  │  ├──check_ending=1
│  │  ├──tip_iteration=16
│  │  ├──tract_count=100000
│  │  └──⏱0ms
│  ├──┬──📟setting up regions
│  │  ├──end=<path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──load volume from <path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──┬──📂opening file
│  │  │  ├──dti_lh_precentral_paracentral loaded as single ROI file
│  │  │  ├──FIB file size: 145 174 145 vs: 1.25 1.25 1.25  not mni space
│  │  │  ├──dti_lh_precentral_paracentral size: 145 174 145 vs: 1.25 1.25 1.25  not mni space (if mni space, add '.mni.' in file name)
│  │  │  └──⏱67ms
│  │  ├──An ending region was placed at <path>/dti_lh_precentral_paracentral.mask.nii.gz (99,89,90).
│  │  ├──end2=<path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──load volume from <path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──┬──📂opening file
│  │  │  ├──dti_lh_precentral_paracentral loaded as single ROI file
│  │  │  ├──FIB file size: 145 174 145 vs: 1.25 1.25 1.25  not mni space
│  │  │  ├──dti_lh_precentral_paracentral size: 145 174 145 vs: 1.25 1.25 1.25  not mni space (if mni space, add '.mni.' in file name)
│  │  │  └──⏱47ms
│  │  ├──An ending region was placed at <path>/dti_lh_precentral_paracentral.mask.nii.gz (99,89,90).
│  │  ├──seed=<path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──load volume from <path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──┬──📂opening file
│  │  │  ├──dti_lh_precentral_paracentral loaded as single ROI file
│  │  │  ├──FIB file size: 145 174 145 vs: 1.25 1.25 1.25  not mni space
│  │  │  ├──dti_lh_precentral_paracentral size: 145 174 145 vs: 1.25 1.25 1.25  not mni space (if mni space, add '.mni.' in file name)
│  │  │  └──⏱48ms
│  │  ├──A seeding region was placed at <path>/dti_lh_precentral_paracentral.mask.nii.gz (99,89,90).
│  │  └──⏱172ms
│  ├──┬──📟fiber tracking
│  │  └──⏱9.458s
│  ├──2111 tracts removed by trimming.
│  ├──tract count after trimming: 97889
│  ├──97889 tracts are generated using 2804597 seeds.
│  ├──┬──📟post-tracking analysis
│  │  ├──output=<path>/L_1m0_thread0.tt.gz
│  │  ├──💾save tracts to <path>/L_1m0_thread0.tt.gz
│  │  ├──dim:145 174 145
│  │  ├──vs:1.25 1.25 1.25
│  │  ├──trans:-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──┬──💾saving
│  │  │  ├──┬──📟compressing trajectories
│  │  │  │  └──⏱75ms
│  │  │  └──⏱524ms
│  │  └──⏱524ms
│  └──⏱11.992s
└──⏱11.992s


reece@Legion-Laptop:~$ /usr/local/dsi-studio/dsi_studio
--action=ana
--source=<path>/automated.fib.gz
--tract=<path>/L_1m0_thread0.tt.gz
--ref=<path>/automated_reg_aparc+aseg.nii.gz
--output=<path>/Diffusion/1m0_in_space.tt.gz

DSI Studio version: Hou "" Sep 17 2025
action=ana
├──CUDA Driver Version: 12080 CUDA Run Time Version: 11080
│  ├──device count: 1
│  ├──device number: 0
│  ├──arch: 120
│  ├──device name: NVIDIA GeForce RTX 5070 Laptop GPU
│  ├──memory clock rate (KHz): 12001000
│  ├──memory bus width (bits): 128
│  ├──peak memory bandwidth (GB/s): 384.032
CPU/GPU computation enabled
┌──📟command line
├──thread_count=32
├──source=<path>/automated.fib.gz
├──┬──📟run
│  ├──┬──📂opening <path>/automated.fib.gz
│  │  ├──fib_ver: 0
│  │  ├──dim: 145 174 145 vs: 1.25 1.25 1.25
│  │  ├──trans: -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──is qsdr: no
│  │  ├──mask created from the images
│  │  ├──mask voxels: 936256
│  │  ├──┬──📟loading image volumes
│  │  │  └──⏱150ms
│  │  ├──matched template: "human"
│  │  └──⏱930ms
│  ├──tract=<path>/L_1m0_thread0.tt.gz
│  ├──┬──📂opening L_1m0_thread0.tt.gz
│  │  └──⏱82ms
│  ├──host space (native): -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──tractography space (native):
│  ├──-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──A total of 97889 tracks loaded
│  ├──a total of 1 tract file(s) loaded
│  ├──┬──📟post-tracking analysis
│  │  ├──output=<path>/1m0_in_space.tt.gz
│  │  ├──ref=<path>/automated_reg_aparc+aseg.nii.gz
│  │  ├──┬──📂open <path>/automated_reg_aparc+aseg.nii.gz
│  │  │  ├──┬──📂opening <path>/automated_reg_aparc+aseg.nii.gz
│  │  │  │  ├──slice dim: 260 311 260
│  │  │  │  ├──slice vs: 0.7 0.7 0.7
│  │  │  │  ├──slice trans: -0.7 -0 0 90; 0 -0.7 0 91; 0 -0 0.7 -72; 0 0 0 1;
│  │  │  │  └──⏱202ms
│  │  │  ├──add new slices: automated_reg_aparc+aseg
│  │  │  ├──dimension: 260 311 260
│  │  │  ├──'reg' found in the file name. no registration applied.
│  │  │  └──⏱211ms
│  │  ├──💾save tracts to <path>/1m0_in_space.tt.gz
│  │  ├──dim:260 311 260
│  │  ├──vs:0.7 0.7 0.7
│  │  ├──trans:-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──┬──💾saving
│  │  │  ├──┬──📟compressing trajectories
│  │  │  │  └──⏱17ms
│  │  │  └──⏱389ms
│  │  └──⏱707ms
│  └──⏱1.787s
└──⏱1.787s

However, where the input is merged tracts (using --ana previously), the --ref is no longer recognised.

Example - first I create a second trk, then merge with the one from above, then attempt to put the merged tracts into ref space:
reece@Legion-Laptop:~$ /usr/local/dsi-studio/dsi_studio --action=trk --source=<path>/Diffusion/automated.fib.gz --thread_count=1 --method=1 --fa_threshold=0 --step_size=0.5 --turning_angle=60 --smoothing=0 --min_length=10 --max_length=300 --check_ending=1 --tip_iteration=16 --tract_count=100000 --output=<path>/Diffusion/L_1m0_thread1.tt.gz --seed=<path>/dti_lh_precentral_paracentral.mask.nii.gz --end=<path>/dti_lh_precentral_paracentral.mask.nii.gz --end2=<path>/dti_lh_precentral_paracentral.mask.nii.gz --random_seed=191664965
DSI Studio version: Hou "" Sep 17 2025
action=trk
├──CUDA Driver Version: 12080 CUDA Run Time Version: 11080
│  ├──device count: 1
│  ├──device number: 0
│  ├──arch: 120
│  ├──device name: NVIDIA GeForce RTX 5070 Laptop GPU
│  ├──memory clock rate (KHz): 12001000
│  ├──memory bus width (bits): 128
│  ├──peak memory bandwidth (GB/s): 384.032
CPU/GPU computation enabled
┌──📟command line
├──thread_count=1
├──source=<path>/Diffusion/automated.fib.gz
├──┬──📟run
│  ├──┬──📂opening <path>/Diffusion/automated.fib.gz
│  │  ├──fib_ver: 0
│  │  ├──dim: 145 174 145 vs: 1.25 1.25 1.25
│  │  ├──trans: -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──is qsdr: no
│  │  ├──mask created from the images
│  │  ├──mask voxels: 936256
│  │  ├──┬──📟loading image volumes
│  │  │  └──⏱142ms
│  │  ├──matched template: "human"
│  │  └──⏱898ms
│  ├──┬──📟tracking parameters:
│  │  ├──otsu_threshold=0.6
│  │  ├──fa_threshold=0
│  │  ├──dt_threshold=0
│  │  ├──turning_angle=60
│  │  ├──step_size=0.5
│  │  ├──smoothing=0
│  │  ├──min_length=10
│  │  ├──max_length=300
│  │  ├──track_voxel_ratio=2
│  │  ├──random_seed=191664965
│  │  ├──method=1
│  │  ├──check_ending=1
│  │  ├──tip_iteration=16
│  │  ├──tract_count=100000
│  │  └──⏱5ms
│  ├──┬──📟setting up regions
│  │  ├──end=<path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──load volume from <path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──┬──📂opening file
│  │  │  ├──dti_lh_precentral_paracentral loaded as single ROI file
│  │  │  ├──FIB file size: 145 174 145 vs: 1.25 1.25 1.25  not mni space
│  │  │  ├──dti_lh_precentral_paracentral size: 145 174 145 vs: 1.25 1.25 1.25  not mni space (if mni space, add '.mni.' in file name)
│  │  │  └──⏱60ms
│  │  ├──An ending region was placed at <path>/dti_lh_precentral_paracentral.mask.nii.gz (99,89,90).
│  │  ├──end2=<path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──load volume from <path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──┬──📂opening file
│  │  │  ├──dti_lh_precentral_paracentral loaded as single ROI file
│  │  │  ├──FIB file size: 145 174 145 vs: 1.25 1.25 1.25  not mni space
│  │  │  ├──dti_lh_precentral_paracentral size: 145 174 145 vs: 1.25 1.25 1.25  not mni space (if mni space, add '.mni.' in file name)
│  │  │  └──⏱48ms
│  │  ├──An ending region was placed at <path>/dti_lh_precentral_paracentral.mask.nii.gz (99,89,90).
│  │  ├──seed=<path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──load volume from <path>/dti_lh_precentral_paracentral.mask.nii.gz
│  │  ├──┬──📂opening file
│  │  │  ├──dti_lh_precentral_paracentral loaded as single ROI file
│  │  │  ├──FIB file size: 145 174 145 vs: 1.25 1.25 1.25  not mni space
│  │  │  ├──dti_lh_precentral_paracentral size: 145 174 145 vs: 1.25 1.25 1.25  not mni space (if mni space, add '.mni.' in file name)
│  │  │  └──⏱48ms
│  │  ├──A seeding region was placed at <path>/dti_lh_precentral_paracentral.mask.nii.gz (99,89,90).
│  │  └──⏱165ms
│  ├──┬──📟fiber tracking
│  │  └──⏱10.63s
│  ├──1999 tracts removed by trimming.
│  ├──tract count after trimming: 98001
│  ├──98001 tracts are generated using 2801520 seeds.
│  ├──┬──📟post-tracking analysis
│  │  ├──output=<path>/Diffusion/L_1m0_thread1.tt.gz
│  │  ├──💾save tracts to <path>/Diffusion/L_1m0_thread1.tt.gz
│  │  ├──dim:145 174 145
│  │  ├──vs:1.25 1.25 1.25
│  │  ├──trans:-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──┬──💾saving
│  │  │  ├──┬──📟compressing trajectories
│  │  │  │  └──⏱76ms
│  │  │  └──⏱526ms
│  │  └──⏱526ms
│  └──⏱13.053s
└──⏱13.053s
reece@Legion-Laptop:~$ /usr/local/dsi-studio/dsi_studio --action=ana --source=<path>/Diffusion/automated.fib.gz --tract=<path>/Diffusion/L_1m0_thread0.tt.gz,<path>/Diffusion/L_1m0_thread1.tt.gz --output=<path>/Diffusion/1m0_threadAll.tt.gz
DSI Studio version: Hou "" Sep 17 2025
action=ana
├──CUDA Driver Version: 12080 CUDA Run Time Version: 11080
│  ├──device count: 1
│  ├──device number: 0
│  ├──arch: 120
│  ├──device name: NVIDIA GeForce RTX 5070 Laptop GPU
│  ├──memory clock rate (KHz): 12001000
│  ├──memory bus width (bits): 128
│  ├──peak memory bandwidth (GB/s): 384.032
CPU/GPU computation enabled
┌──📟command line
├──thread_count=32
├──source=<path>/Diffusion/automated.fib.gz
├──┬──📟run
│  ├──┬──📂opening <path>/Diffusion/automated.fib.gz
│  │  ├──fib_ver: 0
│  │  ├──dim: 145 174 145 vs: 1.25 1.25 1.25
│  │  ├──trans: -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──is qsdr: no
│  │  ├──mask created from the images
│  │  ├──mask voxels: 936256
│  │  ├──┬──📟loading image volumes
│  │  │  └──⏱150ms
│  │  ├──matched template: "human"
│  │  └──⏱929ms
│  ├──tract=<path>/Diffusion/L_1m0_thread0.tt.gz,<path>/Diffusion/L_1m0_thread1.tt.gz
│  ├──┬──📂opening L_1m0_thread0.tt.gz
│  │  └──⏱77ms
│  ├──host space (native): -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──tractography space (native):
│  ├──-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──A total of 97889 tracks loaded
│  ├──┬──📂opening L_1m0_thread1.tt.gz
│  │  └──⏱63ms
│  ├──host space (native): -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──tractography space (native):
│  ├──-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──A total of 98001 tracks loaded
│  ├──a total of 2 tract file(s) loaded
│  ├──output=<path>/Diffusion/1m0_threadAll.tt.gz
│  ├──💾saving multiple tracts into one file: <path>/Diffusion/1m0_threadAll.tt.gz
│  ├──┬──💾saving
│  │  ├──┬──💾saving
│  │  │  ├──┬──📟compressing trajectories
│  │  │  │  └──⏱36ms
│  │  │  └──⏱929ms
│  │  └──⏱930ms
│  └──⏱2.077s
└──⏱2.078s
reece@Legion-Laptop:~$ /usr/local/dsi-studio/dsi_studio --action=ana --source=<path>/Diffusion/automated.fib.gz --tract=<path>/Diffusion/1m0_threadAll.tt.gz --ref=<path>/automated_reg_aparc+aseg.nii.gz --output=<path>/Diffusion/1m0_threadAll_in_space.tt.gz
DSI Studio version: Hou "" Sep 17 2025
action=ana
├──CUDA Driver Version: 12080 CUDA Run Time Version: 11080
│  ├──device count: 1
│  ├──device number: 0
│  ├──arch: 120
│  ├──device name: NVIDIA GeForce RTX 5070 Laptop GPU
│  ├──memory clock rate (KHz): 12001000
│  ├──memory bus width (bits): 128
│  ├──peak memory bandwidth (GB/s): 384.032
CPU/GPU computation enabled
┌──📟command line
├──thread_count=32
├──source=<path>/Diffusion/automated.fib.gz
├──┬──📟run
│  ├──┬──📂opening <path>/Diffusion/automated.fib.gz
│  │  ├──fib_ver: 0
│  │  ├──dim: 145 174 145 vs: 1.25 1.25 1.25
│  │  ├──trans: -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──is qsdr: no
│  │  ├──mask created from the images
│  │  ├──mask voxels: 936256
│  │  ├──┬──📟loading image volumes
│  │  │  └──⏱146ms
│  │  ├──matched template: "human"
│  │  └──⏱911ms
│  ├──tract=<path>/Diffusion/1m0_threadAll.tt.gz
│  ├──┬──📂opening 1m0_threadAll.tt.gz
│  │  └──⏱138ms
│  ├──cluster information loaded
│  ├──host space (native): -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──tractography space (native):
│  ├──-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──A total of 195890 tracks loaded
│  ├──a total of 1 tract file(s) loaded
│  ├──loading cluster information
│  ├──cluster count: 2
│  ├──output=<path>/Diffusion/1m0_threadAll_in_space.tt.gz
│  ├──💾saving multiple tracts into one file: <path>/Diffusion/1m0_threadAll_in_space.tt.gz
│  ├──┬──💾saving
│  │  ├──┬──💾saving
│  │  │  ├──┬──📟compressing trajectories
│  │  │  │  └──⏱45ms
│  │  │  └──⏱936ms
│  │  └──⏱939ms
│  └──⏱2.079s
└──⏱2.079s
❗--ref is not used/recognized. Did you mean --ter ?


Proposed solution: - I have been unable to find a quick fix. I have tried use --action=vis, but my slice is aparc+aseg (and the --cmd is incompatible with "+" and such characters cannot be escaped. Could you consider allowing URL encoding parameters? Possible feature enhancement.

2) Cannot use --action=ana to create  .trk files

A smaller issue, but one I thought I'd raise.

Example - attempting to reformat tt.gz -> .trk
Note no "saving" output seen in CLI.
reece@Legion-Laptop:~$ /usr/local/dsi-studio/dsi_studio --action=ana --source=<path>/automated.fib.gz --tract=<path>/L_1m0.tt.gz --output=<path>/1m0_.trk
DSI Studio version: Hou "" Sep 17 2025
action=ana
├──CUDA Driver Version: 12080 CUDA Run Time Version: 11080
│  ├──device count: 1
│  ├──device number: 0
│  ├──arch: 120
│  ├──device name: NVIDIA GeForce RTX 5070 Laptop GPU
│  ├──memory clock rate (KHz): 12001000
│  ├──memory bus width (bits): 128
│  ├──peak memory bandwidth (GB/s): 384.032
CPU/GPU computation enabled
┌──📟command line
├──thread_count=32
├──source=<path>/automated.fib.gz
├──┬──📟run
│  ├──┬──📂opening <path>/automated.fib.gz
│  │  ├──fib_ver: 0
│  │  ├──dim: 145 174 145 vs: 1.25 1.25 1.25
│  │  ├──trans: -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──is qsdr: no
│  │  ├──mask created from the images
│  │  ├──mask voxels: 936256
│  │  ├──┬──📟loading image volumes
│  │  │  └──⏱146ms
│  │  ├──matched template: "human"
│  │  └──⏱906ms
│  ├──tract=<path>/L_1m0.tt.gz
│  ├──┬──📂opening L_1m0.tt.gz
│  │  └──⏱9ms
│  ├──cluster information loaded
│  ├──host space (native): -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──tractography space (native):
│  ├──-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──A total of 14177 tracks loaded
│  ├──a total of 1 tract file(s) loaded
│  ├──loading cluster information
│  ├──cluster count: 30
│  ├──output=<path>/1m0_.trk
│  └──⏱971ms
└──⏱971ms
Proposed solution: I note that this command works fine if I create .trk.gz. Hence, a quick workaround is tt.gz -> .trk.gz then simply unzipping. Alternatively, dropping support for .trk completely and getting users to decompress.

I'll continue testing the new version as able and will report any further bugs I find.

Many thanks,
Reece

Frank Yeh

unread,
Sep 17, 2025, 10:19:12 AM (8 days ago) Sep 17
to reece...@gmail.com, DSI Studio
The cause of the issues is that those tractography files are "multiple cluster files", and not single cluster files. The function you need is inside the "post-tracking routine", which assumes a single cluster file, thus having this issue.

I modified DSI Studio to handle this problem. If you specify --merge_all, then DSI Studio will merge all clusters into one and trigger the post-tracking routine.

The new build will be ready in one hour.

Best,
Frank

--
You received this message because you are subscribed to the Google Groups "DSI Studio" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dsi-studio+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dsi-studio/fab1e83e-aefd-4d94-869a-7c4857bc742dn%40googlegroups.com.

Reece Hill

unread,
Sep 17, 2025, 2:09:10 PM (8 days ago) Sep 17
to DSI Studio
Thanks, Frank.

New build is not working as expected. Looks like it merged the clusters into one, adds this to the cluster list, then does not remove the old clusters. Subsequently, number of clusters is not one.

Console:
reece@Legion-Laptop:~$ /usr/local/dsi-studio/dsi_studio
--action=ana
--source=<path>/Diffusion/automated.fib.gz
--tract=<path>/Diffusion/L_1m0.tt.gz
--merge_all
--output=<path>/Diffusion/L_1m_all_merged.tt.gz

DSI Studio version: Hou "" Sep 17 2025
action=ana
├──CUDA Driver Version: 12080 CUDA Run Time Version: 11080
│  ├──device count: 1
│  ├──device number: 0
│  ├──arch: 120
│  ├──device name: NVIDIA GeForce RTX 5070 Laptop GPU
│  ├──memory clock rate (KHz): 12001000
│  ├──memory bus width (bits): 128
│  ├──peak memory bandwidth (GB/s): 384.032
CPU/GPU computation enabled
┌──📟command line
├──thread_count=32
├──source=<path>/Diffusion/automated.fib.gz
├──┬──📟run
│  ├──┬──📂opening <path>/Diffusion/automated.fib.gz
│  │  ├──fib_ver: 0
│  │  ├──dim: 145 174 145 vs: 1.25 1.25 1.25
│  │  ├──trans: -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  │  ├──is qsdr: no
│  │  ├──mask created from the images
│  │  ├──mask voxels: 936256
│  │  ├──┬──📟loading image volumes
│  │  │  └──⏱159ms
│  │  ├──matched template: "human"
│  │  └──⏱959ms
│  ├──tract=<path>/Diffusion/L_1m0.tt.gz
│  ├──┬──📂opening L_1m0.tt.gz
│  │  └──⏱13ms
│  ├──cluster information loaded
│  ├──host space (native): -1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──tractography space (native):
│  ├──-1.25 0 0 180; 0 -1.25 0 216.25; 0 0 1.25 0; 0 0 0 1;
│  ├──A total of 27953 tracks loaded
│  ├──a total of 1 tract file(s) loaded
│  ├──loading cluster information
│  ├──cluster count: 30
│  ├──merging all tract clusters into a single one
│  ├──multiple cluster tracts found. only --output, --connectivity, and --export are supported and cannot use other post-tracking routines.
│  ├──To use other post-tracking routines, please specify --merge_all to merge all clusters into one single cluster.
│  ├──output=<path>/Diffusion/L_1m_all_merged.tt.gz
│  ├──💾saving multiple tracts into one file: <path>/Diffusion/L_1m_all_merged.tt.gz
│  ├──┬──💾saving
│  │  ├──┬──💾saving
│  │  │  ├──┬──📟compressing trajectories
│  │  │  │  └──⏱9ms
│  │  │  └──⏱193ms
│  │  └──⏱194ms
│  └──⏱1.233s
└──⏱1.233s

Then, I get --ref errors as before on the *_merged file. Viewing it in GUI shows the attached (multiple clusters).
Screenshot 2025-09-17 164916.png

Thanks

Frank Yeh

unread,
Sep 17, 2025, 2:14:15 PM (8 days ago) Sep 17
to reece...@gmail.com, DSI Studio
Thanks for testing this out and reporting the bug (my bad).
I committed another fix, and the new build will be ready soon. (30 min for Ubuntu, 1 hour for Windows, 3~4 hours for Macs).
Frank

Reece Hill

unread,
Sep 18, 2025, 7:40:26 AM (7 days ago) Sep 18
to DSI Studio
Hi again Frank,

Thanks for fixing the above. I've continued testing --ref with ana.

I'm noticing that Hou versus Chen versions seem to yield different registrations. Has something changed? Unsure if this is a bug or just change in implementation. I think I have isolated the differences to --ref with ana (skip ahead to Step 4).

To reproduce, I've provided the 7 steps I use to visualise the data in Chen and Hou versions. This is for HCP data, for the same subject.


1) Run --action=trk Y times (thread=1) for X runs.
✅ Works fine across both versions, with some changes (shown below).
dsi-studio/dsi_studio \
    --action=trk \
    --source=<path>/Diffusion/automated.fib.gz \
    --thread_count=1 \
    --method=1 \
    --fa_threshold=0 \
    --step_size=0.5 \
    --turning_angle=60 \
    --smoothing=0 \
    --min_length=10 \
    --max_length=300 \
    --check_ending=1 \
    --tip_iteration=16 \
    --threshold_index=qa \
    --output=<path>/Diffusion/L_1m<X>_thread<Y>.trk \ # ⚠️ Hou version uses .tt.gz not .trk
    --fiber_count=10000 \ # ⚠️ Hou version uses tract_count
    --seed_count=1000000000000.0 \ # ⚠️ Omitted in Hou version.
    --seed=<path>/dti_lh_precentral_paracentral.mask.nii.gz \
    --end=<path>/dti_lh_precentral_paracentral.mask.nii.gz \
    --end2=<path>/dti_lh_precentral_paracentral.mask.nii.gz \
    --random_seed=<fix seed>


2) Merge <Y> runs into a singular file for each run.
✅ Works fine across both versions, with some changes (shown below).
dsi-studio/dsi_studio \
    --action=ana \
    --source=<path>/Diffusion/automated.fib.gz \
    --tract=<path>/Diffusion/L_1m<X>_thread<1>.trk,...,<path>/Diffusion/L_1m0_thread<Y>.trk \ ⚠️ Hou version uses .tt.gz not .trk
    --output=<path>/Diffusion/L_1m<X>.trk \ ⚠️ Hou version uses .tt.gz not .trk
--merge_all \ # ⚠️ Added only for Hou version.


3) Merge all runs into a final, singular file. Export metric alongside.
✅ Works fine across both versions, with some changes (shown below).
The outputs, when loaded into FreeSurfer, appear to be in similar spatial locations, accepting for differences in seed etc. (The output actually looks a lot cleaner in Hou, nice!)
Note: for visualisation of Hou in FreeSurfer I convert .tt.gz to .trk
dsi-studio/dsi_studio \
    --action=ana \
    --source=<path>/Diffusion/automated.fib.gz \
    --tract=<path>/Diffusion/L_1m<1>.trk,...,<path>/Diffusion/L_1m<X>.trk \ ⚠️ Hou version uses .tt.gz not .trk
    --output=<path>/Diffusion/L_1m_all.trk \ ⚠️ Hou version uses .tt.gz not .trk
    --export=qa \
--merge_all \ # ⚠️ Added only for Hou version.

4) Now, move all tracks into space of aparc+aseg (diffusion data is registered to aparc+aseg) - overwriting pre-existing .trk/.tt.gz files.
❓Probable cause of divergence between versions.
When the .trk is visualised in Freesurfer, neither version is in register with aparc+aseg. Corrections are implemented for visualisations (steps 5+) - these work for Chen version. However, because Chen and Hou are not in register with each other, such corrections are ineffective for Hou.
dsi-studio/dsi_studio \
    --action=ana \
    --source=<path>/Diffusion/automated.fib.gz \
    --tract=<path>/Diffusion/L_1m_all.trk \ ⚠️ Hou version uses .tt.gz not .trk
    --ref=<path>/automated_reg_aparc+aseg.nii.gz \
    --output=<path>/Diffusion/L_1m_all.trk \ ⚠️ Hou version uses .tt.gz not .trk
    --other_slices=<path>/automated_reg_T1w_acpc_dc_restore_brain.nii.gz \
--merge_all \ # ⚠️ Added only for Hou version.



5) Additionally, export tracks as a nifti image to allow for visualisation in FreeSurfer/FSLeyes.
‼️The output 1m_all.nii.gz files vary in registration between Chen and Hou versions. 
Neither version yield a 1m_all.nii.gz that aligns with aparc+aseg.nii.gz, but Chen and Hou yield different registrations anyhow.
dsi-studio/dsi_studio \
    --action=ana \
    --source=<path>/Diffusion/automated.fib.gz \
    --tract=<path>/Diffusion/1m_all.trk \
    --output=<path>/Diffusion/1m_all.nii.gz \ ⚠️ Hou version omits .nii.gz suffix.
    --trk_format=nii.gz \ ⚠️ Added only for Hou version.


6) Override the geometry of the DSI Studio's Nifti file to match that of the reference image. (Uses FSL)
fslcpgeom \
    <path>/automated_reg_aparc+aseg.nii.gz \
    <path>/Diffusion/1m_all.nii.gz \
    -d \ # Do not copy dimensions.


7) Flip DSI Studio's nifti image from LPS to LAS (to match aparc+aseg). (Uses Freesurfer).
Chen: ✅ Yields perfect registration between 1m_all.nii.gz and aparc+aseg.nii.gz
Hou: ‼️No registration between the two.
mri_convert \
    --in_orientation \
    LPS \
    --out_orientation \
    LAS \
    -rt \
    nearest \
    <path>/Diffusion/1m_all.nii.gz \
    <path>/Diffusion/1m_all_negy.nii.gz



I've compared the headers of 1m_all.nii.gz of both versions and they appear identical.
I've additionally trialled adding --ref=... when exporting as nifti, but this does not work.

I avoided adding the entire logs in fear of making this post too long. But if helpful, I can add the logs for both versions, just let me know.

Any guidance you can give would be appreciated. 

Kind regards,
Reece

Frank Yeh

unread,
Sep 18, 2025, 8:01:47 AM (7 days ago) Sep 18
to reece...@gmail.com, DSI Studio
Thank you for the detailed information.
I will conduct a code review and fix the issues before getting back to you.
Frank

Reece Hill

unread,
Sep 18, 2025, 9:16:17 AM (7 days ago) Sep 18
to DSI Studio
Thanks, Frank. 

I've tried to inspect the codebase myself but looks like it's come on quite a bit since Chen.

Let me know if I can help your review in any way.

Frank Yeh

unread,
Sep 18, 2025, 9:36:51 AM (7 days ago) Sep 18
to reece...@gmail.com, DSI Studio
Yes, there are tons of differences, and hope to get back to you soon...

Frank Yeh

unread,
Sep 19, 2025, 1:34:14 PM (6 days ago) Sep 19
to reece...@gmail.com, DSI Studio
I did a code review but still cannot identify where the issue is.

Could you load the --ref file in Step T3 and  then load the trk to see if DSI Studio shows correct alignment?

You may send me the files needed to reproduce this issue. This may be easier for us to fix it.
Frank

Reece Hill

unread,
Sep 21, 2025, 10:34:27 AM (4 days ago) Sep 21
to DSI Studio
Thanks, Frank. I appreciate your time. So I managed to find a "workaround" to this problem.

1) I was originally saving into aparc+aseg space, then using this output to export as nii.gz. The nifti was not in aparc+aseg space. Now, I append -ref again when making .nii.gz.

2) I prefer .trk.gz in my pipeline when spatial information is important.
I originally thought .tt.gz was the preferred format (owing to its smaller size), but I wondered if spatial information was not stored in this format. Upon switching to .trk.gz in step 4 (the .gz is crucial), I began to make some progress.

3) Drop "reg" from the filename.
I gave in and allowed DSIStudio to run its registration flow. In Chen versions, I set transforms manually (step 6-7).


New commands:
Replacement Step 4) move all tracks into space of aparc+aseg (diffusion data is registered to aparc+aseg)
/usr/local/dsi-studio-hou/dsi_studio \
    --action=ana \
    --source=<path>/Diffusion/automated.fib.gz \
    --tract=<path>/Diffusion/L_1m_all.tt.gz \
    --output=<path>/Diffusion/L_1m_all_in_slice \ ⚠️ For debugging, we no longer overwrite.
    --other_slices=<path>/Diffusion/automated_reg_T1w_exported_from_fib.nii.gz \ # This can probably be removed.
    --ref=<path>/Diffusion/aparc+aseg.nii.gz \ ⚠️ Drop "reg"
    --merge_all \
    --trk_format=trk.gz ⚠️ Switch from .tt.gz to .trk.gz (this is gunzipped, and endpoints handled by custom code)


Replacement Step 5) export as .nii.gz
/usr/local/dsi-studio-hou/dsi_studio \
    --action=ana \
    --source=<path>/Diffusion/automated.fib.gz \
    --other_slices=<path>/Diffusion/automated_reg_aparc+aseg.nii.gz \ # This can probably be removed.
    --output=<path>/Diffusion/1m_all_in_slice \
    --ref=<path>/Diffusion/aparc+aseg.nii.gz \ ⚠️ Drop "reg"
    --trk_format=nii.gz \
    --merge_all \
    --tract=<path>/Diffusion/*_1m_all.tt.gz ⚠️ The input is NOT from Step 4 any more, but we run registration again.


I subsequently do not run Step 6 or 7 any more.

I've seen the --other_slices parameters and I doubt they're affecting results? I will see about removing these.

Hope that's helpful. Let me know if you need anything further. I'm not sure if the problems with .tt.gz are by intended design, or bug?

Frank Yeh

unread,
Sep 23, 2025, 9:43:49 AM (2 days ago) Sep 23
to reece...@gmail.com, DSI Studio
>
> 2) I prefer .trk.gz in my pipeline when spatial information is important.
> I originally thought .tt.gz was the preferred format (owing to its smaller size), but I wondered if spatial information was not stored in this format. Upon switching to .trk.gz in step 4 (the .gz is crucial), I began to make some progress.

tt.gz also has spatial information. It should provide the same
results, or I will look into the code to fix it.

If there is any command that still does not work as expected, please
feel free to let me know.

Thanks a lot for reporting these issues!

Best regards,
Frank
Reply all
Reply to author
Forward
0 new messages