Skip to main content

MNELayoutPort

Namespace: MNELIB  ·  Library: MNE Library

#include <mne/mne_layout_port.h>

class MNELIB::MNELayoutPort

Single viewport of a plotter layout (one line of an MNE-C .lout file).

Channel names are stored in matching form: lower case, without spaces and without anything after a dash (MNE-C mne_lout_clean_name), so "MEG 0113" and "meg0113" select the same port and a CTF "MLC11-2622" matches "MLC11".

src/examples/ex_mne_api/main.cpp
// The Neuromag Vectorview layout: one viewport per channel
auto layout = MNELayout::read(layoutDir + "/Vectorview-all.lout");
const QMap<QString, QPointF> positions = layout->channelPositions(); // lower-left corners, keyed "MEG 0113"
const int leftHalf = layout->confine(QRectF(QPointF(-85.0, -83.0), QPointF(0.0, 75.0))); // zoom to the left half
const int shownTriplet = layout->matchPorts(QStringList({"MEG0113", "MEG0112", "MEG0111"}));

Public Methods​

contains(channel)​

Returns whether channel (any spelling) is one of the port's channels.

Parameters:

  • channel : const QString & A channel name.

Returns:

  • bool — True if the cleaned name equals one of the port's channel names.

rect()​

Returns the viewport box.

Returns:

  • QRectF — The box from (xmin, ymin) with the port's width and height.

Static Methods​

cleanName(name)​

Returns name in matching form.

Parameters:

  • name : const QString & A channel name.

Returns:

  • QString — The name in lower case, without spaces and cut at the first dash.

Example​

Used in examples​

ex_mne_api​

MNE library: BEM surfaces, surface projection, ICP, source spaces and epochs.

src/examples/ex_mne_api/main.cpp, line 528
// mne.channels.read_layout("Vectorview-all.lout", scale=False): 306 viewports in -85 ... 90 x -83 ... 75, MEG 0113 at (-73.4162, 33.4167); 138 boxes left of x = 0
ok &= expect(layout && layout->ports.size() == 306 && (positions.value("MEG 0113") - QPointF(-73.416206, 33.416687)).manhattanLength() < 1e-4 && leftHalf == 138 && shownTriplet == 3,
"MNELayout/MNELayoutPort: Vectorview layout like mne.channels.read_layout, zoom and channel matching");

Authors of this file​