MRG, ENH: Create a tutorial for how to find intracranial electrode contacts from a CT and an MR image#9484
Conversation
|
@alexrockhill feel free to ping me when I should look |
|
Just a WIP so far but probably tomorrow |
|
Ok @larsoner, if you have time to review once the artifact renders, this is a good first draft. It does look like the SDR does a better job with the morph than the Talairach: |
|
The references won't work until #9480 merges though.... |
|
Uh oh I think the SDR takes longer than 10 minutes... not sure how to fix that |
|
I'm not sure what the latest error was but maybe rebasing will take care of it. I still think it's probably related to execution time. I'll look in the SDR tests for source space to see if there's a way to do things faster... |
|
Ok so still failing with the weird error. I'm going to try profiling the code but the SDR function and maybe the affine registrations too might need to be added to misc data so that they can just be loaded instead of computed. |
I have no idea what this error means, if anyone had a chance to give it a look that would be appreciated. |
|
Ok, I know it's not rendering but it does run locally and it would be great to get a review of the content @larsoner if you have a minute. Here is the |
|
Hmmm so there's an issue that the |
|
Is it expected to work? If so, might be worth opening an issue on dipy, they might know a workaround We could add another dependency if histogram registration is expected to work on most cases |
I don't think so, I don't think Dipy has any reason to use or have tested anything using CT images. The Nipy histogram registration is written in cython so that would be a bit harder to reimplement, but I could give it a try and see how slow it is in pure python... |
|
So this last version has all the parts working but there is some confusion converting between nibabel and nipy image objects that is not ideal. This adds a nipy dependency but I'm not sure how else to register the CT to the MR. I think I'm going to start on the GUI next week and we can continue to iterate on this. |
update version fixed the transform, the issue was units added myself as author, probably good for answering questions since I collected the data fix detrend issue so many ways to format notes had to move note finally fixed the note and fixed in the other ieeg example too more specific extra space fix note in ECoG working on ieeg contact localization tutorial
|
Ok, I think that addressed all your comments @larsoner, I think the changes from your commit caused a few tests to fail though... |
|
Once mne-tools/mne-misc-data#6 merges, we should be good to go. |
larsoner
left a comment
There was a problem hiding this comment.
Great progress! I think working on this example is useful for seeing what actually needs to be done to make this work, thanks for sticking with it. The align_volumes seems like the simplest solution I can think of, but if you see problems with it maybe we should have a quick chat tomorrow.
Also if you are sick of iterating on this and want to move onto GUI I can try implementing my suggested changes locally. I can also fix the tests I broke if it would help.
If you wouldn't mind fixing the tests you broke, I'm not exactly sure what you were doing there. You're welcome to make some changes if you'd like, I stopped working on it today. |
|
I won't get to it until tomorrow morning EDT but I'll push something then after pulling your latest changes |
Thanks for all the help! Sounds good, I think what needs to happen is that the tests need to be fixed and if you want to refactor the SDR morph you could do that but I might save it for a followup PR as it's going to affect the other SDR tests. |
|
Ok, I'm happy to keep iterating if you have a chance to look at it tomorrow @larsoner but this looks like a viable tutorial to me |
|
Thanks @alexrockhill ! |
| sphinx_copybutton | ||
| https://github.com/mne-tools/mne-bids/archive/main.zip | ||
| pyxdf | ||
| nipy |
There was a problem hiding this comment.
We probably don't need this


Addresses part of #9155.
This is a tutorial for how to:
img_pipeone)fsaverageusing DipyThis prepares you to start the working with SEEG and working with ECoG tutorials which require you to already have electrode positions in MNI space before starting but don't explain how you find them.