From: <car...@us...> - 2012-09-02 03:52:23
|
Revision: 10950 http://octave.svn.sourceforge.net/octave/?rev=10950&view=rev Author: carandraug Date: 2012-09-02 03:52:17 +0000 (Sun, 02 Sep 2012) Log Message: ----------- iscolormap: also check class and number of dimensions Modified Paths: -------------- trunk/octave-forge/main/image/inst/iptcheckmap.m trunk/octave-forge/main/image/inst/iscolormap.m Modified: trunk/octave-forge/main/image/inst/iptcheckmap.m =================================================================== --- trunk/octave-forge/main/image/inst/iptcheckmap.m 2012-09-02 03:41:40 UTC (rev 10949) +++ trunk/octave-forge/main/image/inst/iptcheckmap.m 2012-09-02 03:52:17 UTC (rev 10950) @@ -43,7 +43,7 @@ ## error ends in \n so the back trace of the error is not show. This is on ## purpose since the whole idea of this function is already to give a properly ## formatted error message - if (!strcmp (class(in), "double") || columns (in) != 3 || ndims (in) != 2 || !isreal (in) || min (in(:) < 0) || max (in(:) > 1)) + if (!iscolormap (in)) error ("Function %s expected input number %d, %s, to be a valid colormap.\n... Valid colormaps must be nonempty, double, 2-D matrices with 3 columns.\n", ... func_name, pos, var_name); Modified: trunk/octave-forge/main/image/inst/iscolormap.m =================================================================== --- trunk/octave-forge/main/image/inst/iscolormap.m 2012-09-02 03:41:40 UTC (rev 10949) +++ trunk/octave-forge/main/image/inst/iscolormap.m 2012-09-02 03:52:17 UTC (rev 10950) @@ -31,7 +31,8 @@ endif bool = false; - if (ismatrix (cm) && isnumeric (cm) && columns(cm) == 3 && + if (ismatrix (cm) && isreal (cm) isnumeric (cm) && columns(cm) == 3 && + ndims (cm) == 2 && strcmp (class (cm), "double") && min (cm(:)) >= 0 && max (cm(:)) <= 1) bool = true; endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |