bids-matlab icon indicating copy to clipboard operation
bids-matlab copied to clipboard

fmap issue

Open CPernet opened this issue 2 years ago • 15 comments

under demos/fmap_failexemple 3 subjects for which all files do not populate -- have figured why -- note my bad, this includes the 'old' suggested change about the trial type on the face rep data set

CPernet avatar Jan 30 '23 09:01 CPernet

I only see the participants.tsv. Were by any chance the truncated files git ignored?

Remi-Gau avatar Jan 30 '23 10:01 Remi-Gau

You may have to use git add --force given this gitignore

https://github.com/bids-standard/bids-matlab/blob/dev/demos/.gitignore

Remi-Gau avatar Jan 30 '23 10:01 Remi-Gau

OMG - yes, forced add and push, it's finally there

CPernet avatar Jan 30 '23 10:01 CPernet

Will try to documment the debugging in the PR.

dir 'entity' is unknown for several fmaps

>> BIDS = bids.layout(pwd, 'verbose', true, 'use_schema', true)


Indexing dataset:
	/home/remi/github/bids/matlab/demos/fmap_failexemple
 Indexing subject: sub-55809 [.]
 Indexing subject: sub-57460 [.Warning:
Skipping file: sub-57460_ses-1wkfollowup_acq-gre_dir-AP_run-1_magnitude1.nii.gz.
 Unknown entities: 'dir'
Try using the parameter: " 'use_schema', false "

 
> In bids.internal.error_handling (line 57)
  In bids.internal.append_to_layout (line 112)
  In bids.layout>parse_using_schema (line 410)
  In bids.layout>parse_subject (line 351)
  In bids.layout (line 188) 

Remi-Gau avatar Jan 30 '23 15:01 Remi-Gau

According to the spec only pepolar fmap support the dir entity

https://bids-specification.readthedocs.io/en/latest/modality-specific-files/magnetic-resonance-imaging-data.html#types-of-fieldmaps

https://bids-specification.readthedocs.io/en/latest/modality-specific-files/magnetic-resonance-imaging-data.html#case-4-multiple-phase-encoded-directions-pepolar

Remi-Gau avatar Jan 30 '23 15:01 Remi-Gau

Quick work around for now is to ask bids-matlab to index without relying on the schema.

>> BIDS = bids.layout(pwd, 'verbose', true, 'use_schema', false)


Indexing dataset:
	/home/remi/github/bids/matlab/demos/fmap_failexemple
 Indexing subject: sub-55809 [.]
 Indexing subject: sub-57460 [..]
 Indexing subject: sub-57507 [.]

BIDS = 

  struct with fields:

              pth: '/home/remi/github/bids/matlab/demos/fmap_failexemple'
      description: [1×1 struct]
         sessions: {}
     participants: [1×1 struct]
         subjects: [1×4 struct]
             root: [0×0 struct]
    is_datalad_ds: 0



>> bids.query(BIDS, 'data')

ans =

  18×1 cell array

    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-55809/ses-Baseline/fmap/sub-55809_ses-Baseline_acq-se_dir-AP_run-1_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-55809/ses-Baseline/fmap/sub-55809_ses-Baseline_acq-se_dir-PA_run-1_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-AP_run-1_magnitude1.nii.gz'}
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-AP_run-1_magnitude2.nii.gz'}
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-AP_run-1_phasediff.nii.gz' }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-LR_run-1_magnitude1.nii.gz'}
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-LR_run-1_magnitude2.nii.gz'}
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-LR_run-1_phasediff.nii.gz' }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-Baseline/fmap/sub-57460_ses-Baseline_acq-se_dir-AP_run-1_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-Baseline/fmap/sub-57460_ses-Baseline_acq-se_dir-AP_run-2_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-Baseline/fmap/sub-57460_ses-Baseline_acq-se_dir-PA_run-1_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-Baseline/fmap/sub-57460_ses-Baseline_acq-se_dir-PA_run-2_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-AP_run-1_magnitude1.nii.gz'      }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-AP_run-1_magnitude2.nii.gz'      }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-AP_run-1_phasediff.nii.gz'       }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-LR_run-1_magnitude1.nii.gz'      }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-LR_run-1_magnitude2.nii.gz'      }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-LR_run-1_phasediff.nii.gz'       }

