summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m')
-rwxr-xr-xSD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m65
1 files changed, 65 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m b/SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m
new file mode 100755
index 0000000..4e419a0
--- /dev/null
+++ b/SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m
@@ -0,0 +1,65 @@
1% function dispimg(g,fmt,lgd,cmap) display multiple images in one figure.
2% Input:
3% g = a cell and fmt is a 1x2 vector specifying the layout.
4% lgd = a string cell for the title of each image.
5% cmap = the colormap (default is the gray, -1 for the inverted gray).
6% ishori = a vector of 1/0 to display real and imag parts horizontally / vertically
7
8% Stella X. Yu, 2000.
9
10function dispimg(g,fmt,lgd,cmap,ishori);
11
12cellg = iscell(g);
13if cellg,
14 num_fig = length(g);
15else
16 num_fig = size(g,3);
17end;
18
19if nargin<2 | isempty(fmt),
20 m = ceil(sqrt(num_fig));
21 n = ceil(num_fig / m);
22else
23 m = fmt(1);
24 n = fmt(2);
25end
26
27if nargin<3 | isempty(lgd),
28 lgd = 1:num_fig;
29end
30if isnumeric(lgd),
31 lgd = cellstr(num2str(lgd(:),3));
32end
33i = size(lgd);
34if i(1)==1,
35 lgd = [lgd, cell(1,num_fig-i(2))];
36else
37 lgd = [lgd; cell(num_fig-i(1),1)];
38end
39
40if nargin<5 | isempty(ishori),
41 ishori = ones(num_fig,1);
42end
43ishori(end+1:num_fig) = ishori(end);
44
45for k=1:num_fig,
46 subplot(m,n,k);
47 if cellg,
48 showim(g{k},[],ishori(k));
49 else
50 showim(g(:,:,k),[],ishori(k));
51 end
52 title(lgd{k});
53end
54
55if nargin<4 | isempty(cmap),
56 cmap = gray;
57end
58if length(cmap)==1,
59 if cmap==1,
60 cmap = gray;
61 else
62 cmap = flipud(gray);
63 end
64end
65colormap(cmap);