FreesurferGoodies/transformRAStoNative42013-03-07 21:23:59localhostconverted to 1.6 markup32012-07-05 10:30:27IanCharest22012-03-08 18:36:42IanCharest12012-03-08 18:02:22IanCharestsize(vol,1) | superset(:,2)>size(vol,2) | superset(:,3)>size(vol,3); superset(find(outgrowths),:)=[]; % draw the layer (excluding multiply defined voxels) cFringe(sub2ind(size(vol),superset(:,1),superset(:,2),superset(:,3)))=1; cFringe=cFringe&mask; cFringe=cFringe-vol; if size(find(cFringe),1)==0 break; % exit the loop (possible cause of empty fringe: the whole volume is full) end % FIND A MAXIMAL-MAP-VALUE FRINGE VOXEL... mapINDs=find(cFringe); %single indices to MAP specifying voxels in the fringe fringemap=map(mapINDs); %column vector of statistical-map subset for the fringe [fringemax,fringemax_fringemapIND]=max(fringemap); %the maximal statistical map value in the roi and its index within roimap fringemax_mapIND=mapINDs(fringemax_fringemapIND); %seed index within map % ...INCLUDE IT vol(fringemax_mapIND)=1; [x,y,z]=ind2sub(size(vol),fringemax_mapIND); newRoi=[newRoi;[x,y,z]]; end end % roi2mask is a function with two arguments: % ARGUMENTS: % roi: this is a 3xn matrix where each row contains the coordinates for % a point inside the roi % volSize_vox: this is a 1x3 vector containing the dimensions of the % scanned volume. E.g., [32 64 64] % RETURNS: % mask: a volume of size volSize_vox which is all 0s, except for the % points indicated by roi, which are 1s. ]]> mm corrected, Nov 2011 ]]>