update parse_filename evaluated string set (anat, func, dwi)#17
update parse_filename evaluated string set (anat, func, dwi)#17
Conversation
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.
|
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/. |
|
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. |
|
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. |
Remi-Gau
left a comment
There was a problem hiding this comment.
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
| %-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'}); |
There was a problem hiding this comment.
no task in diffusion according to the yml schema:
| 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'}); |
There was a problem hiding this comment.
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
| 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'}); |
There was a problem hiding this comment.
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
| %-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'}); |
There was a problem hiding this comment.
This is missing the entities from quantitative MRI:
- mt
- inv
- flip
https://bids-standard.github.io/bids-starter-kit/folders_and_files/files.html#anat-anatomical-mri
https://bids-specification.readthedocs.io/en/latest/appendices/qmri.html#inputs-are-file-collections
|
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 |
|
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'} |
|
also now I PR @fishpm to fix PET data (task not mandatory, parse trc, do not parse acq) |
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?