aestrivex / ielu

grids and strips electrode localization utility
GNU General Public License v3.0
10 stars 7 forks source link

ENH: Plot all grid / strip electrodes on the CT brain #3

Open choldgraf opened 8 years ago

choldgraf commented 8 years ago

It would be really useful to have a plot similar to the current 3D MRI plots, but for the 2D locations on the brain. (like the plot that comes up when you select "manually modify electrode position", but where it shows all electrodes for a grid rather than just one). Most ecog people I know wouldn't trust an automatic electrode extraction algorithm without looking at the raw positions chosen on the CT brain.

E.g., I've found that the extraction algorithm often misses the centroid of electrodes by 5-10 pixels on a slice. In this case because it's actually 2 electrodes next to each other: image

Alternatively, if you could quickly choose an electrode in the list, and have its position pop up in the CT, then this would be useful as well. That way, you could quickly scroll through the electrodes and make sure each one was positioned correctly. As it is now, clicking "manually modify electrode position" will bring up a new window every time.

aestrivex commented 8 years ago

The way I usually deal with this situation in practice is by opening the CT window, clicking on the "correct" electrode centers rather than the one in the middle as shown there, and adding "new electrode here". Then I deselect the other one and add the new ones in its place.

If I'm really concerned the positions aren't right I click on the electrodes in the CT in sequence and do "track cursor". It's not easy to make track cursor go faster than it does currently because of some issues with memory management in mayavi.

All of the tools for dealing with this are pretty much things that exist already in the CT window. The enhancements you suggested to do it better are reasonable, however they are UI improvements over something that already exists and I will probably be a bit slow about addressing them.

choldgraf commented 8 years ago

Ah, I didn't realize that you could do this with the CT view. Probably something that documentation can fix. If it was clear in the instructions, then I think that it wouldn't be necessary to do a UI overhaul.

FWIW, this would be much easier to use if it would display a point where each electrode was, so that you could tell what was there and what wasn't.

aestrivex commented 8 years ago

image

Hitting track cursor shows this slightly larger white dot where the cursor was indicated.

It wouldn't be that difficult to add multiple tracked points. It also wouldn't be that difficult to add a bunch of pins (but the tracked points would be easier to navigate since the pins are represented in 2D, currently you have to scroll to somewhere near the correct slice for the pin to show up).

choldgraf commented 8 years ago

Sounds like track cursor would be useful in this situation. Right now, I can only click "track cursor" once, and it shows the white sphere where the cursor was when I clicked the button. However, if I re-click anywhere on the CT then the position doesn't update. Is this a bug or just where this function is at right now?

aestrivex commented 8 years ago

You have to click "track cursor" again at the new location for it to update. There's only one cursor currently.

choldgraf commented 8 years ago

Ah ok - in that case, is it possible for the update to occur without re-drawing the whole MRI? Right now every time I click "track cursor" it zooms out and repositions the MR at the center of the screen. So if I click a new spot on the CT, I also have to then zoom back in, and rotate the brain to the view I had before.

aestrivex commented 8 years ago

It's not as straightforward as it might seem. There's a memory issue with adding and removing dots because of some bugs in mayavi that are very hard to trace (but its easy to clear the memory by rebuilding the scene).

It would probably be possible now that I think of it to just update the cursor's position as long as there is only one cursor and it is going to stay in the image for a while. If there are many dots, its harder to keep track of them all internally. To avoid memory leakage, the scene should be rebuilt whenever any dots are removed.

choldgraf commented 8 years ago

Ah that makes sense - maybe it wouldn't be such a big deal once the bug is fixed so that it will highlight in white a highlighted electrode. 3D plotting is always a PITA :)