changeset 10286:8cf666139297

imshow for logical matrices
author John W. Eaton <jwe@octave.org>
date Tue, 09 Feb 2010 17:12:17 -0500
parents 22a7913bbeb5
children 7c7685cc0676
files scripts/ChangeLog scripts/image/imshow.m
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Feb 09 12:56:47 2010 +0100
+++ b/scripts/ChangeLog	Tue Feb 09 17:12:17 2010 -0500
@@ -1,3 +1,7 @@
+2010-02-09  John W. Eaton  <jwe@octave.org>
+
+	* image/imshow.m: Allow logical values for images.
+
 2010-02-09  Jaroslav Hajek  <highegg@gmail.com>
 
 	* general/accumarray.m: Use != instead of diff to compare indices in
--- a/scripts/image/imshow.m	Tue Feb 09 12:56:47 2010 +0100
+++ b/scripts/image/imshow.m	Tue Feb 09 17:12:17 2010 -0500
@@ -70,11 +70,13 @@
     colormap (map);
   endif
 
-  if (! (isnumeric (im) && (ndims (im) == 2 || ndims (im) == 3)))
+  nd = ndims (im);
+
+  if (! ((isnumeric (im) || islogical (im)) && (nd == 2 || nd == 3)))
     error ("imshow: first argument must be an image or the filename of an image");
   endif
 
-  if (ndims (im) == 2)
+  if (nd == 2)
     if (! indexed)
       colormap (gray ());
     endif