Skip to content

Commit

Permalink
Merge pull request #438 from Remi-Gau/remi-fix_demos
Browse files Browse the repository at this point in the history
[FIX] Fix facerep demo
  • Loading branch information
Remi-Gau authored Dec 11, 2021
2 parents 26fbcb0 + 8c96f4b commit 559aa2d
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 14 deletions.
8 changes: 4 additions & 4 deletions demos/MoAE/moae_01_preproc.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
clear;
clc;

download_data = false;
download_data = true;
clean = false;

try
Expand All @@ -16,7 +16,7 @@

opt = moae_get_option();

% download_moae_ds(download_data, clean);
download_moae_ds(download_data, clean);

% reportBIDS(opt);

Expand Down Expand Up @@ -44,7 +44,7 @@
% one may not need it if they are running bidsFFX
% since it creates a mask.nii by default
% NEEDS DEBUGGING
opt.skullstrip.mean = 1;
mask = bidsWholeBrainFuncMask(opt);
% opt.skullstrip.mean = 0;
% mask = bidsWholeBrainFuncMask(opt);

bidsSmoothing(opt);
2 changes: 1 addition & 1 deletion demos/face_repetition/face_rep_01_preproc_func.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
clear;
clc;

downloadData = false;
downloadData = true;

try
run ../../initCppSpm.m;
Expand Down
2 changes: 1 addition & 1 deletion demos/face_repetition/face_rep_02_stats.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
bidsFFX('contrasts', opt);

% TODO
% bidsResults(opt);
bidsResults(opt);
25 changes: 23 additions & 2 deletions demos/face_repetition/models/model-faceRepetition_smdl.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"Steps": [
{
"Level": "subject",
"Level": "run",
"Transformations": [
{
"Name": "Factor",
Expand Down Expand Up @@ -69,6 +69,27 @@
"type": "t"
}
]
}
},
{
"Level": "subject",
"Contrasts": [
{
"Name": "faces_gt_baseline",
"ConditionList": [
"trial_type.F1",
"trial_type.F2",
"trial_type.N1",
"trial_type.N2"
],
"weights": [
1,
1,
1,
1
],
"type": "t"
}
]
}
]
}
4 changes: 2 additions & 2 deletions initCppSpm.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ function initCppSpm()
'slice_display', ...
'panel-2.14', ...
'utils'};

pathSep = ':';
if ~isunix
pathSep = ';';
pathSep = ';';
end
for i = 1:numel(libList)
CPP_SPM_PATHS = cat(2, CPP_SPM_PATHS, pathSep, ...
Expand Down
10 changes: 10 additions & 0 deletions src/bids_model/returnModelStep.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@
iStep = nan;
step = {};

nbSteps = numel(model.Steps);

if nbSteps == 1
model.Steps = {model.Steps};
end

levels = cellfun(@(x) x.Level, model.Steps, 'UniformOutput', false);

idx = ismember(levels, nodeType);
if any(idx)
step = model.Steps{idx};
iStep = find(idx);
else
msg = sprintf('could not find a model step of type %s', nodeType);
errorHandling(mfilename(), 'missingModelStep', msg, false, true);
end

end
4 changes: 2 additions & 2 deletions src/utils/checkDependencies.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ function checkDependencies(opt)
a = which('load_untouch_nii');
if isempty(a)
msg = sprintf(['Failed to find the Nifti tools: ' ...
'Are you sure they in the matlab path?\n', ...
'You can download them here: %s'], nifti_tools_url);
'Are you sure they in the matlab path?\n', ...
'You can download them here: %s'], nifti_tools_url);
tolerant = false;
errorHandling(mfilename(), 'missingDependency', msg, tolerant, opt.verbosity);
else
Expand Down
10 changes: 8 additions & 2 deletions tests/tests_bids_model/test_bidsModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@
end

function test_returnModelStep()

content = createEmptyStatsModel();
content.Steps{4} = createEmptyNode('dataset');

[~, iStep] = returnModelStep(content, 'run');
assertEqual(iStep, 1);
[~, iStep] = returnModelStep(content, 'foo');
assertEqual(iStep, nan);

[~, iStep] = returnModelStep(content, 'dataset');
assertEqual(iStep, [3; 4]);

assertExceptionThrown( ...
@()returnModelStep(content, 'foo'), ...
'returnModelStep:missingModelStep');

end

function test_getHighPassFilter()
Expand Down

0 comments on commit 559aa2d

Please sign in to comment.