Skip to content

Commit dcb8a6a

Browse files
Merge pull request #98 from cpp-lln-lab/release_candidate_v0.4.0
candidate for v0.4.0
2 parents b208a68 + 86be184 commit dcb8a6a

29 files changed

+454
-264
lines changed

.github/workflows/moxunit.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,32 @@ on:
44
push:
55
branches:
66
- master
7+
- dev
78
pull_request:
89
branches: ['*']
910

1011
jobs:
1112
build:
1213
runs-on: ubuntu-latest
1314
steps:
15+
1416
- uses: actions/checkout@v2
1517
with:
1618
submodules: true
1719
fetch-depth: 1
20+
1821
- name: MOxUnit Action
19-
uses: joergbrech/moxunit-action@v1.1
22+
uses: joergbrech/moxunit-action@v1.2.0
2023
with:
2124
tests: tests
2225
src: subfun
26+
# add CPP_PTB to the path but don't include it the coverage
27+
ext: lib/CPP_PTB/src
28+
# Octave packages needed
29+
pkg: statistics
2330
with_coverage: true
2431
cover_xml_file: coverage.xml
32+
2533
- name: Code coverage
2634
uses: codecov/codecov-action@v1
2735
with:

README.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
[![](https://img.shields.io/badge/Octave-CI-blue?logo=Octave&logoColor=white)](https://github.com/cpp-lln-lab/localizer_visual_motion/actions)
2+
![](https://github.com/cpp-lln-lab/localizer_visual_motion/workflows/CI/badge.svg)
3+
[![codecov](https://codecov.io/gh/cpp-lln-lab/localizer_visual_motion/branch/master/graph/badge.svg)](https://codecov.io/gh/cpp-lln-lab/localizer_visual_motion)
24
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
35
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
46
<!-- ALL-CONTRIBUTORS-BADGE:END -->
5-
![](https://github.com/cpp-lln-lab/localizer_visual_motion/workflows/CI/badge.svg)
6-
7-
[![codecov](https://codecov.io/gh/cpp-lln-lab/localizer_visual_motion/branch/master/graph/badge.svg)](https://codecov.io/gh/cpp-lln-lab/localizer_visual_motion)
8-
9-
[![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)
107

118
<!-- TOC -->
129
- [fMRI localizers for visual motion](#fmri-localizers-for-visual-motion)
13-
- [Translational Motion](#translational-motion)
1410
- [Requirements](#requirements)
1511
- [Installation](#installation)
1612
- [Structure and function details](#structure-and-function-details)
17-
- [visualLocTranslational](#visualloctranslational)
13+
- [visualMotionLocalizer](#visualmotionlocalizer)
1814
- [setParameters](#setparameters)
1915
- [Let the scanner pace the experiment](#let-the-scanner-pace-the-experiment)
2016
- [subfun/doDotMo](#subfundodotmo)
2117
- [Input](#input)
2218
- [Output](#output)
23-
- [subfun/expDesign](#subfunexpdesign)
24-
- [EVENTS](#events)
25-
- [TARGETS](#targets)
26-
- [Input](#input-1)
27-
- [Output](#output-1)
19+
- [subfun/design/expDesign](#subfundesignexpdesign)
20+
- [Events](#events)
21+
- [Pseudorandomization rules:](#pseudorandomization-rules)
22+
- [Input:](#input-1)
23+
- [Output:](#output-1)
24+
- [Contributors ✨](#contributors-)
2825
<!-- TOC -->
2926

3027
# fMRI localizers for visual motion
@@ -37,8 +34,8 @@ For instructions see the following links:
3734

3835
| Requirements | Used version |
3936
| --------------------------------------------------------------- | ------------ |
40-
| [CPP_BIDS](https://github.com/cpp-lln-lab/CPP_BIDS) (submodule) | 2.1.0 |
41-
| [CPP_PTB](https://github.com/cpp-lln-lab/CPP_PTB) (submodule) | 1.2.0 |
37+
| [CPP_BIDS](https://github.com/cpp-lln-lab/CPP_BIDS) (submodule) | 2.1.1 |
38+
| [CPP_PTB](https://github.com/cpp-lln-lab/CPP_PTB) (submodule) | 1.2.1 |
4239
| [PsychToolBox](http://psychtoolbox.org/) | >=3.0.14 |
4340
| [Matlab](https://www.mathworks.com/products/matlab.html) | >=2017 |
4441
| or [octave](https://www.gnu.org/software/octave/) | >=4.? |
@@ -124,13 +121,13 @@ Wrapper function that present the dot stimulation (static or motion) per event.
124121

125122
> NB: 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.
126123
127-
### subfun/expDesign(MtMst)
124+
### subfun/design/expDesign
128125

129-
These functions, one per MT+ and one per MT/MST localizer, create the sequence of blocks and the events in them. The conditions are consecutive static and motion blocks (Gives better results than randomised).
126+
This function and its companions creates the sequence of blocks (static/motion) and the events (the single directions) for MT+ and MT/MST localizers. The conditions are consecutive static and motion blocks (fixed in this order gives better results than randomised).
130127

131-
It can be run as a stand alone without inputs and display a visual example of the possible design. See `getMockConfig` to set up the mock configuration.
128+
It can be run as a stand alone without inputs and displays a visual example of the possible design. See `getMockConfig` to set up the mock configuration.
132129

133-
It computes the directions to display and the task(s), at the moment
130+
It computes the directions to display and the task(s), at the moment:
134131
1. detection of change in the color of the fixation target
135132
2. detection of different speed of the moving dots [ W I P - if selected as a task it will give the same null output as if not selected ie no difference in speed]
136133

setParameters.m

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@
4848
% - MST: radial motion centered in a circle aperture that is on the opposite
4949
% side of the screen relative to the fixation
5050
% - alternates fixaton left and fixation right
51-
cfg.design.localizer = 'MT';
52-
% cfg.design.localizer = 'MT_MST';
51+
% cfg.design.localizer = 'MT';
52+
cfg.design.localizer = 'MT_MST';
5353

5454
cfg.design.motionType = 'translation';
5555
cfg.design.motionDirections = [0 0 180 180];
5656
cfg.design.names = {'static'; 'motion'};
5757

58-
% if you have static and motion and `nbRepetions` = 4, this will return 8 blocks (n blocks per
59-
% hemifield in case of MT/MST localizer)
58+
% if you have static and motion and `nbRepetions` = 4, this will return 8 blocks (for MT/MST
59+
% localizer && 2 hemifield it is 8 blocks per hemifield), i.e. how many times each condition
60+
% will be repeated
6061
cfg.design.nbRepetitions = 12;
6162
cfg.design.nbEventsPerBlock = 12;
6263

@@ -221,17 +222,14 @@
221222

222223
cfg.design.motionType = 'radial';
223224
cfg.design.motionDirections = [666 -666];
224-
% cfg.design.names = {'motion'};
225-
cfg.design.names = {'static'; 'motion'};
226-
cfg.design.fixationPosition = {'fixation_left'; 'fixation_right'};
227-
% cfg.design.fixationPosition = {'fixation_right'; 'fixation_left'};
225+
cfg.design.names = {'motion'};
226+
% cfg.design.names = {'static'; 'motion'};
227+
cfg.design.fixationPosition = {'fixation_left'};
228+
% cfg.design.fixationPosition = {'fixation_right'; 'fixation_left'};
228229
cfg.design.xDisplacementFixation = 7;
229230
cfg.design.xDisplacementAperture = 3;
230231

231-
% here we double the repetions (2 hemifields)
232-
cfg.design.nbRepetitions = cfg.design.nbRepetitions * length(cfg.design.fixationPosition);
233-
234-
% inward&outward are presented as separated event
232+
% inward and outward are presented as separated event
235233
cfg.design.nbEventsPerBlock = cfg.design.nbEventsPerBlock * 2;
236234

237235
cfg.timing.IBI = 4;

subfun/design/diplayDesign.m

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
function diplayDesign(cfg, displayFigs)
2+
%
3+
% diplayDesign(cfg, displayFigs)
4+
%
25
%
36
% (C) Copyright 2020 CPP visual motion localizer developpers
47

@@ -22,7 +25,19 @@ function diplayDesign(cfg, displayFigs)
2225
myColorMap = lines(5);
2326
colormap(myColorMap);
2427

25-
title('Block (static and motion) & Events (motion direction)');
28+
if strcmp(cfg.design.localizer, 'MT') || ...
29+
strcmp(cfg.design.localizer, 'MT_MST') && ...
30+
length(cfg.design.names) == 2
31+
32+
title(['Blocks (rows, static-odd and motion-even) & ' ...
33+
'Events (columns, colors: motion direction)']);
34+
35+
else
36+
37+
title(['Block (rows, only motion blocks) & ' ...
38+
'Events (columns, colors: motion direction)']);
39+
40+
end
2641

2742
% Shows the fixation targets design in each event (1 or 0)
2843
fixationTargets = cfg.design.fixationTargets;
@@ -39,9 +54,11 @@ function diplayDesign(cfg, displayFigs)
3954

4055
subplot(3, 1, 3);
4156
hist(itargetPosition);
42-
labelAxesFreq();
57+
labelAxesFreqTarget();
4358
title('Fixation Targets position distribution');
4459

60+
% Show the direction presented distribution per event position
61+
% in the blocks across the experiment
4562
figure(2);
4663

4764
[~, motionDirections] = getDirectionBaseVectors(cfg);
@@ -54,11 +71,13 @@ function diplayDesign(cfg, displayFigs)
5471
subplot(2, 2, iMotion);
5572
hist(position);
5673
scaleAxes();
57-
labelAxesFreq();
74+
labelAxesFreqDirection();
5875
title(num2str(motionDirections(iMotion)));
5976

6077
end
6178

79+
suptitle('Distribution of events for each direction');
80+
6281
end
6382

6483
end
@@ -69,12 +88,18 @@ function labelAxesBlock()
6988
xlabel('Events', 'Fontsize', 8);
7089
end
7190

72-
function labelAxesFreq()
91+
function labelAxesFreqTarget()
7392
% an old viking saying because they really cared about their axes
7493
ylabel('Number of targets', 'Fontsize', 8);
7594
xlabel('Events', 'Fontsize', 8);
7695
end
7796

97+
function labelAxesFreqDirection()
98+
% an old viking saying because they really cared about their axes
99+
ylabel('Number of directions', 'Fontsize', 8);
100+
xlabel('Events', 'Fontsize', 8);
101+
end
102+
78103
function scaleAxes()
79104
xlim([1 12]);
80105
ylim([0 5]);

subfun/design/expDesign.m

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
function [cfg] = expDesign(cfg, displayFigs)
1+
function [cfg] = expDesign(cfg)
22
%
33
% Creates the sequence of blocks and the events in them
44
%
5-
% The conditions are consecutive static and motion blocks. It gives better results than
6-
% randomised.
5+
% The conditions are consecutive static and motion blocks.
6+
% It gives better results than randomised.
77
%
88
% It can be run as a stand alone without inputs and display a visual example of the
99
% possible design. See `getMockConfig` to set up the mock configuration.
1010
%
1111
% It computes the directions to display and the task(s), at the moment:
1212
% (1) detection of change in the color of the fixation target
13-
% (2) detection of different speed of the moving dots [ W I P - if selected as a task it will
14-
% give the same null output as if not selected ie no difference in speed ]
13+
% (2) detection of different speed of the moving dots
14+
% [ W I P - if selected as a task it will give the same null output
15+
% as if not selected ie no difference in speed ]
1516
%
1617
% EVENTS
1718
% The ``nbEventsPerBlock`` should be a multiple of the number of motion directions requested in
1819
% ``motionDirections`` (which should be more than 1) e.g.:
20+
%
1921
% MT localizer: ``cfg.design.motionDirections = [ 0 90 180 270 ]; % right down left up``
2022
% MT_MST localizer: ``cfg.design.motionDirections = [666 -666]; % outward inward``
2123
%
@@ -40,15 +42,19 @@
4042
% Output:
4143
% - cfg.design.blockNames: cell array (nbBlocks, 1) with the condition name for each block
4244
% - cfg.design.nbBlocks: integer for th etotal number of blocks in the run
43-
% - cfg.design.directions: array (nbBlocks, nbEventsPerBlock) with the direction to present in a
44-
% given event of a block.
45+
% - cfg.design.directions: array (nbBlocks, nbEventsPerBlock) with the direction
46+
% to present in a given event of a block.
47+
% - cfg.design.blockFixationPosition: [MT_MST] array (nbBlocks, 1)
48+
% with the position in the hemifiled
49+
% where to show the fixation cross
4550
% - 0 90 180 270 indicate the angle for translational motion direction
4651
% - 666 -666 indicate in/out-ward direction in radial motion
4752
% - -1 indicates static
4853
% - cfg.design.speeds: array (nbBlocks, nbEventsPerBlock) indicate the dots speed
4954
% in each event, the target is represented by a higher/lower value
50-
% - cfg.design.fixationTargets: array (nbBlocks, numEventsPerBlock) showing for each event if it
51-
% should be accompanied by a target
55+
% - cfg.design.fixationTargets: array (nbBlocks, numEventsPerBlock) showing
56+
% for each event if it should be accompanied by a target
57+
%
5258
%
5359
% (C) Copyright 2020 CPP visual motion localizer developpers
5460

@@ -59,9 +65,12 @@
5965

6066
if nargin < 1 || isempty(cfg)
6167

68+
% make sure we got access to all the required functions and inputs
69+
run('../../initEnv.m');
70+
6271
% ``true`` for MT+ translational localizer
6372
% ``false`` for MT/MST localizer
64-
isMT = true;
73+
isMT = false;
6574

6675
% Get mock inputs to run this function as a stand alone and get a flavour of how the design
6776
% looks like given certain inputs. Open this function to set different inputs.
@@ -85,6 +94,9 @@
8594
% Compute a matrix [nbBlocks x nbEventsPerBlock]
8695
cfg.design.directions = setDirections(cfg);
8796

97+
% Compute the fixation position (left/right hemifield) for MT/MST
98+
cfg.design.blockFixationPosition = setFixationPosition(cfg);
99+
88100
%% Task(s) design
89101

90102
% Compute a matrix [nbBlocks x nbEventsPerBlock] with

0 commit comments

Comments
 (0)