-
Notifications
You must be signed in to change notification settings - Fork 35
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 B0fieldIdentifier/Source when having multiple fieldmap runs #198
Comments
I guess there is no timeline for this feature? |
It will probably be in the next release, but I don't know when that will be. I also haven't thought very much about the best approach to solve this issue |
The new |
So just to be clear, for a template bidsmap with
For the fieldmaps this is straightforward to implement (just increment the tag), but unfortunately it is not so easy for the functional scans... |
I'm no expert but this is how I understand the BIDS specification. When you assign the |
That is not possible, because the semantics that |
I implemented this feature in the latest commit. Since you are the main user and presumably have a real-life case at hand, could you perhaps test it out to see if it does what you want? For usage see: https://bidscoin.readthedocs.io/en/latest/bidsmap.html#fieldmaps-b0fieldidentifier-b0fieldsource |
I'll try to do some testing today. If I remember correctly, our problem was triggered by multiple fieldmaps in a single session (interrupted session). We used |
I tried with some generated data and the newest version on master branch:
My template bidsmapOptions:
bidscoin:
version: 4.3.1
bidsignore: [extra_data/]
subprefix: sub-
sesprefix: ses-
unknowntypes: [extra_data]
ignoretypes: [exclude]
unzip:
plugins:
dcm2niix2bids:
command: dcm2niix
args: -b y -z n -i n
anon: n
meta: [.json, .tsv, .tsv.gz]
DICOM:
subject: <<filepath:/sub-(.*?)/>>
session: <<filepath:/sub-.*?/ses-(.*?)/>>
func:
- provenance:
attributes:
SeriesDescription: (?i)^func.*
bids:
suffix: bold
run: <<>>
task: rest
meta:
TaskName: rest
B0FieldSource:
- magnitude1_<<session:[0:]>>
- magnitude2_<<session:[0:]>>
- phasediff_<<session:[0:]>>
fmap:
- provenance:
attributes: &fmap_dicomattr
ImageType:
SeriesDescription:
EchoNumbers:
bids: &fmap_bidsattr
suffix: magnitude1
run: <<>>
meta: &fmap_metaattr
IntendedFor: <<task:[0:]>>
B0FieldIdentifier: magnitude1_<<session:[0:]>>
- provenance:
attributes:
<<: *fmap_dicomattr
SeriesDescription: (?i)^fmap.*
ImageType: .*'M'.*
bids:
<<: *fmap_bidsattr
suffix: magnitude2 # Due to magnitude1 and magnitude2 images in the same series (Siemens). dcm2niix will deal with it correctly.
meta:
<<: *fmap_metaattr
B0FieldIdentifier: magnitude2_<<session:[0:]>>
- provenance:
attributes:
<<: *fmap_dicomattr
SeriesDescription: (?i)^fmap.*
ImageType: '[''ORIGINAL'', ''PRIMARY'', ''P'', ''ND'']'
bids:
<<: *fmap_bidsattr
suffix: phasediff
meta:
<<: *fmap_metaattr
B0FieldIdentifier: phasediff_<<session:[0:]>> The limits of bidscoin/bidscoin/bidscoiner.py Line 449 in 2a0dd3a
For example, for A question about the result of
It also seems I have a problem with our magnitude fmaps being in one sequence. I don't know how to get different identifiers for them. But that's most probably not related. Please let me know what I can do. |
Ai, that's a bummer. In the new code, I treat IntendeFor and the B0Field tags more or less in the same way. Is the IntendedFor still working for you? One (rare) omission is that B0FieldIdentifiers outside the fmap folder are missed (I'll add a warning for this). You say you have generated data that can produce this issue, can you share it with me? That helps me tremendously! |
You want to give them different tags, so that suggests you mean that you have magnitude images from two fieldmaps in one folder? I have never seen that (and I'm pretty sure Siemens would never do that), shouldn't they have different SeriesNumbers? If the two magnitude images in the same folder are from the same fieldmap, then you want to use the same tag, no? |
This should not happen and looks like a bug
Yes, for e.g. |
Or this is perhaps because the acquisition times in the DICOM header are not increasing with SeriesNumber? |
B0FieldSource:
- magnitude1_<<session:[0:]>>
- magnitude2_<<session:[0:]>>
- phasediff_<<session:[0:]>> Oh wait, it can be a list of course, I keep forgetting that p.s. A list is indeed valid according to the specifications but why do you do this instead of just using a single tag (which is how I think you should use the B0Field tags)? A single B0FieldIdentifier tag groups all files of one fieldmap (mag1, mag2 and phasediff).
|
… that list of strings are currently not supported (Github issue #198)
Bounding terms for lists of B0FieldIdentifiers are much harder to support and I suspect it is going to be very very uncommon that users may want to use lists of tags here at all (I think you are using b0 field tags in a wrong way). I may add support for bounded B0FieldIdentifier lists in the future, but for now, I clarified the docs about this limitation |
…dIdentifier (Github issue #198)
Yes. For example: "B0FieldIdentifier": "magnitude2_<<ses1_1>>",
"IntendedFor": [
"bids::sub-001/ses-1/func/sub-001_ses-1_task-rest_run-1_bold.nii"
]
I don't understand. Isn't it the case, that only the fmaps that need the
Here's the DICOMs: b0_test_dicoms.zip I used my DICOm generator 😉 |
Our Siemens scanner generates one sequence (same series number) for both magnitude1 and magnitude2 (and one sequence for phasediff). dcm2niix and BIDScoin handle the magnitude maps correctly if I assign I'll reply to the B0 identifier with another comment. As you wrote later, I most probably didn't understand it exactly. |
In the resulting json files I see increasing ds.AcquisitionDate = datetime.today().strftime('%Y%m%d')
ds.AcquisitionTime = datetime.today().strftime('%H%M%S.%f') |
I missed that part. Thanks. I thought all identifiers must be unique. I'll fix that on my side. I've also found a PR with similar explanation bids-standard/bids-specification#622 |
Do you mean the lists of identifiers in |
Well, if for example you acquire the same amount of normal and of inverted dwi scans, you want to put both scans in the dwi folder, right? So the dwi scans are both data and fieldmap at the same time |
Yes, that's what I mean, on our scanners it is the same |
Another question. Are |
Yes, indeed, I mean a list of B0FieldIdentifier tags. And the PR link you gave indicates that there are scenarios where one could think about using B0FieldIedntifiers lists, but it is very rare I think. For now I leave such scenarios unsupported (I will deal with it when someone asks for it, altough with the latest commits I already prepared the code a bit for such support) |
Yes, they are not allowed in the BIDS filenames, but I wouldn't know why they wouldn't be allowed inside a file (such as in the sidecar files) |
I've just tested 84be28f and it seems to works as expected. One of my users said that the generated identifier string could be nicer 😉, for example instead of |
Great, I really appreciate you tested this
Yeah, I don't like it that much either, and in my initial implementation I didn't have the |
Btw, in the latest version you can also switch trackusage on or off by setting the environment variable |
Do you mean to switch it off when testing things? I can do that. We are in the process of converting historical data and we execute BIDScoin (bidsmapper and bidscoiner) once for each subject session. That means hundreds of executions on real data. Should I suspend it there too?
I don't know what else I could test, so it's fine for me to close it. |
Thanks!
No, I consider that to be real usage
Great, I will then update a few read-the-docs files and publish the new release today or tomorrow :-) |
@marcelzwiers I've just converted some data without the fmap runs and got |
When sessions are interrupted, typically a new fieldmap is acquired. The IntendedFor dynamic value can already limit it's search scope to adjacent runs. The B0FieldIdentifier/Source pairs should get the same possibility (either from within bidscoin or as a post-processing tool), e.g. by adding a run-suffix to the B0Field tags
The text was updated successfully, but these errors were encountered: