Home > marsbar > @maroi_shape > maroi_matrix.m

maroi_matrix

PURPOSE ^

method to convert shape objects to maroi_matrix objects

SYNOPSIS ^

function o2 = maroi_matrix(o, space)

DESCRIPTION ^

 method to convert shape objects to maroi_matrix objects

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function o2 = maroi_matrix(o, space)
0002 % method to convert shape objects to maroi_matrix objects
0003 %
0004 % $Id$
0005 
0006 if nargin < 2
0007   space = [];
0008 end
0009 if isempty(space)
0010    space = native_space(o);
0011 end    
0012 if isempty(space)
0013    error('Need space to create maroi_matrix');
0014 end
0015 
0016 params = paramfields(o);
0017 params.mat = space.mat;
0018 dim = space.dim(1:3);
0019 params.dat = zeros(dim);
0020 
0021 [pts vals] = voxpts(o, space);
0022 dinds = pts(1,:) + ...
0023     (pts(2,:)-1) * dim(1) + ...
0024     (pts(3,:)-1) * dim(1)*dim(2);
0025 
0026 params.dat(dinds) = vals;
0027 o2 = maroi_matrix(params);

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019