MNE-CPP  beta 1.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
FIFFLIB::FiffStream Class Reference

FIFF File I/O routines. More...

#include <fiff_stream.h>

Inheritance diagram for FIFFLIB::FiffStream:

Public Types

typedef QSharedPointer< FiffStreamSPtr
 
typedef QSharedPointer< const FiffStreamConstSPtr
 

Public Member Functions

 FiffStream (QIODevice *p_pIODevice)
 
 FiffStream (QByteArray *a, QIODevice::OpenMode mode)
 
 ~FiffStream ()
 
void end_block (fiff_int_t kind)
 
void end_file ()
 
void finish_writing_raw ()
 
bool get_evoked_entries (const QList< FiffDirTree > &evoked_node, QStringList &comments, QList< fiff_int_t > &aspect_kinds, QString &t)
 
bool open (FiffDirTree &p_Tree, QList< FiffDirEntry > &p_Dir)
 
QStringList read_bad_channels (const FiffDirTree &p_Node)
 
bool read_cov (const FiffDirTree &p_Node, fiff_int_t cov_kind, FiffCov &p_covData)
 
QList< FiffCtfCompread_ctf_comp (const FiffDirTree &p_Node, const QList< FiffChInfo > &p_Chs)
 
bool read_meas_info (const FiffDirTree &p_Node, FiffInfo &p_Info, FiffDirTree &p_NodeInfo)
 
bool read_meas_info_base (const FiffDirTree &p_Node, FiffInfoBase &p_InfoForward)
 
bool read_named_matrix (const FiffDirTree &p_Node, fiff_int_t matkind, FiffNamedMatrix &mat)
 
QList< FiffProjread_proj (const FiffDirTree &p_Node)
 
void start_block (fiff_int_t kind)
 
QString streamName ()
 
void write_ch_info (FiffChInfo *ch)
 
void write_coord_trans (const FiffCoordTrans &trans)
 
void write_cov (const FiffCov &p_FiffCov)
 
void write_ctf_comp (const QList< FiffCtfComp > &comps)
 
void write_dig_point (const FiffDigPoint &dig)
 
void write_double (fiff_int_t kind, const double *data, fiff_int_t nel=1)
 
void write_id (fiff_int_t kind, const FiffId &id=defaultFiffId)
 
void write_info_base (const FiffInfoBase &p_FiffInfoBase)
 
void write_int (fiff_int_t kind, const fiff_int_t *data, fiff_int_t nel=1)
 
void write_int_matrix (fiff_int_t kind, const MatrixXi &mat)
 
void write_float (fiff_int_t kind, const float *data, fiff_int_t nel=1)
 
void write_float_matrix (fiff_int_t kind, const MatrixXf &mat)
 
void write_float_sparse_ccs (fiff_int_t kind, const SparseMatrix< float > &mat)
 
void write_float_sparse_rcs (fiff_int_t kind, const SparseMatrix< float > &mat)
 
void write_name_list (fiff_int_t kind, const QStringList &data)
 
void write_named_matrix (fiff_int_t kind, const FiffNamedMatrix &mat)
 
void write_proj (const QList< FiffProj > &projs)
 
bool write_raw_buffer (const MatrixXd &buf, const RowVectorXd &cals)
 
bool write_raw_buffer (const MatrixXd &buf, const SparseMatrix< double > &mult)
 
bool write_raw_buffer (const MatrixXd &buf)
 
void write_string (fiff_int_t kind, const QString &data)
 
void write_rt_command (fiff_int_t command, const QString &data)
 

Static Public Member Functions

static bool setup_read_raw (QIODevice &p_IODevice, FiffRawData &data, bool allow_maxshield=false)
 
static QStringList split_name_list (QString p_sNameList)
 
static FiffStream::SPtr start_file (QIODevice &p_IODevice)
 
static FiffStream::SPtr start_writing_raw (QIODevice &p_IODevice, const FiffInfo &info, RowVectorXd &cals, MatrixXi sel=defaultMatrixXi)
 

Detailed Description

FIFF File I/O routines.

FiffStream provides an interface for reading from and writing to fiff files

Definition at line 129 of file fiff_stream.h.

Member Typedef Documentation

typedef QSharedPointer<const FiffStream> FIFFLIB::FiffStream::ConstSPtr

Const shared pointer type for FiffStream.

Definition at line 133 of file fiff_stream.h.

typedef QSharedPointer<FiffStream> FIFFLIB::FiffStream::SPtr

Shared pointer type for FiffStream.

Definition at line 132 of file fiff_stream.h.

Constructor & Destructor Documentation

FiffStream::FiffStream ( QIODevice *  p_pIODevice)
explicit

Constructs a fiff stream that uses the I/O device p_pIODevice.

Parameters
[in]p_pIODeviceA fiff IO device like a fiff QFile or QTCPSocket

Definition at line 75 of file fiff_stream.cpp.

FiffStream::FiffStream ( QByteArray *  a,
QIODevice::OpenMode  mode 
)
explicit

Constructs a fiff stream that operates on a byte array, a. The mode describes how the device is to be used.

Parameters
[in]aThe byte array
[in]modeThe open mode

Definition at line 86 of file fiff_stream.cpp.

FiffStream::~FiffStream ( )

Destroys the FiffInfo.

Definition at line 97 of file fiff_stream.cpp.

Member Function Documentation

void FiffStream::end_block ( fiff_int_t  kind)

MNE toolbox root function ###: Implementation of the fiff_end_block function

Writes a FIFF_BLOCK_END tag

Parameters
[in]kindThe block kind to end

Definition at line 112 of file fiff_stream.cpp.

void FiffStream::end_file ( )

MNE toolbox root function ###: Implementation of the fiff_end_file function

Writes the closing tags to a fif file and closes the file

Definition at line 120 of file fiff_stream.cpp.

void FiffStream::finish_writing_raw ( )

MNE toolbox root function ###: Implementation of the fiff_finish_writing_raw function

Finishes a raw file by writing all necessary end tags.

Definition at line 133 of file fiff_stream.cpp.

bool FiffStream::get_evoked_entries ( const QList< FiffDirTree > &  evoked_node,
QStringList &  comments,
QList< fiff_int_t > &  aspect_kinds,
QString &  t 
)

Helper to get all evoked entries

Parameters
[in]evoked_nodeevoked tree nodes
[out]commentsfound comments
[out]aspect_kindsfound aspect_kinds
[out]ttext formatted found information
Returns
true if information is available, fasle otherwise

Definition at line 144 of file fiff_stream.cpp.

bool FiffStream::open ( FiffDirTree p_Tree,
QList< FiffDirEntry > &  p_Dir 
)

QFile::open

unmask base class open function fiff_open

MNE toolbox root function

Opens a fif file and provides the directory of tags

Parameters
[out]p_Treetag directory organized into a tree
[out]p_Dirthe sequential tag directory
Returns
true if succeeded, false otherwise

Definition at line 202 of file fiff_stream.cpp.

QStringList FiffStream::read_bad_channels ( const FiffDirTree p_Node)

fiff_read_bad_channels

MNE toolbox root function

Reads the bad channel list from a node if it exists Note: In difference to mne-matlab this is not a static function. This is a method of the FiffDirTree class, that's why a tree object doesn't need to be handed to the function.

Parameters
[in]p_NodeThe node of interest
Returns
the bad channel list

Definition at line 286 of file fiff_stream.cpp.

bool FiffStream::read_cov ( const FiffDirTree p_Node,
fiff_int_t  cov_kind,
FiffCov p_covData 
)

mne_read_cov - also for mne_read_noise_cov

MNE toolbox root function

Reads a covariance matrix from a fiff file

Parameters
[in]p_Nodelook for the matrix in here
[in]cov_kindwhat kind of a covariance matrix do we want?
[out]p_covDatathe read covariance matrix
Returns
true if succeeded, false otherwise

