Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] update hed tags face rep #632

Merged
merged 1 commit into from
Sep 16, 2023
Merged
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
44 changes: 20 additions & 24 deletions demos/spm/facerep/code/convert_facerep_ds.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ function create_events_tsv_file(input_dir, output_dir, task_name, repetition_tim
for i = 1:size(trial_type_column, 1)

if strcmp(trial_type_column(i, 2), '1')
repetition_type_column(i, 1) = 1;
repetition_type_column{i, 1} = 'first_show';
else
repetition_type_column(i, 1) = 2;
repetition_type_column{i, 1} = 'delayed_repeat';
end

if strcmp(trial_type_column(i, 1), 'N')
Expand All @@ -125,7 +125,7 @@ function create_events_tsv_file(input_dir, output_dir, task_name, repetition_tim
tsv_content = struct('onset', onset_column, ...
'duration', duration_column, ...
'trial_type', {cellstr(event_type_column)}, ....
'repetition_type', repetition_type_column, ...
'repetition_type', {cellstr(repetition_type_column)}, ...
'face_type', {cellstr(face_type_column)}, ...
'lag', lag_column);

Expand All @@ -148,7 +148,7 @@ function create_events_json(output_dir, task_name, opt)

repetition_type_desc = 'Factor indicating whether this image has been already seen.';
first_show_desc = 'indicates the first display of this face.';
delayed_repeat_desc = 'indicates face was seen X trials ago.';
delayed_repeat_desc = 'indicates the second display of this face.';

face_type_desc = 'Factor indicating type of face image being displayed.';
famous_face_desc = 'A face that should be recognized by the participants.';
Expand All @@ -162,17 +162,16 @@ function create_events_json(output_dir, task_name, opt)
repetition_type_HED = struct('first_show', 'Def/First-show-cond', ...
'delayed_repeat', 'Def/Delayed-repeat-cond');

face_type_levels = struct( ...
'famous_face', famous_face_desc, ...
'unfamiliar_face', unfamiliar_face_desc);
face_type_HED = struct( ...
'famous_face', 'Def/Famous-face-cond', ...
'unfamiliar_face', 'Def/Unfamiliar-face-cond');
face_type_levels = struct('famous', famous_face_desc, ...
'unfamiliar', unfamiliar_face_desc);
face_type_HED = struct('famous', 'Def/Famous-face-cond', ...
'unfamiliar', 'Def/Unfamiliar-face-cond');

hed_face_image_def = ['(Definition/Face-image, ', ...
'(Visual, (Foreground-view, ', ...
'(Visual-presentation, ', ...
'(Foreground-view, ', ...
'((Image, Face, Hair), Color/Grayscale), ', ...
'((White, Cross), (Center-of, Screen))), ', ...
'((White, Cross), (Center-of, Computer-screen))), ', ...
'(Background-view, Black), ', ...
'Description/', ...
'A happy or neutral face in frontal or 3/4 frontal pose ', ...
Expand All @@ -181,12 +180,11 @@ function create_events_json(output_dir, task_name, opt)
'on a black background ', ...
'with a white fixation cross superposed.)', ...
')'];
hed_def_sensory = struct( ...
'Description', 'Dictionary for gathering sensory definitions', ...
hed_def_sensory = struct('Description', 'Dictionary for gathering sensory definitions', ...
'HED', struct('Face_image_def', hed_face_image_def));

% pattern to use to create condition HED definitions
cdt_hed_def = '(Definition/%s, (Condition-variable, Label/%s, %s, Description/%s))';
cdt_hed_def = '(Definition/%s, (Condition-variable/%s, %s, Description/%s))';
create_def = @(x) sprintf(cdt_hed_def, x.def, x.label, x.tags, x.desc);

label = 'Face-type';
Expand All @@ -208,12 +206,12 @@ function create_events_json(output_dir, task_name, opt)

first_show.def = 'First-show-cond';
first_show.label = label;
first_show.tags = '(First-item, Repetition-number/1)';
first_show.tags = '(Item-count/1, Face)';
first_show.desc = first_show_desc;

delayed_repeat.def = 'Delayed-repeat-cond';
delayed_repeat.label = label;
delayed_repeat.tags = '(Later-item, Repetition-number/2)';
delayed_repeat.tags = '(Item-count/2, Face)';
delayed_repeat.desc = delayed_repeat_desc;

first_show_def = create_def(first_show);
Expand Down Expand Up @@ -244,12 +242,10 @@ function create_events_json(output_dir, task_name, opt)
' end of pre-stimulus and' ...
' start of blink-inhibition.']), ...
'HED', event_type_HED), ...
'repetition_type', struct( ...
'Description', repetition_type_desc, ...
'repetition_type', struct('Description', repetition_type_desc, ...
'Levels', repetition_type_levels, ...
'HED', repetition_type_HED), ...
'face_type', struct( ...
'Description', face_type_desc, ...
'face_type', struct('Description', face_type_desc, ...
'Levels', face_type_levels, ...
'HED', face_type_HED), ...
'hed_def_sensory', hed_def_sensory, ...
Expand Down Expand Up @@ -339,7 +335,7 @@ function create_changelog(output_dir)
function create_datasetdescription(output_dir, opt)

descr = struct( ...
'BIDSVersion', '1.4.0', ...
'BIDSVersion', '1.8.0', ...
'Name', 'Mother of All Experiments', ...
'Authors', {{ ...
'Henson, R.N.A.', ...
Expand All @@ -352,8 +348,8 @@ function create_datasetdescription(output_dir, opt)
'and Dolan, R.J. (2002),', ...
'Face repetition effects in implicit and explicit memory tests as', ...
'measured by fMRI. Cerebral Cortex, 12, 178-186.'], ...
'doi:10.1093/cercor/12.2.178'}} ...
);
'doi:10.1093/cercor/12.2.178'}}, ...
'HEDVersion', '8.0.0');

spm_save(fullfile(output_dir, 'dataset_description.json'), ...
descr, ...
Expand Down