[FieldTrip] FT doesn't close .fif files

Vladimir Litvak v.litvak at ion.ucl.ac.uk
Wed Feb 9 17:16:19 CET 2011

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
>> stateless?
> we could write a single function that does both :
> fiff_setup_read_raw and fiff_read_raw_segment
> if it can help.
> Alex

More information about the fieldtrip mailing list