Home > phiwave > @slover > private > pr_matrix2vol.m

pr_matrix2vol

PURPOSE ^

returns (pseudo) vol struct for 3d matrix

SYNOPSIS ^

function vol = pr_matrix2vol(mat3d, mat)

DESCRIPTION ^

 returns (pseudo) vol struct for 3d matrix 
 FORMAT vol = pr_matrix2vol(mat3d,mat)

 Inputs
 mat3d   - 3D matrix
 mat     - optional 4x4 voxel -> world transformation
 
 Outputs
 vol     - kind of SPM vol struct with matrix data added

 $Id: pr_matrix2vol.m,v 1.1 2005/04/20 15:05:00 matthewbrett Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function vol = pr_matrix2vol(mat3d, mat)
0002 % returns (pseudo) vol struct for 3d matrix
0003 % FORMAT vol = pr_matrix2vol(mat3d,mat)
0004 %
0005 % Inputs
0006 % mat3d   - 3D matrix
0007 % mat     - optional 4x4 voxel -> world transformation
0008 %
0009 % Outputs
0010 % vol     - kind of SPM vol struct with matrix data added
0011 %
0012 % $Id: pr_matrix2vol.m,v 1.1 2005/04/20 15:05:00 matthewbrett Exp $
0013   
0014 if nargin < 1
0015   error('Need matrix to add to vol');
0016 end
0017 if nargin < 2
0018   mat = [];
0019 end
0020 if isempty(mat)
0021   mat = spm_matrix([]);
0022 end
0023 vol = [];
0024 if ~isempty(mat3d)
0025   vol.imgdata = mat3d;
0026   vol.mat = mat;
0027   vol.dim = size(mat3d);
0028 end

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003