Skip to content

Commit faeaa1d

Browse files
authored
Merge pull request #71 from cpp-lln-lab/dev
[REL] new release
2 parents 3d9ebfe + b02a06c commit faeaa1d

22 files changed

+471
-275
lines changed

README.md

+32-35
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,30 @@
88

99
[![Build Status](https://travis-ci.com/cpp-lln-lab/localizer_visual_motion.svg?branch=master)](https://travis-ci.com/cpp-lln-lab/localizer_visual_motion)
1010

11-
<!-- vscode-markdown-toc -->
12-
13-
- 1. [Requirements](#Requirements)
14-
- 2. [Installation](#Installation)
15-
- 3. [Structure and function details](#Structureandfunctiondetails)
16-
_ 3.1. [visualLocTranslational](#visualLocTranslational)
17-
_ 3.2. [setParameters](#setParameters)
18-
_ 3.3. [subfun/doDotMo](#subfundoDotMo)
19-
_ 3.3.1. [Input:](#Input:)
20-
_ 3.3.2. [Output:](#Output:)
21-
_ 3.4. [subfun/expDesign](#subfunexpDesign)
22-
_ 3.4.1. [EVENTS](#EVENTS)
23-
_ 3.4.2. [TARGETS:](#TARGETS:)
24-
_ 3.4.3. [Input:](#Input:-1)
25-
_ 3.4.4. [Output:](#Output:-1)
26-
27-
<!-- vscode-markdown-toc-config
28-
numbering=true
29-
autoSave=true
30-
/vscode-markdown-toc-config -->
31-
<!-- /vscode-markdown-toc -->
11+
<!-- TOC -->
12+
- [fMRI localizers for visual motion](#fmri-localizers-for-visual-motion)
13+
- [Translational Motion](#translational-motion)
14+
- [Requirements](#requirements)
15+
- [Installation](#installation)
16+
- [Structure and function details](#structure-and-function-details)
17+
- [visualLocTranslational](#visualloctranslational)
18+
- [setParameters](#setparameters)
19+
- [Let the scanner pace the experiment](#let-the-scanner-pace-the-experiment)
20+
- [subfun/doDotMo](#subfundodotmo)
21+
- [Input](#input)
22+
- [Output](#output)
23+
- [subfun/expDesign](#subfunexpdesign)
24+
- [EVENTS](#events)
25+
- [TARGETS](#targets)
26+
- [Input](#input-1)
27+
- [Output](#output-1)
28+
<!-- TOC -->
3229

3330
# fMRI localizers for visual motion
3431

35-
# Translational Motion
32+
## Translational Motion
3633

37-
## 1. <a name='Requirements'></a>Requirements
34+
## Requirements
3835

3936
Make sure that the following toolboxes are installed and added to the matlab / octave path.
4037

@@ -48,7 +45,7 @@ For instructions see the following links:
4845
| [Matlab](https://www.mathworks.com/products/matlab.html) | >=2017 |
4946
| or [octave](https://www.gnu.org/software/octave/) | >=4.? |
5047

51-
## 2. <a name='Installation'></a>Installation
48+
## Installation
5249

5350
The CPP_BIDS and CPP_PTB dependencies are already set up as submodule to this repository.
5451
You can install it all with git by doing.
@@ -57,17 +54,17 @@ You can install it all with git by doing.
5754
git clone --recurse-submodules https://github.com/cpp-lln-lab/localizer_visual_motion.git
5855
```
5956

60-
## 3. <a name='Structureandfunctiondetails'></a>Structure and function details
57+
## Structure and function details
6158

62-
### 3.1. <a name='visualLocTranslational'></a>visualLocTranslational
59+
### visualLocTranslational
6360

6461
Running this script will show blocks of motion dots (soon also moving gratings) and static dots. Motion blocks will show dots(/gratings) moving in one of four directions (up-, down-, left-, and right-ward)
6562

6663
By default it is run in `Debug mode` meaning that it does not run care about subjID, run n., fMRI triggers, Eye Tracker, etc..
6764

6865
Any details of the experiment can be changed in `setParameters.m` (e.g., experiment mode, motion stimuli details, exp. design, etc.)
6966

70-
### 3.2. <a name='setParameters'></a>setParameters
67+
### setParameters
7168

7269
`setParameters.m` is the core engine of the experiment. It contains the following tweakable sections:
7370

@@ -108,40 +105,40 @@ if cfg.pacedByTriggers.do
108105
end
109106
```
110107

111-
### 3.3. <a name='subfundoDotMo'></a>subfun/doDotMo
108+
### subfun/doDotMo
112109

113-
#### 3.3.1. <a name='Input:'></a>Input:
110+
#### Input
114111

115112
- `cfg`: PTB/machine configurations returned by `setParameters` and `initPTB`
116113
- `expParameters`: parameters returned by `setParameters`
117114
- `logFile`: structure that stores the experiment logfile to be saved
118115

119-
#### 3.3.2. <a name='Output:'></a>Output:
116+
#### Output
120117

121118
- Event `onset`
122119
- Event `duration`
123120

124121
The dots are drawn on a square that contains the round aperture, then any dots outside of the aperture is turned into a NaN so effectively the actual number of dots on the screen at any given time is not the one that you input but a smaller number (nDots / Area of aperture) on average.
125122

126-
### 3.4. <a name='subfunexpDesign'></a>subfun/expDesign
123+
### subfun/expDesign
127124

128125
Creates the sequence of blocks and the events in them. The conditions are consecutive static and motion blocks (Gives better results than randomised). It can be run as a stand alone without inputs to display a visual example of possible design.
129126

130-
#### 3.4.1. <a name='EVENTS'></a>EVENTS
127+
#### EVENTS
131128

132129
The `numEventsPerBlock` should be a multiple of the number of "base" listed in the `motionDirections` and `staticDirections` (4 at the moment).
133130

134-
#### 3.4.2. <a name='TARGETS:'></a>TARGETS:
131+
#### TARGETS
135132

136133
- If there are 2 targets per block we make sure that they are at least 2 events apart.
137134
- Targets cannot be on the first or last event of a block
138135

139-
#### 3.4.3. <a name='Input:-1'></a>Input:
136+
#### Input
140137

141138
- `expParameters`: parameters returned by `setParameters`
142139
- `displayFigs`: a boolean to decide whether to show the basic design matrix of the design
143140

144-
#### 3.4.4. <a name='Output:-1'></a>Output:
141+
#### Output
145142

146143
- `expParameters.designBlockNames` is a cell array `(nr_blocks, 1)` with the name for each block
147144
- `expParameters.designDirections` is an array `(nr_blocks, numEventsPerBlock)` with the direction to present in a given block

docs/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Documentation

initEnv.m

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
%
2-
% 1 - Check if version requirements
3-
% are satisfied and the packages are
4-
% are installed/loaded:
5-
% Octave > 4
6-
% - image
7-
% - optim
8-
% - struct
9-
% - statistics
10-
%
11-
% MATLAB >= R2015b
12-
%
13-
% 2 - Add project to the O/M path
1+
% (C) Copyright 2020 Agah Karakuzu
2+
% (C) Copyright 2019 CPP BIDS SPM-pipeline developpers
143

154
function initEnv
5+
% 1 - Check if version requirements
6+
% are satisfied and the packages are
7+
% are installed/loaded:
8+
% Octave > 4
9+
% - image
10+
% - optim
11+
% - struct
12+
% - statistics
13+
%
14+
% MATLAB >= R2015b
15+
%
16+
% 2 - Add project to the O/M path
1617

1718
octaveVersion = '4.0.3';
1819
matlabVersion = '8.6.0';
@@ -56,8 +57,8 @@
5657

5758
if numel(dir(libDirectory)) <= 2 % Means that the external is empty
5859
error(['Git submodules are not cloned!', ...
59-
'Try this in your terminal:', ...
60-
' git submodule update --recursive ']);
60+
'Try this in your terminal:', ...
61+
' git submodule update --recursive ']);
6162
else
6263
addDependencies();
6364
end

lib/CPP_BIDS

Submodule CPP_BIDS updated 127 files

lib/CPP_PTB

Submodule CPP_PTB updated 112 files

lib/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# External libraries and dependencies

miss_hit.cfg

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# style guide (https://florianschanda.github.io/miss_hit/style_checker.html)
22
line_length: 100
33
regex_function_name: "[a-z]+(([A-Z]){1}[A-Za-z]+)*"
4-
suppress_rule: "copyright_notice"
54
exclude_dir: "lib"
5+
copyright_entity: "Mohamed Rezk"
6+
copyright_entity: "Agah Karakuzu"
7+
copyright_entity: "CPP visual motion localizer developpers"
68

79
# metrics limit for the code quality (https://florianschanda.github.io/miss_hit/metrics.html)
810
metric "cnest": limit 4

setParameters.m

100644100755
+71-17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
% (C) Copyright 2020 CPP visual motion localizer developpers
2+
13
function [cfg] = setParameters()
24

35
% VISUAL LOCALIZER
@@ -9,16 +11,17 @@
911
% setParamters.m file is
1012
% change that if you want the data to be saved somewhere else
1113
cfg.dir.output = fullfile( ...
12-
fileparts(mfilename('fullpath')), '..', ...
13-
'output');
14+
fileparts(mfilename('fullpath')),'output');
1415

1516
%% Debug mode settings
1617

1718
cfg.debug.do = false; % To test the script out of the scanner, skip PTB sync
1819
cfg.debug.smallWin = false; % To test on a part of the screen, change to 1
1920
cfg.debug.transpWin = false; % To test with trasparent full size screen
2021

21-
cfg.verbose = false;
22+
cfg.skipSyncTests = 0;
23+
24+
cfg.verbose = 1;
2225

2326
%% Engine parameters
2427

@@ -33,17 +36,26 @@
3336

3437
% MRI settings
3538
cfg = setMRI(cfg);
39+
cfg.suffix.acquisition = '0p75mmEvTr2p18';
3640

37-
cfg.pacedByTriggers.do = true;
41+
cfg.pacedByTriggers.do = false;
3842

3943
%% Experiment Design
4044

41-
% cfg.design.motionType = 'translation';
42-
% cfg.design.motionType = 'radial';
45+
% switching this on to MT or MT/MST with use:
46+
% - MT: translational motion on the whole screen
47+
% - alternates static and motion (left or right) blocks
48+
% - MST: radial motion centered in a circle aperture that is on the opposite
49+
% side of the screen relative to the fixation
50+
% - alternates fixaton left and fixation right
51+
cfg.design.localizer = 'MT';
52+
% cfg.design.localizer = 'MT_MST';
53+
4354
cfg.design.motionType = 'translation';
4455
cfg.design.motionDirections = [0 0 180 180];
4556
cfg.design.names = {'static'; 'motion'};
46-
cfg.design.nbRepetitions = 8;
57+
58+
cfg.design.nbRepetitions = 12;
4759
cfg.design.nbEventsPerBlock = 12; % DO NOT CHANGE
4860

4961
%% Timing
@@ -54,7 +66,7 @@
5466
% IBI
5567
% block length = (cfg.eventDuration + cfg.ISI) * cfg.design.nbEventsPerBlock
5668

57-
cfg.timing.eventDuration = 0.8; % second
69+
cfg.timing.eventDuration = 0.79; % second
5870

5971
% Time between blocs in secs
6072
cfg.timing.IBI = 0;
@@ -69,7 +81,7 @@
6981
if cfg.pacedByTriggers.do
7082

7183
cfg.pacedByTriggers.quietMode = true;
72-
cfg.pacedByTriggers.nbTriggers = 1;
84+
cfg.pacedByTriggers.nbTriggers = 5;
7385

7486
cfg.timing.eventDuration = cfg.mri.repetitionTime / 2 - 0.04; % second
7587

@@ -81,6 +93,7 @@
8193
cfg.timing.onsetDelay = 0;
8294
% Number of seconds after the end all the stimuli before ending the run
8395
cfg.timing.endDelay = 2;
96+
8497
end
8598

8699
%% Visual Stimulation
@@ -92,11 +105,11 @@
92105
% Number of dots per visual angle square.
93106
cfg.dot.density = 1;
94107
% Dot life time in seconds
95-
cfg.dot.lifeTime = 10;
108+
cfg.dot.lifeTime = 0.4;
96109
% proportion of dots killed per frame
97110
cfg.dot.proportionKilledPerFrame = 0;
98111
% Dot Size (dot width) in visual angles.
99-
cfg.dot.size = .1;
112+
cfg.dot.size = .2;
100113
cfg.dot.color = cfg.color.white;
101114

102115
% Diameter/length of side of aperture in Visual angles
@@ -115,24 +128,35 @@
115128
cfg.fixation.type = 'cross';
116129
cfg.fixation.colorTarget = cfg.color.red;
117130
cfg.fixation.color = cfg.color.white;
118-
cfg.fixation.width = .5;
131+
cfg.fixation.width = .25;
119132
cfg.fixation.lineWidthPix = 3;
120133
cfg.fixation.xDisplacement = 0;
121134
cfg.fixation.yDisplacement = 0;
122135

123136
cfg.target.maxNbPerBlock = 1;
124-
cfg.target.duration = 0.05; % In secs
137+
cfg.target.duration = 0.1; % In secs
125138

126-
cfg.extraColumns = {'direction', 'speed', 'target', 'event', 'block', 'keyName'};
139+
cfg.extraColumns = { ...
140+
'direction', ...
141+
'speedDegVA', ...
142+
'target', ...
143+
'event', ...
144+
'block', ...
145+
'keyName', ...
146+
'fixationPosition', ...
147+
'aperturePosition'};
148+
149+
%% orverrireds the relevant fields in case we use the MT / MST localizer
150+
cfg = setParametersMtMst(cfg);
127151

128152
end
129153

130154
function cfg = setKeyboards(cfg)
131155
cfg.keyboard.escapeKey = 'ESCAPE';
132156
cfg.keyboard.responseKey = { ...
133-
'r', 'g', 'y', 'b', ...
134-
'd', 'n', 'z', 'e', ...
135-
't'}; % dnze rgyb
157+
'r', 'g', 'y', 'b', ...
158+
'd', 'n', 'z', 'e', ...
159+
't'};
136160
cfg.keyboard.keyboard = [];
137161
cfg.keyboard.responseBox = [];
138162

@@ -172,4 +196,34 @@
172196
cfg.screen.monitorWidth = 25;
173197
cfg.screen.monitorDistance = 95;
174198
end
199+
200+
end
201+
202+
function cfg = setParametersMtMst(cfg)
203+
204+
if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST')
205+
206+
cfg.task.name = 'mt mst localizer';
207+
208+
cfg.design.motionType = 'radial';
209+
cfg.design.motionDirections = [666 666 -666 -666];
210+
cfg.design.names = {'fixation_right'; 'fixation_left'};
211+
cfg.design.xDisplacementFixation = 7;
212+
cfg.design.xDisplacementAperture = 3;
213+
214+
cfg.timing.IBI = 3.6;
215+
216+
% reexpress those in terms of repetition time
217+
if cfg.pacedByTriggers.do
218+
219+
cfg.timing.IBI = 2;
220+
221+
end
222+
223+
cfg.aperture.type = 'circle';
224+
cfg.aperture.width = 7; % if left empty it will take the screen height
225+
cfg.aperture.xPos = cfg.design.xDisplacementAperture;
226+
227+
end
228+
175229
end

subfun/assignConditions.m

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
% (C) Copyright 2020 CPP visual motion localizer developpers
2+
3+
function [conditionNamesVector, CONDITON1_INDEX, CONDITON2_INDEX] = assignConditions(cfg)
4+
5+
[~, nbRepet] = getDesignInput(cfg);
6+
7+
conditionNamesVector = repmat(cfg.design.names, nbRepet, 1);
8+
9+
% Get the index of each condition
10+
nameCondition1 = 'static';
11+
nameCondition2 = 'motion';
12+
if isfield(cfg.design, 'localizer') && strcmpi(cfg.design.localizer, 'MT_MST')
13+
nameCondition1 = 'fixation_right';
14+
nameCondition2 = 'fixation_left';
15+
end
16+
17+
CONDITON1_INDEX = find(strcmp(conditionNamesVector, nameCondition1));
18+
CONDITON2_INDEX = find(strcmp(conditionNamesVector, nameCondition2));
19+
20+
end

0 commit comments

Comments
 (0)