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

📄 vtcinterpolate.m

📁 VTC file is the file format of the Brainvoyager. The FMRI matchine scan human s brain and get the vt
💻 M
字号:
function vtcInterpolate(path, vtc, points_per_TR);
% syntax: vtcInterpolate(path, vtc, points_per_TR);
% 
% this func resample the vtc, i.e. increase its samplig rate by
% 'points_per_TR' factor. it does it using the interp function. it returns
% TCs multiplied by 100, in order to avoid accuracy loss by the VTC format
% (TCs as integers)
% 
% 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 the vtc file for reading
fid = fopen([path vtc '.vtc'],'r');

% open the vmp file for writing
nfid = fopen([path vtc '_interpolated_' num2str(points_per_TR) 'points_per_TR.vtc'],'w');

% READ HEADER
[NoOfVolumes, cols, rows, slices, protocol, TR] = vtcMoveToAfterHeaderPosition(fid);
% WRITE THE HEADER OF THE NEW VTC
vtcWriteHeader(nfid, NoOfVolumes*points_per_TR,protocol, TR/points_per_TR);

for z=1:slices
	for y=1:rows
        for x=1:cols         
            fseek(fid, 0, 'cof');
            TC = fread(fid, NoOfVolumes, 'uint16');
            TC = TC/100;
            TC = interp(TC,points_per_TR)*100;
            fseek(nfid, 0, 'cof');
            fwrite(nfid,TC, 'uint16');
        end
    end
end

fclose('all');
datestr(now)

⌨️ 快捷键说明

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