[FieldTrip] FT doesn't close .fif files
lhunt at fmrib.ox.ac.uk
Wed Feb 9 18:35:46 CET 2011
I don't think this works because fopen will place the file cursor at the beginning of the file, whereas fiff_setup_read_raw places the cursor at the beginning of the data (after all the header tags in the .fif file). So we need to store the cursor position too. See my earlier e-mail.
Laurence Hunt, DPhil Student
Centre for Functional MRI of the Brain (FMRIB),
University of Oxford
lhunt at fmrib.ox.ac.uk
On 9 Feb 2011, at 16:41, Alexandre Gramfort wrote:
> the filename is stored raw.info
> we could close the file after the fiff_setup_read_raw
> and then do
> raw.fid = fopen(raw.info.filename)
> before reading from it later.
> see my attempt :
> would this solve your pb?
> On Wed, Feb 9, 2011 at 11:16 AM, Vladimir Litvak <v.litvak at ion.ucl.ac.uk> wrote:
>> The question is if it would be possible to pre-read those fif tags and
>> all the other info and store it in the header, then close the file and
>> then given just the samples to read to open it again and navigate fast
>> to the right place based on the info that has been stored before?
>> Those tags don't change (do they?) so it should be sufficient to read
>> them once.
>> On Wed, Feb 9, 2011 at 4:05 PM, Alexandre Gramfort
>> <gramfort at nmr.mgh.harvard.edu> wrote:
>>> Hi Vladimir,
>>>> So why does fiff_setup_read_raw take so long? Do you really need half
>>>> a second to open a fif file or does it also read some header data not
>>>> all of which is necessary?
>>> fiff_setup_read_raw reads many things from the fif file:
>>> - measurement info
>>> - sampling rate
>>> - first/last time sample
>>> to do this it locates in the file the location of all the info (the fif tags).
>>> So when you look for something in the file, you go down the tree
>>> (in matlab) and that points you to the location in the file where to read.
>>>> Could there perhaps be a faster version for
>>>> repeated calls that would make it possible to keep fileio code
>>> we could write a single function that does both :
>>> fiff_setup_read_raw and fiff_read_raw_segment
>>> if it can help.
>> 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
More information about the fieldtrip