From 2db46f988c3f99b7d08fdcfe541c52beb51632c0 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Fri, 25 Sep 2020 22:23:02 +0200 Subject: [PATCH 1/3] MT / MST ready --- lib/CPP_BIDS | 2 +- lib/CPP_PTB | 2 +- setParameters.m | 23 ++++++++++++++--------- subfun/preTrialSetup.m | 11 +++++++++-- 4 files changed, 25 insertions(+), 13 deletions(-) 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..cb146d2 100644 --- a/setParameters.m +++ b/setParameters.m @@ -18,7 +18,7 @@ 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; @@ -40,13 +40,18 @@ %% Experiment Design - % cfg.design.localizer = 'MT_MST'; + cfg.design.localizer = 'MT_MST'; - % cfg.design.motionType = 'radial'; - cfg.design.motionType = 'translation'; - - cfg.design.motionDirections = [0 0 180 180]; + cfg.design.motionType = 'radial'; + cfg.design.motionDirections = [666 666 -666 -666]; cfg.design.names = {'static'; 'motion'}; + cfg.design.xDisplacementFixation = 7; + cfg.design.xDisplacementAperture = 3; + +% 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 @@ -109,9 +114,9 @@ % Number of dots per visual angle square. cfg.dot.density = 1; % Dot life time in seconds - cfg.dot.lifeTime = .15; + cfg.dot.lifeTime = .5; % proportion of dots killed per frame - cfg.dot.proportionKilledPerFrame = 0.005; + cfg.dot.proportionKilledPerFrame = 0.05; % Dot Size (dot width) in visual angles. cfg.dot.size = .2; cfg.dot.color = cfg.color.white; @@ -124,7 +129,7 @@ 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; + cfg.aperture.xPos = cfg.design.xDisplacementAperture; end %% Task(s) diff --git a/subfun/preTrialSetup.m b/subfun/preTrialSetup.m index 2c8a49a..21c8b74 100644 --- a/subfun/preTrialSetup.m +++ b/subfun/preTrialSetup.m @@ -16,18 +16,25 @@ % If this frame shows a target we change the color of the cross thisFixation.fixation = cfg.fixation; thisFixation.screen = cfg.screen; + + % To shift the dot matrix + thisEvent.dotCenterXPosPix = 0; switch thisEvent.trial_type case 'fixation_right' cfg.aperture.xPosPix = -abs(cfg.aperture.xPosPix); + + thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix; - thisFixation.fixation.xDisplacement = cfg.aperture.xPos; + thisFixation.fixation.xDisplacement = cfg.design.xDisplacementFixation; thisFixation = initFixation(thisFixation); case 'fixation_left' cfg.aperture.xPosPix = +abs(cfg.aperture.xPosPix); + + thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix; - thisFixation.fixation.xDisplacement = -cfg.aperture.xPos; + thisFixation.fixation.xDisplacement = -cfg.design.xDisplacementFixation; thisFixation = initFixation(thisFixation); end From b8b183b9bd0cbc6d96dc3b12a7f1f5dd32706d51 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Thu, 1 Oct 2020 17:31:50 +0200 Subject: [PATCH 2/3] rename main script and lint --- setParameters.m | 85 +++++++++++-------- subfun/preTrialSetup.m | 16 +++- ...Translational.m => visualMotionLocalizer.m | 0 3 files changed, 61 insertions(+), 40 deletions(-) rename visualLocTranslational.m => visualMotionLocalizer.m (100%) diff --git a/setParameters.m b/setParameters.m index cb146d2..3a1c2c1 100644 --- a/setParameters.m +++ b/setParameters.m @@ -20,7 +20,7 @@ cfg.debug.smallWin = false; % To test on a part of the screen, change to 1 cfg.debug.transpWin = false; % To test with trasparent full size screen - cfg.verbose = false; + cfg.verbose = 2; %% Engine parameters @@ -40,25 +40,22 @@ %% Experiment Design - cfg.design.localizer = 'MT_MST'; - - cfg.design.motionType = 'radial'; - cfg.design.motionDirections = [666 666 -666 -666]; + % 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 = 'translation'; + cfg.design.motionDirections = [0 0 180 180]; cfg.design.names = {'static'; 'motion'}; - cfg.design.xDisplacementFixation = 7; - cfg.design.xDisplacementAperture = 3; - -% 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 @@ -78,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 @@ -99,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 @@ -114,9 +103,9 @@ % Number of dots per visual angle square. cfg.dot.density = 1; % Dot life time in seconds - cfg.dot.lifeTime = .5; + cfg.dot.lifeTime = .4; % proportion of dots killed per frame - cfg.dot.proportionKilledPerFrame = 0.05; + cfg.dot.proportionKilledPerFrame = 0; % Dot Size (dot width) in visual angles. cfg.dot.size = .2; cfg.dot.color = cfg.color.white; @@ -126,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 = cfg.design.xDisplacementAperture; - 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'; @@ -152,7 +132,7 @@ cfg.fixation.yDisplacement = 0; cfg.target.maxNbPerBlock = 1; - cfg.target.duration = 0.05; % In secs + cfg.target.duration = 0.025; % In secs cfg.extraColumns = { ... 'direction', ... @@ -164,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) @@ -211,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/preTrialSetup.m b/subfun/preTrialSetup.m index 21c8b74..b29c541 100644 --- a/subfun/preTrialSetup.m +++ b/subfun/preTrialSetup.m @@ -16,14 +16,22 @@ % If this frame shows a target we change the color of the cross thisFixation.fixation = cfg.fixation; thisFixation.screen = cfg.screen; - - % To shift the dot matrix + + % 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); - + thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix; thisFixation.fixation.xDisplacement = cfg.design.xDisplacementFixation; @@ -31,7 +39,7 @@ case 'fixation_left' cfg.aperture.xPosPix = +abs(cfg.aperture.xPosPix); - + thisEvent.dotCenterXPosPix = cfg.aperture.xPosPix; thisFixation.fixation.xDisplacement = -cfg.design.xDisplacementFixation; diff --git a/visualLocTranslational.m b/visualMotionLocalizer.m similarity index 100% rename from visualLocTranslational.m rename to visualMotionLocalizer.m From f16bcff7e7b33587d43672ac837e7ff7cc06dd55 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Thu, 1 Oct 2020 17:48:38 +0200 Subject: [PATCH 3/3] fixes target being displayed too long --- setParameters.m | 2 +- subfun/doDotMo.m | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setParameters.m b/setParameters.m index 3a1c2c1..8767caf 100644 --- a/setParameters.m +++ b/setParameters.m @@ -132,7 +132,7 @@ cfg.fixation.yDisplacement = 0; cfg.target.maxNbPerBlock = 1; - cfg.target.duration = 0.025; % In secs + cfg.target.duration = 0.1; % In secs cfg.extraColumns = { ... 'direction', ... 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);