Back to the main page.

Bug 1991 - use callbacks in sourceplot

Reported 2013-02-18 15:36:00 +0100
Modified 2014-03-12 12:21:39 +0100
Product: FieldTrip
Component: core
Version: unspecified
Hardware: PC
Operating System: Windows
Importance: P3 enhancement
Assigned to: Jörn M. Horschig
Depends on:
See also:

Jörn M. Horschig - 2013-02-18 15:36:10 +0100

This is more a request than a bug. I find it extremely inconvenient to have sourceplot looping infinitely until the the window is closed or one control-c's out. Apart from being inconvenient I consider it pretty ugly code-wise (no hard feelings to who ever wrote it). Using a callback would be much better. However, this would mean that code execution continues immediately which is pretty much against the idea of being backwards compatible. Still, if someone allows me, I would be happy to make the function nicer and make it use a callback.

Jan-Mathijs Schoffelen - 2013-02-18 15:40:10 +0100

check out private/volumeedit, basically a lot of the callbacks implemented there can be used to replace the stuff in ft_sourceplot. Also consider the same improvement for ft_volumerealign

Jörn M. Horschig - 2013-02-18 15:45:21 +0100

so that means, I'm allowed to do it? yaay (CC Robert in case he wants to protest)

Jörn M. Horschig - 2013-02-18 17:37:52 +0100

I'm going the lazy approach and been moving many things without rewriting much, hope that's alright. tomorrow there'll be keyboard shortcuts and I'll fix the broken crosshair. btw, you can now also hold the mouse button and smoothly scroll through the volume, just like in volumeedit. got some suggestion for other test data rather than my own? and is it correct that the interactive mode only works for ortho mode? so e.g. no atlas lookup for slice?

Robert Oostenveld - 2013-02-19 09:21:45 +0100

(In reply to comment #2) Am I also allowed to protest in favor of this?

Jörn M. Horschig - 2013-02-19 09:37:38 +0100

hehe, I would be more than happy if you do ;)

Jörn M. Horschig - 2013-02-19 11:58:55 +0100

$ svn ci ft_sourceplot.m -m "enhancement #1991 - sourceplot uses callback functions rather than a while-loop. also: crosshair fixed, mousetracing possible, atlas lookup fixed" Sending ft_sourceplot.m Transmitting file data . Committed revision 7501. I hope I took care of all possibilities and did enough testing. Inspired this bug, I created bug 1994 bug 1995 and bug 1996

Jörn M. Horschig - 2013-02-19 12:01:48 +0100

oh and also, the callbacks are always there and active (in ortho viewmode), but the function does only halt and wait if cfg.interactive = 'yes'.

Jan-Mathijs Schoffelen - 2013-02-19 20:21:52 +0100

Nice! Needed to fix only 1 bug, hehehe. When no functional data in the input I managed to get a crash. Now solved with a certain revision.