PsychoDisplay Class Reference

Class fo do various psychophysics displays. More...

#include <Psycho/PsychoDisplay.H>

Inheritance diagram for PsychoDisplay:
Inheritance graph
[legend]
Collaboration diagram for PsychoDisplay:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Constructors, destructor and initialization

 PsychoDisplay (OptionManager &mgr, const std::string &descrName="Psycho Display", const std::string &tagName="PsychoDisplay")
 Constructor.
 ~PsychoDisplay ()
 Destructor.
void setEyeTracker (nub::soft_ref< EyeTracker > e)
 Optionally we may work in conjunction with an EyeTracker.
void setFixationSize (const int size)
 Set the size of the fixation point.
Display and interaction functions

void clearScreen (const bool vsync=true)
 Clear screen using our default grey.
void displayCircle (const int x=-1, const int y=-1, const int radius=10, const PixRGB< byte > color=PixRGB< byte >(255, 255, 255), const bool vsync=true)
 display a circle
void displayFilledCircle (const int x=-1, const int y=-1, const int radius=10, const PixRGB< byte > color=PixRGB< byte >(255, 255, 255), const bool vsync=true)
 display a filled circle
void displayFilledCircleBlink (const int x=-1, const int y=-1, const int radius=10, const PixRGB< byte > color=PixRGB< byte >(255, 255, 255), const int iter=5, const int delay=2)
void displayFixationIcon (const Image< PixRGB< byte > > &image, const int x=-1, const int y=-1, const bool vsync=true)
 display a fixation image icon
void displayFixationIconBlink (const Image< PixRGB< byte > > &image, const int x=-1, const int y=-1, const int iter=5, const int delay=2)
 blink a fixation image icon
void displayFixation (const int x=-1, const int y=-1, const bool vsync=true)
 display a fixation cross
void displayFixationBlink (const int x=-1, const int y=-1, const int iter=5, const int delay=2)
 blink a fixation cross
void displayColorDotFixation (const int x=-1, const int y=-1, const PixRGB< byte > color=PixRGB< byte >(255, 255, 255), const bool vsync=true)
 display a fixation red dot
void displayColorDotFixationBlink (const int x=-1, const int y=-1, const int iter=5, const int delay=2, const PixRGB< byte > color=PixRGB< byte >(255, 255, 255))
 blink a fixation color dot
void displayRedDotFixation (const int x=-1, const int y=-1, const bool vsync=true)
 display a fixation red dot
void displayWhiteDotFixation (const int x=-1, const int y=-1, const bool vsync=true)
 display a fixation white dot
void displayRedDotFixationBlink (const int x=-1, const int y=-1, const int iter=5, const int delay=2)
 blink a fixation red dot
void displayRedDotFixationBlink (Image< PixRGB< byte > > img, const int x=-1, const int y=-1, const int iter=5, const int delay=2)
void displayISCANcalib ()
 display a static low-level 5-point ISCAN calibration array
void displayEyeTrackerCalibration (const int nptshoriz=7, const int nptsvertic=5, const int timefactor=1, const bool mouserespond=false)
 display a bunch of eye-tracker calibration dots
void displayMovingDotBackground (SDL_Surface *img, const int startX=320, const int startY=240, const int endX=320, const int endY=100, const float speed=10.0, const PixRGB< byte > color=PixRGB< byte >(255, 255, 255))
 display a dot moving on a bacground image
void displayMovingDotTrain (const Image< PixRGB< byte > > &img, int location[][2], int num_loc, float speed[], int stay[], const PixRGB< byte > color=PixRGB< byte >(255, 255, 255))
 string together many dot animations
void displaySmoothPursuitGroupCalibration (int location[][2], int num_loc, float speed[], int num_speed)
 display a square that moves along the path in different speed each time
void displaySmoothPursuitCalibration (const int startX=10, const int startY=10, const int endX=500, const int endY=500, const float speed=10.0, uint color=0)
 display a square moving from start point to end point for
void displaySmoothPursuitFancyTrace (int location[][2], int num_loc, float speed[], int stay[], uint color)
 display a square moving along the path with different speed from transition location
void drawCloud (DOT *clouds, const int numDots=-1, const Uint8 r=0xff, const Uint8 g=0xff, const Uint8 b=0xff, const bool vsync=true)
 display a cloud of dots
