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

B0FieldSource as a list #228

Closed mateuszpawlik closed 8 months ago

mateuszpawlik commented 8 months ago

Describe the bug If multiple fieldmaps are used for one functional image, the B0FieldSource should be a list. We're having trouble to compose that list in the mapping file. We used the yaml syntax but it seems not to work.

The log of bidscoiner doesn't have any entry for B0FieldSource under functional files.

To reproduce Use something like this in the mapping file

B0FieldSource: 
  - magnetude1
  - magnetude2
  - phasediff

Expected behavior B0FieldSource key with JSON array is added to the functional json files.

Software version

marcelzwiers commented 8 months ago

I'm not sure if I understand the problem, as the BIDS specification defines just a single tag, not a list, right? So

B0FieldSource: 
  - tag1
  - tag2
  - tag3

should be converted to

B0FieldSource: tag1tag2tag3

???

marcelzwiers commented 8 months ago

B0FieldIdentifier | RECOMMENDED | string or array of strings

Aha, I didn't know this, I'll see what I can do

mateuszpawlik commented 8 months ago

BIDS specification says that it's a string or an array of strings. I don't really know how tools should use it, but with IntendedFor we can say that we use three fieldmaps for one functional image.

marcelzwiers commented 8 months ago

I guess you can pass a list like this?

B0FieldSource: [magnetude1, magnetude2, phasediff]
mateuszpawlik commented 8 months ago

Should be fine but it shouldn't matter both forms are correct syntax.

marcelzwiers commented 8 months ago

Yes I know, but I mean that's how you can pass it in the bidseditor?

mateuszpawlik commented 8 months ago

Ah, I'm not using the BIDS editor :see_no_evil: But if I did, I'd be fine with the compact syntax.

marcelzwiers commented 8 months ago

I just tested it and, except for the <<session>> value, it worked just fine? In the template I did:

    meta: &fmap_meta
      B0FieldIdentifier: [tag1, <<session>>tag2]

And then I got this in the json sidecar file:

    "B0FieldIdentifier": [
        "tag1",
        "<<session>>tag2"
    ]
mateuszpawlik commented 8 months ago

Looks fine to me. I can try to test more next week (with the <<session>> tag) as we're planning to upgrade to BIDScoin 4.3.0 and test some mappings.

marcelzwiers commented 8 months ago

Actually, entering [tag1, <<session>>tag2] in the bidseditor is interpreted as a string, so that doesn't work (but then <<session>> does), giving for sub-001_ses-01_acq-fieldmap2p4iso_magnitude1.json:

    "B0FieldIdentifier": "[tag1, 01tag2]"
marcelzwiers commented 8 months ago

NB: passing ["tag1", '<<session>>tag2'] in the bidseditor correctly (besides <<session>>) gives:

    "B0FieldIdentifier": [
        "tag1",
        "<<session>>tag2"
    ]
marcelzwiers commented 8 months ago

Please reopen if things are not working for you