Skip to main content

FiffIO

Namespace: FIFFLIB  ·  Library: FIFF Library

#include <fiff/fiff_io.h>

class FIFFLIB::FiffIO

One-call FIFF reader/writer: opens a file, dispatches to the right specialized loader and returns ready-to-use FIFFLIB containers.

Sniffs the FIFF block tree, dispatches FiffRawData / FiffEvokedSet / FiffCov / FiffInfo loaders as appropriate, and returns shared pointers so the resulting objects can be freely passed across the rest of the pipeline. Front-end parity with mne.io.read_raw_fif and friends.

src/examples/ex_fiff_api/main.cpp
QFile ioFile(dir + "/sample_audvis-ave.fif");
FiffIO io(ioFile); // detects what the file holds (raw, evoked, fwd, ...)

Inheritance​


Public Methods​

FiffIO()​

Constructs a FiffIO.


~FiffIO()​

Destroys the FiffIO.


FiffIO(pIODevice)​

Constructs a FiffIO object by reading from a I/O device pIODevice.

Parameters:

  • pIODevice : QIODevice & A fiff IO device like a fiff QFile or QTCPSocket.

FiffIO(p_qlistIODevices)​

Constructs a FiffIO object that uses the I/O device pIODevice.

Parameters:

  • p_qlistIODevices : QList< QIODevice * > & A QList of fiff IO devices like a fiff QFile or QTCPSocket.

FiffIO(p_FiffIO)​

Copy constructor.

Parameters:

  • p_FiffIO : const FiffIO & FiffIO, which should be copied.

read(pIODevice)​

Read data from a pIODevice.

Parameters:

  • pIODevice : QIODevice & A fiff IO device like a fiff QFile or QTCPSocket.

Returns:

  • bool — false if the directory tree could not be read, true otherwise.

read(p_qlistIODevices)​

Read data from a QList of pIODevices.

Parameters:

  • p_qlistIODevices : QList< QIODevice > & A QList of fiff IO devices like a fiff QFile or QTCPSocket.

Returns:

  • bool — true if all devices were read successfully, false otherwise.

write(pIODevice, type, idx)​

Write data to a single pIODevice.

Parameters:

  • pIODevice : QIODevice & A fiff IO device like a fiff QFile or QTCPSocket.

  • type : const fiff_int_t Type of data to write (fiff constants types, e.g. FIFFB_RAW_DATA).

  • idx : const fiff_int_t Index of type, -1 for all entities of this type.

Returns:

  • bool — true if succeeded, false otherwise.

write(p_QFile, type, idx)​

Write whole data of a type to a fiff file.

Parameters:

  • p_QFile : QFile & Output file (name extended with type and index, e.g. sample_audvis-type-1.fif).

  • type : const fiff_int_t Type of data to write (fiff constants types, e.g. FIFFB_RAW_DATA).

  • idx : const fiff_int_t Index of type, -1 for all entities of this type.

Returns:

  • bool — true if succeeded, false otherwise.

write_raw(pIODevice, idx)​

Write raw data to a pIODevice.

Parameters:

  • pIODevice : QIODevice & A fiff IO device like a fiff QFile or QTCPSocket.

  • idx : const fiff_int_t Index of type, -1 for all entities of this type.

Returns:

  • bool — true if succeeded, false otherwise.

Static Methods​

setup_read(pIODevice, info, dirTree)​

Setup a FiffStream.

Parameters:

  • pIODevice : QIODevice & An fiff IO device like a fiff QFile or QTCPSocket.

  • info : FiffInfo & Overall info for fiff IO device.

  • dirTree : FiffDirNode::SPtr & Node directory structure.

Returns:

  • bool — true if succeeded, false otherwise.

Example​

Used in examples​

ex_fiff_api​

FIFF library: measurement info, channels, digitizer, transforms, projectors, covariance, events,.

src/examples/ex_fiff_api/main.cpp, line 271
QFile ioFile(dir + "/sample_audvis-ave.fif");
FiffIO io(ioFile); // detects what the file holds (raw, evoked, fwd, ...)
ok &= expect(io.m_qlistEvoked.size() == 4 && io.m_qlistRaw.isEmpty(), "FiffIO finds the 4 evoked sets in an -ave.fif file");

ex_fiff_io​

Example of the FiffIO interface class.

src/examples/ex_fiff_io/main.cpp, line 72
FiffIO p_fiffIO(t_listSampleFilesIn);

ex_fiff_sniffer​

Read a FIFF file from a memory buffer with a chosen byte order and summarise its contents.

src/examples/ex_fiff_sniffer/main.cpp, line 139
FIFFLIB::FiffIO p_fiffIO(t_fileRaw);

Authors of this file​