void drawClouds (DOT *newClouds, DOT *oldClouds, const int numDots=-1, const Uint8 r=0xff, const Uint8 g=0xff, const Uint8 b=0xff, const bool vsync=true)
 display a cloud of dots
void displayText (const std::string &msg, const bool vsync=true, int ind=0, const int fontsize=10)
void displayText (const std::string &msg, const Point2D< int > &p, const PixRGB< byte > txtcol, const PixRGB< byte > bgcol, const bool vsync=true)
void displayRandomText (const int stringlength=8, const int fontsize=6, const bool vsync=true, int ind=0)
int displayNumbers (const int targetRow=-1, const int targetCol=-1, const bool vsync=true)
 display a 5x5 grid of random numbers
int drawPoint (const Point2D< int > thePoint)
int drawPointColor (const Point2D< int > thePoint, PixRGB< byte > color)
int drawCalibPoint (const Point2D< int > thePoint)
Access functions

PixRGB< bytegetGrey () const
 Get background grey value.
void changeBackgroundColor (PixRGB< byte > c)
 change background color

Protected Member Functions

Uint32 getGreyUint32 () const
 Get our background grey as Uint32 color (for use with SDL).
Uint32 getBlackUint32 () const
 Get our black as Uint32 color (for use with SDL).
Uint32 getWhiteUint32 () const
 Get our white as Uint32 color (for use with SDL).

Protected Attributes

OModelParam< PixRGB< byte > > itsBackgroundColor
 background grey color
OModelParam< PixRGB< byte > > itsTextColor
 text foreground color
OModelParam< PixRGB< byte > > itsBlack
 "black" color
OModelParam< PixRGB< byte > > itsWhite
 "white" color
OModelParam< std::stringitsFixationIcon
 image icon for fixation
NModelParam< int > itsFixSiz
 size of fixation cross
NModelParam< int > itsFixThick
 thickness of fixation cross

Detailed Description

Class fo do various psychophysics displays.

This class is to facilitate the display of various psychophysics stimuli, with an initial emphasis on playing movies at a controlled framerate. Programs using this class, such as psycho-movie.C, should run as root if SCHED_FIFO scheduling is required (and I highly recommend it, as it will make timing reliable). The class uses the SDLdisplay class to do the displays, and PsychoDisplay derives from SDLdisplay. See GUI/SDLdisplay.H for basic SDL info.

Definition at line 66 of file PsychoDisplay.H.


Constructor & Destructor Documentation

PsychoDisplay::PsychoDisplay ( OptionManager mgr,
const std::string descrName = "Psycho Display",
const std::string tagName = "PsychoDisplay" 
)

Constructor.

Definition at line 84 of file PsychoDisplay.C.

PsychoDisplay::~PsychoDisplay (  ) 

Destructor.

Definition at line 98 of file PsychoDisplay.C.


Member Function Documentation

void PsychoDisplay::changeBackgroundColor ( PixRGB< byte c  ) 

change background color

Definition at line 956 of file PsychoDisplay.C.

References itsBackgroundColor, and OModelParam< T >::setVal().

void PsychoDisplay::clearScreen ( const bool  vsync = true  ) 
void PsychoDisplay::displayCircle ( const int  x = -1,
const int  y = -1,
const int  radius = 10,
const PixRGB< byte color = PixRGB<byte>(255,255,255),
const bool  vsync = true 
)

display a circle

Parameters:
x horizontal position of center of cross, or -1 to have it at the center of the screen
y vertical position of center of cross, or -1 to have it at the center of the screen
radius radius of the circle
ringwidth width of the ring
color of the circle
vsync will attempt to sync with vertical blanking if true

Definition at line 179 of file PsychoDisplay.C.

References PixRGB< T >::blue(), OModelParam< T >::getVal(), PixRGB< T >::green(), Dims::h(), SDLdisplay::itsDims, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), PixRGB< T >::red(), sformat(), and Dims::w().

void PsychoDisplay::displayColorDotFixation ( const int  x = -1,
const int  y = -1,
const PixRGB< byte color = PixRGB<byte>(255,255,255),
const bool  vsync = true 
)

display a fixation red dot

Parameters:
x horizontal position of center of dot, or -1 to have it at the center of the screen
y vertical position of center of cross, or -1 to have it at the center of the screen
color RGB to specifiy the color
vsync will attempt to sync with vertical blanking if true