Definition at line 303 of file fiff_stream.cpp.

QList< FiffCtfComp > FiffStream::read_ctf_comp ( const FiffDirTree p_Node,
const QList< FiffChInfo > &  p_Chs 
)

fiff_read_ctf_comp

MNE toolbox root function

Read the CTF software compensation data from the given node

Parameters
[in]p_NodeThe node of interest
[in]p_Chschannels with the calibration info
Returns
the CTF software compensation data

Definition at line 523 of file fiff_stream.cpp.

bool FiffStream::read_meas_info ( const FiffDirTree p_Node,
FiffInfo p_Info,
FiffDirTree p_NodeInfo 
)

fiff_read_meas_info

MNE toolbox root function

Read the measurement info Source is assumed to be an open fiff file.

Parameters
[in]p_NodeThe node of interest
[out]p_InfoThe read measurement info
[out]p_NodeInfoThe to measurement corresponding fiff_dir_tree.
Returns
the to measurement corresponding fiff_dir_tree.

Definition at line 746 of file fiff_stream.cpp.

bool FiffStream::read_meas_info_base ( const FiffDirTree p_Node,
FiffInfoBase p_InfoForward 
)

python read_forward_meas_info

Read light measurement info from forward operator -> ToDo base class of FiffInfo

Parameters
[in]p_NodeThe node of interest
[out]p_InfoForwardThe read light measurement info
Returns
the to measurement corresponding fiff_dir_tree.

Definition at line 676 of file fiff_stream.cpp.

bool FiffStream::read_named_matrix ( const FiffDirTree p_Node,
fiff_int_t  matkind,
FiffNamedMatrix mat 
)

fiff_read_named_matrix

MNE toolbox root function

Reads a named matrix.

Parameters
[in]p_NodeThe node of interest
[in]matkindThe matrix kind to look for
[out]matThe named matrix
Returns
true if succeeded, false otherwise

Definition at line 1059 of file fiff_stream.cpp.

QList< FiffProj > FiffStream::read_proj ( const FiffDirTree p_Node)

fiff_read_proj

MNE toolbox root function

[ projdata ] = fiff_read_proj(fid,node)

Read the SSP data under a given directory node

Parameters
[in]p_NodeThe node of interest
Returns
a list of SSP projectors

Definition at line 1152 of file fiff_stream.cpp.

bool FiffStream::setup_read_raw ( QIODevice &  p_IODevice,
FiffRawData data,
bool  allow_maxshield = false 
)
static

fiff_setup_read_raw

MNE toolbox root function

Read information about raw data file

Parameters
[in]p_IODeviceAn fiff IO device like a fiff QFile or QTCPSocket
[out]dataThe raw data information - contains the opened fiff file
[in]allow_maxshieldAccept unprocessed MaxShield data
Returns
true if succeeded, false otherwise

Definition at line 1302 of file fiff_stream.cpp.

QStringList FiffStream::split_name_list ( QString  p_sNameList)
static

fiff_split_name_list

MNE toolbox root function

Splits a string by looking for seperator ":"

Parameters
[in]p_sNameListstring to split
Returns
the splitted string list

Definition at line 1500 of file fiff_stream.cpp.

void FiffStream::start_block ( fiff_int_t  kind)

fiff_start_block

MNE toolbox root function

Wrapper for the FiffStream start_block member function

Writes a FIFF_BLOCK_START tag

Parameters
[in]kindThe block kind to start

Definition at line 1507 of file fiff_stream.cpp.

FiffStream::SPtr FiffStream::start_file ( QIODevice &  p_IODevice)
static

fiff_start_file

MNE toolbox root function

Opens a fiff file for writing and writes the compulsory header tags

Parameters
[in]p_IODeviceThe IODevice (like QFile or QTCPSocket) to open. It is recommended that the name ends with .fif
Returns
The opened file.

Definition at line 1515 of file fiff_stream.cpp.

