Skip to content
42 changes: 8 additions & 34 deletions demos/MoAE/moae_03_slice_display.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,12 @@

opt.model.file = fullfile(this_dir, 'models', 'model-MoAE_smdl.json');

% Specify the result to compute
opt.results(1).nodeName = 'run_level';

opt.results(1).name = 'listening';
% MONTAGE FIGURE OPTIONS
opt.results(1).montage.do = true();
opt.results(1).montage.slices = -4:2:16; % in mm
% axial is default 'sagittal', 'coronal'
opt.results(1).montage.orientation = 'axial';
% will use the MNI T1 template by default but the underlay image can be changed.
opt.results(1).montage.background = ...
fullfile(spm('dir'), 'canonical', 'avg152T1.nii');

% read the model
opt = checkOptions(opt);

use_schema = false;
BIDS_ROI = bids.layout(opt.dir.roi, 'use_schema', use_schema);

filter = struct('sub', subLabel, ...
'hemi', 'R', ...
'desc', 'auditoryCortex');

rightRoiFile = bids.query(BIDS_ROI, 'data', filter);

filter.hemi = 'L';
opt.results = opt.model.bm.Nodes{1}.Model.Software.bidspm.Results{1};

leftRoiFile = bids.query(BIDS_ROI, 'data', filter);
opt = checkOptions(opt);

% we get the con image to extract data
ffxDir = getFFXdir(subLabel, opt);
Expand All @@ -66,13 +45,12 @@
conImage = spm_select('FPList', ffxDir, ['^con_' bf.entities.label '.nii$']);

%% Layers to put on the figure
layers = sd_config_layers('init', {'truecolor', 'dual', 'contour', 'contour'});
layers = sd_config_layers('init', {'truecolor', 'dual', 'contour'});

% Layer 1: Anatomical map
[anat_normalized_file, anatRange] = return_normalized_anat_file(opt, subLabel);
layers(1).color.file = anat_normalized_file;
layers(1).color.range = [0 anatRange(2)];

layers(1).color.map = gray(256);

%% Layer 2: Dual-coded layer
Expand All @@ -95,25 +73,21 @@
spmTImage = spm_select('FPList', ffxDir, ['^spmT_' bf.entities.label '.nii$']);
layers(2).opacity.file = spmTImage;

layers(2).opacity.range = [2 3];
layers(2).opacity.range = [0 3];
layers(2).opacity.label = '| t |';

%% Layer 3 and 4: Contour of ROI

layers(3).color.file = rightRoiFile{1};
contour = spm_select('FPList', ffxDir, ['^sub.*' bf.entities.label '.*_mask.nii']);
layers(3).color.file = contour;
layers(3).color.map = [0 0 0];
layers(3).color.line_width = 2;

layers(4).color.file = leftRoiFile{1};
layers(4).color.map = [1 1 1];
layers(4).color.line_width = 2;

%% Settings
settings = sd_config_settings('init');

% we reuse the details for the SPM montage
settings.slice.disp_slices = opt.results(1).montage.slices;
settings.slice.orientation = opt.results(1).montage.orientation;
settings.slice.disp_slices = -15:3:18;
settings.fig_specs.n.slice_column = 4;
settings.fig_specs.title = opt.results(1).name;

Expand Down
Loading