Definition at line 288 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), Dims::h(), SDLdisplay::itsDims, itsFixSiz, and Dims::w().

Referenced by displayColorDotFixationBlink().

void PsychoDisplay::displayColorDotFixationBlink ( const int  x = -1,
const int  y = -1,
const int  iter = 5,
const int  delay = 2,
const PixRGB< byte color = PixRGB<byte>(255,255,255) 
)

blink a fixation color dot

Parameters:
iter number of times we should blink the cross
delay blink duration, in frames as per our frame duration ModelParam

Definition at line 271 of file PsychoDisplay.C.

References displayColorDotFixation(), OModelParam< T >::getVal(), itsBackgroundColor, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), and SDLdisplay::waitNextRequestedVsync().

void PsychoDisplay::displayEyeTrackerCalibration ( const int  nptshoriz = 7,
const int  nptsvertic = 5,
const int  timefactor = 1,
const bool  mouserespond = false 
)
void PsychoDisplay::displayFilledCircle ( const int  x = -1,
const int  y = -1,
const int  radius = 10,
const PixRGB< byte color = PixRGB<byte>(255,255,255),
const bool  vsync = true 
)

display a filled circle

Parameters:
x horizontal position of center of cross, or -1 to have it at the center of the screen
y vertical position of center of cross, or -1 to have it at the center of the screen
radius radius of the circle
ringwidth width of the ring
color of the circle
vsync will attempt to sync with vertical blanking if true

Definition at line 201 of file PsychoDisplay.C.

References PixRGB< T >::blue(), OModelParam< T >::getVal(), PixRGB< T >::green(), Dims::h(), SDLdisplay::itsDims, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), PixRGB< T >::red(), sformat(), and Dims::w().

void PsychoDisplay::displayFixation ( const int  x = -1,
const int  y = -1,
const bool  vsync = true 
)

display a fixation cross

Parameters:
x horizontal position of center of cross, or -1 to have it at the center of the screen
y vertical position of center of cross, or -1 to have it at the center of the screen
vsync will attempt to sync with vertical blanking if true

Definition at line 142 of file PsychoDisplay.C.

References getBlackUint32(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), Dims::h(), SDLdisplay::itsDims, itsFixSiz, itsFixThick, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), sformat(), and Dims::w().

Referenced by displayEyeTrackerCalibration(), displayFixationBlink(), and displaySmoothPursuitGroupCalibration().

void PsychoDisplay::displayFixationBlink ( const int  x = -1,
const int  y = -1,
const int  iter = 5,
const int  delay = 2 
)

blink a fixation cross

Parameters:
iter number of times we should blink the cross
delay blink duration, in frames as per our frame duration ModelParam

Definition at line 256 of file PsychoDisplay.C.

References clearScreen(), displayFixation(), SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), and SDLdisplay::waitNextRequestedVsync().

Referenced by displayEyeTrackerCalibration().

void PsychoDisplay::displayFixationIcon ( const Image< PixRGB< byte > > &  image,
const int  x = -1,
const int  y = -1,
const bool  vsync = true 
)

display a fixation image icon

Parameters:
image icon that replaces fixation cross
x horizontal position of center of cross, or -1 to have it at the center of the screen
y vertical position of center of cross, or -1 to have it at the center of the screen
vsync will attempt to sync with vertical blanking if true

Definition at line 116 of file PsychoDisplay.C.

References SDLdisplay::displayImagePatch(), OModelParam< T >::getVal(), Image< T >::getWidth(), Dims::h(), image, SDLdisplay::itsDims, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), sformat(), and Dims::w().

Referenced by displayFixationIconBlink().

void PsychoDisplay::displayFixationIconBlink ( const Image< PixRGB< byte > > &  image,
const int  x = -1,
const int  y = -1,
const int  iter = 5,
const int  delay = 2 
)

blink a fixation image icon

Parameters:
image icon that replaces fixation cross
iter number of times we should blink the cross
delay blink duration, in frames as per our frame duration ModelParam

Definition at line 240 of file PsychoDisplay.C.

References clearScreen(), displayFixationIcon(), image, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), and SDLdisplay::waitNextRequestedVsync().

void PsychoDisplay::displayISCANcalib (  ) 

display a static low-level 5-point ISCAN calibration array

Definition at line 402 of file PsychoDisplay.C.

References getBlackUint32(), OModelParam< T >::getVal(), getWhiteUint32(), Dims::h(), SDLdisplay::itsDims, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), and Dims::w().

void PsychoDisplay::displayMovingDotBackground ( SDL_Surface *  img,
const int  startX = 320,
const int  startY = 240,
const int  endX = 320,
const int  endY = 100,
const float  speed = 10.0,
const PixRGB< byte color = PixRGB<byte>(255,255,255) 
)

display a dot moving on a bacground image

Definition at line 435 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), Point2D< T >::i, SDLdisplay::pushEvent(), sformat(), sqrt(), and SDLdisplay::waitNextRequestedVsync().

Referenced by displayMovingDotTrain().

void PsychoDisplay::displayMovingDotTrain ( const Image< PixRGB< byte > > &  img,
int  location[][2],
int  num_loc,
float  speed[],
int  stay[],
const PixRGB< byte color = PixRGB<byte>(255,255,255) 
)
int PsychoDisplay::displayNumbers ( const int  targetRow = -1,
const int  targetCol = -1,
const bool  vsync = true 
)

display a 5x5 grid of random numbers

This is flashed after every trial and subject is asked to report the number that appeared at the target location.

Definition at line 843 of file PsychoDisplay.C.

References SDLdisplay::displaySurface(), OModelParam< T >::getVal(), Point2D< T >::i, itsBackgroundColor, SDLdisplay::itsDims, itsTextColor, NO_INIT, randShuffle(), and writeText().

void PsychoDisplay::displayRedDotFixation ( const int  x = -1,
const int  y = -1,
const bool  vsync = true 
)

display a fixation red dot

Parameters:
x horizontal position of center of dot, or -1 to have it at the center of the screen
y vertical position of center of cross, or -1 to have it at the center of the screen
vsync will attempt to sync with vertical blanking if true

Definition at line 313 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), Dims::h(), SDLdisplay::itsDims, itsFixSiz, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), sformat(), and Dims::w().

Referenced by displayRedDotFixationBlink().

void PsychoDisplay::displayRedDotFixationBlink ( const int  x = -1,
const int  y = -1,
const int  iter = 5,
const int  delay = 2 
)

blink a fixation red dot

Parameters:
iter number of times we should blink the cross
delay blink duration, in frames as per our frame duration ModelParam

Definition at line 367 of file PsychoDisplay.C.

References clearScreen(), displayRedDotFixation(), SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), and SDLdisplay::waitNextRequestedVsync().

void PsychoDisplay::displaySmoothPursuitCalibration ( const int  startX = 10,
const int  startY = 10,
const int  endX = 500,
const int  endY = 500,
const float  speed = 10.0,
uint  color = 0 
)

display a square moving from start point to end point for

Parameters:
startX x position of the starting point
startY y position of the starting point
endX x position of the end point
endY y position of the end point
speed pixels/secs

Definition at line 556 of file PsychoDisplay.C.

References getGreyUint32(), SDLdisplay::getUint32color(), OModelParam< T >::getVal(), Point2D< T >::i, itsBackgroundColor, SDLdisplay::pushEvent(), sformat(), sqrt(), and SDLdisplay::waitNextRequestedVsync().

Referenced by displaySmoothPursuitFancyTrace(), and displaySmoothPursuitGroupCalibration().

void PsychoDisplay::displaySmoothPursuitFancyTrace ( int  location[][2],
int  num_loc,
float  speed[],
int  stay[],
uint  color 
)

display a square moving along the path with different speed from transition location

Parameters:
location transition points that segment path. The first index is point and the second index is the x or y position of the point
num_loc number of transition points specified
speed pixels/frame. It specify the speed from each transition point to point
stay number of frames to stay

Definition at line 607 of file PsychoDisplay.C.

References clearScreen(), displaySmoothPursuitCalibration(), getGreyUint32(), SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), sformat(), and SDLdisplay::waitNextRequestedVsync().

void PsychoDisplay::displaySmoothPursuitGroupCalibration ( int  location[][2],
int  num_loc,
float  speed[],
int  num_speed 
)

display a square that moves along the path in different speed each time

Parameters:
location points that segment path. The first index is point and the second index is the x or y position of the point
num_loc number of locations specified
speed pixels/frame. If more than one speed is specified, then it displays the same path with differnt speed
num_speed number of speeds specified

Definition at line 522 of file PsychoDisplay.C.

References clearScreen(), displayFixation(), displaySmoothPursuitCalibration(), SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), and SDLdisplay::waitForKey().

void PsychoDisplay::displayText ( const std::string msg,
const bool  vsync = true,
int  ind = 0,
const int  fontsize = 10 
)

show a text message using our default colors show a text message

Parameters:
ind ind=0 displays the text in the middle of screen, ind =1 displays the text on top or the screen and ind = -1 displays the message at the buttom of the display, ind=-2 for random placement of the message

Definition at line 763 of file PsychoDisplay.C.

References OModelParam< T >::getVal(), itsBackgroundColor, and itsTextColor.

void PsychoDisplay::displayWhiteDotFixation ( const int  x = -1,
const int  y = -1,
const bool  vsync = true 
)

display a fixation white dot

Parameters:
x horizontal position of center of dot, or -1 to have it at the center of the screen
y vertical position of center of cross, or -1 to have it at the center of the screen
vsync will attempt to sync with vertical blanking if true

Definition at line 340 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), OModelParam< T >::getVal(), NModelParam< T >::getVal(), Dims::h(), SDLdisplay::itsDims, itsFixSiz, SDLdisplay::pushEventBegin(), SDLdisplay::pushEventEnd(), sformat(), and Dims::w().

void PsychoDisplay::drawCloud ( DOT clouds,
const int  numDots = -1,
const Uint8  r = 0xff,
const Uint8  g = 0xff,
const Uint8  b = 0xff,
const bool  vsync = true 
)

display a cloud of dots

Definition at line 780 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), and SDLdisplay::putPixel32().

void PsychoDisplay::drawClouds ( DOT newClouds,
DOT oldClouds,
const int  numDots = -1,
const Uint8  r = 0xff,
const Uint8  g = 0xff,
const Uint8  b = 0xff,
const bool  vsync = true 
)

display a cloud of dots

Definition at line 810 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), and SDLdisplay::putPixel32().

Uint32 PsychoDisplay::getBlackUint32 (  )  const [protected]

Get our black as Uint32 color (for use with SDL).

Definition at line 948 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), OModelParam< T >::getVal(), and itsBlack.

Referenced by displayEyeTrackerCalibration(), displayFixation(), and displayISCANcalib().

PixRGB< byte > PsychoDisplay::getGrey (  )  const

Get background grey value.

Definition at line 776 of file PsychoDisplay.C.

References OModelParam< T >::getVal(), and itsBackgroundColor.

Uint32 PsychoDisplay::getGreyUint32 (  )  const [protected]

Get our background grey as Uint32 color (for use with SDL).

Definition at line 944 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), OModelParam< T >::getVal(), and itsBackgroundColor.

Referenced by displaySmoothPursuitCalibration(), and displaySmoothPursuitFancyTrace().

Uint32 PsychoDisplay::getWhiteUint32 (  )  const [protected]

Get our white as Uint32 color (for use with SDL).

Definition at line 952 of file PsychoDisplay.C.

References SDLdisplay::getUint32color(), OModelParam< T >::getVal(), and itsWhite.

Referenced by displayEyeTrackerCalibration(), and displayISCANcalib().

void PsychoDisplay::setEyeTracker ( nub::soft_ref< EyeTracker e  ) 

Optionally we may work in conjunction with an EyeTracker.

Definition at line 102 of file PsychoDisplay.C.

void PsychoDisplay::setFixationSize ( const int  size  ) 

Set the size of the fixation point.

Definition at line 106 of file PsychoDisplay.C.

References itsFixSiz, and NModelParam< T >::setVal().


Member Data Documentation

"black" color

Definition at line 337 of file PsychoDisplay.H.

Referenced by getBlackUint32().

image icon for fixation

Definition at line 339 of file PsychoDisplay.H.

thickness of fixation cross

Definition at line 342 of file PsychoDisplay.H.

Referenced by displayFixation().

text foreground color

Definition at line 336 of file PsychoDisplay.H.

Referenced by displayNumbers(), and displayText().

"white" color

Definition at line 338 of file PsychoDisplay.H.

Referenced by getWhiteUint32().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:43 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3