diff options
author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
---|---|---|
committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/toolbox_basic/stella/showim.m | |
parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (diff) |
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to:
- Use libextra to loop as realtime jobs
- Preallocate memory before starting their main computation
- Accept input via stdin instead of via argc
Does not include the SD-VBS matlab code.
Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/stella/showim.m')
-rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/stella/showim.m | 36 |
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 | |||
8 | function showim(f,cmap,ishori) | ||
9 | |||
10 | if 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 | ||
24 | end | ||
25 | imagesc(f); axis off; axis image; | ||
26 | |||
27 | if nargin<2 | isempty(cmap), | ||
28 | return; | ||
29 | end | ||
30 | |||
31 | if cmap==1, | ||
32 | cmap = gray; | ||
33 | elseif cmap==-1, | ||
34 | cmap = flipud(gray); | ||
35 | end | ||
36 | colormap(cmap); \ No newline at end of file | ||