📄 vtcreplaceheaderparameter.m
字号:
function returnVal = vtcReplaceHeaderParameter(path, vtc, newVal);
% syntax : vtcReplaceHeaderParameter(path, vtc, newVal)
% the function replace a header parameter with newVal
% it is now written for the NoOfVolumes parameter, but this can easily be changed.
%
% This function was written by:
% Hagar Gelbard
% Rafi Malach's Lab
% Weizmann Institute of Science
% Rehovot, Israel
% hagar.gelbard@weizmann.ac.il
% open the file for reading and writing
fid = fopen([path vtc '.vtc'],'r+');
% READ HEADER
% read version number
ver = fread(fid,1,'short');
% read fmr name
fmr = [];
a = 'a';
while a ~= 0
a = fread(fid,1,'char');
fmr = [fmr a];
end
% read protocol name
protocol = [];
a = 'a';
while a ~= 0
a = fread(fid,1,'char');
protocol = [protocol a];
end
% read important parameters
% -----------------------------------------------------------------------
% use the following code to replace a variable
% -----------------------------------------------------------------------
tmp=ftell(fid);
NoOfVolumes = fread(fid,1,'short');
fseek(fid,tmp,'bof');
fwrite(fid, newVal, 'short');
VTC_resolution = fread(fid,1,'short');
XStart = fread(fid,1,'short');
XEnd = fread(fid,1,'short');
YStart = fread(fid,1,'short');
YEnd = fread(fid,1,'short');
ZStart = fread(fid,1,'short');
ZEnd = fread(fid,1,'short');
HemDelay = fread(fid,1,'short');
TR = fread(fid,1,'float');
HemDelta = fread(fid,1,'float');
HemTau = fread(fid,1,'float');
SegmentSize = fread(fid,1,'short');
SegmentOffset = fread(fid,1,'short');
fclose('all');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -