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/dispimg.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/dispimg.m')
| -rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/stella/dispimg.m | 65 |
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 | |||
| 10 | function dispimg(g,fmt,lgd,cmap,ishori); | ||
| 11 | |||
| 12 | cellg = iscell(g); | ||
| 13 | if cellg, | ||
| 14 | num_fig = length(g); | ||
| 15 | else | ||
| 16 | num_fig = size(g,3); | ||
| 17 | end; | ||
| 18 | |||
| 19 | if nargin<2 | isempty(fmt), | ||
| 20 | m = ceil(sqrt(num_fig)); | ||
| 21 | n = ceil(num_fig / m); | ||
| 22 | else | ||
| 23 | m = fmt(1); | ||
| 24 | n = fmt(2); | ||
| 25 | end | ||
| 26 | |||
| 27 | if nargin<3 | isempty(lgd), | ||
| 28 | lgd = 1:num_fig; | ||
| 29 | end | ||
| 30 | if isnumeric(lgd), | ||
| 31 | lgd = cellstr(num2str(lgd(:),3)); | ||
| 32 | end | ||
| 33 | i = size(lgd); | ||
| 34 | if i(1)==1, | ||
| 35 | lgd = [lgd, cell(1,num_fig-i(2))]; | ||
| 36 | else | ||
| 37 | lgd = [lgd; cell(num_fig-i(1),1)]; | ||
| 38 | end | ||
| 39 | |||
| 40 | if nargin<5 | isempty(ishori), | ||
| 41 | ishori = ones(num_fig,1); | ||
| 42 | end | ||
| 43 | ishori(end+1:num_fig) = ishori(end); | ||
| 44 | |||
| 45 | for 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}); | ||
| 53 | end | ||
| 54 | |||
| 55 | if nargin<4 | isempty(cmap), | ||
| 56 | cmap = gray; | ||
| 57 | end | ||
| 58 | if length(cmap)==1, | ||
| 59 | if cmap==1, | ||
| 60 | cmap = gray; | ||
| 61 | else | ||
| 62 | cmap = flipud(gray); | ||
| 63 | end | ||
| 64 | end | ||
| 65 | colormap(cmap); | ||
