git.schokokeks.org
Repositories
Help
Report an Issue
SVMCrossVal.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
9b240b5
Branches
Tags
master
SVMCrossVal.git
private
calculateRoiImageData.m
stable version for conference.
Christoph Budziszewski
commited
9b240b5
at 2009-03-19 15:14:44
calculateRoiImageData.m
Blame
History
Raw
function [extr xx yy zz] = calculateRoiImageData(filenameList,roiImageList) V = filenameList; nImage = numel(V); Vm = roiImageList; nRoi = numel(Vm); for kImage=1:nImage x = []; y = []; z = []; dat = []; for iRoiFile = 1:nRoi [x1 y1] = ndgrid(1:V(kImage).dim(1),1:V(kImage).dim(2)); for p = 1:V(kImage).dim(3) % resample mask Vm(i) in space of V(k) B = spm_matrix([0 0 -p 0 0 0 1 1 1]); M = inv(B*inv(V(kImage).mat)*Vm(iRoiFile).mat); msk = find(spm_slice_vol(Vm(iRoiFile),M,V(kImage).dim(1:2),0)); if ~isempty(msk) z1 = p*ones(size(msk(:))); x = [x; x1(msk(:))]; y = [y; y1(msk(:))]; z = [z; z1]; end end dat = [dat spm_sample_vol(V(kImage), x, y, z,0)]; if kImage == 1 % sample coordinates from first image xx = x; yy = y; zz = z; end end extr(kImage).dat = dat; end end