⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vtcsubstructcommon.m

📁 VTC file is the file format of the Brainvoyager. The FMRI matchine scan human s brain and get the vt
💻 M
字号:
function returnVal = vtcSubstructCommon(path, vtc, left_common_TC, right_common_TC);
% syntax: vtcSubstructCommon(path, vtc, left_common_TC, right_common_TC);
%  
% this func will substruct the 'left_common_TC' vector from the TC of each
% voxel on the left hemisphere, and the same for 'right_common_vec' and the
% right hemisphere
% the new VTC file will be written to [path vtc '_no_common.vtc']
% 
% This function was written by:
% Hagar Gelbard
% Rafi Malach's Lab
% Weizmann Institute of Science
% Rehovot, Israel
% hagar.gelbard@weizmann.ac.il

datestr(now)

% OPEN FILES
fid = fopen([path vtc '.vtc'],'r');
nfid = fopen([path vtc '_no_common.vtc'],'w');

% COPY VTC HEADER
[cols, rows, slices,NoOfVolumes] = vtcCopyHeader(fid,nfid);

% CREATE NEW TCs

% voxelsNo = rows * cols * slices;
% for voxel = 1:voxelsNo
%    % read time course of current voxel
%     fseek(fid, 0, 'cof');
%     TC = fread(fid, NoOfVolumes, 'uint16');
%     fwrite(nfid, TC - common_vec, 'uint16');
% end    

for z=1:slices
	for y=1:rows
        for x=1:cols
           % read time course of current voxel
            fseek(fid, 0, 'cof');
            TC = fread(fid, NoOfVolumes, 'uint16')+5000;
            if z<slices/2
                fwrite(nfid, TC - left_common_TC, 'uint16');
            else
                fwrite(nfid, TC - right_common_TC, 'uint16');
            end
		end
    end
end


fclose('all');
datestr(now)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -