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

📄 vmpreturnvec.m

📁 vmp is the file generate from Brainvoyager which can link vtc file and the 3D image. This toolbox he
💻 M
字号:
function vmpVec = vmpReturnVec(path, vmp);
% syntax: vmpVec = returnVMPvec(path, vmp)
% 
% this func returns the vmpMat of the map [path vmp '.vmp']
% in a vector form (which is vmpMat read in the order: 
% for z=1:slices
%   for y=1:rows
%       for x=1:cols)
% 
% This function was written by:
% Hagar Gelbard
% Rafi Malach's Lab
% Weizmann Institute of Science
% Rehovot, Israel
% hagar.gelbard@weizmann.ac.il

% open the vmp file for reading
fid = fopen([path vmp '.vmp'],'r');

% READ HEADER
ver = fread(fid,1,'short');
NrOfMaps = fread(fid,1,'short');
MapType = fread(fid,1,'short');
NrOfLags = fread(fid,1,'short');
ClusterSize = fread(fid,1,'short');
CritThreshold = fread(fid,1,'float');
MaxThreshold = fread(fid,1,'float');
df1 = fread(fid,1,'short');
df2 = fread(fid,1,'short');

MapName = [];
a = 'a';
while a ~= 0
  a = fread(fid,1,'char');
  MapName = [MapName a];
end
char(MapName);

DimX = fread(fid,1,'short');
DimY = fread(fid,1,'short');
DimZ = 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');
resolution = fread(fid,1,'short');
 
cols = (XEnd-XStart+1)/resolution;
rows = (YEnd-YStart+1)/resolution;
slices = (ZEnd-ZStart+1)/resolution;

voxelsNo = cols*rows*slices;

fseek(fid, 0, 'cof');

vmpVec=fread(fid, voxelsNo, 'float');

fclose('all');

⌨️ 快捷键说明

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