FiffStream::SPtr FiffStream::start_writing_raw ( QIODevice &  p_IODevice,
const FiffInfo info,
RowVectorXd &  cals,
MatrixXi  sel = defaultMatrixXi 
)
static

fiff_start_writing_raw

MNE toolbox root function

function [fid,cals] = fiff_start_writing_raw(name,info,sel)

Parameters
[in]p_IODeviceA fiff IO device like a fiff QFile or QTCPSocket
[in]infoThe measurement info block of the source file
[out]calsThecalibration matrix
[in]selWhich channels will be included in the output file (optional)
Returns
the started fiff file

Definition at line 1543 of file fiff_stream.cpp.

QString FiffStream::streamName ( )

Get the stream name

Returns
the name of the current stream

Definition at line 1701 of file fiff_stream.cpp.

void FiffStream::write_ch_info ( FiffChInfo ch)

fiff_write_ch_info

MNE toolbox root function

Writes a channel information record to a fif file The type, cal, unit, and pos members are explained in Table 9.5 of the MNE manual

Parameters
[in]chThe channel information structure to write

Definition at line 1716 of file fiff_stream.cpp.

void FiffStream::write_coord_trans ( const FiffCoordTrans trans)

fiff_write_coord_trans

MNE toolbox root function

Writes a coordinate transformation structure

Parameters
[in]transThe coordinate transfomation structure

Definition at line 1794 of file fiff_stream.cpp.

void FiffStream::write_cov ( const FiffCov p_FiffCov)

Write a noise covariance matrix

MNE toolbox root function

Parameters
[in]p_FiffCovThe noise covariance matrix to write

Definition at line 1840 of file fiff_stream.cpp.

void FiffStream::write_ctf_comp ( const QList< FiffCtfComp > &  comps)

fiff_write_ctf_comp

MNE toolbox root function

Writes the CTF compensation data into a fif file

Parameters
[in]compsThe compensation data to write

Definition at line 1910 of file fiff_stream.cpp.

void FiffStream::write_dig_point ( const FiffDigPoint dig)

fiff_write_dig_point

MNE toolbox root function

Writes a digitizer data point into a fif file

Parameters
[in]digThe point to write

Definition at line 1943 of file fiff_stream.cpp.

void FiffStream::write_double ( fiff_int_t  kind,
const double *  data,
fiff_int_t  nel = 1 
)

fiff_write_double

MNE toolbox root function

Writes a double-precision floating point tag to a fif file

Parameters
[in]kindTag kind
[in]dataThe float data pointer
[in]nelNumber of doubles to write (default = 1)

Definition at line 1971 of file fiff_stream.cpp.

void FiffStream::write_float ( fiff_int_t  kind,
const float *  data,
fiff_int_t  nel = 1 
)

fiff_write_float

MNE toolbox root function

Writes a single-precision floating point tag to a fif file

Parameters
[in]kindTag kind
[in]dataThe float data pointer
[in]nelNumber of floats to write (default = 1)

Definition at line 1989 of file fiff_stream.cpp.

void FiffStream::write_float_matrix ( fiff_int_t  kind,
const MatrixXf &  mat 
)

fiff_write_float_matrix

MNE toolbox root function

Writes a single-precision floating-point matrix tag

Parameters
[in]kindThe tag kind
[in]matThe data matrix

Definition at line 2007 of file fiff_stream.cpp.

void FiffStream::write_float_sparse_ccs ( fiff_int_t  kind,
const SparseMatrix< float > &  mat 
)

fiff_write_float_sparse_ccs

MNE toolbox root function

Writes a single-precision sparse (ccs) floating-point matrix tag

Parameters
[in]kindThe tag kind
[in]matThe data matrix

Definition at line 2037 of file fiff_stream.cpp.

void FiffStream::write_float_sparse_rcs ( fiff_int_t  kind,
const SparseMatrix< float > &  mat 
)

fiff_write_float_sparse_rcs

MNE toolbox root function

Writes a single-precision sparse (RCS) floating-point matrix tag

Parameters
[in]kindThe tag kind
[in]matThe data matrix

