Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Calculate average DKI measures per tract

102 views
Skip to first unread message

Nelson Descalço

unread,
Feb 2, 2024, 2:43:19 PM2/2/24
to DSI Studio
Hi,

I have done tractography in DSI and exported mean DTI values for each tract. However, I also have multishell acquisitions and I have calculated kurtosis maps per subject elsewhere. I would like to obtain average 'mean kurtosis', 'axial kurtosis' and 'radial kurtosis' per tract determined in DSI.
Is that possible? How can I do it?

Best,
Nelson

Frank Yeh

unread,
Feb 2, 2024, 7:10:36 PM2/2/24
to ndes...@gmail.com, DSI Studio
In GUI, add DKI nifti file using  [Slices][Insert other images]
In CLI, specify --t1t2=DKI.nii.gz


--
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 on the web visit https://groups.google.com/d/msgid/dsi-studio/d661aab9-b642-46b1-abce-b11564559968n%40googlegroups.com.

Nelson Descalço

unread,
Apr 26, 2024, 7:23:02 AM4/26/24
to DSI Studio
Hi Frank, I wanted to get back to you on this because I am not able to use the option --t1t2 as you suggested. Can you provide the full command in the CLI to add nifti files to the tractogram?
Thanks

Nelson Descalço

unread,
Apr 26, 2024, 7:27:56 AM4/26/24
to DSI Studio
Just to be more specific - I would like to upload this 'DKI map' (obtained elsewhere) into DSI and then get for all tracts generated from automatic fiber tracking the mean value per tract. Ideally, this would be done in a single command for all tracts during AFT.
Thanks

Frank Yeh

unread,
Apr 26, 2024, 8:43:36 AM4/26/24
to ndes...@gmail.com, DSI Studio
Sorry for the wrong instruction (my apology). It should be --other_slices

One example can be found here: https://dsi-studio.labsolver.org/doc/cli_t3.html
> To view this discussion on the web visit https://groups.google.com/d/msgid/dsi-studio/db1e3384-45ce-4b5e-ad4d-a8c670a62043n%40googlegroups.com.

Nelson Descalço

unread,
Apr 26, 2024, 9:41:53 AM4/26/24
to Frank Yeh, DSI Studio
Thanks, I am using something like:

dsi_studio --action=trk --source=/mnt/data2/nelson/neurocomp_tms/tractography/sub-0126_postms_dwi_tpca_gibbs_topup_eddy.nii.gz.src.gz.gqi.1.25.fib.gz --other_slices=/mnt/data2/nelson/neurocomp_tms/dki_metrics/sub-0126_postms_MK_b0c.nii --output=/mnt/data2/nelson/neurocomp_tms/tractography/Corpus_Callosum_Body/sub-0126_postms_dwi_tpca_gibbs_topup_eddy.Corpus_Callosum_Body.tt.gz --export=stat

I can only do it for one tract at a time, specifying the 'tt.gz' file specific for that tract and subject. Is there a way to update all the tract statistics for all tracts with this new image? And to update the "all_results_subject_wise.txt" file?

Thanks
Nelson

Derek Monroe

unread,
Dec 7, 2024, 8:07:19 AM12/7/24
to DSI Studio
Frank,

Piggy-backing here: Since other_slices is not an option for 'atk', it seems that the recommended solution is to run 'trk' while looping over all track_ids. It works. I can generate statistics for each track (including metrics from my other_slices) this way.

However, it seems an important missing piece--between this approach and 'atk'--is the automated generation of parameter_id on a track-wise basis. The resulting track is naturally much different using 'trk' without these tuned parameters. For example, a volume of 5792 mm^3 for CingulumR with 'trk' and 10357 mm^3 with 'atk'. 

Are the track-wise parameter id's stored in a list somewhere like the track ids are? <https://github.com/frankyeh/data-atlas/blob/main/ICBM152_adult/ICBM152_adult.tt.gz.txt

Or would it be a straightforward edit to add the 'other_slices' flag to 'atk'?

