-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
merging clickable image and 2d projection examples #4098
Conversation
@@ -1031,7 +1031,7 @@ def __init__(self, imdata, **kwargs): # noqa: D102 | |||
self.ax = self.fig.add_subplot(111) | |||
self.ymax = self.imdata.shape[0] | |||
self.xmax = self.imdata.shape[1] | |||
self.im = self.ax.imshow(imdata, aspect='auto', | |||
self.im = self.ax.imshow(imdata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it should be aspect='equal'
? Or is that the default?
create scatterplots on top of a brain, with each point representing an | ||
electrode. | ||
|
||
In this example, we'll show two ways of doing this in MNE-python. First, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MNE-Python
if we have the 3D locations of each electrode then we can use Mayavi to | ||
take a snapshot of a view of the brain. If we do not have these 3D locations, | ||
and only have a 2D image of the electrodes on the brain, we can use the | ||
`mne.viz.ClickableImage` class to choose our own electrode positions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:class:
mmk added reference and made changes etc |
Codecov Report
@@ Coverage Diff @@
## master #4098 +/- ##
=========================================
Coverage ? 85.97%
=========================================
Files ? 354
Lines ? 63944
Branches ? 9833
=========================================
Hits ? 54974
Misses ? 6299
Partials ? 2671 Continue to review full report at Codecov.
|
# # The click coordinates are stored as a list of tuples | ||
# im = plt.imread('./brain.png') | ||
# click = ClickableImage(im) | ||
# click.plot_clicks() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to comment out
im = plt.imread('./brain.png')
click = ClickableImage(im)
click.plot_clicks()
but I get
ValueError: not enough values to unpack (expected 2, got 0)
I need I demo I guess...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you not click anywhere on the image? sounds like that might have been the issue. Either way the latest commit adds a check to make sure self.coords
has something in it
|
||
# # Generate a layout from our clicks and normalize by the image | ||
# print('Generating and saving layout...') | ||
# lt = generate_2d_layout(np.vstack(coords), bg_image=im) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the vstack? why not make coord already of the right shape?
+1 for MRG when CIs are happy |
any idea why circle just failed? |
No idea, just restarted it. |
thx @choldgraf |
…mne-python into refactor_xdawn * 'refactor_xdawn' of https://github.com/jona-sassenhagen/mne-python: (366 commits) fix lin reg test Test fixes. (mne-tools#4114) fix test fix test fix test and pep add error checks improve coverage simplify and add test simplify pep8 revert to cholesky default init_t_y [MRG] Optimize read_source_estimate function (mne-tools#4107) merging clickable image and 2d projection examples (mne-tools#4098) [MRG+2] adding receptive field module (mne-tools#3728) FIX: Found another FIX: Fix another FIX: No fname [MRG] Picks argument to layout.plot. (mne-tools#4106) remove transparent background for plot_compare_evoked (mne-tools#4111) ...
* 'master' of git://github.com/mne-tools/mne-python: fix lin reg test Test fixes. (mne-tools#4114) fix test fix test fix test and pep add error checks improve coverage simplify and add test simplify pep8 revert to cholesky default init_t_y [MRG] Optimize read_source_estimate function (mne-tools#4107) merging clickable image and 2d projection examples (mne-tools#4098) [MRG+2] adding receptive field module (mne-tools#3728) FIX: Found another FIX: Fix another
this converts the clickableimage example into a more general example showing how to convert 3D representations of electrodes into 2D, either using the mayavi 2D projection, or manually clicking w/ clickableimage