Donders-Institute / bidscoin

BIDScoin converts your source-level neuroimaging data to BIDS
https://bidscoin.readthedocs.io
GNU General Public License v3.0
130 stars 35 forks source link

/raw is implicitly assumed despite specifying a different source folder #172

Closed themeo closed 1 year ago

themeo commented 1 year ago

Bidscoin implicitly expects that the source files will be contained in the /raw folder. THis is encoded in the default version of the bidsmapper yaml file e.g.

  subject: <<filepath:.*/raw/sub-(.*?)/>> # This filesystem property extracts the subject label from the source directory. NB: Any property or attribute can be used as subject-label, e.g. <PatientID>
  session: <<filepath:.*/raw/ses-(.*?)/>> # This filesystem property extracts the subject label from the source directory. NB: Any property or attribute can be used as session-label, e.g. <StudyID>

This leads to an error when the source directories are placed in another folder. This setting is not overridden by specifying a different (ie not /raw) folder in bidscoiner arguments. This feature is also not prominently mentioned in the docs, so it took me a moment to figure out what is going on.

To me, a more natural behaviour would be to accept whatever directory is provided by the user without any additional assumptions.

marcelzwiers commented 1 year ago

Can you replicate this using the latest (dev) version? Because raw is not in the template bidsmap, but only put there after you gave raw as an input to the bidsmapper... The idea is that the template bidsmap is generic, but the study bidsmap (i.e. after running the bidsmapper) is study specific, hence it is assumed that the source folder is fixed for the study (and should not suddenly change between running the bidsmapper and the bidscoiner). This is the default (the template bidsmap):

subject: <<filepath:/sub-(.*?)/>>   # This filesystem property extracts the subject label from the source directory. NB: Any property or attribute can be used as subject-label, e.g. <PatientID>
session: <<filepath:/sub-.*?/ses-(.*?)/>>   # This filesystem property extracts the subject label from the source directory. NB: Any property or attribute can be used as session-label, e.g. <StudyID>
marcelzwiers commented 1 year ago

If you re-run the bidsmapper from scratch (e.g. by using the -f option), and you give it something else than raw, that something else should appear in the study bidsmap. The reason for adding something like raw to the regular expression is to make the expression more robust for use cases without or with a very short prefix. The latest version, however, now has a --no-update option to skip that and leave the expression as is (see issue #166).

themeo commented 1 year ago

Thanks for the fast reply!

And yes, I did change the directory, I just assumed bidscoin would preserve in .yaml the mapping of filenames/types but not be too attached to directories, or that this could get overridden by specifying the source directory in bidscoiner.

But I can see your reason for doing that this way. In the future, I will simply use the --no-update option, thanks again.