Thanks!
-dcm

Frank Yeh

unread,
Dec 7, 2024, 8:22:05 AM12/7/24
to dcmo...@unc.edu, DSI Studio
Good point.
I am going to add other_slices to atk.
Hope to get it ready in days and notify here.
Frank

Frank Yeh

unread,
Dec 25, 2024, 3:56:49 AM12/25/24
to dcmo...@unc.edu, DSI Studio
I checked the code.

Atk runs with multiple fib files at once and it cannot work with a single "other slices" (each fib should have its own matching slices).

A quick solution is to use atk to generate tract first.

Then use --action=ana to loop on each fib with its matching slices to extract the values.

Hope this helps
Frank


Derek Monroe

unread,
Jan 7, 2025, 2:48:03 PMJan 7
to DSI Studio
Frank,

Sorry for the delayed response. Thanks for checking the code--this affirmed the approach I was taking. 

Something curious though that I have not been able to sort:
  1. When running --action=ana, I could not run -connectivity and --other_slices in the same command without generating this error:  Segmentation fault (core dumped)
  2. It does not seem to be a traditional memory availability error in that memory usage as tracked by SLURM is not surpassing the job allotment. 
  3. So, I split the commands and ran -connectivity and --other_slices in separate calls to the container. --other_slices was still generating that error. 
  4. So I split that command further, running a loop such that each tract is being fed into --action=ana (...) --other_slices one at a time rather than as a comma separated list. This works except for 
    ProjectionBrainstem_MedialLemniscus{L/R}.  These generate the Segmentation fault (core dumped) error and an empty tt.gz.stat.txt file for 164 of the possible 200 MedialLemniscus tracts among the HCPYA Unrelated 100. 

Maybe I'm missing something obvious w.r.t. to the anatomy of this tract or nuances related to HCPYA acquisition/preprocessing... 

Let me know if you need further information to debug. I'm running 'Hou Nov 28 2024' as a singularity container.

Thanks so much,

-Derek

Frank Yeh

unread,
Jan 7, 2025, 9:56:31 PMJan 7
to dcmo...@unc.edu, DSI Studio

  1. When running --action=ana, I could not run -connectivity and --other_slices in the same command without generating this error:  Segmentation fault (core dumped)
Sorry about the bug.

Could you post the complete command you used and the log out before the crash?



Derek Monroe

unread,
Jan 9, 2025, 3:18:17 PMJan 9
to DSI Studio
Frank,

Thanks for the assistance! Here is the complete command and the output is attached:

singularity exec \

--bind ${WRKDIR}:${WRKDIR} \

--workdir ${WRKDIR}:dsistudio-working \

${PROJDIR}/dsistudio-120624.sif dsi_studio --action=ana \

--source=${DERIVDIR}/dsistudio/${subject_id}_atk/${subject_id}_space-T1w_desc-preproc.gqi.fz \

--tract=${postracks} \

--connectivity=${DERIVDIR}/dsistudio/${subject_id}_atk/${subject_id}_MMPvol_reduced.nii.gz \

--other_slices="\

${DERIVDIR}/dsistudio/${subject_id}_atk/fit_NDI_reg.nii.gz,\

${DERIVDIR}/dsistudio/${subject_id}_atk/fit_ODI_reg.nii.gz,\

${DERIVDIR}/dsistudio/${subject_id}_atk/mk_reg.nii.gz,\

${DERIVDIR}/dsistudio/${subject_id}_atk/rk_reg.nii.gz,\

${DERIVDIR}/dsistudio/${subject_id}_atk/ak_reg.nii.gz,\

${DERIVDIR}/dsistudio/${subject_id}_atk/fa_reg.nii.gz,\

${DERIVDIR}/dsistudio/${subject_id}_atk/md_reg.nii.gz,\

${DERIVDIR}/dsistudio/${subject_id}_atk/rd_reg.nii.gz" \

--export=stat

dsistudio_ana_error.rtf

Frank Yeh

unread,
Jan 17, 2025, 4:22:34 PMJan 17
to dcmo...@unc.edu, DSI Studio
Hi Derek,

    Today's updated version may have this bug fixed.

    If still doesn't work, please don't hesitate to let me know.

    Thank you very much for reporting the problem.

Best regards,
Frank

Derek Monroe

unread,
Jan 22, 2025, 2:28:54 PMJan 22
to DSI Studio
Frank,

Thanks so much for your assistance with this bug.

Unfortunately, running with version Hou Jan 17 2025 did not fix the issue. The output looks identical and the seg fault occurs at the same step. Additional steps:
  • I also tried working the pipeline from the beginning with the updated container (src -> rec -> atk -> ana).
  • I also updated to Hou Jan 20 2025 and retried. Same result.
Let me know if I can provide further reports/logs. 

-Derek

Frank Yeh

unread,
Jan 22, 2025, 2:32:09 PMJan 22
to dcmo...@unc.edu, DSI Studio
I am very sorry to learn that it didn't work out.

If possible, could you send me the console output or log out before
the crash? (as well as the command used).
I will do my best to tackle the bug again and fix it asap.

Best regards,
Frank

On Wed, Jan 22, 2025 at 2:28 PM 'Derek Monroe' via DSI Studio
> To view this discussion visit https://groups.google.com/d/msgid/dsi-studio/c6ed1b29-9549-40f0-8cc4-e28bdb305d66n%40googlegroups.com.

Derek Monroe

unread,
Jan 22, 2025, 3:17:19 PMJan 22
to DSI Studio
Frank,

At the risk of giving you too much, I've attached the full job script (.sh) demonstrating the entire workflow, the output (.out), and the error log (.err).

Let me know if you have any questions or want me to try/provide anything different to assist in debugging.
Output_57687502_0.out
job_57687502_0.sh
Error_57687502_0.err

Frank Yeh

unread,
Jan 22, 2025, 3:44:17 PMJan 22
to dcmo...@unc.edu, DSI Studio
This is very helpful!
I am checking them and will work on the issue.
Frank

Frank Yeh

unread,
Jan 23, 2025, 3:57:59 PMJan 23
to dcmo...@unc.edu, DSI Studio
I updated DSI Studio again.
Please update and see if it works. If still doesn't work, please don't
hesitate to let me know.
Frank

Derek Monroe

unread,
Jan 25, 2025, 12:29:31 PMJan 25
to DSI Studio
Frank,

Thanks for your continued assistance. Unfortunately, the issue has not resolved with the latest update. 

I also ran all unrelated 100 subjects just to be sure it wasn't something specific to 100307.

Noting for posterity more than anything: It looks like there is still something funky happening when MedialLemniscus{R/L}.tt.gz are being opened in the 'ana' step. All other tracts are recognized as being in native space, but these are being treated as if they were tracked in mni space. 

.out/.err attached in case they are useful.

-Derek

Error_57884808_0.err
Output_57884808_0.out

Frank Yeh

unread,
Jan 26, 2025, 6:36:17 AMJan 26
to dcmo...@unc.edu, DSI Studio
I will work on it.
Mu appreciated for your assistance.
The information is very helpful.

Best regards
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.

Frank Yeh

unread,
Jan 27, 2025, 8:00:46 AMJan 27
to dcmo...@unc.edu, DSI Studio
Thank you again for your patience.
I fixed the bug related to MedialLemniscus, but it is likely that the
crash may be due to other data-specific problems because I could not
reproduce the crash on my data here.

Please give the updated version another try and I would appreciate
sending me the .out file if there is still a crash.
From the message, I may have a better guess of what potential problem is.

Alternatively, if there is a test data set available (.fz, tt.gz,
_MMPvol_reduced.nii.gz, nii in other slice), you may send it to me.
Once I can reproduce the crash on my side, I can trace the bug and fix
it right away.

Sorry for all the hassle, and I really appreciate your help!
Frank
Reply all
Reply to author
Forward
0 new messages