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

update parse_filename evaluated string set (anat, func, dwi) #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fishpm
Copy link

@fishpm fishpm commented Nov 22, 2023

Updated set of evaluated strings via parse_filename for anat, func, and dwi according to BIDS v1.9.0. Other modalities might also need to be updated. Probably a more clever way to encode evaluated string more dynamically?

Updated to reflect allowed entities according to BIDS v1.9.0. Other modalities might also need update. Probably a more clever way to encode allowable entities more dynamically.
@gllmflndn
Copy link
Contributor

Thanks @fishpm! I presume it supersedes your previous PR?

It looks good to me and it seems to also cover @CPernet's other PR.

If @Remi-Gau and @CPernet are OK with it, I'm happy to merge this.

Concerning your last question, the future is to use https://github.com/bids-standard/bids-matlab/.

@Remi-Gau
Copy link

Need to check in detail (can't right now because at a conference) but wait before merging because I think some entities have been added in the wrong place.

@fishpm
Copy link
Author

fishpm commented Nov 22, 2023

Thanks for the quick look. I was looking at the bids documentation (v1.9.0) when adding entities, but would not rule out making an error.

Copy link

@Remi-Gau Remi-Gau left a comment

Choose a reason for hiding this comment

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

a few things to fix that are easy to miss: may usually requires digging into the schema or the appendix or the starter kit to be sure

@@ -504,7 +504,7 @@

%-Diffusion imaging file
%------------------------------------------------------------------
p = parse_filename(f{i}, {'sub','ses','acq','run', 'bval','bvec'});
p = parse_filename(f{i}, {'sub','ses','task','acq','rec','dir','run','part','chunk','bval','bvec'});

Choose a reason for hiding this comment

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

@@ -207,7 +207,7 @@
if isempty(f), f = {}; else f = cellstr(f); end
for i=1:numel(f)

p = parse_filename(f{i}, {'sub','ses','task','acq','rec','fa','echo','inv','run','recording', 'meta'});
p = parse_filename(f{i}, {'sub','ses','task','acq','ce','rec','dir','run','echo','recording','part','chunk','meta'});

Choose a reason for hiding this comment

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

no part, chunk or echo for physio (also note that this assumes that this physio is for func data)

I have set up the starter kit to give you all the BIDS filename templates:

https://bids-standard.github.io/bids-starter-kit/folders_and_files/files.html#func-functional-mri

@@ -192,7 +192,7 @@
if isempty(f), f = {}; else f = cellstr(f); end
for i=1:numel(f)

p = parse_filename(f{i}, {'sub','ses','task','acq','rec','fa','echo','inv','run','recording', 'meta'});
p = parse_filename(f{i}, {'sub','ses','task','acq','ce','rec','dir','run','echo','recording','part','chunk','meta'});

Choose a reason for hiding this comment

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

no part, chunk, echo or recording for events files (also note that this assumes that this is for func data)

https://bids-standard.github.io/bids-starter-kit/folders_and_files/files.html#func-functional-mri

@@ -159,7 +159,7 @@

%-Anatomy imaging data file
%------------------------------------------------------------------
p = parse_filename(f{i}, {'sub','ses','acq','ce','rec','fa','echo','inv','run'});
p = parse_filename(f{i}, {'sub','ses','task','acq','ce','rec','run','echo','part','chunk'});

Choose a reason for hiding this comment

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

@CPernet
Copy link

CPernet commented Dec 14, 2023

it would be more work but better to parse BIDS yaml files to search/filter files - how do we do it bids-matlab? -- There is a parser here

@Remi-Gau
Copy link

bids-matlab has a class to help navigate the json version of the schema that bids-matlab gets shipped with:

https://bids-matlab.readthedocs.io/en/main/schema.html

The names of the methods are bit on the verbose side and the API could probably be improved but easier than browsing the yml files in general.

schema = bids.Schema
suffix_groups = schema.list_suffix_groups('func')
suffix_group_of_interest = suffix_groups.func
entities = schema.return_entities_for_suffix_group(suffix_group_of_interest)

schema = 
  Schema with properties:

                 content: [1×1 struct]
                 verbose: 0
          is_bids_schema: 0
    load_schema_metadata: 0

suffix_groups = 
  struct with fields:

                func: [1×1 struct]
               phase: [1×1 struct]
         events__mri: [1×1 struct]
    timeseries__func: [1×1 struct]

suffix_group_of_interest = 
  struct with fields:

      suffixes: {3×1 cell}
    extensions: {3×1 cell}
     datatypes: {'func'}
      entities: [1×1 struct]

entities =
  1×11 cell array
  Columns 1 through 9
    {'sub'}    {'ses'}    {'task'}    {'acq'}    {'ce'}    {'rec'}    {'dir'}    {'run'}    {'echo'}
  Columns 10 through 11
    {'part'}    {'chunk'}

@CPernet
Copy link

CPernet commented Jan 26, 2024

also now I PR @fishpm to fix PET data (task not mandatory, parse trc, do not parse acq)

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.

4 participants