-
Notifications
You must be signed in to change notification settings - Fork 28
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
base: main
Are you sure you want to change the base?
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. |
There was a problem hiding this 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'}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no task in diffusion according to the yml schema:
@@ -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'}); |
There was a problem hiding this comment.
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'}); |
There was a problem hiding this comment.
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'}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?