changeset 574:b64d36b203a2

isind: use shared private functions for checks
author carandraug
date Sun, 02 Sep 2012 02:44:23 +0000
parents 9a6addcc1c55
children cefe03364864
files inst/isind.m
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/inst/isind.m
+++ b/inst/isind.m
@@ -37,15 +37,12 @@
   endif
 
   bool = false;
-  if (ismatrix (img) && ndims (img) == 2 && !issparse (img) && isreal (img) && !isempty (img))
+  if (!isimage (img))
+    bool = false;
+  elseif (ndims (img) == 2 && isreal (img))
     switch (class (img))
       case "double"
-        ## to speed this up, we can look at a sample of the image first
-        bool = is_ind_double (img(1:ceil (rows (img) /100), 1:ceil (columns (img) /100)));
-        if (bool)
-          ## sample was true, we better make sure it's real
-          bool = is_ind_double (img);
-        endif
+        bool = ispart (@is_ind_double, img);
       case {"uint8", "uint16"}
         bool = true;
     endswitch