0001 function o2 = maroi_matrix(o, space)
0002
0003
0004
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);