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

📄 vtcsmoothtcpeak.m

📁 VTC file is the file format of the Brainvoyager. The FMRI matchine scan human s brain and get the vt
💻 M
字号:
function returnVal = vtcSmoothTCpeak(path, vtc, start_at, end_at);
% syntax: vtcSmoothTCpeak(path, vtc, start_at, end_at)
% start_at, end_at are 2 TRs for where the peak begins and ends
% 
% this func will replace the TC is this range with 
% constant value: the average of the TRs before and after
% use it to smooth an unwanted peak that results from a movement etc.
% the original file is [path vtc '.vtc] 
% and the new is [path vtc 'smoothed' start_at 'to' end_at '.vtc']
% 
% This function was written by:
% Hagar Gelbard
% Rafi Malach's Lab
% Weizmann Institute of Science
% Rehovot, Israel
% hagar.gelbard@weizmann.ac.il

% OPEN FILES
fid = fopen([path vtc '.vtc'],'r');
nfid = fopen([path vtc '_smoothed' num2str(start_at) 'to' num2str(end_at) '.vtc'],'w');

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

% CREATE NEW TCs

for voxel = 1:voxelsNo
   % read time course of current voxel
    fseek(fid, 0, 'cof');
    TC = fread(fid, NoOfVolumes, 'uint16');
    returnVal = mean([TC(start_at-1) TC(end_at+1)]);
    TC(start_at:end_at)=mean([TC(start_at-1) TC(end_at+1)]);
    fwrite(nfid, TC, 'uint16');
end    

fclose('all');

⌨️ 快捷键说明

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