source: plugins/fmri_plugins/resting_state_fc.m @ 79

Last change on this file since 79 was 79, checked in by tjniskan, 10 years ago
  • Fixed the resting state fMRI plugin to work with 3D data

M an2_revision.m
M plugins/fmri_plugins/resting_state_fc.m

File size: 1.5 KB
Line 
1function resting_state_fc(DATA,ROI,AddInfo)
2%
3% An Aedes plugin that calculates resting state funtional connectivity from
4% seed ROIs.
5
6
7% Only accept 3D or 4D data
8if AddInfo.isDataMixed || ndims(DATA{1}.FTDATA)==2
9  errordlg('Only 3D or 4D can be used with this plugin.','Error',...
10    'modal');
11  return
12end
13
14% Don't include the reference image from EPIs
15%if isfield(DATA{1},'PROCPAR') && isfield(DATA{1}.PROCPAR,'readres')
16%  data = DATA{1}.FTDATA(:,:,:,2:end);
17%else
18  data=DATA{1}.FTDATA;
19%end
20
21% Get the ROIs from current slice/volume
22if ndims(data)==3
23  % Data volume upon which to show the maps
24  vol = data(:,:,1);
25 
26  for ii=1:length(ROI)
27    ROI(ii).voxels{1} = ROI(ii).voxels{1}(:,:,AddInfo.CurrentSlice(3));
28  end
29else
30  vol = data(:,:,:,1);
31  for ii=1:length(ROI)
32    ROI(ii).voxels{1} = ROI(ii).voxels{1}(:,:,:,AddInfo.CurrentVol);
33  end
34end
35
36% Do global normalization
37data = fmri_global_norm(data);
38
39% Spatially smooth data
40data = fmri_smooth(data,[2 2 1]);
41%aedes(data)
42
43% Filter data
44% data = fmri_filter(data,2.039,'hipass',0.009,...
45%   'lowpass',0.08);
46data = fmri_filter(data,2,'detrending','on',...
47  'lowpass',0.08);
48%aedes(data)
49
50% Correlate seeds
51corrmap = fmri_corr(data,ROI);
52
53% Display results in a new Aedes window
54dt = repmat(vol,[1 1 1 length(corrmap)]);
55rs_maps = zeros(size(corrmap(1).ccc,1),size(corrmap(1).ccc,2),...
56  size(corrmap(1).ccc,3),length(corrmap));
57for kk=1:length(corrmap)
58  rs_maps(:,:,:,kk) = corrmap(kk).ccc;
59end
60aedes(dt,[],rs_maps)
61
62
63
Note: See TracBrowser for help on using the repository browser.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008