Definition at line 2130 of file fiff_stream.cpp.

void FiffStream::write_id ( fiff_int_t  kind,
const FiffId id = defaultFiffId 
)

fiff_write_id

MNE toolbox root function

Wrapper for the FiffStream write_id member function

Writes fiff id If the id argument is missing it will be generated here

Parameters
[in]kindThe tag kind
[in]idThe id to write

Definition at line 2226 of file fiff_stream.cpp.

void FiffStream::write_info_base ( const FiffInfoBase p_FiffInfoBase)

Write measurement info stored in forward solution

Parameters
[in]p_FiffInfoBaseThe measurement info.

Definition at line 2272 of file fiff_stream.cpp.

void FiffStream::write_int ( fiff_int_t  kind,
const fiff_int_t *  data,
fiff_int_t  nel = 1 
)

fiff_write_int

MNE toolbox root function

Writes a 32-bit integer tag to a fif file

Parameters
[in]kindTag kind
[in]dataThe integer data pointer
[in]nelNumber of integers to write (default = 1)

Definition at line 2337 of file fiff_stream.cpp.

void FiffStream::write_int_matrix ( fiff_int_t  kind,
const MatrixXi &  mat 
)

fiff_write_int_matrix

MNE toolbox root function

Writes a integer matrix tag

Parameters
[in]kindThe tag kind
[in]matThe data matrix

Definition at line 2353 of file fiff_stream.cpp.

void FiffStream::write_name_list ( fiff_int_t  kind,
const QStringList &  data 
)

fiff_write_name_list

MNE toolbox root function

Writes a colon-separated list of names

Parameters
[in]kindThe tag kind
[in]dataAn array of names to create the list from

Definition at line 2383 of file fiff_stream.cpp.

void FiffStream::write_named_matrix ( fiff_int_t  kind,
const FiffNamedMatrix mat 
)

fiff_write_named_matrix

MNE toolbox root function

Writes a named single-precision floating-point matrix

Parameters
[in]kindThe tag kind to use for the data
[in]matThe data matrix

Definition at line 2392 of file fiff_stream.cpp.

void FiffStream::write_proj ( const QList< FiffProj > &  projs)

fiff_write_proj

MNE toolbox root function

Writes the projection data into a fif stream (file)

Parameters
[in]projsThe compensation data to write

Definition at line 2408 of file fiff_stream.cpp.

bool FiffStream::write_raw_buffer ( const MatrixXd &  buf,
const RowVectorXd &  cals 
)

fiff_write_raw_buffer

MNE toolbox root function

Writes a raw buffer.

Parameters
[in]bufthe buffer to write
[in]calscalibration factors
Returns
true if succeeded, false otherwise

Definition at line 2440 of file fiff_stream.cpp.

bool FiffStream::write_raw_buffer ( const MatrixXd &  buf,
const SparseMatrix< double > &  mult 
)

fiff_write_raw_buffer

MNE toolbox root function

Writes a raw buffer.

Parameters
[in]bufthe buffer to write
[in]multthe used multiplication matrix consisting out of projection,calibration and compensation
Returns
true if succeeded, false otherwise

Definition at line 2465 of file fiff_stream.cpp.

bool FiffStream::write_raw_buffer ( const MatrixXd &  buf)

fiff_write_raw_buffer

Writes a raw buffer without calibrations.

Parameters
[in]bufthe buffer to write
Returns
true if succeeded, false otherwise

Definition at line 2485 of file fiff_stream.cpp.

void FiffStream::write_rt_command ( fiff_int_t  command,
const QString &  data 
)

Writes a real-time command

Parameters
[in]commandThe real time command
[in]dataThe string data to write

Definition at line 2509 of file fiff_stream.cpp.

void FiffStream::write_string ( fiff_int_t  kind,
const QString &  data 
)

fiff_write_string

MNE toolbox root function

Writes a string tag

Parameters
[in]kindThe tag kind
[in]dataThe string data to write

Definition at line 2495 of file fiff_stream.cpp.


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