mne.viz.ClickableImage#

class mne.viz.ClickableImage(imdata, **kwargs)[source]#

Display an image so you can click on it and store x/y positions.

Takes as input an image array (can be any array that works with imshow, but will work best with images. Displays the image and lets you click on it. Stores the xy coordinates of each click, so now you can superimpose something on top of it.

Upon clicking, the x/y coordinate of the cursor will be stored in self.coords, which is a list of (x, y) tuples.

Parameters:
imdatandarray

The image that you wish to click on for 2-d points.

**kwargsdict

Keyword arguments. Passed to ax.imshow.

Methods

onclick(event)

Handle Mouse clicks.

plot_clicks(**kwargs)

Plot the x/y positions stored in self.coords.

to_layout(**kwargs)

Turn coordinates into an MNE Layout object.

Notes

New in v0.9.0.

onclick(event)[source]#

Handle Mouse clicks.

Parameters:
eventmatplotlib.backend_bases.Event

The matplotlib object that we use to get x/y position.

plot_clicks(**kwargs)[source]#

Plot the x/y positions stored in self.coords.

Parameters:
**kwargsdict

Arguments are passed to imshow in displaying the bg image.

to_layout(**kwargs)[source]#

Turn coordinates into an MNE Layout object.

Normalizes by the image you used to generate clicks

Parameters:
**kwargsdict

Arguments are passed to generate_2d_layout.

Returns:
layoutinstance of Layout

The layout.

Examples using mne.viz.ClickableImage#

How to convert 3D electrode positions to a 2D image

How to convert 3D electrode positions to a 2D image