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

📄 writevmp.m

📁 vmp is the file generate from Brainvoyager which can link vtc file and the 3D image. This toolbox he
💻 M
字号:
function writeVMP(path, output, vmpMat, resolution, df, CritThreshold, MaxThreshold, clusterSize);
% syntax: writeVMP(path, output, vmpMat, resolution, df, CritThreshold,
%                                     MaxThreshold, clusterSize)
% 
% default values: resolution = 3, df = 397, CritThreshold = 0.1500,
% MaxThreshold = 0.5000, ClusterSize = 50
% 
% this func gets a matrix of one value per voxel (values between -1 and 1) 
% in resolution 3x3 or 1x1 (corresponding to the resolution variable value)
% and write a map in a format of correlation map (values [-1,1])
% into a file named [path output '.vmp']
% the func takes care of the transformation between 3x3 resolution to 1x1
% resolution if needed (using the inflatMatX3 func)
% the degrees of freedom (df) parameter determine the p-value that will be
% displayed with the map. the other parameters can be changed also using
% BrainVoayager.
% 
% This function was written by:
% Hagar Gelbard
% Rafi Malach's Lab
% Weizmann Institute of Science
% Rehovot, Israel
% hagar.gelbard@weizmann.ac.il


if nargin < 8, ClusterSize = 50; end
if nargin < 7, MaxThreshold = 0.5000; end
if nargin < 6, CritThreshold = 0.1500; end
if nargin < 5, df = 100; end
if nargin < 4, resolution =3; end

if resolution == 3
    vmpMat = inflateMatX3(vmpMat);
end

ver = 1;
NrOfMaps = 1;
MapType = 2; %correlation map
NrOfLags = 0;
df2 = 0;
DimX = 256;
DimY = 256;
DimZ = 256;
XStart = 57;
XEnd = 231;
YStart = 52;
YEnd = 172;
ZStart = 59;
ZEnd = 197;
resolution = 1;

% open the vmp file for writing
nvmp_fid = fopen([path output '.vmp'],'w');

% WRITE HEADER
fwrite(nvmp_fid, ver, 'short');
fwrite(nvmp_fid, NrOfMaps, 'short');
fwrite(nvmp_fid, MapType, 'short');
fwrite(nvmp_fid, NrOfLags, 'short');
fwrite(nvmp_fid, ClusterSize, 'short');
fwrite(nvmp_fid, CritThreshold, 'float');
fwrite(nvmp_fid, MaxThreshold, 'float');
fwrite(nvmp_fid, df, 'short');
fwrite(nvmp_fid, df2, 'short');
fwrite(nvmp_fid, '<correlation>', 'char'); % write MapName
fwrite(nvmp_fid, 0, 'char');
fwrite(nvmp_fid, DimX,'short');
fwrite(nvmp_fid, DimY,'short');
fwrite(nvmp_fid, DimZ,'short');
fwrite(nvmp_fid, XStart,'short');
fwrite(nvmp_fid, XEnd,'short');
fwrite(nvmp_fid, YStart,'short');
fwrite(nvmp_fid, YEnd,'short');
fwrite(nvmp_fid, ZStart,'short');
fwrite(nvmp_fid, ZEnd,'short');
fwrite(nvmp_fid, resolution,'short');

% write the vmpMat
fwrite(nvmp_fid, vmpMat, 'float32');

fclose('all');

⌨️ 快捷键说明

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