v2.0.0
Loading...
Searching...
No Matches
FIFFLIB::FiffDigPointSet Class Reference

Collection of FiffDigPoint records as parsed from a FIFFB_ISOTRAK block. More...

#include <fiff_dig_point_set.h>

Public Types

using SPtr = QSharedPointer<FiffDigPointSet>
using ConstSPtr = QSharedPointer<const FiffDigPointSet>
using UPtr = std::unique_ptr<FiffDigPointSet>
using ConstUPtr = std::unique_ptr<const FiffDigPointSet>

Public Member Functions

 FiffDigPointSet ()
 FiffDigPointSet (const FiffDigPointSet &p_FiffDigPointSet)
FiffDigPointSet & operator= (const FiffDigPointSet &other)=default
 FiffDigPointSet (QList< FIFFLIB::FiffDigPoint > pointList)
 FiffDigPointSet (QIODevice &p_IODevice)
 ~FiffDigPointSet ()
void clear ()
bool isEmpty () const
qint32 size () const
bool write (QIODevice &p_IODevice)
bool write (const QString &filePath, QString *errorMessage=nullptr)
void writeToStream (FiffStream *p_pStream)
const FiffDigPoint & operator[] (qint32 idx) const
FiffDigPoint & operator[] (qint32 idx)
FiffDigPointSet pickTypes (QList< int > includeTypes) const
FiffDigPointSet & operator<< (const FiffDigPoint &dig)
FiffDigPointSet & operator<< (const FiffDigPoint *dig)
void applyTransform (const FiffCoordTrans &coordTrans, bool bApplyInverse=false)
bool transformToHead ()
QList< FiffDigPoint > getList ()

Static Public Member Functions

static bool readFromStream (FiffStream::SPtr &p_Stream, FiffDigPointSet &p_Dig)
static bool readPolhemusIsotrak (const QString &path, FiffDigPointSet &dig, const QStringList &chNames=QStringList(), const QString &unit=QStringLiteral("m"))
static bool readPolhemusFastscan (const QString &path, Eigen::MatrixX3d &points, const QString &unit=QStringLiteral("mm"), bool requireHeader=true)
static bool readCaptrak (const QString &path, FiffDigPointSet &dig, QStringList *chNames=nullptr)
static bool readEgi (const QString &path, FiffDigPointSet &dig, QStringList *chNames=nullptr)
static bool readLocalite (const QString &path, FiffDigPointSet &dig, QStringList *chNames=nullptr, const QString &nasion=QString(), const QString &lpa=QString(), const QString &rpa=QString())
static bool readNeuroscanDat (const QString &path, FiffDigPointSet &dig, QStringList *chNames=nullptr)

Detailed Description

Collection of FiffDigPoint records as parsed from a FIFFB_ISOTRAK block.

Indexed access plus convenience filters (cardinals only, HPI only, EEG only, extras only) so registration code can pick out the subset it needs without re-walking the underlying QList of dig points.

Definition at line 82 of file fiff_dig_point_set.h.

Member Typedef Documentation

◆ ConstSPtr

Const shared pointer type for FiffDigPointSet.

Definition at line 86 of file fiff_dig_point_set.h.

◆ ConstUPtr

using FIFFLIB::FiffDigPointSet::ConstUPtr = std::unique_ptr<const FiffDigPointSet>

Const unique pointer type for FiffDigPointSet.

Definition at line 88 of file fiff_dig_point_set.h.

◆ SPtr

Shared pointer type for FiffDigPointSet.

Definition at line 85 of file fiff_dig_point_set.h.

◆ UPtr

Unique pointer type for FiffDigPointSet.

Definition at line 87 of file fiff_dig_point_set.h.

Constructor & Destructor Documentation

◆ FiffDigPointSet() [1/4]

FiffDigPointSet::FiffDigPointSet ( )

Constructs a FiffDigPointSet object.

Definition at line 69 of file fiff_dig_point_set.cpp.

◆ FiffDigPointSet() [2/4]

FiffDigPointSet::FiffDigPointSet ( const FiffDigPointSet & p_FiffDigPointSet)

Copy constructor.

Parameters
[in]p_FiffDigPointSetFiffDigPointSet which should be copied.

Definition at line 76 of file fiff_dig_point_set.cpp.

◆ FiffDigPointSet() [3/4]

FiffDigPointSet::FiffDigPointSet ( QList< FIFFLIB::FiffDigPoint > pointList)

Construct FiffDigPointSet based on input pointList

Parameters
[in]pointListlist of digitizer points

Definition at line 83 of file fiff_dig_point_set.cpp.

◆ FiffDigPointSet() [4/4]

FiffDigPointSet::FiffDigPointSet ( QIODevice & p_IODevice)

Constructs a FiffDigPointSet by reading from a IO device.

Parameters
[in]p_IODeviceIO device to read the digitizer point set from.

Definition at line 90 of file fiff_dig_point_set.cpp.

◆ ~FiffDigPointSet()

FiffDigPointSet::~FiffDigPointSet ( )

Destroys the FiffDigPointSet

Definition at line 107 of file fiff_dig_point_set.cpp.

Member Function Documentation

◆ applyTransform()

void FiffDigPointSet::applyTransform ( const FiffCoordTrans & coordTrans,
bool bApplyInverse = false )

Apply a transformation matrix on the 3D position of the digitized points.

Parameters
[in]coordTransFiffCoordTrans which is to be applied.
[in]bApplyInverseWhether to apply the inverse. False by default.

Definition at line 720 of file fiff_dig_point_set.cpp.

◆ clear()

void FIFFLIB::FiffDigPointSet::clear ( )
inline

Initializes FiffDigPointSet

Definition at line 400 of file fiff_dig_point_set.h.

◆ getList()

QList< FiffDigPoint > FiffDigPointSet::getList ( )

Returns list of digitizer point the set contains

Returns
list of digitizer points

Definition at line 770 of file fiff_dig_point_set.cpp.

◆ isEmpty()

bool FIFFLIB::FiffDigPointSet::isEmpty ( ) const
inline

True if FiffDigPointSet is empty.

Returns
true if FiffDigPointSet is empty.

Definition at line 407 of file fiff_dig_point_set.h.

◆ operator<<() [1/2]

FiffDigPointSet & FiffDigPointSet::operator<< ( const FiffDigPoint & dig)

Subscript operator << to add a new FiffDigPoint

Parameters
[in]digFiffDigPoint to be added.
Returns
FiffDigPointSet.

Definition at line 704 of file fiff_dig_point_set.cpp.

◆ operator<<() [2/2]

FiffDigPointSet & FiffDigPointSet::operator<< ( const FiffDigPoint * dig)

Subscript operator << to add a new FiffDigPoint

Parameters
[in]digFiffDigPoint to be added.
Returns
FiffDigPointSet.

Definition at line 712 of file fiff_dig_point_set.cpp.

◆ operator=()

FiffDigPointSet & FIFFLIB::FiffDigPointSet::operator= ( const FiffDigPointSet & other)
default

Copy assignment. Every member has value semantics, so the compiler-generated member-wise assignment is correct. It is declared explicitly because declaring a copy constructor and/or a destructor deprecates the implicitly generated one.

Parameters
[in]otherObject to assign from.
Returns
reference to this object.

◆ operator[]() [1/2]

FiffDigPoint & FiffDigPointSet::operator[] ( qint32 idx)

Subscript operator [] to access FiffDigPoint by index

Parameters
[in]idxthe FiffDigPoint index.
Returns
FiffDigPoint related to the parameter index.

Definition at line 678 of file fiff_dig_point_set.cpp.

◆ operator[]() [2/2]

const FiffDigPoint & FiffDigPointSet::operator[] ( qint32 idx) const

Subscript operator [] to access FiffDigPoint by index

Parameters
[in]idxthe FiffDigPoint index.
Returns
FiffDigPoint related to the parameter index.

Definition at line 667 of file fiff_dig_point_set.cpp.

◆ pickTypes()

