nipreps / sdcflows

Susceptibility Distortion Correction (SDC) workflows for EPI MR schemes
https://www.nipreps.org/sdcflows
Apache License 2.0
32 stars 26 forks source link

`HCP101006/sub-101006/fmap/sub-101006_dir-LR_epi.json` has wrong sign in PE direction #376

Closed oesteban closed 1 year ago

oesteban commented 1 year ago

What happened?

In debugging #346, I've realized that the test data of (at least) HCP101006 have the PhaseEncodingDirection metadata flipped.

At the very least, HCP101006/sub-101006/fmap/sub-101006_dir-LR_epi.json has 'PhaseEncodingDirection': 'i', when it should have 'i-'.

To assess this, I opened the new data (for which I have no doubts about the sanity of the parameter) and HCP101006/sub-101006/fmap/sub-101006_dir-LR_epi.nii.gz, I disabled world coordinates (i.e., just drops the affine information and plots the data array orientations), and then checked the distortion pattern. The distortion pattern (where the VMPFC and the temporal lobes move) is consistent between the two images.

Further evidence about this is that both images I used to test are LAS-oriented, and both have dir-LR (the direction entity is not very trustworthy in this case because it's not impossible I tinkered with it in the past).

WDYT?

Do I have your thumbs up to modify the examples? @effigies @mgxd

What command did you use?

mango

What version of the software are you running?

latest

How are you running this software?

Docker

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

No response

Additional information / screenshots

No response

oesteban commented 1 year ago

This problem seems to affect HCP101006 only:

$ grep -r --include \*.json '"PhaseEncodingDirection": "i'
ds000206/sub-05/ses-JHU1/anat/sub-05_ses-JHU1_T1w.json:  "PhaseEncodingDirection": "i",
ds000206/sub-05/ses-MGH1/anat/sub-05_ses-MGH1_T1w.json: "PhaseEncodingDirection": "i-",
ds000054/sub-100185/anat/sub-100185_T1w.json:    "PhaseEncodingDirection": "i-", 
ds000054/sub-100185/fmap/sub-100185_phasediff.json:    "PhaseEncodingDirection": "i-", 
ds000054/sub-100185/fmap/sub-100185_magnitude1.json:    "PhaseEncodingDirection": "i-", 
ds000054/sub-100185/fmap/sub-100185_magnitude2.json:    "PhaseEncodingDirection": "i-", 
ds000054/T1w.json:   "PhaseEncodingDirection": "i-", 
ds000054/phasediff.json:   "PhaseEncodingDirection": "i-", 
HCP101006/sub-101006/func/sub-101006_task-rest_dir-LR_bold.json:  "PhaseEncodingDirection": "i-"
HCP101006/sub-101006/func/sub-101006_task-rest_dir-RL_bold.json:  "PhaseEncodingDirection": "i"
HCP101006/sub-101006/fmap/sub-101006_dir-RL_epi.json:  "PhaseEncodingDirection": "i",
HCP101006/sub-101006/fmap/sub-101006_dir-LR_epi.json:  "PhaseEncodingDirection": "i-",
hcph-pilot_fieldmaps/sub-pilot_ses-15_acq-b0_dir-LR_dwi.json:  "PhaseEncodingDirection": "i-",
hcph-pilot_fieldmaps/sub-pilot_ses-15_acq-b0_dir-LR_desc-3dvolreg_dwi.json:  "PhaseEncodingDirection": "i-",
hcph-pilot_fieldmaps/sub-pilot_ses-15_acq-b0_dir-RL_epi.json:  "PhaseEncodingDirection": "i",
ds001771/sub-36/anat/sub-36_T2w.json:  "PhaseEncodingDirection": "i-",
ds001771/sub-36/anat/sub-36_T1w.json:  "PhaseEncodingDirection": "i-",
effigies commented 1 year ago

Do I have your thumbs up to modify the examples?

The images are all LAS. dir-RL have PhaseEncodingDirection of i- (Left-to-Right) and visually inspecting them, they are compressed on the left and stretched on the right, consistent with Left-to-Right.

I think the only thing wrong with the images is that the labels have the directions reversed, and I believe that is because that is how HCP labeled these scans.

effigies commented 1 year ago

Actually, we recently updated this dataset, and left ourselves notes:

The phase-encoding directions in the filenames are inconsistent with the data. All files are LAS-oriented, and files with dir-LR in the data have PhaseEncodingDirection of "i" instead of "i-". Examining the data, the images are right-to-left encoded (that is, there is visible compression on the right hemisphere and spread in the left), so "i" is correct, but LR is misleading. However, LR is how the data are labeled in the original HCP data, so for consistency in identifying original and resulting files, we preserve this mislabeling.

oesteban commented 1 year ago

A worst case scenario would be that the data are flipped and lost sync with the affine, which remained LAS.

That, or heudiconv/dcm2niix is producing the wrong PE for my data.

However, I suspect my data are okay because the field is below zero around the VMPFC, while the corresponding estimation with the phasediff is positive there (which also is what matches my experience).

On Tue, Jul 11, 2023, 20:30 Chris Markiewicz @.***> wrote:

Actually, we recently updated this dataset, and left ourself notes https://github.com/nipreps-data/HCP101006#notes:

The phase-encoding directions in the filenames are inconsistent with the data. All files are LAS-oriented, and files with dir-LR in the data have PhaseEncodingDirection of "i" instead of "i-". Examining the data, the images are right-to-left encoded (that is, there is visible compression on the right hemisphere and spread in the left), so "i" is correct, but LR is misleading. However, LR is how the data are labeled in the original HCP data, so for consistency in identifying original and resulting files, we preserve this mislabeling.

— Reply to this email directly, view it on GitHub https://github.com/nipreps/sdcflows/issues/376#issuecomment-1631298985, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAESDRUG26OGST5N4W7GNXLXPWLU7ANCNFSM6AAAAAA2FS557Q . You are receiving this because you authored the thread.Message ID: @.***>

oesteban commented 1 year ago

BTW, happy to have a quick call tomorrow to screenshare and arrive to a conclusion.

On Tue, Jul 11, 2023, 20:30 Chris Markiewicz @.***> wrote:

Actually, we recently updated this dataset, and left ourself notes https://github.com/nipreps-data/HCP101006#notes:

The phase-encoding directions in the filenames are inconsistent with the data. All files are LAS-oriented, and files with dir-LR in the data have PhaseEncodingDirection of "i" instead of "i-". Examining the data, the images are right-to-left encoded (that is, there is visible compression on the right hemisphere and spread in the left), so "i" is correct, but LR is misleading. However, LR is how the data are labeled in the original HCP data, so for consistency in identifying original and resulting files, we preserve this mislabeling.

— Reply to this email directly, view it on GitHub https://github.com/nipreps/sdcflows/issues/376#issuecomment-1631298985, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAESDRUG26OGST5N4W7GNXLXPWLU7ANCNFSM6AAAAAA2FS557Q . You are receiving this because you authored the thread.Message ID: @.***>

effigies commented 1 year ago

I'm available to chat until 2pm EDT today. @mgxd would probably be good to have you on, as well, if there's a good time.

effigies commented 1 year ago

Just noting result of call: the HCP example data needs PhaseEncodingDirection flipped on all EPI images, including fieldmaps, BOLD and sbref.

oesteban commented 1 year ago

Dataset updated - closing this.