changeset 450:43974138fa93

Added check if image and SE have the same class
author carandraug
date Wed, 13 Apr 2011 23:57:31 +0000
parents 0bc627a2b5db
children e0fc9967fcf0
files inst/imtophat.m
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/inst/imtophat.m
+++ b/inst/imtophat.m
@@ -17,7 +17,8 @@
 ## Perform morphological top hat filtering.
 ##
 ## The image @var{A} must be a grayscale or binary image, and @var{se} must be a
-## structuring element.
+## structuring element. Both must have the same class, e.g., if @var{A} is a
+## logical matrix, @var{se} must also be logical.
 ##
 ## @var{type} defines the type of top hat transform. To perform a white, or
 ## opening, top-hat transform its value must be @code{open} or @code{white}. To
@@ -40,6 +41,8 @@
     error("imtophat: first input argument must be a real matrix");
   elseif (!ismatrix(se) || !isreal(se))
     error("imtophat: second input argument must be a real matrix");
+  elseif ( !strcmp(class(im), class(se)) )
+    error("imtophat: image and structuring element must have the same class");
   endif
 
   ## Perform filtering