#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
| HxImageRep L_HXIMAGEREP | HxSqrt (HxImageRep im) |
| Square root. More... | |
|
|
Square root. The function computes the square root (see Pixels) of all pixels in the input image via a unary pixel operation (see Images). Implementation specifics : The pixel functor : HxUpoSqrt. The image functor instantiator : HxInstantiatorSqrt.
00013 {
00014 HxString fname("HxSqrt");
00015
00016 if (im.isNull())
00017 {
00018 HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID);
00019 return HxImageRep();
00020 }
00021 HxValue vinf = HxPixInf(im);
00022
00023 if (im.signature().pixelDimensionality() == 1)
00024 {
00025 if (((HxScalarDouble) vinf) <= 0.0)
00026 {
00027 HxGlobalError::instance()->reportError(fname, im.name(), "values less than 0", HxGlobalError::HX_GE_OUTOFRANGE);
00028 }
00029 }
00030 else if (im.signature().pixelDimensionality() == 2)
00031 {
00032 HxVec2Double vinf2d = (HxVec2Double) vinf;
00033 if ((vinf2d.x() <= 0.0) || (vinf2d.y() <= 0.0))
00034 {
00035 HxGlobalError::instance()->reportError(fname, im.name(), "2D values are less than 0", HxGlobalError::HX_GE_OUTOFRANGE);
00036 }
00037 }
00038 else if (im.signature().pixelDimensionality() == 3)
00039 {
00040 HxVec3Double vinf3d = (HxVec3Double) vinf;
00041 if ((vinf3d.x() <= 0.0) || (vinf3d.y() <= 0.0) || (vinf3d.z() <= 0.0))
00042 {
00043 HxGlobalError::instance()->reportError(fname, im.name(), "3D values are less than 0", HxGlobalError::HX_GE_OUTOFRANGE);
00044 }
00045 }
00046
00047 return im.unaryPixOp("sqrt");
00048 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001