Skip to content
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

[ENH] Allow encoding the fieldmapping intent of the protocol #622

Merged
merged 7 commits into from
Apr 28, 2021

Conversation

oesteban
Copy link
Collaborator

@oesteban oesteban commented Sep 28, 2020

This PR addresses the problem @mattcieslak spotted at in #239.

This enhancement (WIP) basically allows for researchers to encode the protocol's intent regarding fieldmaps.

As @satra introduced in #239 (comment), BIDS "could encode intent and automation. Whether it should is a community decision."

This PR proposes a solution to encoding the intent. It doesn't modify anything to allow also encoding automation.

The PR attempts to be backward compatible.

I'm submitting this draft PR to open discussions and looking forward to feedback.

Resolves: #239.
References: #263, nipreps/dmriprep#43, bids-standard/bids-2-devel#39

The gist of this PR...

... is the creation of two new metadata pairs B0FieldIdentifier and B0FieldSource to encode how the researcher originally designed the MR protocol regarding fieldmaps.

B0FieldIdentifier is set in all images that are to be used in estimating some fieldmap. Images with the same B0FieldIdentifier are expected to be used together (e.g., two _epi datasets under fmap/ with opposed PE direction, two _epi datasets under fmap/ plus two _dwi datasets under dwi/, or maybe two _sbref datasets under func/ with opposed PEs, etc.)

B0FieldSource states identifiers intended for correcting the particular instance where it is defined.

Currently unsupported example:

func/
  sub-01_task-rest_bold.json
  sub-01_task-rest_bold.nii.gz
  sub-01_task-rest_dir-ap_sbref.json
  sub-01_task-rest_dir-ap_sbref.nii.gz
  sub-01_task-rest_dir-pa_sbref.json
  sub-01_task-rest_dir-pa_sbref.nii.gz

would have the following metadata:

sub-01_task-rest_bold.json:

{
  "B0FieldSource": "sbrefs_fmap",
  "PhaseEncodingDirection": "j",
  "RepetitionTime": 2.0,
  "TotalReadoutTime": 0.05
}

sub-01_task-rest_dir-ap_sbref.json

{
  "B0FieldIdentifier": "sbrefs_fmap",
  "PhaseEncodingDirection": "j",
  "TotalReadoutTime": 0.05
}

and sub-01_task-rest_dir-pa_sbref.json

{
  "B0FieldIdentifier": "sbrefs_fmap",
  "PhaseEncodingDirection": "j-",
  "TotalReadoutTime": 0.05
}

A currently supported example:

fmap/
  sub-01_phasediff.json
  sub-01_phasediff.nii.gz
  sub-01_magnitude1.nii.gz
func/
  sub-01_task-rest_bold.json
  sub-01_task-rest_bold.nii.gz

would have the following metadata:

sub-01_task-rest_bold.json:

{
  "B0FieldSource": "phdiff_fmap",
  "PhaseEncodingDirection": "j",
  "RepetitionTime": 2.0,
  "TotalReadoutTime": 0.05
}

sub-01_phasediff.json

{
  "B0FieldIdentifier": "phdiff_fmap",
  "EffectiveEchoSpacing": "0.00246",
  "IntendedFor": "func/sub-01_task-rest_bold.nii.gz"
}

