Home > functions > plotfunc > vb_plot_slice.m

vb_plot_slice

PURPOSE ^

Plot specified vertex points on MRI image

SYNOPSIS ^

function vb_plot_slice( B, V, zindx, xymode, Nsubfig, Msize)

DESCRIPTION ^

 Plot specified vertex points on MRI image

 -- Syntax
 vb_plot_slice( B, V, zindx, xymode, Nsubfig, Msize)

 -- Input
 B : 3D-image
 V : vertex coordinate
 --- Optinal Input (= Default)
 zindx   : slice z-index to plot  (= [140:10:190])
 Nsubfig : # of subplot   (= [3, 3])
 Msize   : Marker size
 xymode  :  2D plot mode for X-Y 
        = 0   : plot without transpose
        = 1   : plot by transposing 2D-image matrix

 2006/10/20 M. Sato

 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    vb_plot_slice( B, V, zindx, xymode, Nsubfig, Msize)
0002 % Plot specified vertex points on MRI image
0003 %
0004 % -- Syntax
0005 % vb_plot_slice( B, V, zindx, xymode, Nsubfig, Msize)
0006 %
0007 % -- Input
0008 % B : 3D-image
0009 % V : vertex coordinate
0010 % --- Optinal Input (= Default)
0011 % zindx   : slice z-index to plot  (= [140:10:190])
0012 % Nsubfig : # of subplot   (= [3, 3])
0013 % Msize   : Marker size
0014 % xymode  :  2D plot mode for X-Y
0015 %        = 0   : plot without transpose
0016 %        = 1   : plot by transposing 2D-image matrix
0017 %
0018 % 2006/10/20 M. Sato
0019 %
0020 % Copyright (C) 2011, ATR All Rights Reserved.
0021 % License : New BSD License(see VBMEG_LICENSE.txt)
0022 
0023 % zindx : slice z-coordinate
0024 if ~exist('zindx','var'), zindx = [2:2:60]; end; 
0025 if ~exist('xymode','var'), xymode = 1; end; 
0026 if ~exist('Nsubfig','var'), Nsubfig = [ 3, 3 ]; end; 
0027 if ~exist('Msize','var'), Msize=2; end; 
0028 
0029 NX=Nsubfig(1); 
0030 NY=Nsubfig(2); 
0031 
0032 % z-width for vartex selection
0033 dz = 1;
0034 
0035 Nfig = length(zindx);
0036 nfig = NX*NY;
0037 
0038 for n=1:Nfig
0039     if nfig==NX*NY, 
0040         figure; nfig=1;
0041     else
0042         nfig=nfig+1;
0043     end;
0044     
0045     subplot(NY,NX,nfig);
0046     z = zindx(n);
0047     
0048     % slice plot
0049     h=image(B(:,:,zindx(n)),'CDataMapping','scaled');
0050     
0051     axis('equal'); 
0052     axis('tight');
0053     title(['z-slice (' num2str(zindx(n),3) ')'])
0054     colormap(gray);
0055     hold on
0056 %    xlabel('X');
0057 %    ylabel('Y');
0058     
0059     if ~exist('V','var') | isempty(V), continue; end;
0060     
0061     % vertex plot
0062     switch    xymode
0063     case    {0},
0064         % plot without transpose
0065         ix = find( V(:,3) >= (z-dz) & V(:,3) < (z+dz));
0066         Nv = length(ix);
0067         plot(V(ix,1),V(ix,2),'r.','MarkerSize',Msize);
0068     case    1,
0069         % plot by transposing 2D-image matrix
0070         ix = find( V(:,3) >= (z-dz) & V(:,3) < (z+dz));
0071         Nv = length(ix);
0072         plot(V(ix,2),V(ix,1),'r.','MarkerSize',Msize);
0073     end
0074 end;
0075 
0076 colormap(gray);
0077 %colormap(jet);
0078 
0079

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