Wrong CT and T1 alignment shown in GUI

:question: If you have a question or issue with MNE-Python, please include the following info:

  • MNE version: e.g. 1.4.2
  • operating system: e.g. Windows-10-10.0.19045-SP0

Hello,

I just started some iEEG preprocessing and so far the MNE-python tutorial on locating electrodes has been very helpful. The results I got with my own data generally look fine when I followed the steps, except for when I opened the GUI with mne_gui.locate_ieeg(raw.info, subj_trans, CT_aligned, ‘p02’,‘p2’), the 3D plot shows a serious misalignment between the freesurfer reconstructed T1 and the CT scan (in the right lower corner), both of which are supposed to be aligned already.

When I plot CT and MRI individually you can see they are indeed aligned fairly well.

Can people maybe point me to some possible directions? Is it an issue of different RAS system?

Much appreciated for any help!

Mengya

Hi MNE community,

I have excalty the same issue as Mengya.
After following the tutorial Locating intracranial electrode contacts — MNE-GUI-Addons 0.2.0.dev13+g8ae9622 documentation (@alexrockhill @larsoner), the plot of the CT and MRI are well aligned, but when I went to the GUI, there is a strong misalignement.

Any ideas of how to solve this issue would be highly appreciated.

Thank you for your time and consideration,
Camille.

Sorry I missed this before. Sounds like an issue with the coordinate system. It might have been fixed in recent versions though. Could you try with the development version of mne-python and the development version of mne-gui-addons and let me know if there is still a mis-alignment? If so, then I can help look into the coordinate systems. This looks a lot like an issue that was fixed recently and just hasn’t made it to the next release yet.

I looked into it and I was able to replicate the issue for a CT that wasn’t aligned to the MR. That’s very odd when they are aligned, the image spaces should be exactly the same. Ah actually now that I’m writing this, I remembering that freesurfer surface RAS is hardcoded as LIA (left inferior anterior) with the patient head-first supine so if the CT was a different orientation originally, it could cause that sideways brain. This PR I hope should fix the issues although I’m not 100% sure because I don’t have access to the data you are using but it fixes my replication of the issue: [BUG] Fix marching cubes not in the right space when CT is not aligned by alexrockhill · Pull Request #25 · mne-tools/mne-gui-addons · GitHub

1 Like

Could you check if this solves your issue please?

Steps

git clone https://github.com/mne-tools/mne-gui-addons
cd mne-gui-addons
git add alex https://github.com/alexrockhill/mne-gui-addons
git fetch alex
git checkout alex/bug
git checkout -b bug
pip install -e .

Hi Alex,
Thanks for taking a look. I’m away atm so my replies may be slow.

Questions about incorporating the changes you’ve made (I’m a novice when it comes to Github commands):

  1. I run the SEEG preprocessing within a dedicated conda environment, I assume I should run the above steps from within this env?
  2. At step 3 this error occured: fatal: pathspec ‘alex’ did not match any files. Afraid I dont know what to do next.

Thanks again!
Mengya

Hi Alex,

Thank you for your quick answer.

Sorry for the delay, I am not familiar with git, I had to call for help to install the bug fix on my computer.
Now I can confirm that yes, the fix solves the issue! Thank you very much!

Best,
Camille.

1 Like

Ah shoot that was a typo, should have been git remote add alex https://github.com/alexrockhill/mne-gui-addons

It’s merged to the development version so now you can just do $ pip install --upgrade git+https://github.com/mne-tools/mne-gui-addons@main for the working version, you don’t have to do all those git commands.

Happy to report that the new version fixed my problem as well, Cheers!