-
Notifications
You must be signed in to change notification settings - Fork 23
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
BIDscoin spec2nii2bids plugin development #62
Comments
Hi @marcelzwiers, This is a very cool tool. I enjoyed your presentation at the MRI Together conference. I'm happy to work to make any interface between spec2nii and BIDscoin work better, and include more options. However, I don't particularly have time right now to put lots of effort in. A couple of other thoughts: |
Hi @wtclarke, Certainly, I can look through the aforementioned plugin to ensure it aligns with the integration of MRS into the BIDS standard. |
That would be great, even if it's not tomorrow :-). One thing that would help the plugin a lot is if spec2nii had a generic interface to read / return a MRS header object, e.g. in a similar fashion as nibabel does ( |
You can't see that from the plugin because BIDS compliance is implemented more centrally using the bids schema files (i.e. this is taken care of by BIDScoin itself, plugins only need to convert the data, ideally with valid json sidecar files). |
I'm not entirely sure what you mean. Are you suggesting such a thing for files once converted to NIfTI(-MRS)? If so there is the Or are you suggesting that there is an interface that uses some heuristics to try and figure out what sort of file it is and then load the data? If so I'm less keen on that because there are so many different types and many need a bit of extra information or guidance from the user. |
The latter, some probing to see what the file format is and then read the header |
Why not give the heuristics a try and give the user the option to skip that by passing the format him/herself (as is done now) |
I could try to make something like |
Ah, I see. That makes things easier, then. I assume BIDScoin is synced with the |
@markmikkelsen Yes, though I review the changes myself before I copy them over to bidscoin (to avoid things breaking on my side), see here: |
@marcelzwiers Got it. I was aware of BIDScoin before, and it's great to see it extended to include MRS data. I'll look through it and the plugin as soon as possible. |
I had a quick go at this, it's now in version 0.6.4 (published imminently). Call |
Wow, that was quick :-). I'll try to update the spec2nii2bids plugin accordingly later this week. To support MRS data format, I could use some suggestions for good header attributes to pick for my template bidsmap. But that will be later |
Is there any spec2nii python module that I could use to read MRS header attributes? |
In the converted files? |
No, the source header(s). I currently use this for Twix (and comparable functions for other formats): from mapvbvd import mapVBVD
twixObj = mapVBVD(twixfile, quiet=True)
if isinstance(twixObj, list):
twixObj = twixObj[mraid - 1]
hdr = twixObj['hdr'] But I rather not do this myself if spec2nii already has functions for it |
I also use: from spec2nii.philips import read_spar
hdr = read_spar(sparfile) But I need to know first what format the file is |
What info are you after? The whole point of spec2nii is that the formats of all these proprietary formats (and the poorly conformed to DICOM standard) are a complete mess. That means the info in the headers is highly variable - from very detailed in twix - to basically absent in the Philips formats. Could you do the conversion first then read from the standardised information? The NIfTI-MRS format has quite a bit in a nifti header extension. |
Or constantly changing in GE |
I do automatic data discovery (source data typing), based on the source data attributes and properties. So I need to read them (preferably in a unified way) |
Then the user can edit the mapping from the source datatypes to the BIDS datatypes, then I do the conversion |
It doesn't matter if the attributes are constantly changing, then I (or the user) only need to adapt some names in the template bidsmap. Moreover, the template bidsmap can (should) contain only the more stable ones |
Ah, got it. Ok, I'll have a think how best to handle this. At the moment spec2nii is completely coded for command line use. Obviously you can call individual functions but there is no coherent API. |
I like how nibabel handles this :-) |
I think that in the problem space of writing code that uses spec2nii to process (external) shared data collections, even when spec2nii is called from a shell, many programmers would like to probe a source file first to see what it is (i.e. read attributes) before converting it with spec2nii. Spec2nii is different from dcm2niix here, because dcm2niix basically only deals with one input format (ok, a bit of old PAR/REC legacy code), and more like nibabel, which deals with many input formats. I assume in your codebase, you converge to a shared code path at some point, so for maintainability, it is also good to have that convergence point as early as possible? |
This is not really an issue but an open invitation for anyone interested in participating in (or taking over if you like) the development of the
spec2nii2bids
plugin inBIDScoin
. This plugin is merely a wrapper aroundspec2nii
, to abstract away the file format specifics for BIDScoin. In this way, MRS data for BIDScoin is like any other data, allowing it to do automatic data discovery and present a GUI to the user for further editing of the BIDS output (if desired).The reason I'm reaching out here is that I myself don't have any experience with / much knowledge about MRS, and I just wrote the plugin to help out with a multi-site project (LEAP) of one of my colleagues. For that, I only implemented support for SPAR, Twix, and Pfile data (i.e. the data formats collected in the project). Of course, it would be nice to extend that to all the formats supported by spec2nii, but I don't have access to nor experience with all those formats.
If you are interested, here's the plugin (adding a data format is very easy):
https://github.com/Donders-Institute/bidscoin/blob/master/bidscoin/plugins/spec2nii2bids.py
And here is the template bidsmap (adding a new data format section here isn't hard, but it contains prior knowledge for all the BIDS data types, so it is a bit long):
https://github.com/Donders-Institute/bidscoin/blob/master/bidscoin/heuristics/bidsmap_dccn.yaml
That's all there is to it. For more info about BIDScoin, see the (latest) docs:
https://bidscoin.readthedocs.io/en/latest/
Cheers,
Marcel
The text was updated successfully, but these errors were encountered: