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.
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
- Full source:
src/examples/ex_utils/main.cpp - Build target:
ex_utils(runs under CTest)
Used in examples
ex_utils
Utilities library: buffers, observers, logging, file formats, montages, layouts and reports.
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
- Lorenz Esch <lorenz.esch@tu-ilmenau.de>
- Christoph Dinh <christoph.dinh@mne-cpp.org>
- Juan GPC <jgarciaprieto@mgh.harvard.edu>
- Gabriel Motta <gabrielbenmotta@gmail.com>
- Andreas Griesshammer <ag@fieldlineinc.com>