[FieldTrip] MNE fiff_read / write_raw_segment

Peter Goodin pgoodin at swin.edu.au
Sat Jan 26 12:42:10 CET 2013


Hi Gianpaolo (or anyone else that can help me out again),

Again, thank you very much for putting me onto mne_ex_read_write_raw.m. Unfortunately I am still having problems.

Because I appear to have been not too forthcoming in my original email, the problem is with the triggering in our neuromag triux (306 channel) system,

I'm having triggers add onto each other and others fail to register with the trigger channels. I've written a script to read in the trigger information from my stimuli presentation software and want to write the accurate data to the main trigger channel (STI101), then save as a new fiff file. By adding code from mne_ex_read_write_raw.m to my overall script (reading the entire data set into memory at once), I'm able to replace the questionable STI101 data with that obtained from my stim software, but have a problem when writing the new fiff file. The size of the input file is ~2gb but when writing, the output is approx ~18gb. I suspect I'm writing a WHOLE bunch of redundant data, but am unable to open the new file, even on a machine running 16gb RAM.

I've attached the script and would be extremely grateful for any advice that could be given.

Thanks again to everyone on the mailing list whose helped me out so far,

Peter.

_________________________
Peter Goodin,
BSc (Hons), Ph.D Candidate.

Brain and Psychological Sciences Research Centre (BPsych)
Swinburne University,
Hawthorn, Vic, 3122

Monash Alfred Psychiatry Research Centre (MAPrc)
Level 1, Old Baker Building
Commercial Road
Melbourne, Vic, 3004


________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Peter Goodin [pgoodin at swin.edu.au]
Sent: Thursday, 24 January 2013 11:05 PM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] MNE fiff_read / write_raw_segment

Hi Gianpaolo,

Wonderful! This is exactly what I'm after! Thank you very much for pointing me in the correct direction!

Peter

__________________________
Peter Goodin,
BSc (Hons), Ph.D Candidate.

Brain and Psychological Sciences Research Centre (BPsych)
Swinburne University,
Hawthorn, Vic, 3122

Monash Alfred Psychiatry Research Centre (MAPrc)
Level 1, Old Baker Building
Commercial Road
Melbourne, Vic, 3004


________________________________
From: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl] on behalf of Demarchi, Gianpaolo [gianpaolo.demarchi at unitn.it]
Sent: Thursday, 24 January 2013 9:13 PM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] MNE fiff_read / write_raw_segment

Hi Peter,
for a similar purpose (i.e. cleaning the trigger lines) I found very helpful copying from an example file:

mne_ex_read_write_raw.m

which is in the mne folder as well. This is a nice example script which instructs you on how to open, write and close properly a fiff file, with all the details and parameters explained.
Basically, I just copied and pasted the relevant lines,  and put some intelligence in the

%
%   You can add your own miracle here
%

part (namely, changing accordingly the data(channel, time) matrix).
It's straightforward, but just post back in case of need ...
Best luck,
GP


Il giorno 24/gen/2013, alle ore 10:11, Peter Goodin <pgoodin at swin.edu.au<mailto:pgoodin at swin.edu.au>> ha scritto:

Hi Alex,

Sorry, that "add" in the first sentence is a little misleading. Please accept my apologies.

I'm trying to alter an existing channel with new values, not add a new channel. If the channel already exists but is having the data rewritten, do any changes need to be made to fh.info.ch<http://fh.info.ch> or any other aspect of fh?

Thanks and sorry for the confusion again.

Peter.
__________________________
Peter Goodin,
BSc (Hons), Ph.D Candidate.

Brain and Psychological Sciences Research Centre (BPsych)
Swinburne University,
Hawthorn, Vic, 3122

Monash Alfred Psychiatry Research Centre (MAPrc)
Level 1, Old Baker Building
Commercial Road
Melbourne, Vic, 3004



________________________________________
From: fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl> [fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>] on behalf of Alexandre Gramfort [alexandre.gramfort at inria.fr<mailto:alexandre.gramfort at inria.fr>]
Sent: Thursday, 24 January 2013 5:38 PM
To: FieldTrip discussion list
Subject: Re: [FieldTrip] MNE fiff_read / write_raw_segment

hi Peter,

when you add channels to a fif structure you need to update the measurement
information (channels names, types etc.). With your notations you should update
fh.info.chs

hope this helps
Alex

On Thu, Jan 24, 2013 at 2:59 AM, Peter Goodin <pgoodin at swin.edu.au<mailto:pgoodin at swin.edu.au>> wrote:
Hi Fieldtrip list,

I'm trying to add an altered channel and save it as a new fiff file using
the MNE commands from the external/MNE dir in Fieldtrip, but seem to just
keep getting the data from the old fiff file instead.

The code I'm currently using is:

To read:
fh = fiff_setup_read_raw('input.fif');
f = fiff_read_raw_segment(fh);

After adding in the altered channel data to f, I then use:

fiff_write_raw_segment(output.fif, fh);

What I thought would happen is output.fif would use the information in f and
fh to write output.fif, but what seems to be happening is the data in f is
being ignored.

Does anyone have any ideas on how to insert the altered channel data then
write it back out as a fiff file?

Thanks,

Peter.




__________________________
Peter Goodin,
BSc (Hons), Ph.D Candidate.

Brain and Psychological Sciences Research Centre (BPsych)
Swinburne University,
Hawthorn, Vic, 3122

Monash Alfred Psychiatry Research Centre (MAPrc)
Level 1, Old Baker Building
Commercial Road
Melbourne, Vic, 3004



_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the
e-mail
contains patient information, please contact the Partners Compliance
HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in
error
but does not contain patient information, please contact the sender and
properly
dispose of the e-mail.

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

_______________________________________________
fieldtrip mailing list
fieldtrip at donders.ru.nl
http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


--
------------------------------------------------------------------------
Gianpaolo Demarchi, PhD                      gianpaolo.demarchi at unitn.it<mailto:gianpaolo.demarchi at unitn.it>
MEG Lab                                       phone:  0039 0461 28 30 76
CIMeC  -  Mind/Brain Center                         University of Trento
Via delle Regole, 101           I-38100 Mattarello di Trento (TN), Italy
------------------------------------------------------------------------






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130126/0474be31/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: trigchange.m
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130126/0474be31/attachment-0001.ksh>


More information about the fieldtrip mailing list