-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsearchlight_rsa_social.m
More file actions
87 lines (59 loc) · 2.51 KB
/
searchlight_rsa_social.m
File metadata and controls
87 lines (59 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
function searchlight_rsa_social(SUB)
close all; clearvars -except SUB
addpath(genpath('/data/bswift-1/jmerch/CAT/code/rsatoolbox-develop'));
addpath(genpath('/data/bswift-1/jmerch/CAT/code/CoSMoMVPA-modified'));
addpath('/data/bswift-1/jmerch/CAT/code/NEWSLICETIME');
addpath('/data/bswift-1/jmerch/CompSAN/code');
addpath(genpath('/data/bswift-1/jmerch/CompSAN/code/cvVectorStats'));
% define config variables
config=cosmo_config();
config.tutorial_data_path='/data/bswift-1/jmerch/CompSAN/firstlevel_lss';
data_path=fullfile(config.tutorial_data_path);
config.output_data_path='/data/bswift-1/jmerch/CompSAN/searchlight/character_rsa';
output_path=config.output_data_path;
cd(output_path)
% Define target labels
TARGETS=[repmat(1,1,34)';repmat(2,1,142)';repmat(3,1,48)';repmat(4,1,34)';repmat(5,1,39)']; %'
CHUNKS=repmat(1,1,297)'; CHUNKS=CHUNKS(1:297,1); %'
% echo subject
disp('')
disp('--------------------------------------------------')
disp(strcat('working on: ',SUB))
datetime
% get subject data
sub_path=fullfile(data_path,SUB);
mask_fn='/data/bswift-1/jmerch/CompSAN/firstlevel_lss/MNI152-graymatter-thr25-2mm.nii.gz';
ds_fn=fullfile(data_path,SUB,strcat(SUB,'_AllActors.nii.gz'));
% create full cosmo dataset
ds_tmp = cosmo_fmri_dataset(ds_fn,...
'mask',mask_fn,...
'targets',TARGETS);
% use function to remove zeros
[ds,num_vox] = remove_zero_cosmo_ds(ds_tmp);
% create average cosmo dataset
%ds=cosmo_fx(ds_full, @(x)mean(x,1), 'targets', 1);
% creat searchlight
voxel_count=100;
nbrhood=cosmo_spherical_neighborhood(ds,'count',voxel_count);
% read in characters
CharRDM = dlmread('/data/bswift-1/jmerch/CompSAN/code/rdm_clustering.csv');
% NetRDM = dlmread('/data/bswift-1/jmerch/CompSAN/code/socialNetwork_297x297.csv');
NetRDM = dlmread('/data/bswift-1/jmerch/CompSAN/code/socialNetwork_5x5.csv');
if ~isfile(fullfile(output_path,strcat(SUB,'_searchlight_socialnetwork.nii')))
% echo subject
disp('')
disp('--------------------------------------------------')
disp('working on social network')
datetime
% Define target dsm model
measure = @cosmo_target_dsm_corr_measure_jsm;
measure_args = struct();
measure_args.metric = 'euclidean';
measure_args.type = 'Spearman';
measure_args.center_data=true;
measure_args.target_dsm = NetRDM;
glm_dsm_results = cosmo_searchlight(ds,nbrhood,measure,'nproc', 6, measure_args);
glm_dsm_results.samples=atanh(glm_dsm_results.samples);
cosmo_map2fmri(glm_dsm_results, ...
fullfile(output_path,strcat(SUB,'_searchlight_socialnetwork.nii')));
end