git.schokokeks.org
Repositories
Help
Report an Issue
SVMCrossVal.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
ea58b69
Branches
Tags
master
SVMCrossVal.git
private
calculateRoiImageData.m
roi image working
Christoph Budziszewski
commited
ea58b69
at 2009-02-25 13:40:40
calculateRoiImageData.m
Blame
History
Raw
function extr = 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)]; end extr(kImage).dat = dat; end end