vtccopyheader.m

来自「VTC file is the file format of the Brain」· M 代码 · 共 68 行

M
68
字号
function [cols, rows, slices,NoOfVolumes] = vtcCopyHeader(fid,nfid);
% syntax: [cols, rows, slices] = vtcCopyHeader(fid,nfid);
% 
% copy VTC header from fid to nfid
% 
% This function was written by:
% Hagar Gelbard
% Rafi Malach's Lab
% Weizmann Institute of Science
% Rehovot, Israel
% hagar.gelbard@weizmann.ac.il

% version number
ver = fread(fid,1,'short');
fwrite(nfid, ver, 'short');
% fmr name
fmr = [];
a = 'a';
while a ~= 0
  a = fread(fid,1,'char');
  fmr = [fmr a];
end
fwrite(nfid, fmr, 'char');
% protocol name
protocol = [];
a = 'a';
while a ~= 0
  a = fread(fid,1,'char');
  protocol = [protocol a];
end
fwrite(nfid, protocol, 'char');
% write an empty protocol
% fwrite(nfid, '<none>', 'char');
% fwrite(nfid, 0 , 'char');
% other important parameters
NoOfVolumes = fread(fid,1,'short');
fwrite(nfid, NoOfVolumes, 'short');
VTC_resolution  = fread(fid,1,'short');
fwrite(nfid, VTC_resolution, 'short');
XStart = fread(fid,1,'short');
fwrite(nfid, XStart, 'short');
XEnd = fread(fid,1,'short');
fwrite(nfid, XEnd, 'short');
YStart = fread(fid,1,'short');
fwrite(nfid, YStart, 'short');
YEnd = fread(fid,1,'short');
fwrite(nfid, YEnd, 'short');
ZStart = fread(fid,1,'short');
fwrite(nfid, ZStart, 'short');
ZEnd = fread(fid,1,'short');
fwrite(nfid, ZEnd, 'short');
HemDelay = fread(fid,1,'short');
fwrite(nfid, HemDelay, 'short');
TR = fread(fid,1,'float');
fwrite(nfid, TR, 'float');
HemDelta = fread(fid,1,'float');
fwrite(nfid, HemDelta, 'float');
HemTau = fread(fid,1,'float');
fwrite(nfid, HemTau, 'float');
SegmentSize = fread(fid,1,'short');
fwrite(nfid, SegmentSize, 'short');
SegmentOffset = fread(fid,1,'short');
fwrite(nfid, SegmentOffset, 'short');

% calculate data size
cols = (XEnd-XStart)/VTC_resolution;
rows = (YEnd-YStart)/VTC_resolution;
slices = (ZEnd-ZStart)/VTC_resolution;

⌨️ 快捷键说明

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