Dear Michael, Thank you for sending this. Based on your code, I found that the desired VOI can be generated without further interactive input using: xY.name = V.fname; xY.def = 'mask'; xY.spec = spm_vol(V.fname); xY.Ic = 0; [Y,xY] = spm_regions(xSPM,SPM,hReg,xY); disp(['Saved VOI with ', num2str(size(xY.XYZmm,2)), ' voxels']); All the best, Kay ----- Original Message ----- From: "Michael Erb" <[log in to unmask]> To: "Kay H. Brodersen" <[log in to unmask]>; "SPM-mailbase" <[log in to unmask]> Sent: Friday, August 13, 2010 9:24 PM Subject: Re: [SPM] Extract all voxels belonging to a given cluster > Hi Kay, > after selecting a cluster from the results you can write a mask from this > cluster into the directory of the SPM.mat with the following commands: > % get coordinates from cursor > xyz = spm_XYZreg('NearestXYZ',... > spm_XYZreg('GetCoords',spm_XYZreg('FindReg')),xSPM.XYZmm); > % find next voxel > [xyz,ind] = spm_XYZreg('NearestXYZ',xyz,xSPM.XYZmm); > % cluster indeces > A=spm_clusters(xSPM.XYZ); > cXYZ=xSPM.XYZ(:,A==A(ind)); > > % load mask.ing file > V=SPM.VM; > vol=spm_read_vols(V); > vol(:)=0; > % set new mask > for p=1:size(cXYZ,2) > vol(cXYZ(1,p), cXYZ(2,p), cXYZ(3,p))=1; > end > % write mask int SPM.mat directory > [pt, mn, ext] = fileparts(V.fname); > if isempty(pt), pt=SPM.swd; end > V.fname = fullfile(pt,[sprintf('cluster_%0.1f_%0.1f_%0.1f',xyz) ext]); > V = spm_write_vol(V, vol); > > Unfortunately spm_regions seems to be interactive. > > Hope this helps, > Michael > > > Am 13.08.2010 12:10, schrieb Kay H. Brodersen: >> Dear all, >> >> Given an SPM{T} map from a group analysis, I would like to extract the >> coordinates of the voxels belonging to a particular cluster. I would then >> like to use these coordinates to extract VOI-eigenvariates in an >> individual >> subject. I was wondering what might be the easiest way of accomplishing >> this? >> >> (a) For example, is there a way to select a cluster in a group contrast >> and >> save it as a mask? I could then use this mask when calling spm_regions.m. >> >> (b) Or is there a way of obtaining the coordinates of all voxels >> belonging >> to a certain cluster from xSPM, and then use those to call spm_regions.m? >> >> Many thanks for any hints, >> Kay >> > > -- > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > Dr. Michael Erb > Sektion f. experimentelle Kernspinresonanz des ZNS > Abteilung Neuroradiologie, Universitaetsklinikum > Hoppe-Seyler_Str. 3, D-72076 Tuebingen > Tel.: +49(0)7071/2987753 priv. +49(0)7071/61559 > Fax.: +49(0)7071/294371 > e-mail: <[log in to unmask]> > www: http://www.medizin.uni-tuebingen.de/nrad/sektion/ > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >