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

📄 vtcfliptcs.m

📁 VTC file is the file format of the Brainvoyager. The FMRI matchine scan human s brain and get the vt
💻 M
字号:
function returnVal = vtcFlipTCs(path, vtc, cuts);
% syntax: vtcFlipTCs(path, vtc, cuts)
% 
% this func cuts the TC in each voxel to cuts pieces
% and flip each one of them from end to start
% example: 
% for TC =  [1 2 3 4 5 6 7 8 9] and cuts=3
% the func will give: flippedTC = [3 2 1 6 5 4 9 8 7]
% 
% 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 '_flipped_' num2str(cuts) 'cuts.vtc'],'w');

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

cutSize = floor(NoOfVolumes / cuts);

for z=1:slices
	for y=1:rows
        for x=1:cols         
            fseek(fid, 0, 'cof');
            TC = fread(fid, NoOfVolumes, 'uint16');
            for i = 1:cuts
				TC((i-1)*cutSize+1:(i-1)*cutSize+cutSize)=flipud(TC((i-1)*cutSize+1:(i-1)*cutSize+cutSize));
			end
            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 + -