Back to the main page.

Bug 2526 - ft_prepare_sourcemodel and mri.coordsys

Status CLOSED FIXED
Reported 2014-04-04 20:10:00 +0200
Modified 2014-05-14 20:08:49 +0200
Product: FieldTrip
Component: core
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P5 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Raghavan Gopalakrishnan - 2014-04-04 20:10:04 +0200

ft_prepare_sourcemodel fails if the input cfg.mri = mri; does not contain coordsys field. mri structure looks like this mri = dim: [256 256 256] anatomy: [256x256x256 double] hdr: [1x1 struct] transform: [4x4 double] unit: 'mm' Either the output of ft_read_mri should have coordsys field, or ft_prepare_sourcemodel should not ask for it. The following error is generated. Reference to non-existent field 'coordsys'. Error in ft_convert_coordsys (line 80) if nargin>1 && ~strcmpi(target, obj.coordsys) Error in ft_volumenormalise (line 123) interp = ft_convert_coordsys(interp, 'spm'); Error in ft_prepare_sourcemodel (line 632) normalise = ft_volumenormalise(tmpcfg, mri);


Robert Oostenveld - 2014-04-07 09:23:21 +0200

Hi Raghavan, thanks for reporting. I actually think that ft_determine_coordsys should be called. That is an interactive function, requiring information from the user to determine the coordinate system origin and direction of axes. The error message you are now getting is not informative in this respect. There are three high-level functions that seem to be relying on coordsys: mac011> grep -l mri.coordsys *.m ft_volumerealign.m ft_volumereslice.m ft_volumesegment.m I'll have a look at those...


Robert Oostenveld - 2014-04-07 10:33:35 +0200

(In reply to Robert Oostenveld from comment #1) Looking at the code, I see the call sequence ft_prepare_sourcemodel -> ft_volumenormalise -> ft_convert_coordsys and in ft_convert_coordsys it starts with if ~isfield(obj, 'coordsys') || isempty(obj.coordsys) % determine the coordinate system of the input object obj = ft_determine_coordsys(obj, 'interactive', 'yes'); end where obj is the input argument. This suggests that you have been presented a figure with questions on the command line to specify the coordinate system, but that you somehow (closing the figure?) have been able to get around it, causing it to still not have the coordsys after ft_determine_coordsys. I will build in another check like this if ~isfield(obj, 'coordsys') || isempty(obj.coordsys) % the call to ft_determine_coordsys should have taken care of this, but % it is possible that the user aborted the coordinate system determination error('the coordinate system of the geometrical object is not specified'); end


Robert Oostenveld - 2014-04-07 10:44:21 +0200

(In reply to Robert Oostenveld from comment #2) mac011> svn commit utilities/ft_convert_coordsys.m Sending utilities/ft_convert_coordsys.m Transmitting file data . Committed revision 9364.


Robert Oostenveld - 2014-04-07 10:45:16 +0200

PS could you please check once more and let me know whether this addresses it? It might also be needed to improve the help (or information on screen) that you get with ft_determine_coordsys to ensure you don't skip this step.


Raghavan Gopalakrishnan - 2014-04-08 16:18:31 +0200

(In reply to Robert Oostenveld from comment #4) Thank you very much. This addresses it.


Robert Oostenveld - 2014-05-14 20:08:49 +0200

closed several of my bugs that have been resolved