📄 rest_dividemeanwithinmask.m
字号:
function rest_DivideMeanWithinMask(ASrcReHo, ADstReHo, AMaskFilename)
% Compute the mean within the mask and divide ReHo brain by the mean
%format: rest_DivideMeanWithinMask(ASrcReHo, ADstReHo, AMaskFilename)
% Input:
% ASrcReHo, string, a ReHo brain file (i.e RehoMap or RehoMap.{hdr/img})
% AMaskFile, string, a mask file (i.e mask.{hdr/img} or mask.mat)
% Output:
% ADstReHo, string, a ReHo brain file (i.e mRehoMap, no {hdr/img})
%------------------------------------------------------------------------------------------------------------------------------
% Copyright(c) 2007~2010
% State Key Laboratory of Cognitive Neuroscience and Learning in Beijing Normal University
% Written by Xiao-Wei Song
% http://resting-fmri.sourceforge.net
%------------------------------------------------------------------------------------------------------------------------------
% Dawnwei.Song@gmail.com
% 20070504
% <a href="Dawnwei.Song@gmail.com">Mail to Author</a>: Xiaowei Song
% Version=1.0;
% Release=20070903;
if ~(nargin==3) error(' Error using ==> DivideMaskMean. 3 arguments wanted.'); end
%Load the original ReHo map file
[brainMap,vsize, Origin]=rest_readfile(ASrcReHo);
M = size(brainMap,1); N = size(brainMap,2); O = size(brainMap,3);
isize = [M N O]; vsize =vsize';
mask=rest_loadmask(M, N, O, AMaskFilename);
%Calcute the mean and divide ReHo map by the mean
pos=find(mask);
masked_brainMap=zeros(size(brainMap,1),size(brainMap,2),size(brainMap,3));
masked_brainMap(pos)=brainMap(pos);
mean_value=reshape(masked_brainMap, size(masked_brainMap,1)*size(masked_brainMap,2)*size(masked_brainMap,3), 1);
mean_value=double(sum(mean_value)) / double(length(pos));
ResultReHoMap=brainMap./mean_value;
rest_writefile(ResultReHoMap,ADstReHo,isize,vsize,Origin, 'double');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -