Home > marsbar > mars_blob2roi.m

mars_blob2roi

PURPOSE ^

saves ROI for cluster in xSPM structure, containing point pt

SYNOPSIS ^

function mars_blob2roi(xSPM, pt)

DESCRIPTION ^

 saves ROI for cluster in xSPM structure, containing point pt
 FORMAT mars_blob2roi(xSPM, pt)

 Input
 xSPM         - SPM results structure with needed fields
                  title
                  XYZ   - voxel coordinates of activated points
                  Z     - statistic values for activated points
                  M     - 4x4 matrix from voxels to mm 

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function mars_blob2roi(xSPM, pt)
0002 % saves ROI for cluster in xSPM structure, containing point pt
0003 % FORMAT mars_blob2roi(xSPM, pt)
0004 %
0005 % Input
0006 % xSPM         - SPM results structure with needed fields
0007 %                  title
0008 %                  XYZ   - voxel coordinates of activated points
0009 %                  Z     - statistic values for activated points
0010 %                  M     - 4x4 matrix from voxels to mm
0011 %
0012 % $Id$
0013 
0014 if nargin < 1
0015   error('Need SPM structure');
0016 end
0017 if nargin < 2
0018   error('Need point to identify cluster');
0019 end
0020 
0021 vx_i = spm_XYZreg('findxyz', pt, xSPM.XYZmm);
0022 if isempty(vx_i)
0023   msgbox('No activated voxel at this location');
0024   return
0025 end
0026 Clusters = spm_clusters(xSPM.XYZ);
0027 cXYZ = xSPM.XYZmm(:, Clusters==Clusters(vx_i));  
0028 if isempty(cXYZ), return, end
0029 d = sprintf('%s cluster at [%0.1f %0.1f %0.1f]', xSPM.title, pt);
0030 l = sprintf('%s_%0.0f_%0.0f_%0.0f', xSPM.title, pt);
0031 o = maroi_pointlist(struct('XYZ',cXYZ, 'mat', xSPM.M, ...
0032                'label', l, 'descrip', d));
0033 marsbar('saveroi', o);

Generated on Thu 17-Mar-2016 01:14:46 by m2html © 2005