FIFF File I/O routines. More...
#include <fiff_stream.h>
Public Types | |
| typedef QSharedPointer< FiffStream > | SPtr |
| typedef QSharedPointer< const FiffStream > | ConstSPtr |
Static Public Member Functions | |
| static bool | setup_read_raw (QIODevice &p_IODevice, FiffRawData &data, bool allow_maxshield=true, bool is_littleEndian=false) |
| static QStringList | split_name_list (QString p_sNameList) |
| static FiffStream::SPtr | start_file (QIODevice &p_IODevice) |
| static FiffStream::SPtr | open_update (QIODevice &p_IODevice) |
| static FiffStream::SPtr | start_writing_raw (QIODevice &p_IODevice, const FiffInfo &info, Eigen::RowVectorXd &cals, Eigen::MatrixXi sel=defaultMatrixXi, bool bResetRange=true) |
FIFF File I/O routines.
FiffStream provides an interface for reading from and writing to fiff files Comparable to: fiffFile (struct *fiffFile,fiffFileRec)
Definition at line 105 of file fiff_stream.h.

| typedef QSharedPointer<const FiffStream> FIFFLIB::FiffStream::ConstSPtr |
Const shared pointer type for FiffStream.
Definition at line 109 of file fiff_stream.h.
| typedef QSharedPointer<FiffStream> FIFFLIB::FiffStream::SPtr |
Shared pointer type for FiffStream.
Definition at line 108 of file fiff_stream.h.
|
explicit |
Constructs a fiff stream that uses the I/O device p_pIODevice.
| [in] | p_pIODevice | A fiff IO device like a fiff QFile or QTCPSocket. |
Definition at line 91 of file fiff_stream.cpp.
|
explicit |
Constructs a fiff stream that operates on a byte array, a. The mode describes how the device is to be used.
| [in] | a | The byte array. |
| [in] | mode | The open mode. |
Definition at line 101 of file fiff_stream.cpp.
| bool FiffStream::close | ( | ) |
Close stream
Definition at line 334 of file fiff_stream.cpp.
| QList< FiffDirEntry::SPtr > & FiffStream::dir | ( | ) |
Returns the directory compiled into a tree dir is set when open() was called.
Definition at line 133 of file fiff_stream.cpp.
| const QList< FiffDirEntry::SPtr > & FiffStream::dir | ( | ) | const |
Returns the directory compiled into a tree dir is set when open() was called.
Definition at line 140 of file fiff_stream.cpp.
| const FiffDirNode::SPtr & FiffStream::dirtree | ( | ) | const |
Returns the directory compiled into a tree tree is set when open() was called.
Definition at line 154 of file fiff_stream.cpp.
| fiff_long_t FiffStream::end_block | ( | fiff_int_t | kind, |
| fiff_int_t | next = FIFFV_NEXT_SEQ ) |
Writes a FIFF_BLOCK_END tag
| [in] | kind | The block kind to end. |
| [in] | next | Position of the next tag (default = FIFFV_NEXT_SEQ). |
Definition at line 161 of file fiff_stream.cpp.
| void FiffStream::end_file | ( | ) |
Writes the closing tags to a fif file and closes the file
Definition at line 168 of file fiff_stream.cpp.
| void FiffStream::finish_writing_raw | ( | ) |
Finishes a raw file by writing all necessary end tags.
Definition at line 180 of file fiff_stream.cpp.
| bool FiffStream::get_evoked_entries | ( | const QList< FiffDirNode::SPtr > & | evoked_node, |
| QStringList & | comments, | ||
| QList< fiff_int_t > & | aspect_kinds, | ||
| QString & | t ) |
Helper to get all evoked entries
| [in] | evoked_node | evoked tree nodes. |
| [out] | comments | found comments. |
| [out] | aspect_kinds | found aspect_kinds. |
| [out] | t | text formatted found information. |
Definition at line 190 of file fiff_stream.cpp.
| FiffId FiffStream::id | ( | ) | const |
Returns the file identifier
Definition at line 126 of file fiff_stream.cpp.
| FiffDirNode::SPtr FiffStream::make_subtree | ( | QList< FiffDirEntry::SPtr > & | dentry | ) |
Create the directory tree structure
| [in] | dentry | The dir entries of which the tree should be constructed. |
Definition at line 344 of file fiff_stream.cpp.
| int FiffStream::nent | ( | ) | const |
How many entries?
Definition at line 147 of file fiff_stream.cpp.
| bool FiffStream::open | ( | QIODevice::OpenModeFlag | mode = QIODevice::ReadOnly | ) |
QFile::open
unmask base class open function Opens a fif file and provides the directory of tags
| [in] | mode | The open mode (Default = ReadOnly). |
Definition at line 247 of file fiff_stream.cpp.
|
static |
Open fiff file for update
| [in] | p_IODevice | The IODevice (like QFile or QTCPSocket) to open. It is recommended that the name ends with .fif. |
Definition at line 1947 of file fiff_stream.cpp.
| QStringList FiffStream::read_bad_channels | ( | const FiffDirNode::SPtr & | p_Node | ) |
fiff_read_bad_channels
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 FiffDirNode class, that's why a tree object doesn't need to be handed to the function.
| [in] | p_Node | The node of interest. |
Definition at line 412 of file fiff_stream.cpp.
| bool FiffStream::read_cov | ( | const FiffDirNode::SPtr & | p_Node, |
| fiff_int_t | cov_kind, | ||
| FiffCov & | p_covData ) |
mne_read_cov - also for mne_read_noise_cov
Reads a covariance matrix from a fiff file
| [in] | p_Node | look for the matrix in here. |
| [in] | cov_kind | what kind of a covariance matrix do we want?. |
| [in,out] | p_covData | the read covariance matrix. |
Definition at line 428 of file fiff_stream.cpp.
| QList< FiffCtfComp > FiffStream::read_ctf_comp | ( | const FiffDirNode::SPtr & | p_Node, |
| const QList< FiffChInfo > & | p_Chs ) |
fiff_read_ctf_comp
Read the CTF software compensation data from the given node
| [in] | p_Node | The node of interest. |
| [in] | p_Chs | channels with the calibration info. |
Definition at line 647 of file fiff_stream.cpp.
| bool FiffStream::read_digitizer_data | ( | const FiffDirNode::SPtr & | p_Node, |
| FiffDigitizerData & | p_digData ) |
Reimplemntation of load_digitizer_data (digitizer.c)
Read the digitizer data from the given node.
| [in] | p_Node | The node of interest. |
| [out] | p_digData | The read digitizer data. |
Definition at line 803 of file fiff_stream.cpp.
| bool FiffStream::read_meas_info | ( | const FiffDirNode::SPtr & | p_Node, |
| FiffInfo & | p_Info, | ||
| FiffDirNode::SPtr & | p_NodeInfo ) |
fiff_read_meas_info
Read the measurement info Source is assumed to be an open fiff file.
| [in] | p_Node | The node of interest. |
| [out] | p_Info | The read measurement info. |
| [out] | p_NodeInfo | The to measurement corresponding fiff_dir_node. |
Definition at line 938 of file fiff_stream.cpp.
| bool FiffStream::read_meas_info_base | ( | const FiffDirNode::SPtr & | p_Node, |
| FiffInfoBase & | p_InfoForward ) |
python read_forward_meas_info
Read light measurement info from forward operator.
| [in] | p_Node | The node of interest. |
| [out] | p_InfoForward | The read light measurement info. |
Definition at line 869 of file fiff_stream.cpp.
| bool FiffStream::read_named_matrix | ( | const FiffDirNode::SPtr & | p_Node, |
| fiff_int_t | matkind, | ||
| FiffNamedMatrix & | mat ) |
fiff_read_named_matrix
Reads a named matrix.
| [in] | p_Node | The node of interest. |
| [in] | matkind | The matrix kind to look for. |
| [out] | mat | The named matrix. |
Definition at line 1306 of file fiff_stream.cpp.
| QList< FiffProj > FiffStream::read_proj | ( | const FiffDirNode::SPtr & | p_Node | ) |
Read the SSP data under a given directory node
| [in] | p_Node | The node of interest. |
Definition at line 1408 of file fiff_stream.cpp.
| bool FiffStream::read_rt_tag | ( | QSharedPointer< FiffTag > & | p_pTag | ) |
Read one tag from a fif real-time stream. difference to the other read tag functions is: that this function has blocking behaviour (waitForReadyRead)
| [out] | p_pTag | the read tag. |
Definition at line 1634 of file fiff_stream.cpp.
| bool FiffStream::read_tag | ( | QSharedPointer< FiffTag > & | p_pTag, |
| fiff_long_t | pos = -1 ) |
Read one tag from a fif file. if pos is not provided, reading starts from the current file position
| [out] | p_pTag | the read tag. |
| [in] | pos | position of the tag inside the fif file. |
Definition at line 1654 of file fiff_stream.cpp.
| bool FiffStream::read_tag_data | ( | QSharedPointer< FiffTag > & | p_pTag, |
| fiff_long_t | pos = -1 ) |
Read tag data from a fif file. if pos is not provided, reading starts from the current file position
| [out] | p_pTag | the read tag. |
| [in] | pos | position of the tag inside the fif file. |
Definition at line 1554 of file fiff_stream.cpp.
| fiff_long_t FiffStream::read_tag_info | ( | QSharedPointer< FiffTag > & | p_pTag, |
| bool | p_bDoSkip = true ) |
Read tag information of one tag from a fif file. if pos is not provided, reading starts from the current file position
| [out] | p_pTag | the read tag info. |
| [in] | p_bDoSkip | if true it skips the data of the tag (optional, default = true). |
Definition at line 1581 of file fiff_stream.cpp.
|
static |
fiff_setup_read_raw
Read information about raw data file
| [in] | p_IODevice | An fiff IO device like a fiff QFile or QTCPSocket. |
| [out] | data | The raw data information - contains the opened fiff file. |
| [in] | allow_maxshield | Accept unprocessed MaxShield data. |
Definition at line 1703 of file fiff_stream.cpp.
|
static |
fiff_split_name_list
Splits a string by looking for seperator ":"
| [in] | p_sNameList | string to split. |
Definition at line 1906 of file fiff_stream.cpp.
| fiff_long_t FiffStream::start_block | ( | fiff_int_t | kind | ) |
Writes a FIFF_BLOCK_START tag
| [in] | kind | The block kind to start. |
Definition at line 1913 of file fiff_stream.cpp.
|
static |
Opens a fiff file for writing and writes the compulsory header tags
| [in] | p_IODevice | The IODevice (like QFile or QTCPSocket) to open. It is recommended that the name ends with .fif. |
Definition at line 1920 of file fiff_stream.cpp.
|
static |
fiff_start_writing_raw
function [fid,cals] = fiff_start_writing_raw(name,info,sel)
| [in] | p_IODevice | A fiff IO device like a fiff QFile or QTCPSocket. |
| [in] | info | The measurement info block of the source file. |
| [out] | cals | A copy of the calibration values. |
| [in] | sel | Which channels will be included in the output file (optional). |
| [in] | bResetRange | Flag whether to reset the channel range to 1.0. Default is true. |
Definition at line 2013 of file fiff_stream.cpp.
| QString FiffStream::streamName | ( | ) |
Get the stream name
Definition at line 112 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_ch_info | ( | const FiffChInfo & | ch | ) |
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
| [in] | ch | The channel information structure to write. |
Definition at line 2228 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_ch_pos | ( | const FiffChPos & | chpos | ) |
Writes a channel position to a fif file
| [in] | chpos | Channel position structure to write. |
Definition at line 2304 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_coord_trans | ( | const FiffCoordTrans & | trans | ) |
Writes a coordinate transformation structure
| [in] | trans | The coordinate transfomation structure. |
Definition at line 2332 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_cov | ( | const FiffCov & | p_FiffCov | ) |
Write a noise covariance matrix
| [in] | p_FiffCov | The noise covariance matrix to write. |
Definition at line 2381 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_ctf_comp | ( | const QList< FiffCtfComp > & | comps | ) |
fiff_write_ctf_comp
Writes the CTF compensation data into a fif file
| [in] | comps | The compensation data to write. |
Definition at line 2454 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_dig_point | ( | const FiffDigPoint & | dig | ) |
fiff_write_dig_point
Writes a digitizer data point into a fif file
| [in] | dig | The point to write. |
Definition at line 2492 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_dir_entries | ( | const QList< FiffDirEntry::SPtr > & | dir, |
| fiff_long_t | pos = -1 ) |
Writes a list of dir entries to a fif file, as a FIFFT_DIR_ENTRY_STRUCT Returns the postion where the structure was written to.
| [in] | dir | The dir entries to write. |
| [in] | pos | the position where the entires should be written to (default -1, i.e. end of the file). |
Directories are composed of these structures. * typedef struct _fiffDirEntryRec { fiff_int_t kind; /**< Tag number * fiff_int_t type; /**< Data type * fiff_int_t size; /**< How many bytes * fiff_int_t pos; /**< Location in file Note: the data is located at pos + FIFFC_DATA_OFFSET * } fiffDirEntryRec,*fiffDirEntry;/**< Directory is composed of these *
/* Write entires to specified position
Definition at line 2552 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_dir_pointer | ( | fiff_int_t | dirpos, |
| fiff_long_t | pos = -1, | ||
| fiff_int_t | next = FIFFV_NEXT_SEQ ) |
Writes directory position pointer FIFF_DIR_POINTER Returns the postion where the structure was written to.
| [in] | dirpos | The directory position pointer. |
| [in] | pos | the position where the directory pointer should be written to (default -1, i.e. end of the file). |
| [in] | next | Position of the next tag (default = FIFFV_NEXT_SEQ). |
Definition at line 2523 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_double | ( | fiff_int_t | kind, |
| const double * | data, | ||
| fiff_int_t | nel = 1 ) |
Writes a double-precision floating point tag to a fif file
| [in] | kind | Tag kind. |
| [in] | data | The float data pointer. |
| [in] | nel | Number of doubles to write (default = 1). |
Definition at line 2601 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_evoked_set | ( | const FiffEvokedSet & | p_FiffEvokedSet | ) |
fiff_write_evoked_set
Writes a complete evoked data set to a fif stream (file). This writes FIFFB_MEAS containing measurement info and one FIFFB_EVOKED/FIFFB_ASPECT block per evoked response.
| [in] | p_FiffEvokedSet | The evoked data set to write. |
Definition at line 3085 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_float | ( | fiff_int_t | kind, |
| const float * | data, | ||
| fiff_int_t | nel = 1 ) |
Writes a single-precision floating point tag to a fif file
| [in] | kind | Tag kind. |
| [in] | data | The float data pointer. |
| [in] | nel | Number of floats to write (default = 1). |
Definition at line 2620 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_float_matrix | ( | fiff_int_t | kind, |
| const Eigen::MatrixXf & | mat ) |
Writes a single-precision floating-point matrix tag
| [in] | kind | The tag kind. |
| [in] | mat | The data matrix. |
Definition at line 2639 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_float_sparse_ccs | ( | fiff_int_t | kind, |
| const Eigen::SparseMatrix< float > & | mat ) |
fiff_write_float_sparse_ccs
Writes a single-precision sparse (ccs) floating-point matrix tag
| [in] | kind | The tag kind. |
| [in] | mat | The data matrix. |
Definition at line 2671 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_float_sparse_rcs | ( | fiff_int_t | kind, |
| const Eigen::SparseMatrix< float > & | mat ) |
fiff_write_float_sparse_rcs
Writes a single-precision sparse (RCS) floating-point matrix tag
| [in] | kind | The tag kind. |
| [in] | mat | The data matrix. |
Definition at line 2764 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_id | ( | fiff_int_t | kind, |
| const FiffId & | id = FiffId::getDefault() ) |
Writes fiff id If the id argument is missing it will be generated here
| [in] | kind | The tag kind. |
| [in] | id | The id to write. |
Definition at line 2863 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_info_base | ( | const FiffInfoBase & | p_FiffInfoBase | ) |
Write measurement info stored in forward solution
| [in] | p_FiffInfoBase | The measurement info. |
Definition at line 2902 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_int | ( | fiff_int_t | kind, |
| const fiff_int_t * | data, | ||
| fiff_int_t | nel = 1, | ||
| fiff_int_t | next = FIFFV_NEXT_SEQ ) |
Writes a 32-bit integer tag to a fif file
| [in] | kind | Tag kind. |
| [in] | data | The integer data pointer. |
| [in] | nel | Number of integers to write (default = 1). |
| [in] | next | Position of the next tag (default = FIFFV_NEXT_SEQ). |
Definition at line 2969 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_int_matrix | ( | fiff_int_t | kind, |
| const Eigen::MatrixXi & | mat ) |
fiff_write_int_matrix
Writes a integer matrix tag
| [in] | kind | The tag kind. |
| [in] | mat | The data matrix. |
Definition at line 2988 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_name_list | ( | fiff_int_t | kind, |
| const QStringList & | data ) |
fiff_write_name_list
Writes a colon-separated list of names
| [in] | kind | The tag kind. |
| [in] | data | An array of names to create the list from. |
Definition at line 3023 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_named_matrix | ( | fiff_int_t | kind, |
| const FiffNamedMatrix & | mat ) |
fiff_write_named_matrix
Writes a named single-precision floating-point matrix
| [in] | kind | The tag kind to use for the data. |
| [in] | mat | The data matrix. |
Definition at line 3031 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_proj | ( | const QList< FiffProj > & | projs | ) |
fiff_write_proj
Writes the projection data into a fif stream (file)
| [in] | projs | The compensation data to write. |
Definition at line 3050 of file fiff_stream.cpp.
| bool FIFFLIB::FiffStream::write_raw_buffer | ( | const Eigen::MatrixXd & | buf | ) |
fiff_write_raw_buffer
Writes a raw buffer without calibrations.
| [in] | buf | the buffer to write. |
| bool FIFFLIB::FiffStream::write_raw_buffer | ( | const Eigen::MatrixXd & | buf, |
| const Eigen::RowVectorXd & | cals ) |
fiff_write_raw_buffer
Writes a raw buffer.
| [in] | buf | the buffer to write. |
| [in] | cals | calibration factors. |
| bool FIFFLIB::FiffStream::write_raw_buffer | ( | const Eigen::MatrixXd & | buf, |
| const Eigen::SparseMatrix< double > & | mult ) |
fiff_write_raw_buffer
Writes a raw buffer.
| [in] | buf | the buffer to write. |
| [in] | mult | the used multiplication matrix consisting out of projection,calibration and compensation. |
| void FiffStream::write_rt_command | ( | fiff_int_t | command, |
| const QString & | data ) |
Writes a real-time command
| [in] | command | The real time command. |
| [in] | data | The string data to write. |
Definition at line 3212 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_string | ( | fiff_int_t | kind, |
| const QString & | data ) |
Writes a string tag
| [in] | kind | The tag kind. |
| [in] | data | The string data to write. |
Definition at line 3194 of file fiff_stream.cpp.
| fiff_long_t FiffStream::write_tag | ( | const QSharedPointer< FiffTag > & | p_pTag, |
| fiff_long_t | pos = -1 ) |
Write one tag to file including its data Data is not written if it is nullptr
| [in] | p_pTag | Tag to write;. |
| [in] | pos | the position where the entires should be written to (default -1, i.e. end of the file). |
Definition at line 2191 of file fiff_stream.cpp.