码迷,mamicode.com
首页 > 其他好文 > 详细

相关性分析代码片段2

时间:2014-06-20 22:35:28      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:des   class   blog   java   color   数据   

%% 参考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);

  

相关性分析代码片段2,布布扣,bubuko.com

相关性分析代码片段2

标签:des   class   blog   java   color   数据   

原文地址:http://www.cnblogs.com/haore147/p/3795814.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!