相关性分析代码片段2

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
83
84
85
86
87
%% 参考BLOCK
reference_stimulus =[
     0  0  0  0  0  0  0  0  0  0  ...
     1  1  1  1  1  1  1  1  1  1  ...
     0  0  0  0  0  0  0  0  0  0  ...
     1  1  1  1  1  1  1  1  1  1  ...
     0  0  0  0  0  0  0  0  0  0  ...
     1  1  1  1  1  1  1  1  1  1  ...
     0  0  0  0  0  0  0  0  0  0
];
 
%% 原始数据
datacell_4d   = load_untouch_nii( 'C:\Users\Administrator\Desktop\workspace\phycaa_plus_2104_03_27\func_4d.nii' );
 
 
%% 两个数据,经过生理噪声预处理和未经过生理噪声预处理
ldcca_tms = img_To_4D_array( 'C:\Users\Administrator\Desktop\contrast\2014-05-26-20-00.img' );
spm_tms = img_To_4D_array( 'C:\Users\Administrator\Desktop\contrast\no_phycaa.img' );
 
mask_ldcca_tms = ldcca_tms >  0 ;
inv_mask_ldcca_tms = ~mask_ldcca_tms;
 
mask_spm_tms = spm_tms >  0 ;
inv_mask_spm_tms = ~mask_spm_tms;
 
tmp_spm = spm_tms .* inv_mask_ldcca_tms;
mask_big_left_spm_tms = tmp_spm> 0 ;
 
tmp_ldcca = ldcca_tms .* inv_mask_spm_tms;
mask_big_left_ldcca_tms = tmp_ldcca >  0 ;
 
%% 被去除的体素
ldim = size(datacell_4d.img);
substruct_fullMsk = repmat( mask_big_left_spm_tms, [ 1 , 1 , 1 ,ldim( 4 )] );
substruct_spm_tms_2d = reshape( datacell_4d.img(substruct_fullMsk> 0 ), [], ldim( 4 ) );
 
%% 留下的体素集合
left_fullMsk =  repmat( mask_spm_tms.*(~mask_big_left_spm_tms), [ 1 , 1 , 1 ,ldim( 4 )] );
left_spm_tms_2d = reshape( datacell_4d.img(left_fullMsk> 0 ), [], ldim( 4 ) );
 
%% 新增加的点集合
add_fullMsk = repmat( mask_big_left_ldcca_tms, [ 1 , 1 , 1 ,ldim( 4 )] );
add_spm_tms_2d = reshape( datacell_4d.img(add_fullMsk> 0 ), [], ldim( 4 ) );
 
figure( 2 );
 
% 统计被去除的点的相关系数,强度
substruct_corr_spms=[];
for  i =  1 :size(substruct_spm_tms_2d, 1 )
    
     substruct_corr_spms(i)= corr2(reference_stimulus ' , substruct_spm_tms_2d(i,:)' );
 
end
 
% plot(substruct_corr_spms, 'Color' , 'red' );
 
% hold on;
 
% 统计增加的点的相关系数,强度
add_corr_spms=[];
for  i =  1 :size(add_spm_tms_2d, 1 )
     
     add_corr_spms(i)= corr2(reference_stimulus ' , add_spm_tms_2d(i,:)' );
 
end
 
% plot(add_corr_spms, 'Color' , 'black' );
% hold on;
 
% 统计剩下的点的相关系数,强度
left_corr_spms=[];
for  i =  1 :size(left_spm_tms_2d, 1 )
     
     left_corr_spms(i)= corr2(reference_stimulus ' , left_spm_tms_2d(i,:)' );
 
end
 
% plot(left_corr_spms, 'Color' , 'blue' );
% hold on;
 
 
figure( 1 );
boxplot(substruct_corr_spms);
figure( 2 );
boxplot(add_corr_spms);
figure( 3 );
boxplot(left_corr_spms);

  本文转自二郎三郎博客园博客,原文链接:http://www.cnblogs.com/haore147/p/3795814.html,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值