Remi-Gau avatar Jan 30 '23 16:01 Remi-Gau

other queries seem to work fine after that.

@CPernet can you cross check that if you do not use the schema, for indexing you can query the files you need?

>> BIDS = bids.layout(pwd, 'verbose', true, 'use_schema', false)


Indexing dataset:
	/home/remi/github/bids/matlab/demos/fmap_failexemple
 Indexing subject: sub-55809 [.]
 Indexing subject: sub-57460 [..]
 Indexing subject: sub-57507 [.]

BIDS = 

  struct with fields:

              pth: '/home/remi/github/bids/matlab/demos/fmap_failexemple'
      description: [1×1 struct]
         sessions: {}
     participants: [1×1 struct]
         subjects: [1×4 struct]
             root: [0×0 struct]
    is_datalad_ds: 0

>> bids.query(BIDS, 'data')

ans =

  18×1 cell array

    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-55809/ses-Baseline/fmap/sub-55809_ses-Baseline_acq-se_dir-AP_run-1_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-55809/ses-Baseline/fmap/sub-55809_ses-Baseline_acq-se_dir-PA_run-1_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-AP_run-1_magnitude1.nii.gz'}
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-AP_run-1_magnitude2.nii.gz'}
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-AP_run-1_phasediff.nii.gz' }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-LR_run-1_magnitude1.nii.gz'}
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-LR_run-1_magnitude2.nii.gz'}
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-1wkfollowup/fmap/sub-57460_ses-1wkfollowup_acq-gre_dir-LR_run-1_phasediff.nii.gz' }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-Baseline/fmap/sub-57460_ses-Baseline_acq-se_dir-AP_run-1_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-Baseline/fmap/sub-57460_ses-Baseline_acq-se_dir-AP_run-2_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-Baseline/fmap/sub-57460_ses-Baseline_acq-se_dir-PA_run-1_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57460/ses-Baseline/fmap/sub-57460_ses-Baseline_acq-se_dir-PA_run-2_epi.nii.gz'              }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-AP_run-1_magnitude1.nii.gz'      }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-AP_run-1_magnitude2.nii.gz'      }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-AP_run-1_phasediff.nii.gz'       }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-LR_run-1_magnitude1.nii.gz'      }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-LR_run-1_magnitude2.nii.gz'      }
    {'/home/remi/github/bids/matlab/demos/fmap_failexemple/sub-57507/ses-Baseline/fmap/sub-57507_ses-Baseline_acq-gre_dir-LR_run-1_phasediff.nii.gz'       }

Remi-Gau avatar Jan 30 '23 16:01 Remi-Gau

If you want to stick to the schema, then this would require updating the spec by adding the dir entity for all fieldmaps.

Remi-Gau avatar Jan 30 '23 16:01 Remi-Gau

might relate to https://github.com/bids-standard/bids-specification/issues/1391

CPernet avatar Jan 30 '23 17:01 CPernet

i see that, although dir- should really be allowed any where, donæt you think

CPernet avatar Jan 30 '23 17:01 CPernet

Let's say I would not be shocked to have it added to many mri datatype instead of letting acq do the heavy lifting.

Remi-Gau avatar Jan 30 '23 17:01 Remi-Gau

Will probably switch this PR to draft until we see things more clearly on this front, it that is ok with you?

Remi-Gau avatar Jan 30 '23 17:01 Remi-Gau

tagged you in the bids validator issue -- the entitiy says you can, and it silly to have acq-se_dir-AP valid but acq-gre_dir-AP invalid

CPernet avatar Jan 30 '23 17:01 CPernet

yes

CPernet avatar Jan 30 '23 17:01 CPernet

not AP-PA field maps are in SPM dev (testing it) so we should add them @gllmflndn

CPernet avatar May 02 '23 14:05 CPernet