MRtrix3 / mrtrix3

MRtrix3 provides a set of tools to perform various advanced diffusion MRI analyses, including constrained spherical deconvolution (CSD), probabilistic tractography, track-density imaging, and apparent fibre density
http://www.mrtrix.org
Mozilla Public License 2.0
281 stars 176 forks source link

ENH tckgen: Parallel Transport Tractography implementation #2160

Open Lestropie opened 3 years ago

Lestropie commented 3 years ago

As discussed on forum.

baranaydogan commented 3 years ago

Like you said, this is going to be more than an evening's coding. But it would be good to include at some point. Thank you very much for opening an issue.

Lestropie commented 1 year ago

@baranaydogan: I've not attempted to duplicate your derivation; but intuitively it seems to me that the bottom-right element is missing a brace. Can you confirm? PTT_propagator

baranaydogan commented 1 year ago

You are right. There should be parentheses. Don't hesitate to contact if anything else comes up. I would be happy to help.

Lestropie commented 1 year ago

Initial compiling code in bc928f056f7811f8063af946808e4ae917bda141. Algorithm does something resembling appropriate tractography, but there's clearly something wrong with my interpretation of the linear algebra. Eg. The vertices are not equidistant.

Probably first question is the interpretation of t. Is this supposed to be in the range [0, ..., 1] for each computed segment, or should it contain a distance in mm (given the interpretation of kappa as the reciprocal of minimum radius of curvature in mm).

Beyond that I need to start testing on a basic phantom to try to figure out what's wrong.

baranaydogan commented 1 year ago

Thank you for putting your time in this. Looks great. This week is very busy and I didn't have time to compile and run the code myself. Regarding your question, t is the step size, in mm. I also went through the code and wrote some comments there. I hope they help.

Lestropie commented 1 year ago

Awesome, thanks @baranaydogan. Are you happy for me to add you as co-author on a commit that incorporates your feedback?

baranaydogan commented 1 year ago

Sure, happy to contribute. I will test the code too once I find some time for it, possibly during next week.

Lestropie commented 1 year ago

Can you provide insight into the difference between dt (or equivalently N x dt, where N is the number of samples) and l? For default parameters, l = 1/4 voxel size, but step size is 1/40 voxel size, and N = 4 samples (or N-1 more appropriately) doesn't provide the factor between them.

It seems to me that the intent is for the probe to extend beyond the point that will form the next vertex of the streamline. So for instance, for a voxel size of 1mm for simplicity, and default 4 samples, the probe would sample at [0.0, 0.083, 0.167, 0.25] mm distances from the current vertex, but upon selection of a probe, the next vertex would be generated from the PTF using the selected values of k1 and k2 at a distance of 0.025mm?

baranaydogan commented 1 year ago

That is correct. $l$ is the "probe length" (1/4 voxel size), which we use to find the PTF. But when propagating, we use a much shorter length. We call that the "step size" (1/40 voxel size).

baranaydogan commented 1 year ago

I guess the latest code is in here https://github.com/MRtrix3/mrtrix3/commit/4573f2921fd3683deee5ab5147642c4cb3f03294. But, I believe you are still working on it since it didn't compile in my computer. When you are done, I can check and test the code.

Lestropie commented 1 year ago

Just track the tckgen_ptt branch; latest at time of writing is https://github.com/MRtrix3/mrtrix3/commit/e4a16aeebc2b3cd76d0b265f0a1d98f0c371f840. I haven't made even a draft PR yet because there's still TODOs all over the place, but I can do that if it means getting notifications of changes.