Skip to main content

SelectionIO

Namespace: UTILSLIB  ·  Library: Utilities Library

#include <utils/selectionio.h>

class UTILSLIB::SelectionIO

Processes selection files (mne .sel) files which contain the channels for each selection group.

Reader/writer for MNE .sel channel-selection files and Brainstorm .mon montage files.

src/examples/ex_utils/main.cpp
QMultiMap<QString, QStringList> selections;
selections.insert("Left-temporal", {"MEG0111", "MEG0112", "MEG0113"});
selections.insert("Vertex", {"MEG0711"});
const QString selPath = dir.filePath("groups.sel");
SelectionIO::writeMNESelFile(selPath, selections);
QMultiMap<QString, QStringList> reread;
SelectionIO::readMNESelFile(selPath, reread);

Public Methods​

SelectionIO()​

Constructs a Filter object.


Static Methods​

readMNESelFile(path, selectionMap)​

Reads the specified MNE sel file.

Parameters:

  • path : QString holds the file path of the .sel file which is to be read.

  • selectionMap : QMultiMap< QString, QStringList > & holds the map to which the read selection groups are stored.

Returns:

  • bool — True on success, false if the path lacks a .sel extension or the file cannot be opened.

readMNESelFile(path, selectionMap)​

Reads the specified MNE sel file.

Parameters:

  • path : const std::string & holds the file path of the .sel file which is to be read.

  • selectionMap : std::multimap< std::string, std::vector< std::string > > & holds the map to which the read selection groups are stored.

Returns:

  • bool — True on success, false if the path lacks a .sel extension or the file cannot be opened.

readBrainstormMonFile(path, selectionMap)​

Reads the specified Brainstorm montage file.

Parameters:

  • path : QString holds the file path of the .mon file which is to be read.

  • selectionMap : QMultiMap< QString, QStringList > & holds the map to which the read selection groups are stored.

Returns:

  • bool — True on success, false if the path lacks a .mon extension or the file cannot be opened.

readBrainstormMonFile(path, selectionMap)​

Reads the specified Brainstorm montage file.

Parameters:

  • path : const std::string & holds the file path of the .mon file which is to be read.

  • selectionMap : std::multimap< std::string, std::vector< std::string > > & holds the map to which the read selection groups are stored.

Returns:

  • bool — True on success, false if the path lacks a .mon extension or the file cannot be opened.

writeMNESelFile(path, selectionMap)​

Writes the specified selection groups to a single MNE .sel file.

Parameters:

  • path : QString holds the file path of the .sel file which is to be read.

  • selectionMap : const QMultiMap< QString, QStringList > & holds the map to which the read selection groups are stored.

Returns:

  • bool — True on success, false if the path lacks a .sel extension or the file cannot be opened for writing.

writeMNESelFile(path, selectionMap)​

Writes the specified selection groups to a single MNE .sel file.

Parameters:

  • path : const std::string & holds the file path of the .sel file which is to be read.

  • selectionMap : const std::map< std::string, std::vector< std::string > > & holds the map to which the read selection groups are stored.

Returns:

  • bool — True on success, false if the path lacks a .sel extension or the file cannot be opened for writing.

writeBrainstormMonFiles(path, selectionMap)​

Writes the specified selection groups to different Brainstorm .mon files.

The amount of written files depend on the number of selection groups in selectionMap

Parameters:

  • path : QString holds the file path of the .mon file which is to be read.

  • selectionMap : const QMultiMap< QString, QStringList > & holds the map to which the read selection groups are stored.

Returns:

  • bool — True if all .mon files were written, false if any file could not be opened for writing.

writeBrainstormMonFiles(path, selectionMap)​

Writes the specified selection groups to different Brainstorm .mon files.

The amount of written files depend on the number of selection groups in selectionMap

Parameters:

  • path : const std::string & holds the file path of the .mon file which is to be read.

  • selectionMap : const std::map< std::string, std::vector< std::string > > & holds the map to which the read selection groups are stored.

Returns:

  • bool — True if all .mon files were written, false if any file could not be opened for writing.

Example​

Used in examples​

ex_utils​

Utilities library: buffers, observers, logging, file formats, montages, layouts and reports.

src/examples/ex_utils/main.cpp, line 197
selections.insert("Left-temporal", {"MEG0111", "MEG0112", "MEG0113"});
selections.insert("Vertex", {"MEG0711"});
const QString selPath = dir.filePath("groups.sel");
SelectionIO::writeMNESelFile(selPath, selections);
QMultiMap<QString, QStringList> reread;
SelectionIO::readMNESelFile(selPath, reread);
ok &= expect(reread.size() == 2 && reread.value("Left-temporal") == QStringList({"MEG0111", "MEG0112", "MEG0113"}),
"SelectionIO .sel round trip");

Authors of this file​