zoukankan      html  css  js  c++  java
  • 相关性分析代码片段2

    %% 参考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:UsersAdministratorDesktopworkspacephycaa_plus_2104_03_27func_4d.nii'); 
    
    
    %% 两个数据,经过生理噪声预处理和未经过生理噪声预处理
    ldcca_tms = img_To_4D_array('C:UsersAdministratorDesktopcontrast2014-05-26-20-00.img');
    spm_tms = img_To_4D_array('C:UsersAdministratorDesktopcontrast
    o_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);
    

      

  • 相关阅读:
    由 Rest参数 和 Spread扩展运算符想到的...
    输出数组重复项
    echarts 踩坑记
    es6 Promise.all() 和 Promise.race() 区别
    关于Promise.all
    移动端弹出层平滑滚动和fix定位的冲突
    ES6 数组和字符串
    IE9以下 placeholder兼容
    jQuery设置聚焦并使光标位置在文字最后
    处理GitHub不允许上传大于100M文件问题
  • 原文地址:https://www.cnblogs.com/haore147/p/3795814.html
Copyright © 2011-2022 走看看