Skip to main content

IeegImplantation

Namespace: IEEGLIB  ·  Library: iEEG Library

Python equivalent

mne.channels.DigMontage (iEEG) in MNE-Python.

#include <ieeg/ieeg_implantation.h>

class IEEGLIB::IeegImplantation

Contacts of an sEEG / ECoG implantation and the leads they belong to.

src/examples/ex_ieeg/main.cpp
// Contacts of one depth lead, 3.5 mm apart, in metres; the lead comes from the names
QVector<IeegContact> contacts;
for (int k : {3, 1, 2}) {
IeegContact contact;
contact.name = QStringLiteral("LA%1").arg(k);
contact.position = Eigen::Vector3f(-0.03f, 0.0f, 0.0035f * float(k - 1));
contacts.append(contact);
}
const IeegImplantation implantation(contacts, QStringLiteral("ACPC"));
const IeegLead& lead = implantation.leads().first(); // contacts ordered LA1, LA2, LA3
// IeegImplantation::readBids("sub-01_electrodes.tsv") reads the same from BIDS iEEG

Public Methods​

IeegImplantation()​


IeegImplantation(contacts, coordinateSystem)​

Group contacts into leads.

A contact without a lead name belongs to the lead named like the contact without its trailing number (LA1, LA10 -> LA; A'1 stays apart from A1, the prime marking the other hemisphere). Within a lead, contacts are ordered by that number. A lead whose closest neighbouring contacts are less than kMaxDepthSpacing apart is a depth lead, others are strips.

Parameters:

  • contacts : const QVector< IeegContact > & Contacts, positions in metres.

  • coordinateSystem : const QString & Name of the frame of the positions, e.g. "ACPC".


contacts()​

Returns:


leads()​

Returns:

  • const QVector< IeegLead > & — All leads, in order of their first contact.

coordinateSystem()​

Returns:

  • QString — Name of the frame of the positions, e.g. "ACPC"; empty when unknown.

isEmpty()​

Returns:

  • bool — True without contacts.

setLeadType(lead, type, rows, cols)​

Set a lead's type when it is declared rather than inferred.

Parameters:

  • lead : const QString & Lead name.

  • type : IeegLeadType Lead type.

  • rows : int Grid rows, or 0 when unknown.

  • cols : int Grid columns, or 0 when unknown.

Returns:

  • bool — False when there is no such lead. A shape that does not match the contact count is dropped.

indexOf(name)​

Parameters:

  • name : const QString & Contact name.

Returns:

  • int — Index of the contact, or -1.

positions()​

Returns:

  • Eigen::MatrixX3f — Contact positions, one row per contact, in metres.

isScannerRas()​

Returns:

  • bool — True when the positions are scanner RAS of the subject's T1, which MNE-BIDS reads the BIDS iEEG systems "ACPC" and "ScanRAS" as. Such positions must be moved into the surface (tkr) RAS of the FreeSurfer surfaces before they are drawn on them.

transformed(trans, frame)​

Parameters:

  • trans : const Eigen::Matrix4f & Affine, in metres, from the current frame to the new one.

  • frame : const QString & Name of the new frame.

Returns:

  • IeegImplantation — A copy with every position transformed; leads are unchanged.

Static Methods​

readBids(electrodesTsv, error)​

Read a BIDS iEEG *_electrodes.tsv.

Units and the coordinate system come from the *_coordsystem.json in the same folder that shares the longest name prefix; without one the file is refused, since the units are then unknown. Contacts without coordinates are skipped. The group column assigns leads and the dimension column ("[4x8]") the grid shape; a type naming depth, strip or grid sets the lead type. Otherwise names and spacing decide, as in the constructor.

Parameters:

  • electrodesTsv : const QString & Path to the *_electrodes.tsv file.

  • error : *QString ** Optional: why the file was refused.

Returns:

  • IeegImplantation — The implantation; empty when the file was refused or has no placed contacts.

Example​

Used in examples​

ex_ieeg​

IEEG library: group sEEG contacts into a lead, derive a bipolar montage and paint contact values onto a surface.

src/examples/ex_ieeg/main.cpp, line 72
const IeegImplantation implantation(contacts, QStringLiteral("ACPC"));
const IeegLead& lead = implantation.leads().first(); // contacts ordered LA1, LA2, LA3
// IeegImplantation::readBids("sub-01_electrodes.tsv") reads the same from BIDS iEEG
ok &= expect(implantation.leads().size() == 1 && lead.name == "LA" && lead.type == IeegLeadType::Depth && lead.contacts == QVector<int>({1, 2, 0}),
"IeegImplantation: one depth lead LA, ordered by contact number");

ex_disp3d_scene​

Disp3D scene data: sensor-to-surface interpolation, electrodes, MRI slices, video overlay and layers.

src/examples/ex_disp3d_scene/main.cpp, line 139
ElectrodeObject electrodes; // a view of the implantation, drawn by BrainView::setElectrodes()
electrodes.setImplantation(IeegImplantation(shaft));
electrodes.selectContact("LH3");
float contactDistance = 0.0f;
const int pickedContact = electrodes.intersect(QVector3D(0.017f, -0.020f, 1.0f), QVector3D(0.0f, 0.0f, -1.0f), contactDistance);
ok &= expect(electrodes.totalContactCount() == 4 && electrodes.selectedContact() == "LH3" && electrodes.contactStreams().instanceCount == 4 && electrodes.bodyStreams().instanceCount == 1 && electrodes.contactLabel(pickedContact) == "LH3 (depth lead LH)",
"ElectrodeObject: 4 contacts on one shaft, a ray through LH3 picks it");

Authors of this file​