Back to the main page.

Bug 1227 - implement gifti-format and nifti-format for ft_sourcewrite

Status CLOSED FIXED
Reported 2011-12-12 15:14:00 +0100
Modified 2013-10-26 17:58:40 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jan-Mathijs Schoffelen
URL:
Tags:
Depends on:
Blocks:
See also:

Jan-Mathijs Schoffelen - 2011-12-12 15:14:35 +0100

gifti for 2D cortical sheets nifti for 3D regular grids


Jan-Mathijs Schoffelen - 2011-12-13 09:52:05 +0100

implemented with revision 5024


Robert Oostenveld - 2013-06-28 13:59:14 +0200

There is a regression error in test_bug1227 ------ Error using spm_write_vol (line 19) Can only handle a maximum of 3 dimensions. Error in volumewrite_spm (line 75) Va = spm_write_vol(Va,data); Error in ft_write_mri (line 84) V = volumewrite_spm(filename, dat, transform, spmversion); Error in ft_sourcewrite (line 59) ft_write_mri(cfg.filename, dat, 'dataformat', 'nifti', 'transform', source.transform); Error in test_bug1227 (line 34) ft_sourcewrite(cfg, source2); ------ At that line in the code of spm_write_vol, the volume is 4D, which spm8 does not like.


Jan-Mathijs Schoffelen - 2013-06-28 15:02:14 +0200

this bug has been introduced apparently by Vladimir's addition of the 'spm8up' check. Earlier, Freesurfer was used to write nifties, and this worked for 4D volumes.


Jan-Mathijs Schoffelen - 2013-06-28 15:04:16 +0200

ft_write_mri allows for writing nifties with spm, but then the dataformat should be 'nifti_spm'


Jan-Mathijs Schoffelen - 2013-06-28 15:40:31 +0200

Hi Vladimir, An error has been introduced in ft_write_mri (line 83) where you implemented the spm8up thingy. It goes wrong when trying to write > 3 dimensional nifti data. Is it OK to remove these lines? The nifties that will be written should be readable by SPM anyway. If the user explicitly wants SPM to write the data, he/she should specify 'nifti_spm' as dataformat. This is handled a few lines up in the code. Best,JM


Vladimir Litvak - 2013-06-28 15:46:56 +0200

Hi Jan-Mathijs, There is no reason why SPM wouldn't write 4D files. I just wanted to preserve your old code but you could change the switch in volumewrite_spm so that what I put there for 'spm12' would apply to both 'spm8' and 'spm12' cases (current spm8 code can then be removed). This should solve the problem. Vladimir


Jan-Mathijs Schoffelen - 2013-06-28 16:55:38 +0200

fixed with revision 8289