samer@0
|
1 function u=construct(s,sizes_in)
|
samer@0
|
2 acquire(s);
|
samer@0
|
3 figure(fig(s)); set(gcf,'Name',name(s));
|
samer@0
|
4
|
samer@0
|
5 X=nan(sizes_in{1});
|
samer@0
|
6
|
samer@0
|
7 if isfield(s.opts,'xdom') || isfield(s.opts,'ydom')
|
samer@0
|
8 xdom=getparam(s.opts,'xdom',[1,size(X,2)]);
|
samer@0
|
9 ydom=getparam(s.opts,'ydom',[1,size(X,1)]);
|
samer@0
|
10 h=s.opts.imagefn(xdom,ydom,X,s.opts.args{:});
|
samer@0
|
11 else
|
samer@0
|
12 h=s.opts.imagefn(X,s.opts.args{:});
|
samer@0
|
13 end
|
samer@0
|
14 if isfield(s.opts,'clickthru') && s.opts.clickthru
|
samer@0
|
15 parent=get(h,'Parent');
|
samer@0
|
16 set(h,'ButtonDownFcn',@clickthru);
|
samer@0
|
17 end
|
samer@0
|
18
|
samer@0
|
19 if ~isempty(s.opts.xlim), xlim(s.opts.xlim); end
|
samer@0
|
20 if ~isempty(s.opts.ylim), ylim(s.opts.ylim); end
|
samer@0
|
21 if isfield(s.opts,'ylabel'), ylabel(s.opts.ylabel); end
|
samer@0
|
22 if isfield(s.opts,'xlabel'), xlabel(s.opts.xlabel); end
|
samer@0
|
23 if getparam(s.opts,'colorbar',0), colorbar; end
|
samer@0
|
24 if ~isempty(s.opts.clim) caxis(s.opts.clim); end
|
samer@0
|
25 if ~isempty(s.opts.colormap), colormap(s.opts.colormap); end
|
samer@0
|
26
|
samer@0
|
27 u=mkunit(s);
|
samer@0
|
28 if autoflush(s), u.process =@proc_flush;
|
samer@0
|
29 else u.process=@proc_noflush; end
|
samer@0
|
30
|
samer@0
|
31 u.sizes_out = {};
|
samer@0
|
32 u.dispose = @dispose;
|
samer@0
|
33
|
samer@0
|
34 function dispose, delete(h); release(s); end
|
samer@0
|
35 function proc_flush(x), set(h,'CData',x); drawnow; end
|
samer@0
|
36 function proc_noflush(x), set(h,'CData',x); end
|
samer@0
|
37 function clickthru(a,b)
|
samer@0
|
38 fn=get(parent,'ButtonDownFcn');
|
samer@0
|
39 if ~isempty(fn), fn(a,b); end
|
samer@0
|
40 end
|
samer@0
|
41 end
|