MASILab / Synb0-DISCO

Distortion correction of diffusion weighted MRI without reverse phase-encoding scans or field-maps
https://my.vanderbilt.edu/masi
57 stars 28 forks source link

Synb0-DISCO topup output changes movement parameters when included in EDDY #63

Open george-gifford opened 2 months ago

george-gifford commented 2 months ago

Hi there,

This may be an EDDY issue rather than Synb0-DISCO issue, but wanted to check whether there would be a Synb-DISCO reason for this.

Including the topup outputs from Synb0-DISCO in EDDY causes the movement parameter estimates to be much higher than if not included. Any suggestions as to why would be much appreciated!

BW, George

george-gifford commented 2 months ago

Hi there,

We've investigated this issue with some of the experts from FSL and have found something potentially problematic.

The synthetic image seems to have been "cut" along a diagonal at the bottom, removing some extra nose/mouth, whereas in the actual b0 there is no corresponding cut.

It may be that when running eddy with topup outputs from synb0 it tries to match the two images, but introduces problematically large warps to remove the differences outside of the brain where the cut-off differs, creating unsually high field values.

Please do let me know if we're missing something here! Otherwise, this might be an issue with synb0.

Example synthetic

synth_b0

and actual b0

actual_b0
schillkg commented 2 months ago

Is this cut the one near the crosshairs at the edge of the field of view? This occurs because the image synthesis takes place in MNI space. When the image is transformed back to native space for popup-processing, anything outside the MNI field of view will be zero-filled.

I have a few questions:

Does this alter the results within the brain itself, or just the estimated field at the edge of the field of view? Would you be able to post a picture of the final topup+eddy-corrected results?

You said this alters motion parameters - do you have plots of the eddy_parameters or similar that you could show?

Has the FSL team provided any suggestions? We run EDDY with a coarse brain mask, so are surprised to see this is altering EDDY results!

Thank you.

george-gifford commented 2 months ago

Thanks for you reply!

I believe the issue only effects voxels outside of the brain but I will check.

Here is a screenshort of the topup+eddy corrected dwi image. It looks good to me!

Screenshot 2024-05-03 at 15 52 56

EDDY QUAD motion parameters without synb0 topup

Screenshot 2024-05-03 at 15 56 17

EDDY QUAD motion parameters with synb0 topup

Screenshot 2024-05-03 at 15 56 51

I'm just asking our FSL experts whether they'd have any recommendations and will get back to you.

BW, George

VosperFlopstop commented 2 months ago

Hi guys,

the field was only affected outside of the brain. If "just" using the field to correct the input image it looks fine. The problem was that the field had very large values ~1000Hz outside of the FOV, and that caused problems when inverting the field inside eddy (eddy jumps back and forth between "unwarped" and "observation" space). It had a very large effect on the EC and movement estimates (they were essentially nonsense).

The mask in eddy is not used to mask estimating the cost-function. It is only used to restrict what voxels are used for estimating the hyperparameters of the Gaussian Process. So the mask doesn't really make a difference.

The way I eventually managed to solve the problem for George was by binarising the synthetic b0 in b0_all, and then multiply b0_all by the resulting binary image. I.e. setting all voxels that are exactly zero in the synthetic b0 to zero also in the "actual" b0. I also used a topup config file that "doesn't try quite as hard". That is that same one I sent a Kurt in the past.

I hope that helps.

Jesper

schillkg commented 2 months ago

Thanks George and Jesper.

I didn't realize that the mask was only for estimating the hyper parameters of the gaussian process. This issue is good to see - we never included anything outside the brain (nor the motion parameters) as part of our QA for this process.

We can implement similar logic within the pipeline to enforce zeros in identical locations of both volumes of b0_all.

For the config: our master branch (and latest containers) now implement the config file you sent us last year. We will aim to update again implementing the masking logic.

Thank you again, Kurt

Kikubernetes commented 2 months ago

Hi there,

I'm very excited to find this thread, because I ran into a similar problem and was about to ask a similar question.

Specifically, I am concerned about the image quality after eddy. The result of synb0 is nice, but topup and eddy using synb0 resulted in a little bit strange image with distortion and high signal that was not there originally. (not only outside the brain,but also inside the brain).

In summary, Jesper's method worked well for some subjects.

But for other subjects, the method seems not enough, so I tried to match the histogram of the images of b0_all.nii.gz. (I used mrhistmatch of Mrtrix3 after Jesper's method. I have pushed the detailed commands to my repository forked from here.)

b0_d_smooth b0_d_smooth0000

b0_u b0_u0000

b1000_notopup 00000

b1000_synb0_nomasking 10000

b1000_synb0_masked masked_only0000

b1000_synb0_masked_histmatched masked_histmached0000

b1000_synb0_masked_histmatched_with_synb0.conf masked_histmached_conf0000

All b1000 images are output of eddy. I like the last or the second last image visually.

My question is as follows:

  1. Is it reasonable to match the histogram of the input images for topup?
  2. I modified synb0.cnf to deal with odd number in image dimension. Specifically, I changed all subsampling level to ones. Is it correct?
  3. Is there anything I can do to improve the result more? Because there are still some artifact in the last image. (Or is it better to give up topup...?)

Any advice would be much appreciated. Thanks in advance!

Kikuko

schillkg commented 2 months ago

Hi Kikuko,

I agree I do not like the middle sets of images - I've never seen that type of contrast - they almost look like image gradients rather than the diffusion weighted images themselves. Does the input to topup look reasonable? It should be the b0_all volume, where the first volume is the distorted image, and the second is the synthesized (undistorted) image. If b0_all looks reasonable, do the topup results look reasonable? This will help narrow down whether it is the synthesis, our application of topup, or eddy that is resulting in this contrast.

I personally would not try histogram matching. These already should have well-matched contrast - in fact, the image synthesis (ideally) not only matches contrast to the b=0 image, but synthesizes images of the contrast the the undistorted imaged should have after geometric and signal intensity corrections. As pointed out above, the issues seem to be happening 'outside' the brain.

Thank you, Kurt

Kikubernetes commented 2 months ago

Hi Kurt,

Thank you for your reply! I double checked the input to topup. AS for "--imain", the first screenshot(distorted) is the first volume of b0_all, and the second one(undistorted) is the second volume.

image

As for "--datain", my phase encoding direction is AP, so acqparams.txt is as follows

0 -1 0 0.0596912
0 1 0 0

It looks reasonable to me, am I missing something?

Thanks for sharing about the histogram too. So the intensity correction is included in the pipeline. But am I correct in assuming that there is at least no problem if I do it additionally?

Kikuko