Home > phiwave > @slover > print_fig.m

print_fig

PURPOSE ^

print slice overlay figure

SYNOPSIS ^

function print_fig(obj, filename, printstr)

DESCRIPTION ^

 print slice overlay figure
 FORMAT print_fig(obj, filename, printstr)
 
 Input 
 obj       - object
 filename  - optional filename to print to (obj.filename)
 printstr  - optional string giving print command (obj.printstr)

 Based on spm_figure print, and including fix from thence for ps
 printing
 
 $Id: print_fig.m,v 1.1 2005/04/20 15:05:36 matthewbrett Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function print_fig(obj, filename, printstr)
0002 % print slice overlay figure
0003 % FORMAT print_fig(obj, filename, printstr)
0004 %
0005 % Input
0006 % obj       - object
0007 % filename  - optional filename to print to (obj.filename)
0008 % printstr  - optional string giving print command (obj.printstr)
0009 %
0010 % Based on spm_figure print, and including fix from thence for ps
0011 % printing
0012 %
0013 % $Id: print_fig.m,v 1.1 2005/04/20 15:05:36 matthewbrett Exp $
0014   
0015 if nargin < 2
0016   filename = [];
0017 end
0018 if isempty(filename)
0019   filename = obj.printfile;
0020 end
0021 if nargin < 3
0022   printstr = '';
0023 end
0024 if isempty(printstr)
0025   printstr = obj.printstr;
0026 end
0027 
0028 %-Note current figure, & switch to figure to print
0029 cF = get(0,'CurrentFigure');
0030 set(0,'CurrentFigure',obj.figure)
0031 
0032 %-Temporarily change all units to normalized prior to printing
0033 % (Fixes bizzarre problem with stuff jumping around!)
0034 %-----------------------------------------------------------------------
0035 H  = findobj(get(obj.figure,'Children'),'flat','Type','axes');
0036 un = cellstr(get(H,'Units'));
0037 set(H,'Units','normalized')
0038 
0039 %-Print
0040 %-----------------------------------------------------------------------
0041 err = 0;
0042 try, eval([printstr ' ' filename]), catch, err=1; end
0043 if err
0044     errstr = lasterr;
0045     tmp = [find(abs(errstr)==10),length(errstr)+1];
0046     str = {errstr(1:tmp(1)-1)};
0047     for i = 1:length(tmp)-1
0048         if tmp(i)+1 < tmp(i+1) 
0049             str = [str, {errstr(tmp(i)+1:tmp(i+1)-1)}];
0050         end
0051     end
0052     str = {str{:},    '','- print command is:',['    ',printstr ' ' filename],...
0053             '','- current directory is:',['    ',pwd],...
0054             '','            * nothing has been printed *'};
0055     for i=1:length(str)
0056       disp(str{i});end
0057 end
0058 
0059 set(H,{'Units'},un)
0060 set(0,'CurrentFigure',cF)
0061 
0062 return

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003