diff --git a/lib/CPP_BIDS b/lib/CPP_BIDS index bfa76ac..faf45ad 160000 --- a/lib/CPP_BIDS +++ b/lib/CPP_BIDS @@ -1 +1 @@ -Subproject commit bfa76acd7ad6796dbe2d353a097c9c1db94cade9 +Subproject commit faf45ad07a3db2546cc605f6d19b851eb20bacb3 diff --git a/lib/CPP_PTB b/lib/CPP_PTB index 0334054..aa0799e 160000 --- a/lib/CPP_PTB +++ b/lib/CPP_PTB @@ -1 +1 @@ -Subproject commit 03340548820285460bde9e27396a2595bb2e54af +Subproject commit aa0799e2e63a1cb65f2a3d8d4336e63eb4d3a74d diff --git a/setParameters.m b/setParameters.m index 7714aeb..8767caf 100644 --- a/setParameters.m +++ b/setParameters.m @@ -18,9 +18,9 @@ cfg.debug.do = false; % To test the script out of the scanner, skip PTB sync cfg.debug.smallWin = false; % To test on a part of the screen, change to 1 - cfg.debug.transpWin = true; % To test with trasparent full size screen + cfg.debug.transpWin = false; % To test with trasparent full size screen - cfg.verbose = false; + cfg.verbose = 2; %% Engine parameters @@ -40,20 +40,22 @@ %% Experiment Design - % cfg.design.localizer = 'MT_MST'; + % switching this on to MT or MT/MST with use: + % - MT: translational motion on the whole screen + % - alternates static and motion (left or right) blocks + % - MST: radial motion centered in a circle aperture that is on the opposite + % side of the screen relative to the fixation + % - alternates fixaton left and fixation right + cfg.design.localizer = 'MT'; + % cfg.design.localizer = 'MT_MST'; - % cfg.design.motionType = 'radial'; cfg.design.motionType = 'translation'; - cfg.design.motionDirections = [0 0 180 180]; cfg.design.names = {'static'; 'motion'}; + cfg.design.nbRepetitions = 8; cfg.design.nbEventsPerBlock = 12; % DO NOT CHANGE - if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST') - cfg.design.names = {'fixation_right'; 'fixation_left'}; - end - %% Timing % FOR 7T: if you want to create localizers on the fly, the following must be @@ -73,10 +75,6 @@ % Number of seconds after the end all the stimuli before ending the run cfg.timing.endDelay = 3.6; - if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST') - cfg.timing.IBI = 3.6; - end - % reexpress those in terms of repetition time if cfg.pacedByTriggers.do @@ -94,10 +92,6 @@ % Number of seconds after the end all the stimuli before ending the run cfg.timing.endDelay = 2; - if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST') - cfg.timing.IBI = 2; - end - end %% Visual Stimulation @@ -109,9 +103,9 @@ % Number of dots per visual angle square. cfg.dot.density = 1; % Dot life time in seconds - cfg.dot.lifeTime = .15; + cfg.dot.lifeTime = .4; % proportion of dots killed per frame - cfg.dot.proportionKilledPerFrame = 0.005; + cfg.dot.proportionKilledPerFrame = 0; % Dot Size (dot width) in visual angles. cfg.dot.size = .2; cfg.dot.color = cfg.color.white; @@ -121,18 +115,9 @@ cfg.aperture.width = []; % if left empty it will take the screen height cfg.aperture.xPos = 0; - if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST') - cfg.aperture.type = 'circle'; - cfg.aperture.width = 7; % if left empty it will take the screen height - cfg.aperture.xPos = 7; - end - %% Task(s) cfg.task.name = 'visual localizer'; - if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST') - cfg.task.name = 'mt mst localizer'; - end % Instruction cfg.task.instruction = '1-Detect the RED fixation cross\n \n\n'; @@ -147,7 +132,7 @@ cfg.fixation.yDisplacement = 0; cfg.target.maxNbPerBlock = 1; - cfg.target.duration = 0.05; % In secs + cfg.target.duration = 0.1; % In secs cfg.extraColumns = { ... 'direction', ... @@ -159,6 +144,9 @@ 'fixationPosition', ... 'aperturePosition'}; + %% orverrireds the relevant fields in case we use the MT / MST localizer + cfg = setParametersMtMst(cfg); + end function cfg = setKeyboards(cfg) @@ -206,4 +194,34 @@ cfg.screen.monitorWidth = 25; cfg.screen.monitorDistance = 95; end + +end + +function cfg = setParametersMtMst(cfg) + + if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST') + + cfg.task.name = 'mt mst localizer'; + + cfg.design.motionType = 'radial'; + cfg.design.motionDirections = [666 666 -666 -666]; + cfg.design.names = {'fixation_right'; 'fixation_left'}; + cfg.design.xDisplacementFixation = 7; + cfg.design.xDisplacementAperture = 3; + + cfg.timing.IBI = 3.6; + + % reexpress those in terms of repetition time + if cfg.pacedByTriggers.do + + cfg.timing.IBI = 2; + + end + + cfg.aperture.type = 'circle'; + cfg.aperture.width = 7; % if left empty it will take the screen height + cfg.aperture.xPos = cfg.design.xDisplacementAperture; + + end + end diff --git a/subfun/doDotMo.m b/subfun/doDotMo.m index 4a4a312..b444f25 100644 --- a/subfun/doDotMo.m +++ b/subfun/doDotMo.m @@ -51,7 +51,8 @@ apertureTexture('draw', cfg, thisEvent); - if thisEvent.target(1) && GetSecs < (onset + cfg.target.duration) + thisFixation.fixation.color = cfg.fixation.color; + if thisEvent.target(1) && vbl < (onset + cfg.target.duration) thisFixation.fixation.color = cfg.fixation.colorTarget; end drawFixation(thisFixation); diff --git a/subfun/preTrialSetup.m b/subfun/preTrialSetup.m index 2c8a49a..b29c541 100644 --- a/subfun/preTrialSetup.m +++ b/subfun/preTrialSetup.m @@ -17,17 +17,32 @@ thisFixation.fixation = cfg.fixation; thisFixation.screen = cfg.screen; + % ThisEvent.dotCenterXPosPix determines by how much the dot matrix has to be + % shifted relative to the center of the screen. + % By default it is centered on screen but for the MT/MST localizer we + % shift so the center of the radial motion is matched to that of the + % aperture on the side of the screen. + % + % Meanwhile the cross is shifted on the opposite side + % + + thisEvent.dotCenterXPosPix = 0; + switch thisEvent.trial_type case 'fixation_right' cfg.aperture.xPosPix = -abs(cfg.aperture.xPosPix); - thisFixation.fixation.xDisplacement = cfg.aperture.xPos; + thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix; + + thisFixation.fixation.xDisplacement = cfg.design.xDisplacementFixation; thisFixation = initFixation(thisFixation); case 'fixation_left' cfg.aperture.xPosPix = +abs(cfg.aperture.xPosPix); - thisFixation.fixation.xDisplacement = -cfg.aperture.xPos; + thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix; + + thisFixation.fixation.xDisplacement = -cfg.design.xDisplacementFixation; thisFixation = initFixation(thisFixation); end diff --git a/visualLocTranslational.m b/visualMotionLocalizer.m similarity index 100% rename from visualLocTranslational.m rename to visualMotionLocalizer.m