annotate scripts/image/imshow.m @ 33596:96a203bc7e17 bytecode-interpreter tip

maint: Merge default to bytecode-interpreter
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Fri, 17 May 2024 22:49:58 -0400
parents 2e484f9f1f18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 32002
diff changeset
3 ## Copyright (C) 1994-2024 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26817
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
7 ##
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
8 ## This file is part of Octave.
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24057
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24057
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22392
diff changeset
13 ## (at your option) any later version.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
14 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22392
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22392
diff changeset
18 ## GNU General Public License for more details.
2313
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
19 ##
5ca126254d15 [project @ 1996-07-11 21:25:22 by jwe]
jwe
parents: 2312
diff changeset
20 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6757
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24057
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
1024
56520a75b5b3 [project @ 1995-01-11 20:30:04 by jwe]
jwe
parents: 904
diff changeset
25
3381
69b167451491 [project @ 1999-12-15 20:48:10 by jwe]
jwe
parents: 3373
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20735
diff changeset
27 ## @deftypefn {} {} imshow (@var{im})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20735
diff changeset
28 ## @deftypefnx {} {} imshow (@var{im}, @var{limits})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20735
diff changeset
29 ## @deftypefnx {} {} imshow (@var{im}, @var{map})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20735
diff changeset
30 ## @deftypefnx {} {} imshow (@var{rgb}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20735
diff changeset
31 ## @deftypefnx {} {} imshow (@var{filename})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20735
diff changeset
32 ## @deftypefnx {} {} imshow (@dots{}, @var{string_param1}, @var{value1}, @dots{})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20735
diff changeset
33 ## @deftypefnx {} {@var{h} =} imshow (@dots{})
6368
ec2a523713b5 [project @ 2007-02-28 22:07:24 by jwe]
jwe
parents: 6310
diff changeset
34 ## Display the image @var{im}, where @var{im} can be a 2-dimensional
14897
8e2a6fc55787 doc: Use 'grayscale' rather than 'gray-scale' in documentation.
Rik <rik@octave.org>
parents: 14366
diff changeset
35 ## (grayscale image) or a 3-dimensional (RGB image) matrix.
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
36 ##
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
37 ## If @var{limits} is a 2-element vector @code{[@var{low}, @var{high}]}, the
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
38 ## image is shown using a display range between @var{low} and @var{high}. If
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
39 ## an empty matrix is passed for @var{limits}, the display range is computed
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
40 ## as the range between the minimal and the maximal value in the image.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3381
diff changeset
41 ##
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
42 ## If @var{map} is a valid color map, the image will be shown as an indexed
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
43 ## image using the supplied color map.
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
44 ##
20713
2469d78a1d8b Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents: 20711
diff changeset
45 ## If a filename is given instead of an image, the file will be read and shown.
3426
f8dde1807dee [project @ 2000-01-13 08:40:00 by jwe]
jwe
parents: 3381
diff changeset
46 ##
20181
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20158
diff changeset
47 ## If given, the parameter @var{string_param1} has value @var{value1}.
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
48 ## @var{string_param1} can be any of the following:
14366
b76f0740940e doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents: 14237
diff changeset
49 ##
11595
5ec6aa05638d Prevent doubled quotes around @table items in Info.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
50 ## @table @asis
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 14897
diff changeset
51 ## @item @qcode{"displayrange"}
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
52 ## @var{value1} is the display range as described above.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18546
diff changeset
53 ##
18714
c79696701468 doc: Document new 'colormap' parameter to imshow.
Rik <rik@octave.org>
parents: 18713
diff changeset
54 ## @item @qcode{"colormap"}
c79696701468 doc: Document new 'colormap' parameter to imshow.
Rik <rik@octave.org>
parents: 18713
diff changeset
55 ## @var{value1} is the colormap to use when displaying an indexed image.
19596
0e1f5a750d00 maint: Periodic merge of gui-release to default.
John W. Eaton <jwe@octave.org>
parents: 18739 19593
diff changeset
56 ##
17753
887df64e54e4 doc: Final grammarcheck of docstrings for 3.8 release.
Rik <rik@octave.org>
parents: 17744
diff changeset
57 ## @item @qcode{"xdata"}
25856
9578af67a0d4 Document that image x/ydata indicate the centers of corner pixels (bug #54610).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
58 ## If @var{value1} is a 2-element vector, it must contain horizontal image
25980
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
59 ## limits in the form [xfirst, xlast], where xfirst and xlast are the
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
60 ## abscissa of the centers of the corner pixels. Otherwise @var{value1}
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
61 ## must be a vector and only the first and last elements will be used
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
62 ## for xfirst and xlast respectively.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 18546
diff changeset
63 ##
17753
887df64e54e4 doc: Final grammarcheck of docstrings for 3.8 release.
Rik <rik@octave.org>
parents: 17744
diff changeset
64 ## @item @qcode{"ydata"}
25856
9578af67a0d4 Document that image x/ydata indicate the centers of corner pixels (bug #54610).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25054
diff changeset
65 ## If @var{value1} is a 2-element vector, it must contain vertical image
25980
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
66 ## limits in the form [yfirst, ylast], where yfirst and ylast are the ordinates
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
67 ## of the center of the corner pixels. Otherwise @var{value1} must be a vector
221c039aa415 Fix rendering of images with permuted x/ydata (bug #49756).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 25856
diff changeset
68 ## and only the first and last elements will be used for yfirst and ylast
21546
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 21385
diff changeset
69 ## respectively.
17734
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
70 ##
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
71 ## @end table
14001
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13738
diff changeset
72 ##
5f0bb45e615c doc: Update documentation for functions returning a graphics handle h (Bug #34761)
Rik <octave@nomad.inbox5.com>
parents: 13738
diff changeset
73 ## The optional return value @var{h} is a graphics handle to the image.
5642
2618a0750ae6 [project @ 2006-03-06 21:26:48 by jwe]
jwe
parents: 5443
diff changeset
74 ## @seealso{image, imagesc, colormap, gray2ind, rgb2ind}
3373
36405da8e173 [project @ 1999-11-23 20:54:17 by jwe]
jwe
parents: 3202
diff changeset
75 ## @end deftypefn
904
3470f1e25a79 [project @ 1994-11-09 21:22:15 by jwe]
jwe
parents: 559
diff changeset
76
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
77 function h = imshow (im, varargin)
559
4e826edfbc56 [project @ 1994-07-25 22:18:28 by jwe]
jwe
parents:
diff changeset
78
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
79 if (nargin == 0)
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
80 print_usage ();
5318
9a72639b62a7 [project @ 2005-04-28 18:44:27 by jwe]
jwe
parents: 5307
diff changeset
81 endif
9a72639b62a7 [project @ 2005-04-28 18:44:27 by jwe]
jwe
parents: 5307
diff changeset
82
7328
d0784e593d39 [project @ 2007-12-20 07:24:02 by jwe]
jwe
parents: 7321
diff changeset
83 display_range = NA;
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
84 truecolor = false;
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
85 indexed = false;
17734
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
86 xdata = ydata = [];
20301
eca5aa3225f4 imshow.m: Add support for 'parent' property (bug #45473).
Rik <rik@octave.org>
parents: 20181
diff changeset
87 prop_val_args = {};
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
88
5935
01ff100fcd64 [project @ 2006-08-17 20:40:58 by jwe]
jwe
parents: 5934
diff changeset
89 ## Get the image.
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
90 if (ischar (im))
7931
de26beacb20f imread.m: simplify; loadimage.m: deprecate
John W. Eaton <jwe@octave.org>
parents: 7930
diff changeset
91 [im, map] = imread (im);
26817
880466837c06 imshow.m: Read indexed images correctly when only file name given (bug #49137).
Rik <rik@octave.org>
parents: 26376
diff changeset
92 if (isempty (map))
880466837c06 imshow.m: Read indexed images correctly when only file name given (bug #49137).
Rik <rik@octave.org>
parents: 26376
diff changeset
93 indexed = false;
880466837c06 imshow.m: Read indexed images correctly when only file name given (bug #49137).
Rik <rik@octave.org>
parents: 26376
diff changeset
94 else
880466837c06 imshow.m: Read indexed images correctly when only file name given (bug #49137).
Rik <rik@octave.org>
parents: 26376
diff changeset
95 indexed = true;
880466837c06 imshow.m: Read indexed images correctly when only file name given (bug #49137).
Rik <rik@octave.org>
parents: 26376
diff changeset
96 colormap (gca, map);
880466837c06 imshow.m: Read indexed images correctly when only file name given (bug #49137).
Rik <rik@octave.org>
parents: 26376
diff changeset
97 endif
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
98 endif
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
99
10286
8cf666139297 imshow for logical matrices
John W. Eaton <jwe@octave.org>
parents: 9273
diff changeset
100 nd = ndims (im);
8cf666139297 imshow for logical matrices
John W. Eaton <jwe@octave.org>
parents: 9273
diff changeset
101
8cf666139297 imshow for logical matrices
John W. Eaton <jwe@octave.org>
parents: 9273
diff changeset
102 if (! ((isnumeric (im) || islogical (im)) && (nd == 2 || nd == 3)))
22760
c4d80b9d2898 maint: Capitalize variable names appearing in error() messages of m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
103 error ("imshow: IM must be an image or the FILENAME of an image");
5318
9a72639b62a7 [project @ 2005-04-28 18:44:27 by jwe]
jwe
parents: 5307
diff changeset
104 endif
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
105
10286
8cf666139297 imshow for logical matrices
John W. Eaton <jwe@octave.org>
parents: 9273
diff changeset
106 if (nd == 2)
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
107 if (! indexed)
23524
7c278572db66 Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 23220
diff changeset
108 colormap (gca, gray ());
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
109 endif
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
110 elseif (size (im, 3) == 3)
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
111 if (ismember (class (im), {"uint8", "uint16", "double", "single"}))
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
112 truecolor = true;
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
113 else
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
114 error ("imshow: TrueColor image must be uint8, uint16, double, or single");
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
115 endif
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
116 else
20711
7b608fadc663 Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents: 20357
diff changeset
117 error ("imshow: image must be MxN or MxNx3 matrix");
5318
9a72639b62a7 [project @ 2005-04-28 18:44:27 by jwe]
jwe
parents: 5307
diff changeset
118 endif
9a72639b62a7 [project @ 2005-04-28 18:44:27 by jwe]
jwe
parents: 5307
diff changeset
119
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
120 narg = 1;
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
121 while (narg <= numel (varargin))
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
122 arg = varargin{narg++};
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
123 if (isnumeric (arg))
7331
3ed85de5922c [project @ 2007-12-21 17:40:20 by jwe]
jwe
parents: 7328
diff changeset
124 if (numel (arg) == 2 || isempty (arg))
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 10286
diff changeset
125 display_range = arg;
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
126 elseif (columns (arg) == 3)
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 10286
diff changeset
127 indexed = true;
20357
a3bf503652b2 iscolormap: relax input check - specially in [0 1] range.
Carnë Draug <carandraug@octave.org>
parents: 20302
diff changeset
128 if (iscolormap (arg) && min (arg) >= 0 || max (arg) <= 1)
23524
7c278572db66 Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 23220
diff changeset
129 colormap (gca, arg);
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
130 else
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
131 error ("imshow: invalid colormap MAP");
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
132 endif
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
133 elseif (! isempty (arg))
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
134 error ("imshow: argument number %d is invalid", narg);
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
135 endif
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
136 elseif (ischar (arg))
32002
939e5d952675 Use upper/lower in preference to toupper/tolower to match Matlab.
Rik <rik@octave.org>
parents: 31706
diff changeset
137 switch (lower (arg))
20301
eca5aa3225f4 imshow.m: Add support for 'parent' property (bug #45473).
Rik <rik@octave.org>
parents: 20181
diff changeset
138 case "border"
eca5aa3225f4 imshow.m: Add support for 'parent' property (bug #45473).
Rik <rik@octave.org>
parents: 20181
diff changeset
139 warning ("imshow: border argument is not implemented");
20735
418ae0cb752f Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents: 20715
diff changeset
140 narg += 1;
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
141 case "colormap"
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
142 map = varargin{narg++};
20357
a3bf503652b2 iscolormap: relax input check - specially in [0 1] range.
Carnë Draug <carandraug@octave.org>
parents: 20302
diff changeset
143 if (iscolormap (map) && min (map) >= 0 || max (map) <= 1)
23524
7c278572db66 Implement colormap property for axes objects (bug #48667).
Markus Muetzel <markus.muetzel@gmx.de>
parents: 23220
diff changeset
144 colormap (gca, map);
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
145 else
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
146 error ("imshow: invalid colormap");
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
147 endif
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
148 case "displayrange"
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 10286
diff changeset
149 display_range = varargin{narg++};
20301
eca5aa3225f4 imshow.m: Add support for 'parent' property (bug #45473).
Rik <rik@octave.org>
parents: 20181
diff changeset
150 case {"initialmagnification"}
20302
928e2c6f888e imshow.m: Respect new 'parent' property when setting axis properties.
Rik <rik@octave.org>
parents: 20301
diff changeset
151 warning ("imshow: zoom argument ignored -- use GUI features");
20735
418ae0cb752f Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents: 20715
diff changeset
152 narg += 1;
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
153 case "parent"
20715
5b7643257978 Remove trailing whitespace at end of lines.
Rik <rik@octave.org>
parents: 20713
diff changeset
154 prop_val_args(end+(1:2)) = {"parent", varargin{narg++}};
20302
928e2c6f888e imshow.m: Respect new 'parent' property when setting axis properties.
Rik <rik@octave.org>
parents: 20301
diff changeset
155 if (! isaxes (prop_val_args{end}))
928e2c6f888e imshow.m: Respect new 'parent' property when setting axis properties.
Rik <rik@octave.org>
parents: 20301
diff changeset
156 error ("imshow: parent must be an axes handle");
928e2c6f888e imshow.m: Respect new 'parent' property when setting axis properties.
Rik <rik@octave.org>
parents: 20301
diff changeset
157 endif
20301
eca5aa3225f4 imshow.m: Add support for 'parent' property (bug #45473).
Rik <rik@octave.org>
parents: 20181
diff changeset
158 case "reduce"
eca5aa3225f4 imshow.m: Add support for 'parent' property (bug #45473).
Rik <rik@octave.org>
parents: 20181
diff changeset
159 warning ("imshow: reduce argument is not implemented");
20735
418ae0cb752f Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents: 20715
diff changeset
160 narg += 1;
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
161 case "xdata"
17734
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
162 xdata = varargin{narg++};
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
163 if (! isvector (xdata))
21385
89fa0694aa2e Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents: 20852
diff changeset
164 error ("imshow: xdata must be a vector");
17734
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
165 endif
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
166 xdata = [xdata(1) xdata(end)];
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
167 case "ydata"
17734
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
168 ydata = varargin{narg++};
18546
8e384416ebb3 imshow.m: Fix bad input validation of ydata (bug #41773).
Rik <rik@octave.org>
parents: 17753
diff changeset
169 if (! isvector (ydata))
21385
89fa0694aa2e Fix check-missing-semicolon QA target (bug #47277).
Rik <rik@octave.org>
parents: 20852
diff changeset
170 error ("imshow: ydata must be a vector");
17734
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
171 endif
64ad713b3a64 imshow.m: Add support for "xdata" and "ydata" options, make option parser case insensitive
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 17281
diff changeset
172 ydata = [ydata(1) ydata(end)];
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 10286
diff changeset
173 otherwise
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 10286
diff changeset
174 warning ("imshow: unrecognized property %s", arg);
20735
418ae0cb752f Replace ++,-- with in-place operators for performance.
Rik <rik@octave.org>
parents: 20715
diff changeset
175 narg += 1;
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
176 endswitch
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
177 else
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
178 error ("imshow: argument number %d is invalid", narg);
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
179 endif
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
180 endwhile
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
181
13738
7ee61e56eaed Periodic merge of stable to default
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 13705
diff changeset
182 ## Check for complex images.
7ee61e56eaed Periodic merge of stable to default
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 13705
diff changeset
183 if (iscomplex (im))
7ee61e56eaed Periodic merge of stable to default
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 13705
diff changeset
184 warning ("imshow: only showing real part of complex image");
7ee61e56eaed Periodic merge of stable to default
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 13705
diff changeset
185 im = real (im);
7ee61e56eaed Periodic merge of stable to default
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 13705
diff changeset
186 endif
7ee61e56eaed Periodic merge of stable to default
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 13705
diff changeset
187
8117
40aa36406a94 Fix for display_range in imshow
Kris Thielemans
parents: 7931
diff changeset
188 ## Set default display range if display_range not set yet.
7328
d0784e593d39 [project @ 2007-12-20 07:24:02 by jwe]
jwe
parents: 7321
diff changeset
189 if (isempty (display_range))
24056
ae35d50d9756 Ensure numeric values are passed for the axes "clim" property (bug #52053).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23219
diff changeset
190 display_range = double ([min(im(:)), max(im(:))]);
8117
40aa36406a94 Fix for display_range in imshow
Kris Thielemans
parents: 7931
diff changeset
191 elseif (isna (display_range))
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
192 t = class (im);
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
193 switch (t)
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
194 case {"double", "single", "logical"}
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 10286
diff changeset
195 display_range = [0, 1];
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
196 case {"uint8", "uint16", "int16"}
11597
a066673566da set clim to [0,1] so that scaled cdatamapping works as intended.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents: 11595
diff changeset
197 display_range = [intmin(t), intmax(t)];
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
198 otherwise
10433
2c01d24459fb Detabify scripts in 'scripts/image/'
Soren Hauberg <hauberg@gmail.com>
parents: 10286
diff changeset
199 error ("imshow: invalid data type for image");
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
200 endswitch
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
201 endif
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
202
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
203 if (isfloat (im))
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
204 nans = isnan (im(:));
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
205 if (any (nans))
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
206 warning ("Octave:imshow-NaN",
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
207 "imshow: pixels with NaN or NA values are set to minimum pixel value");
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
208 im(nans) = display_range(1);
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
209 endif
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
210 endif
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
211
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
212 if (truecolor || indexed)
20301
eca5aa3225f4 imshow.m: Add support for 'parent' property (bug #45473).
Rik <rik@octave.org>
parents: 20181
diff changeset
213 htmp = image (xdata, ydata, im, prop_val_args{:});
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
214 else
20301
eca5aa3225f4 imshow.m: Add support for 'parent' property (bug #45473).
Rik <rik@octave.org>
parents: 20181
diff changeset
215 htmp = imagesc (xdata, ydata, im, display_range, prop_val_args{:});
20302
928e2c6f888e imshow.m: Respect new 'parent' property when setting axis properties.
Rik <rik@octave.org>
parents: 20301
diff changeset
216 set (get (htmp, "parent"), "clim", display_range);
5934
8702f00329bf [project @ 2006-08-17 20:29:51 by jwe]
jwe
parents: 5642
diff changeset
217 endif
20302
928e2c6f888e imshow.m: Respect new 'parent' property when setting axis properties.
Rik <rik@octave.org>
parents: 20301
diff changeset
218 set (get (htmp, "parent"), "visible", "off", "view", [0, 90],
928e2c6f888e imshow.m: Respect new 'parent' property when setting axis properties.
Rik <rik@octave.org>
parents: 20301
diff changeset
219 "ydir", "reverse", "layer", "top");
7511
f028e7aa77a7 imshow.m: use axis ("image")
John W. Eaton <jwe@octave.org>
parents: 7331
diff changeset
220 axis ("image");
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
221
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
222 if (nargout > 0)
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
223 h = htmp;
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
224 endif
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
225
559
4e826edfbc56 [project @ 1994-07-25 22:18:28 by jwe]
jwe
parents:
diff changeset
226 endfunction
4836
518e495e489f [project @ 2004-03-12 18:16:03 by jwe]
jwe
parents: 3457
diff changeset
227
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
228
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
229 %!demo
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
230 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
231 %! imshow ("default.img");
4836
518e495e489f [project @ 2004-03-12 18:16:03 by jwe]
jwe
parents: 3457
diff changeset
232
518e495e489f [project @ 2004-03-12 18:16:03 by jwe]
jwe
parents: 3457
diff changeset
233 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
234 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
235 %! imshow ("default.img");
23931
b208e1a7dd02 imshow.m: fix colormap related demos (bug #51825)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23524
diff changeset
236 %! colormap (gca, autumn (64));
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
237
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
238 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
239 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
240 %! [I, M] = imread ("default.img");
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
241 %! imshow (I, M);
4836
518e495e489f [project @ 2004-03-12 18:16:03 by jwe]
jwe
parents: 3457
diff changeset
242
518e495e489f [project @ 2004-03-12 18:16:03 by jwe]
jwe
parents: 3457
diff changeset
243 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
244 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
245 %! [I, M] = imread ("default.img");
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
246 %! [R, G, B] = ind2rgb (I, M);
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
247 %! imshow (cat (3, R, G*0.5, B*0.8));
5318
9a72639b62a7 [project @ 2005-04-28 18:44:27 by jwe]
jwe
parents: 5307
diff changeset
248
9a72639b62a7 [project @ 2005-04-28 18:44:27 by jwe]
jwe
parents: 5307
diff changeset
249 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
250 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
251 %! imshow (rand (100, 100));
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
252 %! title ({"imshow with random 100x100 matrix", "black and white"});
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
253
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
254 %!demo
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
255 %! clf;
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
256 %! imshow (rand (100, 100));
23931
b208e1a7dd02 imshow.m: fix colormap related demos (bug #51825)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23524
diff changeset
257 %! colormap (gca, jet (64));
22314
a1840b139c37 dump_demos.m: Remove dummy assert function.
Rik <rik@octave.org>
parents: 22312
diff changeset
258 %! title ({"imshow with random 100x100 matrix", "colormap() makes color image"});
22312
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
259
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
260 %!demo
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
261 %! clf;
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
262 %! imshow (rand (100, 100, 3));
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
263 %! title ({"imshow with random 100x100x3 matrix", "RGB color"});
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
264
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
265 %!demo
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
266 %! clf;
533c3c4059a3 Add titles to more of the graphic demos.
Rik <rik@octave.org>
parents: 21580
diff changeset
267 %! imshow (100*rand (100, 100, 3));
22392
4dfb28724863 Clip double RGB data before passing to gl2psDrawPixels (bug #48873).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 22323
diff changeset
268 %! title ({"imshow with random 100x100x3 matrix", "RGB values > 1 are clipped"});
7074
87151f298e6a [project @ 2007-10-26 17:57:34 by jwe]
jwe
parents: 7017
diff changeset
269
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
270 ## Test input validation
28896
90fea9cc9caa test: Add expected error message <Invalid call> to BIST tests for nargin.
Rik <rik@octave.org>
parents: 27985
diff changeset
271 %!error <Invalid call> imshow ()
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
272 %!error <IM must be an image> imshow ({"cell"})
18713
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
273 %!error <TrueColor image must be uint8> imshow (ones (3,3,3, "uint32"))
0585787aa8ae imshow.m: Overhaul function and support integer images (bug #41240).
Rik <rik@octave.org>
parents: 18712
diff changeset
274 %!error <TrueColor image must be uint8> imshow (ones (3,3,3, "int16"))
20711
7b608fadc663 Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents: 20357
diff changeset
275 %!error <image must be MxN or MxNx3 matrix> imshow (ones (4,4,4))
14237
11949c9795a0 Revamp %!demos in m-files to use Octave coding conventions on spacing, etc.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
276
18739
0461fe1d2a01 imshow.m: Don't popup blank figure during 'make check'
Rik <rik@octave.org>
parents: 18719
diff changeset
277 %!test
0461fe1d2a01 imshow.m: Don't popup blank figure during 'make check'
Rik <rik@octave.org>
parents: 18719
diff changeset
278 %! hf = figure ("visible", "off");
0461fe1d2a01 imshow.m: Don't popup blank figure during 'make check'
Rik <rik@octave.org>
parents: 18719
diff changeset
279 %! unwind_protect
20357
a3bf503652b2 iscolormap: relax input check - specially in [0 1] range.
Carnë Draug <carandraug@octave.org>
parents: 20302
diff changeset
280 %! fail ("imshow ([1,1], [2 0 0])", "all MAP values must be in the range");
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
281 %! fail ("imshow ([1,1], [1 0 0 0])", "argument number 2 is invalid");
20357
a3bf503652b2 iscolormap: relax input check - specially in [0 1] range.
Carnë Draug <carandraug@octave.org>
parents: 20302
diff changeset
282 %! fail ('imshow ([1,1], "colormap", [2 0 0])', "all MAP values must be in the range");
20302
928e2c6f888e imshow.m: Respect new 'parent' property when setting axis properties.
Rik <rik@octave.org>
parents: 20301
diff changeset
283 %! fail ('imshow ([1,1], "parent", -1)', "must be an axes handle");
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
284 %! fail ('imshow ([1,1], "xdata", ones (2,2))', "xdata must be a vector");
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
285 %! fail ('imshow ([1,1], "ydata", ones (2,2))', "ydata must be a vector");
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21546
diff changeset
286 %! fail ('imshow ([1,1], "foobar")', "warning", "unrecognized property foobar");
19597
db92e7e28e1f strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19596
diff changeset
287 %! fail ("imshow ([1,1], {1})", "argument number 2 is invalid");
18739
0461fe1d2a01 imshow.m: Don't popup blank figure during 'make check'
Rik <rik@octave.org>
parents: 18719
diff changeset
288 %! fail ("imshow ([1+i,1-i])", "warning", "only showing real part of complex image");
0461fe1d2a01 imshow.m: Don't popup blank figure during 'make check'
Rik <rik@octave.org>
parents: 18719
diff changeset
289 %! unwind_protect_cleanup
0461fe1d2a01 imshow.m: Don't popup blank figure during 'make check'
Rik <rik@octave.org>
parents: 18719
diff changeset
290 %! close (hf);
0461fe1d2a01 imshow.m: Don't popup blank figure during 'make check'
Rik <rik@octave.org>
parents: 18719
diff changeset
291 %! end_unwind_protect