FiffDigPointSet FiffDigPointSet::pickTypes ( QList< int > includeTypes) const

Pick the wanted types from this set and returns them

Parameters
[in]includeTypesThe include types (FIFFV_POINT_HPI, FIFFV_POINT_CARDINAL, FIFFV_POINT_EEG, FIFFV_POINT_ECG, FIFFV_POINT_EXTRA, FIFFV_POINT_LPA, FIFFV_POINT_NASION, FIFFV_POINT_RPA).
Returns
FiffDigPointSet.

Definition at line 689 of file fiff_dig_point_set.cpp.

◆ readCaptrak()

bool FiffDigPointSet::readCaptrak ( const QString & path,
FiffDigPointSet & dig,
QStringList * chNames = nullptr )
static

Reads a BrainVision CapTrak .bvct file, as mne.channels.read_dig_captrak does.

The electrodes named Nasion, LPA and RPA become the cardinal points, every other electrode an EEG point; millimetres are converted to metres. The points are in digitizer coordinates (FIFFV_COORD_UNKNOWN), numbered as by readPolhemusIsotrak; a repeated name keeps its first place and its last position.

Parameters
[in]pathThe .bvct file.
[out]digThe digitizer points.
[out]chNamesIf not null, the electrode names in the order of the EEG points.
Returns
false if the file cannot be parsed or lacks one of the fiducials.

Definition at line 440 of file fiff_dig_point_set.cpp.

◆ readEgi()

bool FiffDigPointSet::readEgi ( const QString & path,
FiffDigPointSet & dig,
QStringList * chNames = nullptr )
static

Reads the coordinates.xml of an EGI MFF recording, as mne.channels.read_dig_egi does.

Sensors of type 0 become EEG points named "EEG <number>", the reference (type 1) is numbered after the electrodes before it, and the nasion and periauricular points (type 2) become the cardinal points. Unlike mne.channels.read_dig_egi, which keeps the file's centimetres as if they were metres, the positions are converted to metres (as mne.io.read_raw_egi does).

Parameters
[in]pathThe coordinates.xml file.
[out]digThe digitizer points, in digitizer coordinates.
[out]chNamesIf not null, the electrode names in the order of the EEG points.
Returns
false if the file cannot be parsed or lacks one of the fiducials.

Definition at line 469 of file fiff_dig_point_set.cpp.

◆ readFromStream()

bool FiffDigPointSet::readFromStream ( FiffStream::SPtr & p_Stream,
FiffDigPointSet & p_Dig )
static

Reads FiffDigPointSet from a fif file

Parameters
[in,out]p_StreamThe opened fif file.
[in,out]p_DigThe read digitizer point set.
Returns
true if succeeded, false otherwise.

Definition at line 113 of file fiff_dig_point_set.cpp.

◆ readLocalite()

bool FiffDigPointSet::readLocalite ( const QString & path,
FiffDigPointSet & dig,
QStringList * chNames = nullptr,
const QString & nasion = QString(),
const QString & lpa = QString(),
const QString & rpa = QString() )
static

Reads a Localite .csv file ("#,name,x,y,z" in millimetres after a header row), as mne.channels.read_dig_localite does.

Parameters
[in]pathThe .csv file.
[out]digThe digitizer points, in digitizer coordinates.
[out]chNamesIf not null, the electrode names in the order of the EEG points.
[in]nasionName of the point that is the nasion, or empty.
[in]lpaName of the point that is the left preauricular point, or empty.
[in]rpaName of the point that is the right preauricular point, or empty.
Returns
false if the file cannot be read, a row is malformed or a named fiducial is missing.

Definition at line 510 of file fiff_dig_point_set.cpp.

◆ readNeuroscanDat()

bool FiffDigPointSet::readNeuroscanDat ( const QString & path,
FiffDigPointSet & dig,
QStringList * chNames = nullptr )
static

Reads a Neuroscan .dat electrode file ("name number x y z" per line), as mne.channels.read_dig_dat does: point numbers 78, 76 and 82 are the nasion, LPA and RPA, 67 (the centroid) is skipped, and the coordinates are kept as they are.

