layerfMRI/LAYNII

Add gradient magnitude computation program LN2_GRAMAG

ofgulban opened this issue · 2 comments

It is currently becoming more and more handy to have a fast / ram efficient gradient magnitude computation. I should translate the gradient magnitude methods from https://github.com/ofgulban/segmentator to LayNii.

  • Add gradient magnitude without RAM inflation (do not hold gradient images, directly compute gradient magnitude per voxel). Important for e.g. whole brain 0.1 mm human brain images.
  • Add circular difference option for phase images (-pi to pi range).

I should add a circular difference option to compute gradients on phase images (e.g. -pi to pi).

Circular difference option added

See the images below for the difference between normal gradient magnitude and "circular" gradient magnitude outputs:

  • Upper left is a phase image.
  • Upper right is "normal" gradient magnitude.
  • Lower left if circular gradient magnitude.
  • Colormaps are equal between gradient magnitude images.
  • Incorrectly inflated differences around phase wraps are visible in the "normal" gradient magnitude image (upper right).

Simulated phase data results:

Screenshot 2023-02-16 at 23 53 55

Empirical phase data results:

Screenshot 2023-02-16 at 23 52 57