annotate core/tools/uimagesc.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function h = uimagesc(varargin)
Daniel@0 2 %UIMAGESC Display scaled image with uneven axis.
Daniel@0 3 % UIMAGESC(...) is the same as UIMAGE(...) except the data is scaled
Daniel@0 4 % to use the full colormap. See UIMAGE for details.
Daniel@0 5 %
Daniel@0 6 % Note: UIMAGESC is based on Matlab's original IMAGESC, Revision 5.11.4.5.
Daniel@0 7 % UIMAGESC simply calls UIMAGE with a scaled colormap.
Daniel@0 8 %
Daniel@0 9 % F. Moisy - adapted from TMW
Daniel@0 10 % Revision: 1.01, Date: 2006/06/13.
Daniel@0 11 %
Daniel@0 12 % See also IMAGE, IMAGESC, UIMAGE.
Daniel@0 13
Daniel@0 14 % History:
Daniel@0 15 % 2006/06/12: v1.00, first version.
Daniel@0 16
Daniel@0 17 clim = [];
Daniel@0 18 switch (nargin),
Daniel@0 19 case 0,
Daniel@0 20 hh = uimage('CDataMapping','scaled');
Daniel@0 21 case 1,
Daniel@0 22 hh = uimage(varargin{1},'CDataMapping','scaled');
Daniel@0 23 case 3,
Daniel@0 24 hh = uimage(varargin{:},'CDataMapping','scaled');
Daniel@0 25 otherwise,
Daniel@0 26
Daniel@0 27 % Determine if last input is clim
Daniel@0 28 if isequal(size(varargin{end}),[1 2])
Daniel@0 29 str = false(length(varargin),1);
Daniel@0 30 for n=1:length(varargin)
Daniel@0 31 str(n) = ischar(varargin{n});
Daniel@0 32 end
Daniel@0 33 str = find(str);
Daniel@0 34 if isempty(str) || (rem(length(varargin)-min(str),2)==0),
Daniel@0 35 clim = varargin{end};
Daniel@0 36 varargin(end) = []; % Remove last cell
Daniel@0 37 else
Daniel@0 38 clim = [];
Daniel@0 39 end
Daniel@0 40 else
Daniel@0 41 clim = [];
Daniel@0 42 end
Daniel@0 43 hh = uimage(varargin{:},'CDataMapping','scaled');
Daniel@0 44 end
Daniel@0 45
Daniel@0 46 % Get the parent Axes of the image
Daniel@0 47 cax = ancestor(hh,'axes');
Daniel@0 48
Daniel@0 49 if ~isempty(clim),
Daniel@0 50 set(cax,'CLim',clim)
Daniel@0 51 elseif ~ishold(cax),
Daniel@0 52 set(cax,'CLimMode','auto')
Daniel@0 53 end
Daniel@0 54
Daniel@0 55 if nargout > 0
Daniel@0 56 h = hh;
Daniel@0 57 end