view arrows/@imager/imager.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents beb8a3f4a345
children
line wrap: on
line source
% imager - Unit for displaying images
%
% imager :: options {
%    xdom    :: [[_]->real] / [] ~'x-vals for pixel centres';
%    ydom    :: [[_]->real] / [] ~'y-vals for pixel centres';
%    xlim    :: [[1,2]]     / [] ~'passed to xlim if not empty';
%    ylim    :: [[1,2]]     / [] ~'passed to ylim if not empty';
%    clim    :: [[_]->real] / [] ~'passed to caxis if not empty';
%    xlabel  :: string      / [] ~'passed to xlabel if not empty';
%    ylabel  :: string      / [] ~'passed to ylabel if not empty';
%    imagefn :: imagefn     / @imagexy ~'function to create image';
%    colormap  :: [[N,3]]   /[]  ~'if not empty, colormap to install';
%    clickthru :: bool      / 0  ~'if 1, button clicks passed to parent';
%    args    :: {[_]}       / {}        ~'extra arguments for imagefn'
% } -> arrow({[[M,N]]}, {}, empty) ~'arrow from 2D arrays'.
%
% imager is an arrow which displays each input array as an image
% using imagexy by default. The essential thing about imager is that
% the graphics must be updated by setting the 'CData' property of
% the handle graphics object returned by the imaging function.

function o=imager(varargin)
	s.opts=options('dlim',[],'xlim',[],'ylim',[],'clim',[],'colormap',[],'imagefn',@imagexy,'args',{},varargin{:});
	if isempty(s.opts.clim), s.opts.clim=s.opts.dlim; end
	o=class(s,'imager',agraph(1,s.opts));
end