Back to the main page.

Bug 2572 - well, this seems like a fairly easy unit conversion ;)

Reported 2014-05-12 11:34:00 +0200
Modified 2014-05-14 20:08:48 +0200
Product: FieldTrip
Component: forward
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P5 normal
Assigned to: Robert Oostenveld
Depends on:
See also:

- 2014-05-12 11:34:18 +0200

When running ft_sourceanalysis with the following arguments... cfg=[]; cfg.method='lcmv'; cfg.vol=vol; cfg.grid=grid_lcmv; cfg.keepfilter='yes'; s_lcmv_seated=ft_sourceanalysis(cfg,tl_seated); ...I get... ??? Error using ==> scalingfactor at 167 cannot convert cm to mm Error in ==> ft_convert_units at 160 scale = scalingfactor(unit, target); Error in ==> prepare_headmodel at 67 sens = ft_convert_units(sens, cfg.grid.unit, 'feedback', true); Error in ==> ft_sourceanalysis at 286 [vol, sens, cfg] = prepare_headmodel(cfg, data); This unit conversion seems like it should be doable ;) Any ideas what's going on? grid_lcmv.unit and vol.unit = 'mm'. tl_seated.grad.unit = 'cm'.

Jörn M. Horschig - 2014-05-12 11:43:17 +0200

Robert is still working on all that unit stuff, and not sure what he is busy with right now, so no clue how long it will take until this all works. As a workaround, maybe call grid_lcmv = ft_convert_unit(grid_lcmv, 'cm') and vol = ft_convert_unit(vol, 'cm') hope that suffices to make your code run smoothly again ;)

Jörn M. Horschig - 2014-05-12 11:44:04 +0200

oh, I just saw that the error happens in ft_convert_units... ehm, okay, then... Robert?

Jörn M. Horschig - 2014-05-12 11:51:45 +0200

oh, maybe this one was my fault, and the fix of bug 2571 was wrong

Jörn M. Horschig - 2014-05-12 11:52:46 +0200

so, I now undone my changes for 2571 and fixed that one otherwise. It actually does make sense to first understand the code someone else wrote and then fix it ;) svn ci scalingfactor.m -m "bugfix #2571 - eval statements unfixed, unknown introduced" Sending scalingfactor.m Transmitting file data . Committed revision 9496. can you check whether it works?

- 2014-05-12 11:53:08 +0200

Oh yeah. Do they both have something to do with 'scalingfactor'? (In reply to Jörn M. Horschig from comment #3)

Jörn M. Horschig - 2014-05-12 11:55:01 +0200

yes, so this bug was definitely caused by my fix to bug 2571. And bug 2571 I tried to fix otherwise (which to me makes sense, and I hope Robert agrees)

Robert Oostenveld - 2014-05-12 12:19:11 +0200

This is indeed related to bug2571 and to my change yesterday. Other test scripts also show it: >> test_bug1043 Error using scalingfactor (line 168) cannot convert T to unknown Error in scalingfactor (line 87) factor = cellfun(@scalingfactor, old, new); Error in ft_apply_montage (line 266) scale = scalingfactor(input.chanunit, montage.chanunitorg); Error in ft_megplanar (line 309) interp.grad = ft_apply_montage(sens, planarmontage, 'balancename', 'planar', 'keepunused', 'yes'); Error in test_bug1043 (line 23) planar = ft_megplanar(cfg, data);

Jörn M. Horschig - 2014-05-12 12:21:07 +0200

I guess it's fair to say a conversion from or to unknown is impossible, right?

Robert Oostenveld - 2014-05-12 12:21:37 +0200

the problem represents the carry over of bug 2532 into bug 2570. I had expected some work to be done, but not that it would break so massively.

Robert Oostenveld - 2014-05-12 12:22:15 +0200

Let's continue the discussion at the original bug. *** This bug has been marked as a duplicate of bug 2570 ***

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

closed several of my bugs that have been resolved