Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
mgl:mglcamera [2019/10/29 18:59]
justin
mgl:mglcamera [2019/10/29 19:15]
justin
Line 211: Line 211:
  
 The file it saves is a standard [[:​mgl:​taskReferenceOverview|mgl task]] structure that has been converted with [[:​mgl:​taskReferenceSavingData#​gettaskparameters|getTaskParameters]] and has added on to it a structure with the camera images. The file it saves is a standard [[:​mgl:​taskReferenceOverview|mgl task]] structure that has been converted with [[:​mgl:​taskReferenceSavingData#​gettaskparameters|getTaskParameters]] and has added on to it a structure with the camera images.
-It will be saved in the file with name:+It will be saved in a matlab ​file with session-id as follows:
  
-[SID_YYYYMMDD_HHMMDD].amt+SID_YYYYMMDD_HHMMDD.mat
  
 <​code>​ <​code>​
->> load('workingMemoryExample'​); ​   ​+>> load('TEST_20191029_101045.mat'​); ​   ​
 >> e >> e
  
 e =  e = 
  
-                  nTrials: ​10 +                  nTrials: ​3 
-              trialVolume:​ [1 1 1 1 1 1 1 1 1 1] +              trialVolume:​ [1 1 1] 
-                trialTime: [0 19.0181041989999 ​38.0017435149994 57.0014000969995 76.0013935589996 95.0015778540001 114.002434384 133.002684323 152.002299174 171.002411732+                trialTime: [0 19.002511224011 ​38.0194256540271
-             ​trialTicknum:​ [1710 2807 3924 5021 6139 7257 8349 9466 10582 11674+             ​trialTicknum:​ [317 1443 2514
-                   ​trials:​ [1x10 struct] +                   ​trials:​ [1x3 struct] 
-                 ​blockNum:​ [1 2 3 4 5 6 7 8 9 10+                 ​blockNum:​ [1 2 3] 
-            blockTrialNum:​ [1 1 1 1 1 1 1 1 1 1] +            blockTrialNum:​ [1 1 1] 
-                 ​response:​ [1 2 1 2 1 2 1 1 1 1+                 ​response:​ [NaN NaN NaN
-             ​reactionTime:​ [1x10 double]+             ​reactionTime:​ [NaN NaN NaN]
     originalTaskParameter:​ [1x1 struct]     originalTaskParameter:​ [1x1 struct]
          ​originalRandVars:​ [1x1 struct]          ​originalRandVars:​ [1x1 struct]
-           ​responseVolume:​ [1 1 1 1 1 1 1 1 1 1+           ​responseVolume:​ [NaN NaN NaN
-          responseTimeRaw:​ [1x10 double]+          responseTimeRaw:​ [NaN NaN NaN]
                  ​randVars:​ [1x1 struct]                  ​randVars:​ [1x1 struct]
                 parameter: [1x1 struct]                 parameter: [1x1 struct]
-                   ​camera:​ [1x10 struct]+                   ​camera:​ [1x3 struct] 
 +                 ​exptName:​ '​TEST_20191029_101045'​ 
 +                        s: [1x1 struct]
 </​code>​ </​code>​
  
-There are 10 trials in the example, the relevant fields are e.response and e.randVars which has the following information (per trial):+There are trials in the example, the relevant fields are e.response and e.randVars which has the following information (per trial):
  
 <​code>​ <​code>​
Line 260: Line 262:
 </​code>​ </​code>​
  
-Note that e.response is simply which **button** was pressed by the subject (button 1 or 2) and whether that is correct or not is determined by whether the correct answer is clockwise or counter clockwise (which is coded as -1 and 1). So, to compute correct, you should do the following+These values may be Nan if there was no subject response. ​Note that e.response is simply which **button** was pressed by the subject (button 1 or 2) and whether that is correct or not is determined by whether the correct answer is clockwise or counter clockwise (which is coded as -1 and 1). So, to compute correct, you should do the following
  
 <​code>​ <​code>​
Line 266: Line 268:
 </​code>​ </​code>​
  
-BTW, this was a test run, and I think the subject may have had the buttons mixed up, so was mostly incorrect. +The camera ​info is in e.camera and you can find out which segment they were recorded in in e.camera.seg and the time relative to the beginning of the trial in e.camera.t. The exposureTime field is what the camera reports for how long the exposures are for. e.camera.im contains the images:
- +
-The camera ​images are in e.camera and you can find out which segment they were recorded in in e.camera.seg and the time relative to the beginning of the trial in e.camera.t. The exposureTime field is what the camera reports for how long the exposures are for. e.camera.im contains the images:+
  
 <​code>​ <​code>​
Line 275: Line 275:
 ans =  ans = 
  
-          nImages: ​461 +          nImages: ​425 
-              seg: [1x461 double] +              seg: [1x425 double] 
-                t: [1x461 double+                t: [1x425 double] 
-               im: [1440x1080x461 uint8+    exposureTimes:​ [1x425 double] 
-    exposureTimes:​ [1x461 double] +         filepath: '/​Volumes/​GoogleDrive/​My Drive/​docs/​2019/​shaul'​ 
 +         ​filename:​ '​[TEST_20191029_101045]-[0001].mj2'​
 </​code>​ </​code>​
  
-There is also a file in which I recorded ​the image on the screen. This can help confirm that the segment markings are correct for each image. Displaying them with [[:​mrTools:​mlrImage#​mlrvol|mlrVol]]:​+The filename ​is the video file that was saved for that particular trial. It is in the format [session-id]-[trial-sequence-number]. These images were taken of the screen ​while the experiment was running and can be viewed in matlab using [[:​mrTools:​mlrImage#​mlrvol|mlrVol]]:​
  
 <​code>​ <​code>​
->> load('​workingMemoryScreen'​); +v = VideoReader(e.camera(1).filename); 
->> mlrVol(e.camera(1).im)+frameNum = 1; 
 +while (v.hasFrame) 
 +  im(:,:,​frameNum= v.readFrame;​ 
 +  frameNum = frameNum+1;​ 
 +end 
 +mlrVol(im)
 </​code>​ </​code>​