Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/CPP_BIDS
Submodule CPP_BIDS updated 0 files
12 changes: 6 additions & 6 deletions setParameters.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@

%% Experiment Design

% cfg.design.motionType = 'translation';
% cfg.design.motionType = 'radial';
% cfg.design.motionType = 'translation';
% cfg.design.motionType = 'radial';
cfg.design.motionType = 'translation';
cfg.design.names = {'static'; 'motion'};
cfg.design.nbRepetitions = 4;
cfg.design.nbEventsPerBlock = 12; % DO NOT CHANGE

%% Timing

% FOR 7T: if you want to create localizers on the fly, the following must be
% multiples of the scanneryour sequence TR
%
%
% IBI
% block length = (cfg.eventDuration + cfg.ISI) * cfg.design.nbEventsPerBlock

% Time between blocs in secs
cfg.IBI = 1.8*3; % 8;
cfg.IBI = 1.8 * 3; % 8;
% Time between events in secs
cfg.ISI = 0.1;
% Number of seconds before the motion stimuli are presented
Expand All @@ -59,7 +59,7 @@
cfg.endDelay = .1;

cfg.eventDuration = 0.8; % second

%% Visual Stimulation

% Speed in visual angles / second
Expand Down
2 changes: 1 addition & 1 deletion subfun/doDotMo.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

apertureTexture('draw', cfg, thisEvent);

% If this frame shows a target we change the color
% If this frame shows a target we change the color of the cross
thisFixation.fixation = cfg.fixation;
thisFixation.screen = cfg.screen;
if thisEvent.target(1) && GetSecs < (onset + cfg.target.duration)
Expand Down
14 changes: 7 additions & 7 deletions subfun/expDesign.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

% Set variables here for a dummy test of this function
if nargin < 1 || isempty(cfg)
% cfg.design.motionType = 'translation';
% cfg.design.motionType = 'translation';
cfg.design.motionType = 'radial';
cfg.design.names = {'static'; 'motion'};
cfg.design.nbRepetitions = 4;
Expand Down Expand Up @@ -184,20 +184,20 @@
end

function [MOTION_DIRECTIONS, STATIC_DIRECTIONS] = getDirectionBaseVectors(cfg)

% CONSTANTS
% Set directions for static and motion condition

STATIC_DIRECTIONS = [-1 -1 -1 -1];

switch cfg.design.motionType
case 'translation'
MOTION_DIRECTIONS = [0 90 180 270];
case 'radial'
STATIC_DIRECTIONS = [666 -666 666 -666];
MOTION_DIRECTIONS = [666 -666 666 -666];
end
end

end

function [nbBlocks, nbRepet, nbEventsBlock, maxTargBlock] = getInput(cfg)
Expand Down Expand Up @@ -271,7 +271,7 @@ function diplayDesign(cfg, displayFigs)
title('Fixation Targets position distribution');

figure(2);

[motionDirections] = getDirectionBaseVectors(cfg);
motionDirections = unique(motionDirections);

Expand Down
24 changes: 24 additions & 0 deletions subfun/saveResponsesAndTriggers.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString)

if isfield(responseEvents(1), 'onset') && ~isempty(responseEvents(1).onset)

for iResp = 1:size(responseEvents, 1)
responseEvents(iResp).onset = ...
responseEvents(iResp).onset - cfg.experimentStart;
responseEvents(iResp).event = 'n/a';
responseEvents(iResp).block = 'n/a';
responseEvents(iResp).direction = 'n/a';
responseEvents(iResp).speed = 'n/a';
responseEvents(iResp).target = 'n/a';
if strcmp(responseEvents(iResp).keyName, 't')
responseEvents(iResp).trial_type = triggerString;
end
end

responseEvents(1).fileID = logFile.fileID;
responseEvents(1).extraColumns = logFile.extraColumns;
saveEventsFile('save', cfg, responseEvents);

end

end
66 changes: 15 additions & 51 deletions visualLocTanslational.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
[cfg] = initPTB(cfg);

cfg.dot.matrixWidth = cfg.screen.winHeight;

% Convert some values from degrees to pixels
cfg.dot = degToPix('size', cfg.dot, cfg);
cfg.dot = degToPix('speed', cfg.dot, cfg);
Expand All @@ -56,7 +56,7 @@
% Prepare for the output logfiles with all
logFile.extraColumns = cfg.extraColumns;
logFile = saveEventsFile('open', cfg, logFile);

% prepare textures
cfg = apertureTexture('init', cfg);
cfg = dotTexture('init', cfg);
Expand All @@ -67,14 +67,15 @@

% prepare the KbQueue to collect responses
getResponse('init', cfg.keyboard.responseBox, cfg);
getResponse('start', cfg.keyboard.responseBox);

% Wait for Trigger from Scanner
waitForTrigger(cfg);

%% Experiment Start
cfg = getExperimentStart(cfg);

getResponse('start', cfg.keyboard.responseBox);

WaitSecs(cfg.onsetDelay);

%% For Each Block
Expand Down Expand Up @@ -119,62 +120,25 @@
% saving in the tsv file
responseEvents = getResponse('check', cfg.keyboard.responseBox, cfg, ...
getOnlyPress);

if isfield(responseEvents(1), 'onset') && ~isempty(responseEvents(1).onset)

for iResp = 1:size(responseEvents, 1)
responseEvents(iResp).onset = ...
responseEvents(iResp).onset - cfg.experimentStart;
responseEvents(iResp).event = 'n/a';
responseEvents(iResp).block = 'n/a';
responseEvents(iResp).direction = 'n/a';
responseEvents(iResp).speed = 'n/a';
responseEvents(iResp).target = 'n/a';
if strcmp(responseEvents(iResp).keyName, 't')
responseEvents(iResp).trial_type = 'trigger';
end
end

responseEvents(1).fileID = logFile.fileID;
responseEvents(1).extraColumns = logFile.extraColumns;
saveEventsFile('save', cfg, responseEvents);

end


triggerString = ['trigger_' cfg.design.blockNames{iBlock}];
saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString);

% wait for the inter-stimulus interval
WaitSecs(cfg.ISI);

end

eyeTracker('StopRecordings', cfg);

WaitSecs(cfg.IBI);

% trigger monitoring
triggerEvents = getResponse('check', cfg.keyboard.responseBox, cfg, ...
getOnlyPress);

if isfield(triggerEvents(1), 'onset') && ~isempty(triggerEvents(1).onset)

for iResp = 1:size(triggerEvents, 1)
triggerEvents(iResp).onset = ...
triggerEvents(iResp).onset - cfg.experimentStart;
triggerEvents(iResp).event = 'n/a';
triggerEvents(iResp).block = 'n/a';
triggerEvents(iResp).direction = 'n/a';
triggerEvents(iResp).speed = 'n/a';
triggerEvents(iResp).target = 'n/a';
if strcmp(triggerEvents(iResp).keyName, 't')
triggerEvents(iResp).trial_type = 'trigger-baseline';
end
end

triggerEvents(1).fileID = logFile.fileID;
triggerEvents(1).extraColumns = logFile.extraColumns;
saveEventsFile('save', cfg, triggerEvents);

end

triggerString = 'trigger_baseline';
saveResponsesAndTriggers(triggerEvents, cfg, logFile, triggerString);

end

Expand All @@ -190,8 +154,8 @@
getResponse('release', cfg.keyboard.responseBox);

eyeTracker('Shutdown', cfg);
createBoldJson(cfg, cfg)

createBoldJson(cfg, cfg);

farewellScreen(cfg);

Expand Down