Back to the main page.

Bug 511 - warning using ft_write_volume

Status CLOSED FIXED
Reported 2011-03-01 20:38:00 +0100
Modified 2011-03-31 14:13:57 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Linux
Importance: P1 minor
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Lilla Magyari - 2011-03-01 20:38:14 +0100

Hi when I use ft_write_volume for writing .mgz file, I get a warning: >> ft_write_volume('/home/coherence/roboos/data/lilmag/subjects/subject01/mri/Subject01.mgz', mri_tal_rs.anatomy, 'transform', mri_tal_rs.transform); Warning: could not open /home/coherence/roboos/data/lilmag/subjects/subject01/mri/Subject01.mgz > In fileio/private/filetype_check_header at 54 In ft_filetype at 692 In ft_write_volume at 46 however, I do get an mgz file at the right place (so... despite of the warning that it could not open the file, it writes the volume to the .mgz) best, Lilla


Jan-Mathijs Schoffelen - 2011-03-02 10:57:48 +0100

perhaps you shouldn't try to write into robert's home directory? ;o)


Lilla Magyari - 2011-03-02 12:15:37 +0100

(In reply to comment #1) > perhaps you shouldn't try to write into robert's home directory? ;o) My quota was all used, and I got extra quota from him for the mne analysis of the experimental data. He made me this folder under his directory.


Robert Oostenveld - 2011-03-16 22:30:32 +0100

should ft_write_volume not be called ft_write_mri (for consistency with ft_read_mri)? ft_filetype tries to read the header to detect the fileformat, which of course fails here. The same problem is the case for other write functions: MacBook> grep ft_filetype ft_write_* ft_write_data.m:dataformat = keyval('dataformat', varargin); if isempty(dataformat), dataformat = ft_filetype(filename); end ft_write_event.m:eventformat = keyval('eventformat', varargin); if isempty(eventformat), eventformat = ft_filetype(filename); end ft_write_volume.m:dataformat = keyval('dataformat', varargin); if isempty(dataformat), dataformat = ft_filetype(filename); end idea 1: local reimplementation of filetype detection in the write function that avoids reading the first bytes of the file idea 2: fix ft_filetype so that it does not try to read the first bytes of the header


Robert Oostenveld - 2011-03-16 22:32:24 +0100

I have checked out ft_filetype, the warning was due to the incorrect order of - checking the first few bytes of the header and then the file extension instead of - checking the extension and if that matches the first few bytes of the header I changed it at 4 locations in the filetype detection.


Robert Oostenveld - 2011-03-31 14:13:57 +0200

changed the status of most recently resolved/fixed bugs into "CLOSED"