Ejemplo n.º 1
0
// ######################################################################
void EyeTrackerEyeLink::calibrate2(nub::soft_ref<PsychoDisplay> d)
{
#ifndef HAVE_EYELINK
  LFATAL("Proprietary EyeLink developer API not installed");
#else
	//create SDL_Surface of a image that replaces calibration point
	if(!d->getModelParamString("PsychoDisplayFixationIcon").empty()){
		Image< PixRGB<byte> > fixicon = 
			Raster::ReadRGB(d->getModelParamString("PsychoDisplayFixationIcon"));
		SDL_Surface *img = d->makeBlittableSurface(fixicon, false, 
										PixRGB<byte>(target_background_color.r, target_background_color.g, target_background_color.b));
		set_cal_target_surface(img);
	}
	
  // Do camera setup and calibration:
 	do_tracker_setup();

//	INT16 x = 1024;
//	INT16 y = 768;
//	draw_cal_target(x, y);

	// Get calibration result
	char message[256];
	eyelink_cal_message(message);
	eyemsg_printf(message);
#endif
}
Ejemplo n.º 2
0
// SEAN -new actual
int run_trials(void)
{
  int i=0;
  
  target_foreground_color = RGB(0,0,0);          // set background for calibration
  target_background_color = RGB(255,255,255);    // This should match the display
  set_calibration_colors(target_foreground_color, target_background_color);
  
  /*TRIAL_VAR_LABELS message is recorded for EyeLink Data Viewer analysis
  It specifies the list of trial variables for the trial
  This should be written once only and put before the recording of individual trials */
  eyemsg_printf("TRIAL_VAR_LABELS TRIAL_WORD");
  
  /* PERFORM CAMERA SETUP, CALIBRATION */
  do_tracker_setup();
  
  
  //SEAN -moved from win_main
  sean_window(sean_nCmdShow, &sean_lpCmdLine);
  
  if(eyelink_is_connected()==0 || break_pressed())    /* drop out if link closed */
  {
      return ABORT_EXPT;
  }
  
  return 0;
}
Ejemplo n.º 3
0
//SEAN excluded
int run_trials_org(void)
{
  int i=0;
  int trial;
  
  target_foreground_color = RGB(0,0,0);          // set background for calibration
  target_background_color = RGB(255,255,255);    // This should match the display
  set_calibration_colors(target_foreground_color, target_background_color);
  
  /*TRIAL_VAR_LABELS message is recorded for EyeLink Data Viewer analysis
  It specifies the list of trial variables for the trial
  This should be written once only and put before the recording of individual trials */
  eyemsg_printf("TRIAL_VAR_LABELS TRIAL_WORD");
  
  /* PERFORM CAMERA SETUP, CALIBRATION */
  do_tracker_setup();
  
  
  
		/* loop through trials */
  for(trial=1;trial<=NTRIALS;trial++)
  {
    if(eyelink_is_connected()==0 || break_pressed())    /* drop out if link closed */
    {
      return ABORT_EXPT;
    }
				/* RUN THE TRIAL */
    i = do_simple_trial(trial);
    end_realtime_mode();          // safety: make sure realtime mode stopped
    
    
    
    
    switch(i)         	/* REPORT ANY ERRORS */
    {
    case ABORT_EXPT:        /* handle experiment abort or disconnect */
      eyemsg_printf("EXPERIMENT ABORTED");
      return ABORT_EXPT;
    case REPEAT_TRIAL:	  /* trial restart requested */
      eyemsg_printf("TRIAL REPEATED");
      trial--;
      break;
    case SKIP_TRIAL:	  /* skip trial */
      eyemsg_printf("TRIAL ABORTED");
      break;
    case TRIAL_OK:          // successful trial
      eyemsg_printf("TRIAL OK");
      break;
    default:                // other error code
      eyemsg_printf("TRIAL ERROR");
      break;
    }
  }  // END OF TRIAL LOOP
  return 0;
}
	/* from the tracker ABORT menu. */
int run_trials(void)
{
  int i;
  int trial;
                 // INITIAL CALIBRATION: matches following trials
  target_foreground_color = RGB(0,0,0);         // color of calibration target
  target_background_color = RGB(200,200,200);   // background for drift correction
  set_calibration_colors(target_foreground_color, target_background_color); // tell EXPTSPPT the colors
   
  // TRIAL_VAR_LABELS message is recorded for EyeLink Data Viewer analysis
  // It specifies the list of trial variables for the trial 
  // This should be written once only and put before the recording of individual trials
  eyemsg_printf("TRIAL_VAR_LABELS TYPE CENTRAL PERIPHERAL");

  if(SCRWIDTH!=800 || SCRHEIGHT!=600)
    alert_printf("Display mode is not 800x600, resizing will slow loading.");

  		/* PERFORM CAMERA SETUP, CALIBRATION */
  do_tracker_setup();
				/* loop through trials */
  for(trial=1;trial<=NTRIALS;trial++)
    {
      if(eyelink_is_connected()==0 || break_pressed())    /* drop out if link closed */
	{
	  return ABORT_EXPT;
	}
				/* RUN THE TRIAL */
      i = do_gcwindow_trial(trial);
      end_realtime_mode();

      switch(i)         	/* REPORT ANY ERRORS */
	{
	  case ABORT_EXPT:        /* handle experiment abort or disconnect */
	    eyemsg_printf("EXPERIMENT ABORTED");
	    return ABORT_EXPT;
	  case REPEAT_TRIAL:	  /* trial restart requested */
	    eyemsg_printf("TRIAL REPEATED");
	    trial--;
	    break;
	  case SKIP_TRIAL:	  /* skip trial */
	    eyemsg_printf("TRIAL ABORTED");
	    break;
	  case TRIAL_OK:          // successful trial
	    eyemsg_printf("TRIAL OK");
	    break;
	  default:                // other error code
	    eyemsg_printf("TRIAL ERROR");
	    break;
	}
    }  // END OF TRIAL LOOP
  return 0;
}
/******************************** TRIAL LOOP ************************************

	This code sequences trials within a block  It calls run_trial() to 
	execute a trial, then interperts result code. It places a result message 
	in the EDF file. This example allows trials to be repeated from 
	the tracker ABORT menu. 
 ********************************************************************************/
int run_trials(void)
{
  int i;
  int trial;
  
  SETCOLOR(target_foreground_color,0,0,0);       /* set background for calibration */
  SETCOLOR(target_background_color,255,255,255); /* This should match the display */
  set_calibration_colors(&target_foreground_color, &target_background_color); 
        
  /* PERFORM CAMERA SETUP, CALIBRATION */
  do_tracker_setup();
				
  /* loop through trials */
  for(trial=1;trial<=NTRIALS;trial++)
    {
      if(eyelink_is_connected()==0 || break_pressed())    /* drop out if link closed */
		{
			return ABORT_EXPT;
		}
		/* RUN THE TRIAL */
		i = do_simple_trial(trial);
		end_realtime_mode();          /* safety: make sure realtime mode stopped */

		switch(i)         	/* REPORT ANY ERRORS */
		{
		case ABORT_EXPT:        /* handle experiment abort or disconnect */
			eyemsg_printf("EXPERIMENT ABORTED");
			return ABORT_EXPT;
		case REPEAT_TRIAL:	  /* trial restart requested */
			eyemsg_printf("TRIAL REPEATED");
			trial--;
			break;
		case SKIP_TRIAL:	  /* skip trial */
			eyemsg_printf("TRIAL ABORTED");
			break;
		case TRIAL_OK:          /* successful trial */
		    eyemsg_printf("TRIAL OK");
		    break;
		default:                /* other error code */
		    eyemsg_printf("TRIAL ERROR");
			break;
		}
    }  /* END OF TRIAL LOOP */
  return 0;
}