source: plugins/resting_state_fc.m @ 74

Last change on this file since 74 was 73, checked in by tjniskan, 11 years ago
  • Fixed a bug in aedes.m when viewing "voxel time-series" from generic

matrix input

  • Fixed a small issue with some arrayed experiments in an2_readfid.m

and hopefully did not break anything this time

  • Few minor corrections and changes here and there...

M misclib/fmri_filter.m
M misclib/fmri_corr.m
M an2_revision.m
M an2_fitmaps.m
M aedes.m
M plugins/resting_state_fc.m
M an2_readfid.m

File size: 1.4 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 slice upon which to show the maps
24  slice = 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  slice = 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]);
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.039,'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(slice,[1 1 length(corrmap)]);
55rs_maps = zeros(size(corrmap(1).ccc,1),size(corrmap(1).ccc,2),...
56  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