Home > functions > plotfunc > vb_plot_slice2.m

vb_plot_slice2

PURPOSE ^

SYNOPSIS ^

function [h1,h2,h3] = vb_plot_slice2(B,V_bv,V,xxP,indx,PARA)

DESCRIPTION ^

 B(ix,iy,iz) : fMRI slice data
 V(n,:)      : Vertex coordinate Boxel-coordinate[mm]
 V = [Vx, Vy, Vz] <-> [iy, ix, iz]
 image(B(i1,i2)) : [ i2 , i1 ]<-> [ x , y ]
 xxP(n)    : Activity at V(n,:)
 indx      : slice index
 vdim      : slice-cut axis
 PARA.width: Half width to plot active points
 PARA.msize: Marker size for fMRI active point

 Originaly written by S.Kajihara
 Ver 1.0  modified by M. Sato  2003-3-15

 2004-04-23 modified by T. Yoshioka

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [h1,h2,h3] = vb_plot_slice2(B,V_bv,V,xxP,indx,PARA)
0002 %
0003 % B(ix,iy,iz) : fMRI slice data
0004 % V(n,:)      : Vertex coordinate Boxel-coordinate[mm]
0005 % V = [Vx, Vy, Vz] <-> [iy, ix, iz]
0006 % image(B(i1,i2)) : [ i2 , i1 ]<-> [ x , y ]
0007 % xxP(n)    : Activity at V(n,:)
0008 % indx      : slice index
0009 % vdim      : slice-cut axis
0010 % PARA.width: Half width to plot active points
0011 % PARA.msize: Marker size for fMRI active point
0012 %
0013 % Originaly written by S.Kajihara
0014 % Ver 1.0  modified by M. Sato  2003-3-15
0015 %
0016 % 2004-04-23 modified by T. Yoshioka
0017 %
0018 % Copyright (C) 2011, ATR All Rights Reserved.
0019 % License : New BSD License(see VBMEG_LICENSE.txt)
0020 
0021 vdim = PARA.vdim;
0022 
0023 % Color map
0024 cmap2=colormap('jet'); %colormap('cool');
0025 
0026 [NBx,NBy,NBz]=size(B);
0027 
0028 switch    vdim,
0029 case    1,%'TRN'
0030     x=3; y=1; z=2;
0031     B2=reshape(B(indx,:,:),NBy,NBz);
0032 %    [x1,y1]=meshgrid([1:NBz],[1:NBy]);
0033 %    [x2,y2]=meshgrid([1:NBz],[1:NBy]);
0034 %    B3=interp2(x1,y1,B2,x2,y2,'linear');
0035 case    2,%'COR'
0036     x=3; y=2; z=1;
0037     B2=reshape(B(:,indx,:),NBx,NBz);
0038 %    [x1,y1]=meshgrid([1:NBz],[1:NBx]);
0039 %    [x2,y2]=meshgrid([1:NBz],[1:NBx]);
0040 %    B3=interp2(x1,y1,B2,x2,y2,'linear');
0041 case    3,%'SAG'
0042     x=1; y=2; z=3;
0043 %    B3=B(:,:,indx);
0044     B2=B(:,:,indx);
0045 end;
0046 
0047 % display MRI
0048 %h=image(B3,'CDataMapping','scaled');
0049 hold off;
0050 h1=image(B2,'CDataMapping','scaled');
0051 
0052 colormap('gray'); 
0053 axis('equal'); 
0054 axis('tight');
0055 hold on;
0056 
0057 tstr = {'Up-down cut'; 'Front-back cut'; 'Left-right cut'};
0058 
0059 isl0 = indx;
0060 isl1 = isl0 - PARA.width;
0061 isl2 = isl0 + PARA.width;
0062 
0063 % BV points
0064 if ~isempty(V_bv)
0065   pix  = find(V_bv(:,z)>=isl1-0.5 & V_bv(:,z)<isl2+0.5);
0066   Vdisp=V_bv(pix,:);
0067   X=Vdisp(:,x);
0068   Y=Vdisp(:,y);
0069   h2 = plot(X,Y, PARA.mtype,'MarkerSize',PARA.msize);
0070 else
0071   h2 = [];
0072 end
0073 
0074 % Active points
0075 if ~isempty(V)
0076   xxP_max = max(abs(xxP))*PARA.wmax;
0077   xxP_min = max(abs(xxP))*PARA.wmin;
0078   pix  = find(V(:,z)>=isl1-0.5 & V(:,z)<isl2+0.5 ...
0079           & xxP<=xxP_max & xxP>=xxP_min);
0080   Vdisp=V(pix,:);
0081   X=Vdisp(:,x);
0082   Y=Vdisp(:,y);
0083   activity = fix(xxP(pix)/max(xxP)*63)+1;
0084   h3 = scatter(X,Y, 2*PARA.msize, cmap2(activity,:), 'filled');
0085 else
0086   h3 = [];
0087 end
0088 
0089 title(sprintf('%s (%d - %d)',tstr{vdim},isl1,isl2));

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005