53 using namespace FIFFLIB;
54 using namespace Eigen;
55 using namespace RTPROCESSINGLIB;
83 QList<QIODevice*>::iterator i;
84 for(i = p_qlistIODevices.begin(); i != p_qlistIODevices.end(); ++i) {
97 QString t_sFileName = p_pStream->streamName();
99 printf(
"Opening fiff data %s...\n",t_sFileName.toUtf8().constData());
101 if(!p_pStream->open())
105 if(!p_pStream->read_meas_info(p_pStream->dirtree(), info, dirTree))
119 bool hasEvoked =
false;
125 qWarning() <<
"[FiffIO::read] Dir tree could not be read";
130 if(t_dirTree->has_kind(FIFFB_EVOKED)) {
134 if(t_dirTree->has_kind(FIFFB_RAW_DATA) ||
135 t_dirTree->has_kind(FIFFB_PROCESSED_DATA) ||
136 t_dirTree->has_kind(FIFFB_CONTINUOUS_DATA) ||
147 QSharedPointer<FiffRawData> p_fiffRawData(
new FiffRawData(pIODevice));
151 m_qlistRaw.append(p_fiffRawData);
153 printf(
"Finished reading raw data!\n");
162 for(qint32 i=0; i < p_fiffEvokedSet.
evoked.size(); ++i) {
163 m_qlistEvoked.append(QSharedPointer<FiffEvoked>(&p_fiffEvokedSet.
evoked[i]));
184 const fiff_int_t type,
185 const fiff_int_t idx)
const {
187 case FIFFB_RAW_DATA: {
189 qDebug() <<
"Finished writing single raw data with index" << idx <<
".";
202 const fiff_int_t type,
203 const fiff_int_t idx)
const {
204 qDebug(
"------------------------ Writing fiff data ------------------------");
207 case FIFFB_RAW_DATA: {
208 QString t_nameoftype =
"raw";
211 for(qint32 i=0; i < m_qlistRaw.size(); ++i) {
214 qint32 p = p_QFile.fileName().indexOf(
".fif");
215 t_fname = p_QFile.fileName().insert(p,QString(
"_"+t_nameoftype+
"-"+QString::number(i)));
218 qDebug(
"\nWriting set with index %i to file %s ...",i,t_fname.toUtf8().constData());
219 QFile t_file(t_fname);
227 qDebug(
"\nFinished Writing %lli raw data sets!\n",m_qlistRaw.size());
241 const fiff_int_t idx)
const
244 SparseMatrix<double> mult;
249 fiff_int_t from = m_qlistRaw[idx]->first_samp;
250 fiff_int_t to = m_qlistRaw[idx]->last_samp;
251 float quantum_sec = 30.0f;
252 fiff_int_t quantum = ceil(quantum_sec*m_qlistRaw[idx]->info.sfreq);
258 bool first_buffer =
true;
260 fiff_int_t first, last;
264 for(first = from; first < to; first+=quantum) {
265 last = first+quantum-1;
269 if (!m_qlistRaw[idx]->read_raw_segment(data, times, mult, first, last, sel)) {
270 qDebug(
"error during read_raw_segment\n");
274 qDebug(
"Writing...");
278 first_buffer =
false;
280 outfid->write_raw_buffer(data, cals);
284 outfid->finish_writing_raw();