summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/toolbox/toolbox_basic/stella/showim.m
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/stella/showim.m')
-rwxr-xr-xSD-VBS/common/toolbox/toolbox_basic/stella/showim.m36
1 files changed, 36 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/stella/showim.m b/SD-VBS/common/toolbox/toolbox_basic/stella/showim.m
new file mode 100755
index 0000000..10db297
--- /dev/null
+++ b/SD-VBS/common/toolbox/toolbox_basic/stella/showim.m
@@ -0,0 +1,36 @@
1% function showim(f,cmap) display real or complex image.
2% When it is complex, the real part and imaginary part
3% are displayed as [real,imag] in one image.
4% cmap is the colormap. default = gray, -1 = inverted gray.
5
6% Stella X. Yu, 2000.
7
8function showim(f,cmap,ishori)
9
10if not(isreal(f)),
11 i = [real(f(:)); imag(f(:))];
12 j = [min(i), max(i)];
13 [nr,nc] = size(f);
14 if nargin<3 | isempty(ishori),
15 ishori = nr>nc;
16 end
17 if ishori,
18 i = zeros(nr,1);
19 f = [real(f), [i+j(1),i+j(2)], imag(f)];
20 else
21 i = zeros(1,nc);
22 f = [real(f); [i+j(1);i+j(2)]; imag(f)];
23 end
24end
25imagesc(f); axis off; axis image;
26
27if nargin<2 | isempty(cmap),
28 return;
29end
30
31if cmap==1,
32 cmap = gray;
33elseif cmap==-1,
34 cmap = flipud(gray);
35end
36colormap(cmap); \ No newline at end of file