Parameters
[in]pathThe .dat file.
[out]digThe digitizer points, in digitizer coordinates.
[out]chNamesIf not null, the electrode names in the order of the EEG points.
Returns
false if the file cannot be read or a line does not hold five entries.

Definition at line 557 of file fiff_dig_point_set.cpp.

◆ readPolhemusFastscan()

bool FiffDigPointSet::readPolhemusFastscan ( const QString & path,
Eigen::MatrixX3d & points,
const QString & unit = QStringLiteral("mm"),
bool requireHeader = true )
static

Reads the points of a Polhemus FastSCAN .txt file in metres, as mne.channels.read_polhemus_fastscan does.

Parameters
[in]pathThe .txt file.
[out]pointsThe points, one per row, in digitizer coordinates.
[in]unitUnit of the file: "m", "cm" or "mm".
[in]requireHeaderReject files whose "%" header does not name FastSCAN.
Returns
false if the file cannot be read, the extension, unit or header is wrong, or a row does not hold three numbers.

Definition at line 403 of file fiff_dig_point_set.cpp.

◆ readPolhemusIsotrak()

bool FiffDigPointSet::readPolhemusIsotrak ( const QString & path,
FiffDigPointSet & dig,
const QStringList & chNames = QStringList(),
const QString & unit = QStringLiteral("m") )
static

Reads a Polhemus Isotrak digitizer file, as mne.channels.read_dig_polhemus_isotrak does.

The three fiducials become cardinal points (LPA, nasion, RPA). The remaining points become HPI coils for an .elp file and head shape points for .hsp/.eeg files, or EEG electrodes when chNames names them. Electrodes are numbered by the last three characters of their names when all of those are numbers, and 1..n otherwise. All points are in digitizer coordinates (FIFFV_COORD_UNKNOWN).

Parameters
[in]pathThe .elp, .hsp or .eeg file.
[out]digThe digitizer points.
[in]chNamesElectrode names, one per non-fiducial point, or empty.
[in]unitUnit of the file: "m", "cm" or "mm".
Returns
false if the file cannot be read, the extension or unit is unknown, or the number of names does not match the number of points.

Definition at line 363 of file fiff_dig_point_set.cpp.

◆ size()

qint32 FIFFLIB::FiffDigPointSet::size ( ) const
inline

Returns the number of stored FiffDigPoints

Returns
number of stored FiffDigPoints.

Definition at line 414 of file fiff_dig_point_set.h.

◆ transformToHead()

bool FiffDigPointSet::transformToHead ( )

Move every point that shares the frame of the LPA, nasion and RPA points into the Neuromag head frame defined by these fiducials (mne.channels.transform_to_head).

Returns
false if a fiducial is missing or the fiducials are in different frames.

Definition at line 741 of file fiff_dig_point_set.cpp.

◆ write() [1/2]

bool FiffDigPointSet::write ( const QString & filePath,
QString * errorMessage = nullptr )

Convenience overload: write the digitizer point set to a path on disk.

Verifies that the destination directory exists and that the file was actually produced. The file is opened in WriteOnly|Truncate mode.

Parameters
[in]filePathDestination .fif file path.
[out]errorMessageOptional, populated on failure.
Returns
true on success, false on error.

Definition at line 608 of file fiff_dig_point_set.cpp.

◆ write() [2/2]

bool FiffDigPointSet::write ( QIODevice & p_IODevice)

Writes the FiffDigPointSet to a FIFF file.

Parameters
[in]p_IODeviceIO device to write the digitizer point set to.
Returns
false if the device cannot be opened for writing.

Definition at line 594 of file fiff_dig_point_set.cpp.

◆ writeToStream()

void FiffDigPointSet::writeToStream ( FiffStream * p_pStream)

Writes the FiffDigPointSet to a FIFF stream.

Parameters
[in]p_pStreamPointer to the FIFF stream to write to.

Definition at line 649 of file fiff_dig_point_set.cpp.


The documentation for this class was generated from the following files: