justingardner / mgl

A suite of mex/m files for displaying psychophysics stimuli
http://justingardner.net/mgl
Other
18 stars 22 forks source link

pRFGetStimImageFromStimfile errors and crashing with stimfiles #60

Closed austinchkuo closed 1 year ago

austinchkuo commented 2 years ago

pRFGetStimImageFromStimfile takes a stimfile and is supposed to extract the stimuli used

Function throws errors with stimfiles generated by mglMetal and crashes Matlab with stimfiles generated by mgl 2.0

When using stimfiles generated through mglMetal (e.g. mglRetintopy with mglMetal; use attached file): 220608_stim01_aborted0003.mat.zip

(pRFGetStimImageFromStimfile) Computing stimulus images: 00% (00:00:00)Conversion to double from cell is not possible.

Error in mglPolygon (line 54)
xStrip(1, 1:numel(front)) = x(front);

Error in pRFGetStimImageFromStimfile>updateRetinotopyStimulus (line 343)
    mglPolygon(stimulus.maskWedgeX{stimulus.currentMask},stimulus.maskWedgeY{stimulus.currentMask},0.5);

Error in pRFGetStimImageFromStimfile>createMaskImage (line 281)
  updateRetinotopyStimulus(stimulus,s.myscreen);

Error in pRFGetStimImageFromStimfile (line 141)
    im = createMaskImage(s,stim.t(iImage));

54  xStrip(1, 1:numel(front)) = x(front);

When using mgl2.0 generated stimfiles (use attached file): 170324_stim11.mat.zip

(pRFGetStimImageFromStimfile) Computing stimulus images: 00% (00:00:00)                                                                                                                                   
--------------------------------------------------------------------------------                                                                                                                          
          Segmentation violation detected at 2022-06-08 12:50:32 -0700                                                                                                                                    
--------------------------------------------------------------------------------                                                                                                                          

Configuration:                                                                                                                                                                                            
  Crash Decoding           : Disabled - No sandbox or build area path                                                                                                                                     
  Crash Mode               : continue (default)                                                                                                                                                           
  Default Encoding         : UTF-8                                                                                                                                                                        
  Deployed                 : false                                                                                                                                                                        
  Graphics Driver          : Unknown hardware                                                                                                                                                             
  Java Version             : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode                                                                                      
  MATLAB Architecture      : maci64                                                                                                                                                                       
  MATLAB Entitlement ID    : 5658597                                                                                                                                                                      
  MATLAB Root              : /Applications/MATLAB_R2021a.app                                                                                                                                              
  MATLAB Version           : 9.10.0.1602886 (R2021a)                                                                                                                                                      
  OpenGL                   : hardware                                                                                                                                                                     
  Operating System         : Mac OS Version 10.16 (Build 21F79)                                                                                                                                           
  Process ID               : 17169                                                                                                                                                                        
  Processor ID             : x86 Family 6 Model 44 Stepping 0, GenuineIntel                                                                                                                               
  Session Key              : 0d0a1886-50eb-4d1b-b47f-11bc9303ffae                                                                                                                                         
  Window System            : Quartz

Fault Count: 1

Abnormal termination:
Segmentation violation
.
.
.
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
** This crash report has been saved to disk as /Users/austin/matlab_crash_dump.16570-1 **

MATLAB is exiting because of fatal error

Correct output using mgl2.0 should be a struct containing fields t, x, y, and im (documentation for pRFGetStimImageFromStimfile.m) Pass in a stimfile (can be either a string filename, or a strucutre with myscreen/task) created by mglRetinotopy (make sure this is a stimfile created with a version of mglRetinotopy past 10/2011 which has the proper variables stored to enable reconstruction). Will create a volume of dimensions x,y,t with the stimulus image (load in mlrVol to view). stim.x and stim.y are the X and Y coordinates in degrees of every point. stim.t is the array of times at which image is taken.

Example output (for 170324_stim11.mat.zip): test = t: [1x168 double] x: [80x60 double] y: [80x60 double] im: [80x60x168 single]

benjamin-heasly commented 2 years ago

I think we talked about revisiting this in Metal, with the functionality we have to set a texture as a rendering target, and to read texture data back into Matlab.

The best example we have of this right now should be the metal rendering tests: https://github.com/justingardner/mgl/blob/metal/mgllib/mglTestMetal/mglRunRenderingTests.m#L65

justingardner commented 1 year ago

This is the same as the issue that Eli raised. I have a fix for it that Eli is going to test. So will close this one.