Home > cellorganizer > syn2surfaceplot.m

syn2surfaceplot

PURPOSE ^

IMG2PLOT Helper method that displays images generated by CellOrganizer

SYNOPSIS ^

function syn2surfaceplot( directory, colors, viewangles, alphaval)

DESCRIPTION ^

IMG2PLOT Helper method that displays images generated by CellOrganizer

 Input
 directory a directory containing images from CellOrganizer
 colors a cell array containing a list of valid colors as defined by Matlab
         http://www.mathworks.com/help/techdoc/ref/colorspec.html
 viewangles a vector defining the viewing angle as defined by Matlab
         http://www.mathworks.com/help/techdoc/ref/view.html
 alphaval a value that determines the transparency of an object
         http://www.mathworks.com/help/techdoc/ref/alpha.html

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function syn2surfaceplot( directory, colors, viewangles, alphaval)
0002 %IMG2PLOT Helper method that displays images generated by CellOrganizer
0003 %
0004 % Input
0005 % directory a directory containing images from CellOrganizer
0006 % colors a cell array containing a list of valid colors as defined by Matlab
0007 %         http://www.mathworks.com/help/techdoc/ref/colorspec.html
0008 % viewangles a vector defining the viewing angle as defined by Matlab
0009 %         http://www.mathworks.com/help/techdoc/ref/view.html
0010 % alphaval a value that determines the transparency of an object
0011 %         http://www.mathworks.com/help/techdoc/ref/alpha.html
0012 
0013 % Author: Ivan E. Cao-Berg (icaoberg@scs.cmu.edu)
0014 % July 21, 2012 R.F. Murphy Added arguments to control colors, viewangles,
0015 % alpha
0016 % August 10, 2012 I. Cao-Berg Updated docs and renamed method
0017 %
0018 % Copyright (C) 2012 Murphy Lab
0019 % Lane Center for Computational Biology
0020 % School of Computer Science
0021 % Carnegie Mellon University
0022 %
0023 % This program is free software; you can redistribute it and/or modify
0024 % it under the terms of the GNU General Public License as published
0025 % by the Free Software Foundation; either version 2 of the License,
0026 % or (at your option) any later version.
0027 %
0028 % This program is distributed in the hope that it will be useful, but
0029 % WITHOUT ANY WARRANTY; without even the implied warranty of
0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0031 % General Public License for more details.
0032 %
0033 % You should have received a copy of the GNU General Public License
0034 % along with this program; if not, write to the Free Software
0035 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0036 % 02110-1301, USA.
0037 %
0038 % For additional information visit http://murphylab.web.cmu.edu or
0039 % send email to murphy@cmu.edu
0040 
0041 %step 1: check input arguments
0042 if ~isa( directory, 'char' )
0043   error( 'Input argument directory must be a string' )
0044 end
0045 
0046 if ~exist( directory, 'dir' )
0047   error( 'Input argument directory must exist' )
0048 end
0049 
0050 if ~exist( 'colors', 'var')
0051     colors = {'yellow','blue','green','magenta','cyan','red'};
0052 end
0053 
0054 if ~exist( 'viewangles', 'var')
0055     viewangles = [50,-15];
0056 end
0057 
0058 if ~exist( 'alphaval', 'var')
0059     alphaval = 0.1;
0060 end
0061 
0062 files = ml_dir([directory filesep '*.tif']);
0063 if isempty( files )
0064    warning('No files were found in directory. Exiting method' );
0065 end
0066 
0067 
0068 try
0069  clf
0070  for i=1:1:length(files)
0071    img = tif2img([directory filesep files{i}]);
0072    p = patch( isosurface(img) );
0073    set( p, 'FaceColor', colors{mod(i-1,length(colors))+1}, 'EdgeColor', 'none' );
0074    view(viewangles(1),viewangles(2));
0075    hold on
0076  end
0077  
0078  alpha(alphaval);
0079  daspect([1 1 1]);
0080  axis off
0081  hold off
0082 catch
0083  warning('Unable to display images.')
0084 end

Generated on Sun 29-Sep-2013 18:44:06 by m2html © 2005