[visionegg] Re: Vision Egg, EEG and fMRI

On Fri, 2003-01-03 at 08:59, Andrew Straw wrote:
> Hi Christoph!  Best wishes for the New Year!
> 
> On Thursday, January 2, 2003, at 12:38  PM, Christoph Lehmann wrote:
> 
> > I was asked by our group, whether VE could be used for
> > experiments, which use fMRI and EEG simultaneously (EEG in the 
> > scanner):
> >
> > How can I send a parallel port trigger (and write the time in a file, 
> > as I do
> > already) by the time the picture has been swapped to screen, and not 
> > by the
> > time the picture is loaded into memory (as I do currently)? You wrote, 
> > that
> > the parallel port can only be updated, when OpenGL is instructed to 
> > swap
> > buffers.... what about the time between this instruction and the 
> > actual swap?
> >
> > Is it possible at all, with VE (with windows only, or also with 
> > linux), or do I
> > need to get the vsync pulse from the VGA cable? We now have the same 
> > discussion
> > again, we had at the beginning: for EEG the timing with ms precision 
> > is crucial
> > (not for fMRI)..
> 
> The parallel port can be updated any time (I hope I didn't mislead you 
> on this).   But if you're in "sync-swap" mode (buffer swapping 
> synchronized with VSYNC/VBL), the display only changes just after the 
> VSYNC pulse. Therefore it is pointless to update the parallel port to 
> indicate a display change unless you know VSYNC happened.  However, if 
> you are in sync-swap mode, you do know that when the VSYNC just 
> happened 
how do I know this (see my question below)?

and you can therefore update the parallel port  in time with 
> actual display changes (without tapping VSYNC from the video cable).  
in time means: during the next function-evaluation (which happenes for
every frame, yes?)

and linux doesn't allow sync-swap mode, yes?....sh... do I really have
to change to win?

maybee stupid question: but what happens if the swap is not syncronized
with the vsync: are then riks, that pictures are started to be drawn
only from their middle position on downwards? (dont' know how to call
this), as can be seen very very rarely.

> However,with further work, modifying the video cable may give you a 
> better solution: You could make an electronic device that checks when 
> the a digital output on the parallel port changes and then create the 
> "true" digital output trigger only when the VSYNC happened on the VGA 
> cable.
> 
> Don't be afraid of getting the VSYNC signal -- for example, the HD15 to 
> BNC adapters give you the signal very easily indeed.
> 
> Also, it may be possible to use audio output to achieve ms precision, 
> at least if you know somewhat in advance when you want an event to 
> happen.  I have not ventured down that path and there is no Vision Egg 
> code for this.
> 
> > Currently I am evaluating a function every frame. Is it possible to 
> > write a
> > function, which runs only when the vsync pulse has been detected (so 
> > that in
> > this function I can write the parallelport-out command and the log of 
> > the time
> > for the log-file).
> 
> I think the only solution is as above. I don't think any operating 
> system or video driver provides a way for a callback function to be 
> executed immediately after the VSYNC pulse.


so I didn't understand you. Above you write: "However, if 
you are in sync-swap mode, you do know that when the VSYNC just 
happened and you can therefore update the parallel port  in time with 
actual display changes ".
So since I am evaluation functions every frame, how can I know in such a
function, that the vsync just happened (and therefore the picture has
been swapped to screen), and therefore I write something to the parallel
port? do you know, what I mean? Even though the actual picture display
might have a lag, referred to the vsync, since this lag for sure is
constant, I don't bother about that. But I want to update the parallel
port only when the vsync happened: how to do this in a function, as
mine, which is evaluated every frame, i.e. is there a command I can use
like if vsync ...blabla then wirte2lpt ...




> > How can I evaluate the vertical refresh rate of a) my thinkpad and b) 
> > of a pair
> > of LCD goggles? Do you have an idea?
> 
> The laptop's internal display is probably locked at 60 Hz, as are most 
> (all?) LCD displays, including projectors.  When the laptop's video 
> card drives an external display, it uses whatever vertical refresh it's 
> told.  In linux, this is specified in your XF86Config file and in 
> Windows / Mac OS X, this is set in the "Displays" Control Panel / 
> System Preferences, although it may be difficult or impossible to find 
> in Windows. I have no experience with LCD shutter goggles, but they 
> probably synchronize to whatever VGA signal they are given (within a 
> certain range, anyway).
> 
thanks a lot for this info. so LCD probably has 60hz.
> I hope all of this helps!
> 
> Cheers!
> Andrew


thank, you for not getting nerved because of my stupid questions.

christoph

> 
> ======================================
> The Vision Egg mailing list
> Archives: http://www.freelists.org/archives/visionegg
> Website: http://www.visionegg.org/mailinglist.html
-- 
Christoph Lehmann 
Department of Psychiatric Neurophysiology 
University Hospital of Clinical Psychiatry 
Waldau 
CH-3000 Bern 60 
Switzerland 

Phone:  ++41 31 930 93 83 
Fax:    ++41 31 930 96 61 
Email:  lehmann@xxxxxxxxxxxx 
Web:    

======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: