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
295 stars 182 forks source link

GLM: Fixing race condition in Z-transform #2868

Open Lestropie opened 8 months ago

Lestropie commented 8 months ago

Branching train of thought from #2857 as much of the discussion there relates specifically to the std::lgamma() function, whereas the generation of lookup tables for computing Z-scores is an issue in its own right.

From specifically the latest comment, I'm considering point 5: doing an up-front generation of the necessary lookup tables before multi-threaded processing, such that those tables can be shared across threads as const.

I also think that the heteroscedastic case may require different handling. I need to do some testing to confirm, but I suspect that the Welch-Satterthwaite degrees of freedom are regularly going to not attain precise floating-point equivalence, and therefore generating lookup tables for specific values doesn't make sense. It probably needs a 2D lookup table.

So my current logic is:

Lestropie commented 8 months ago
Lestropie commented 8 months ago

Also of note: If utilisation of std::lgamma() is fixed in #2857, could comment MRTRIX_USE_ZSTATISTIC_LOOKUP on dev until there's greater confidence in operation of the lookup tables from here.