Back to the main page.

Bug 2548 - error in ft_prepare_sourcemodel when 'grid' is not gridlike

Status CLOSED FIXED
Reported 2014-04-29 11:04:00 +0200
Modified 2019-08-10 12:29:35 +0200
Product: FieldTrip
Component: forward
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Jörn M. Horschig
URL:
Tags:
Depends on:
Blocks:
See also:

- 2014-04-29 11:04:00 +0200

Howdy tripcats, I'm trying to create a very simple sourcemodel using only a small number of prespecified grid points (namely, some peak activations from a previous analysis). These grid points are MNI co-ordinates, and I want to inverse warp these MNI-coordinates to individual headspace as per http://fieldtrip.fcdonders.nl/example/create_single-subject_grids_in_individual_head_space_that_are_all_aligned_in_mni_space . Note that because I've trimmed down my template grid to just a few points, it does not make sense for my grid to include a 'dim' (which - as I understand it - contains the x- y- and z- axes for a regularly spaced cube of grid points). Unfortunately, when I try to create a single subject grid from this template grid, I get the error: ??? Reference to non-existent field 'dim'. Error in ==> ft_prepare_sourcemodel at 640 grid.dim = mnigrid.dim; I guess ft_prepare_sourcemodel is trying to copy over a structure that is not there (and does not need to be there).


Jörn M. Horschig - 2014-04-29 11:11:22 +0200

Hey Tom, In http://fieldtrip.fcdonders.nl/tutorial/connectivity#compute_the_spatial_filter_for_the_region_of_interest we explain how to do apply the beamformer algorithm on single gridpoints. The same would hold for different gridpoints. In essence, ft_sourceanalysis takes over the computation of the sourcemodel. Have you tried that? I am not sure whether the error you describe is an actual error or a user-error, one of the more wiser guys would need to answer this.


Jörn M. Horschig - 2014-04-29 11:12:03 +0200

me english no good today, please excuse^^


- 2014-04-29 11:17:22 +0200

Yes, but what I want to do involves an extra step. The connectivity tutorial describes taking a point in headspace and running a time-domain beamformer on that. I want to take a point in MNI space, convert that point to individual headspace, and then do the source analysis. Does ft_sourceanalysis take care of the warping too? Because it doesn't mention that in the documentation. I guess the distinction between error and user error depends on what you want to allow your users to do ;)


Jörn M. Horschig - 2014-04-29 11:36:26 +0200

I see, can I drop by to help you out on that (it also helps to keep the comments clean of my bad english ^^)?


- 2014-04-29 11:58:39 +0200

No problemo. I'm back in my office now. Will also be here from 13-14.


Jörn M. Horschig - 2014-04-29 12:15:59 +0200

svn ci ft_prepare_sourcemodel.m -m "bugfix #2548 - dim is only copied over if it already existed" Sending ft_prepare_sourcemodel.m Transmitting file data . Committed revision 9460.


Thomas Hartmann - 2014-05-13 17:03:20 +0200

hey, sorry, but the fix is not correct. although it solved the original issue, it should be checked whether the "dim" field is in the "mnigrid" structure before copying. this way, the "dim" field is never copied, because the "grid" structure is built from scratch. i fixed it and inserted a pull request: https://github.com/fieldtrip/fieldtrip/pull/39 best, thomas


Robert Oostenveld - 2014-05-14 08:37:08 +0200

Thanks Thomas, I downloaded the patch from the email I received for https://github.com/fieldtrip/fieldtrip/pull/39 Then I saved it to a file and did patch -p1 < patchfile After a quick review with "svn diff" I did mac011> svn commit Sending ft_prepare_sourcemodel.m Transmitting file data . Committed revision 9517. Whoho, in only 3 minutes. Hopefully I am now getting the hang of using git in combination with svn. I am sure the process could be improved, but what I just did is certainly acceptable. ----- the fix 2548 is supposed to copy over the dim field only when it existed. the submitted solution is flawed in that it never copies over the dim field, even if it existed in the mnigrid structure. the proposed patch solves the issue.


Jörn M. Horschig - 2014-05-14 09:02:44 +0200

oh, sorry, stupid mistake :/


Robert Oostenveld - 2019-08-10 12:29:35 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue describing the issue on https://github.com/fieldtrip/fieldtrip/issues.