[MRG][ENH]: Add Ability to export STC files as GIFTI#12309
[MRG][ENH]: Add Ability to export STC files as GIFTI#12309larsoner merged 30 commits intomne-tools:mainfrom
Conversation
|
It is indeed probably long overdue to add something like this. We already have |
|
Thanks @larsoner - I've updated the PR to move functionality to source_estimate. I went with |
This one? https://mne.tools/stable/development/contributing.html It's linked in the left sidebar of the page you mentioned. |
|
Thanks @drammock - not sure why I was laser focused on the in-line link in the text! Will check it out. |
|
ah, oops, now I see the inline one is 404; will fix that. Thanks for letting us know. |
…xportstc_gifti
…t it existing since 1.0
|
Getting stuck on how to generate documentation explicitly. I copied as closely as I could to |
|
Can you go to https://app.circleci.com/pipelines/github/mne-tools/mne-python/22368/workflows/bd8128a6-9584-4d03-b606-810945e4c228/jobs/62531 and register/log in? Then CircleCI will build the doc and you can see how it looks |
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
version add Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
|
@larsoner Thanks for all the input on the PR! Getting a "block-unregistered-user" from that link after registering. Just a sanity check, do I need to be added to an authorized user list? |
|
That's odd, seems like it should work. I'll push a commit to get it to run and fix the merge conflict |
* upstream/main: MAINT: Use towncrier for release notes (mne-tools#12299) MAINT: More [ci skip] MAINT: Add bot entry [ci skip] BUG: handle temporal discontinuities in Neuralynx `.ncs` files (mne-tools#12279) MAINT: Work around bad SciPy nightly wheels (mne-tools#12317)
|
FYI I'd recommend running |
|
Thanks @larsoner! I'll do that. I may make documenting all of these things part of my next PR to flush out the contribution docs so I don't forget! |
|
Think we're ready. I could futz with it more to clean up some things but this is a win pre-holidays! |
drammock
left a comment
There was a problem hiding this comment.
nice and clean. +1 for merge (modulo my comments/questions about dtype, which I may be mistaken about).
There is a pip-pre error here (looks like NumPy changed an error message that broke our warnings filter) that we should address in a separate PR; I'll look tomorrow if @larsoner doesn't beat me to it.
mne/source_estimate.py
Outdated
| data=s["rr"] * scale_rr, | ||
| intent="NIFTI_INTENT_POINTSET", | ||
| datatype="NIFTI_TYPE_FLOAT32", |
There was a problem hiding this comment.
do we need to actually cast the data to float32 here? I read in nibabel docs that they don't actually enforce that the datatype matches the descriptor, but since we can make it match, seems like we should? (I'm assuming internally for us it's float64 right?)
There was a problem hiding this comment.
I'll have to test it. I'm checking against the non-Python GIFTI world since that's my use case. We ran into issues where nilearn was writing float64 NIFTI files and that didn't cooperate well with the AFNI/FSL/SPM/Freesurfer programs. Perhaps we add it as an option to match?
There was a problem hiding this comment.
For now let's just cast to and use float32. We can add float64 later if we really need it but I'd assume YAGNI until someone hits a use case where float32 isn't enough
mne/source_estimate.py
Outdated
| data=s["tris"], | ||
| intent="NIFTI_INTENT_TRIANGLE", | ||
| datatype="NIFTI_TYPE_INT32", |
There was a problem hiding this comment.
similar comment as above about casting (here to int32, not float32)
caps Co-authored-by: Daniel McCloy <dan@mccloy.info>
meth instead of class in diff doc Co-authored-by: Daniel McCloy <dan@mccloy.info>
caps in GIFTI Co-authored-by: Daniel McCloy <dan@mccloy.info>
Repetitive text Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Eric Larson <larson.eric.d@gmail.com> Co-authored-by: Daniel McCloy <dan@mccloy.info>
Reference issue
Fixes #9286
What does this implement/fix?
Add functions under mne.export to handle exporting STC files as GIFTI. Should be easy to also expand from there to handle other surface file types if later desired. Given need to export both an "anatomical" and functional datasets, opted to not include in SourceEstimate / SurfaceEstimate classes and instead do what I felt was a cleaner option.
Additional information
Work in progress. Initial code stable, need to add tests and documentation. Opinions valued. Help of course is welcome!