brainlife / app-tractseg

Brainlife App for MIC-DKFZ/TractSeg. A tool for fast and accurate white matter bundle segmentation from Diffusion MRI using pretrained pytorch ML model.
https://brainlife.io/app/5b82d7f4e2f4f800275e020f
MIT License
2 stars 5 forks source link

Appropriate inputs to TractSeg #7

Closed jlhanson5 closed 1 year ago

jlhanson5 commented 4 years ago

Hello Repo Colleagues,

I had done some test-driving of the TractSeg app and noticed a few issues.

First, the app doesn't reference that inputs to TractSeg should be ACPC aligned (I think other apps, like Classifyber and other apps note that).

Second, I think users should preprocess things before pushing things to TractSeg. From conversations with another brainlife user (Steven Meisler), TractSeg is likely expecting a

Steve similarly suggested:

  1. Make sure your tractseg input (dwi image or peaks image) is correctly oriented to MNI. FSL has a command for this (fslreorient2std). You can also rigidly align using code on the tractseg website as long as you have your FA map calculated.
  2. Generate peaks yourself (e.g. via DIPY or MrTrix) and begin tractseg from there
  3. Download the brainlife tractseg repo and execute it on your computer/HPC, and you can script the process out and introduce a flip_peaks command if needed between steps.

I struggled a long time with troubleshooting, trying various gradient flips and other reorientation stuff, so now that I have it working happy to help if you continue hitting roadblocks! (edited)

I haven't tried to complete Peaks And Metrics dMRI processing, but it isn't clear to me if the compiled TractSeg app actually accepts the "appropriate" inputs? (I think it would be expecting NIFTI files and not a peaks.pam5 file from other brainlife apps). Hopefully, some of these pieces make sense and aid next versions of the app!

All the best, Jamie.

soichih commented 4 years ago

@jlhanson5 If I understand it correctly, TractSeg just wants the input image to be 1) oriented in the fslreorient2std orientation. The README states this

Otherwise you should use fslreorient2std or rigidly register your image to MNI space (the brains do not have to be perfectly aligned but must have the same LEFT/RIGHT orientation).

If the image is too far off from MNI, I believe ACPC aligninig the input image should make it close enough to MNI from TractSeg's point of view. @wasserth Am I correct about this?

I like the idea of feeding preprocessed peak to app-tractseg. @bcmcpher Do you think we can feed the neuro/csd output to TractSeg as "peak" (maybe pick the highest lmax?) Or is it not as simple as that?

For using peak_and_metrics from Dipy App,we just had a converation yesterday with @guaje and @francopestilli about maybe we need a conversion tool from Dipy peaks_and_metrics datatype to brainlife's CSD datatype (or have the Dipy App generate both peaks_and_metrics and neuro/csd datatype .. @skoudoro is that possible to do?)

skoudoro commented 4 years ago

What is the Neuro/csd datatype ?

wasserth commented 4 years ago

ACPC should work as input for TractSeg.

soichih commented 4 years ago

@wasserth Thanks. I've added a note for dwi input

image

@skoudoro Here is the neuro/csd datatype > https://brainlife.io/datatype/5c536bf0f9109beac46adb45 It's basically a list of dwi2fod outputs for various lmax.

jlhanson5 commented 4 years ago

Glad things are moving forward here! FYI-- when I input ACPCed images (aligned via "Register DWI to T1 using Vistasoft"), the results were poor. This was likely b/c it was a DWI image and not a CSD?. But it could be good to think about dealing with that issue as well (I'll see if I replicate the poor quality again).

soichih commented 4 years ago

@jlhanson5 Thank you for trying to replicate the poor quality issue. Please share the process once it's done. I am also curious what the outcome might be if you used mrtrix3-preproc App to register your dwi to t1 (https://brainlife.io/app/5a813e52dc4031003b8b36f9). Maybe you can compare the 2 registration Apps?

jlhanson5 commented 4 years ago

Hello all,

I think the quality was more reasonable in these last few "test drives". Here's a screengrab of the tck file in mrView--

Untitled

One note (and this may be in process) it doesn't look like the csd_msmt_5tt option (to Tractseg with the help/addition of a T1w) was currently possible? I couldn't specify any T1w when I selected that specific option, etc.

Happy this is improving and moving forward! Jamie.

francopestilli commented 4 years ago

@jlhanson5 I think it would be helpful to look at the URL of your process, to look into the fill set of params and data. would that be possible by any chance? CC @soichih

jlhanson5 commented 4 years ago

@francopestilli the app points to this URL-- https://brainlife.io/app/5cc3ccf94ed9df00317f6203 (is that the info you are looking for?). It is Branch 2.1.1-2 and I wondered about selecting the non-default csd option (so that would include a T1-weighted image). Can the csd_msmt_5tt only be run if it is multi-shell data?

francopestilli commented 4 years ago

@jlhanson5 thanks. I was actually wondering if you would be willing to share the url to the process that you saw failing/not working. For example, this is an URL to a process I made: https://brainlife.io/project/5d616f704cfacf00366c11ef/process/5e835f5d3138f7500232d443

giulia-berto commented 1 year ago

Resolved here: https://github.com/brainlife/app-tractseg/pull/15