Print

Print


Dear Marko,
This is not a direct answer to your waitforbuttonpress event, but
there is an easy way to do a "clickable image" function with
spm_check_registration and spm_orthviews.
Once you have launch the spm_check_registration with your image, this
function will create a global variable called st. This variable has a
field 'callback'. You can use this field to call any function you
want.
for example in you case, you can do
global st %  to get the variable in the workspace
st.callback='vp = spm_orthviews(''pos'',1);res =
volume2check(round(vp(1)), round(vp(2)), round(vp(3)));'

Ferath

On Feb 12, 2008 10:35 AM, Marko Wilke <[log in to unmask]> wrote:
> Dear All,
>
> I am trying get voxel coordinates from an image as displayed using
> spm_check_registration. Along the lines of an earlier attempt of mine
> (www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind05&L=SPM&P=R132881&I=-3) I
> thought I could use the Matlab function waitforbuttonpress:
>
>    spm_check_registration(volume_to_display);
>    while waitforbuttonpress == 0
>         % this will allow clicking until a key is pressed
>
>         % get positional information, apply to volume of interest
>           vp = spm_orthviews('pos',1);
>          % use values here...
>           refresh
>    end;
>
> This works for spm2 but does not seem to work anymore in the latest spm5
> version. If I try the above, I keep on getting the same results as fast
> as Matlab can deliver, which is quite annoying. I think the background
> is "If a WindowButtonDownFcn is defined for the figure, its callback is
> executed before waitforbuttonpress returns a value." So the
> WindowsButtonDownFcn that is defined for this window prohibits using
> waitforbuttonpress - I think, but 1, I am not sure, and 2, I have no
> idea how to deal with that. Does anybody know a simple way around this
> short of writing a plugin?
>
> Thanks in advance,
> Marko
> --
> =====================================================================
> Marko Wilke                                            (Dr.med./M.D.)
>                 [log in to unmask]
>
> Universitäts-Kinderklinik              University Children's Hospital
> Abt. III (Neuropädiatrie)             Dept. III (Pediatric neurology)
>             Hoppe-Seyler-Str. 1, D - 72076 Tübingen
> Tel.: (+49) 07071 29-83416                   Fax: (+49) 07071 29-5473
> =====================================================================
>