@@ -70,8 +70,11 @@ reflected in a single DICOM tag for all possible aforementioned scan
manipulations). See [here](https://lcni.uoregon.edu/kb-articles/kb-0003) and
[here](https://github.com/neurolabusc/dcm_qa/tree/master/In/TotalReadoutTime)

<sup>3</sup>We use the "FSL definition", i.e, the time between the center of the
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was mentioned again under fieldmaps. I've moved that mention (after applying some improvements to the language) over here for completeness.

@@ -104,6 +107,24 @@ Useful for multimodal co-registration with MEG, (S)EEG, TMS, etc.
| ----------------------------- | --------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AnatomicalLandmarkCoordinates | RECOMMENDED | [object][] of [arrays][] | Key:value pairs of any number of additional anatomical landmarks and their coordinates in voxel units (where first voxel has index 0,0,0) relative to the associated anatomical MRI, (e.g. `{"AC": [127,119,149], "PC": [128,93,141], "IH": [131,114,206]}, or {"NAS": [127,213,139], "LPA": [52,113,96], "RPA": [202,113,91]}`). |

### Echo-Planar Imaging & B0 field-mapping
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the core of the proposal

@oesteban oesteban marked this pull request as ready for review September 28, 2020 16:09
@oesteban oesteban requested a review from tsalo September 28, 2020 16:10
oesteban added a commit to oesteban/bids-specification that referenced this pull request Sep 28, 2020
Addresses the use case of DWI sequencies that need to be split in several
runs because, e.g., the scanner would exceed temperature specifications
due to fast gradient-switching.

This PR also refactors the text of DWIs to better accomodate the addition
and make DWIs more consistent with the rest of the file.

The approach to solve this is similar to that of bids-standard#622 for fieldmaps.

References: nipreps/dmriprep#43.
oesteban added a commit to oesteban/bids-specification that referenced this pull request Oct 6, 2020
Addresses the use case of DWI sequencies that need to be split in several
runs because, e.g., the scanner would exceed temperature specifications
due to fast gradient-switching.

This PR also refactors the text of DWIs to better accomodate the addition
and make DWIs more consistent with the rest of the file.

The approach to solve this is similar to that of bids-standard#622 for fieldmaps.

References: nipreps/dmriprep#43.
oesteban added a commit to oesteban/bids-specification that referenced this pull request Oct 12, 2020
Addresses the use case of DWI sequencies that need to be split in several
runs because, e.g., the scanner would exceed temperature specifications
due to fast gradient-switching.

This PR also refactors the text of DWIs to better accomodate the addition
and make DWIs more consistent with the rest of the file.

The approach to solve this is similar to that of bids-standard#622 for fieldmaps.

References: nipreps/dmriprep#43.
@oesteban oesteban force-pushed the enh/fieldmaps-refactor branch 2 times, most recently from 0fcc838 to 953ed10 Compare October 23, 2020 20:02
@oesteban oesteban marked this pull request as draft October 23, 2020 20:08
@oesteban
Copy link
Collaborator Author

@effigies
Copy link
Collaborator

  • I think the BIDS standard should be internally consistent. The draft for direct field mapping introduces the field Units, but BEP009 uses Unit for the same DICOM field. @effigies perhaps you have thoughts on this.

Good catch. It looks like Units in fieldmaps pre-dates Unit, and we haven't released PET, so we have a chance to fix without breaking backwards compatiblity.

@oesteban
Copy link
Collaborator Author

Are any code owners willing to leave a green tick to get this merged? We will need two more (and/or give Matt rights, how does that process work?)

@bids-standard/raw-mri-dwi @bids-standard/raw-mri

@francopestilli
Copy link
Collaborator

Copy link
Member

@tsalo tsalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me.

@tsalo
Copy link
Member

tsalo commented Apr 21, 2021

This PR has the necessary approvals at this point, I think, but since we're in the embargo period before a release, we can't merge this until Friday, at least.

@effigies
Copy link
Collaborator

@oesteban Can you check that merge? I think I may have done it backwards.

@oesteban
Copy link
Collaborator Author

The merge looks good, with the latest additions to master my latest commit was outdated. I quickly checked and I don't see any difference w.r.t. before the merge.

Should I just merge?

@effigies
Copy link
Collaborator

@oesteban I think I restored something you intended to remove. I'm going to re-do the merge.

@effigies
Copy link
Collaborator

@effigies effigies merged commit 9748a7c into bids-standard:master Apr 28, 2021
@oesteban oesteban deleted the enh/fieldmaps-refactor branch April 28, 2021 15:32
tsalo added a commit to tsalo/bids-specification that referenced this pull request Apr 30, 2021
sappelhoff pushed a commit that referenced this pull request Jul 20, 2021
* Draft schema for suffixes.

* Delete Untitled.ipynb

* Clean up suffixes from Anatomical MRI's first table.

* Add second table from Anatomical MRI.

* Add third table from Anatomical MRI.

* Add first table from Task imaging data

* Add DWI and B0 field map suffixes.

* Add anatomical qMRI table suffixes

* Add field map qMRI table suffixes

* Add ASL suffixes.

* Add MEG suffixes.

* Add EEG suffixes.

* Add remaining suffixes.

* Fix T1map.

* Add make_suffix_table.

* Add angio to first suffix table.

* Add suffix info to README.

* Add descriptions for remaining suffixes.

* Update fieldmap suffix definition from #622.

* Fix bad merge.

* Use three underscores, not two.

* Apply suggestions from code review

Co-authored-by: Chris Markiewicz <effigies@gmail.com>

* Further address review.

* Apply suggestions from code review

Co-authored-by: Chris Markiewicz <effigies@gmail.com>

* Remove hardcoded tables.

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
@sappelhoff sappelhoff modified the milestones: 1.6.1, 1.7.0 Nov 9, 2021
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.

[ENH] Allow images in dwi and func to have an IntendedFor field in their json sidecar
10 participants