Skip to content

[RTM] ENH: Nonlinear warp-based susceptibility distortion correct #544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Jun 21, 2017

Conversation

effigies
Copy link
Member

@effigies effigies commented Jun 2, 2017

Closes #496

@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch 3 times, most recently from d640447 to 719ac30 Compare June 2, 2017 15:08
@effigies
Copy link
Member Author

effigies commented Jun 2, 2017

For the distortion atlas, the authors provide an unspecified template (I'll call the distortion template), I would guess a symmetric MNI template. My current strategy for getting a distortion atlas in the EPI ref space is:

  • Find an affine transformation from the distortion template to the template in use by FMRIPREP
  • Apply (distortion template -> template) + inv(T1 -> template) + inv(EPI ref -> T1) to distortion atlas

If we don't think an affine transformation is sufficient to go between templates, then I think it would make more sense to calculate a transform from the T1 to the distortion template and invert that, since we're going to go through the trouble of a nonlinear transform anyway.

Alternately, we can pre-calculate a (distortion template -> template) warp for each template we support.

WDYT?

@chrisgorgo
Copy link
Contributor

chrisgorgo commented Jun 2, 2017 via email

@effigies
Copy link
Member Author

effigies commented Jun 2, 2017

Right, they used that template, but it's not clear if it's a standard template or if they created it from their collection of subjects. Not sure that it makes a difference for our purposes; just noting the situation.

@effigies
Copy link
Member Author

effigies commented Jun 2, 2017

How do I get the phase-encoding direction from the JSON file associated with a BOLD image? Just make sure I have the original filename and replace nii.gz with json? Or does pybids have some relevant magic?

Edit: Found it: bold_file_pe = layout.get_metadata(bold_file)["PhaseEncodingDirection"]

Another thing to consider: This atlas is only valid for anterior/posterior phase-encoding. In the event of an i/i- or k/k- image, we probably wouldn't want to use the atlas...

@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch from 416f4be to 2cbddd8 Compare June 2, 2017 18:29
@chrisgorgo
Copy link
Contributor

There are two things to consider:

  • AFAIK distortions happen in the same place in the brain independently of the phase encoding direction. It only changes which way the tissue will be pulled/pushed. Thus I think we can use this atlas for both i/i- and j/j-
  • most datasets without fieldmaps do not have any phase encoding information. In such cases it is worth assuming that the distortions happen in either i or j (because we already assume k is slice direction). There are two things we could do: 1) restrict ants to two direction - i and j (instead of one) 2) run ants twice once with i and once with j and see which gives better fit with bbregister

@effigies
Copy link
Member Author

effigies commented Jun 2, 2017

  1. I've searched a bit, and can't find any articles that discuss the effect of PE direction on where artifacts occur. Presumably there's some effect, even though the "epicenters" might be consistent. ANTs' smooth deformation constraints may save us here. In either event, we can start from that assumption.

  2. I suppose I'd rather go with the second option in cases where we don't know; that way we're not using an effectively different algorithm when we don't know. In this case, we should verify on datasets where we do know PE direction that our heuristic (e.g. bbregister min cost) selects the true one.

@oesteban
Copy link
Member

oesteban commented Jun 2, 2017

Yes, theoretically the fieldmap is the same regardless the encoding direction. I don't think you'll find a scan with k/-k for PE since that's the B0 direction.

As regards the case of unknown PEs, as @effigies I'd say better going to option 2 (two registration processes). However, it shouldn't be that hard to look at the disagreement map of the T1 mask linearly mapped into EPI space and the EPI mask. Then project to X and Y. The PE axis should show a bimodal distribution in the PE axis and monomodal in the FE axis.

EDIT: maybe it is not that easy :( because in the FE axis it will probably be bimodal as well. We'll need to look at the width of those histograms.

@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch 4 times, most recently from ae3191e to 70db2ab Compare June 5, 2017 20:20
@effigies
Copy link
Member Author

effigies commented Jun 5, 2017

Current status: This performs the warping as expected and generates a report (currently SyN-registered reference EPI to the inverted-T1-in-EPI space).

Still in progress:

  • PE-direction guessing (switching to MapNode, followed by BBR-based assessment, though making sure this works with FLIRT-BBR will be necessary)
  • Atlas-based restriction of SyN warp

@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch 4 times, most recently from 01c1bdd to 1f281ca Compare June 7, 2017 17:16
@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch 9 times, most recently from b758af5 to 909730c Compare June 14, 2017 21:31
@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch from 92d4a2f to 65594fa Compare June 21, 2017 10:50
@effigies
Copy link
Member Author

This is just about ready. I'm going to work on some documentation today and plan to release 0.5.0 by tonight.

@chrisgorgo
Copy link
Contributor

chrisgorgo commented Jun 21, 2017 via email

@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch from 7c6020c to c0cd9b3 Compare June 21, 2017 14:17
@effigies effigies changed the title [WIP] ENH: Nonlinear warp-based susceptibility distortion correct [RTM] ENH: Nonlinear warp-based susceptibility distortion correct Jun 21, 2017
@effigies
Copy link
Member Author

Added to the SDC docs, in the fieldmap estimation section.

It may make sense to move this workflow out of workflows.epi into workflows.fieldmaps, and manage its selection in a similar way to fmap and phdiff, but I don't want to hold this up further right now. That refactorization can come along with stabilizing, after we've had a chance to test the functionality more broadly.

@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch from 7e4fbaa to cf974c2 Compare June 21, 2017 16:01
@effigies effigies force-pushed the enh/sdc_nonlinear_warp branch from cf974c2 to 9c7727a Compare June 21, 2017 16:02
@effigies effigies merged commit 4d47457 into nipreps:master Jun 21, 2017
@effigies effigies deleted the enh/sdc_nonlinear_warp branch June 21, 2017 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants