Skip to content
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

Merged
merged 8 commits into from
Mar 29, 2017

Conversation

choldgraf
Copy link
Contributor

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

@@ -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,
Copy link
Member

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,
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:class:

@choldgraf
Copy link
Contributor Author

mmk added reference and made changes etc

@codecov-io
Copy link

codecov-io commented Mar 27, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@3506ebb). Click here to learn what that means.
The diff coverage is 50%.

@@            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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3506ebb...45c1842. Read the comment docs.

# # The click coordinates are stored as a list of tuples
# im = plt.imread('./brain.png')
# click = ClickableImage(im)
# click.plot_clicks()
Copy link
Member

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...

Copy link
Contributor Author

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)
Copy link
Member

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?

@agramfort
Copy link
Member

+1 for MRG when CIs are happy

@choldgraf
Copy link
Contributor Author

any idea why circle just failed?

@larsoner
Copy link
Member

No idea, just restarted it.

@agramfort agramfort merged commit 2aebcc4 into mne-tools:master Mar 29, 2017
@agramfort
Copy link
Member

thx @choldgraf

jona-sassenhagen added a commit to jona-sassenhagen/mne-python that referenced this pull request Mar 29, 2017
…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)
  ...
jona-sassenhagen added a commit to jona-sassenhagen/mne-python that referenced this pull request Mar 29, 2017
* '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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants