vtcsubstructcommon.m
来自「VTC file is the file format of the Brain」· M 代码 · 共 52 行
M
52 行
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 + =
减小字号Ctrl + -
显示快捷键?