#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxAcos (HxImageRep im) |
Arc cosine. More... |
|
Arc cosine. The function computes the arc cosine (see Pixels) of all pixels in the input image via a unary pixel operation (see Images). Implementation specifics : The pixel functor : HxUpoAcos. The image functor instantiator : HxInstantiatorAcos.
00015 { 00016 HxString fname("HxAcos"); 00017 00018 if (im.isNull()) 00019 { 00020 HxGlobalError::instance()->reportError(fname, im.name(), "null image", HxGlobalError::HX_GE_INVALID); 00021 return HxImageRep(); 00022 } 00023 // value between -1 and 1 00024 // ook voor vector etc. 00025 00026 HxValue vsup = HxPixSup(im); 00027 HxValue vinf = HxPixInf(im); 00028 00029 if (im.signature().pixelDimensionality() == 1) 00030 { 00031 if ((((HxScalarDouble) vinf) < -1.0) || (((HxScalarDouble) vsup) > 1.0)) 00032 { 00033 HxGlobalError::instance()->reportError(fname, im.name(), "values not in [-1:1]", HxGlobalError::HX_GE_OUTOFRANGE); 00034 } 00035 } 00036 else if (im.signature().pixelDimensionality() == 2) 00037 { 00038 HxVec2Double vinf2d = (HxVec2Double) vinf; 00039 HxVec2Double vsup2d = (HxVec2Double) vsup; 00040 if ((vinf2d.x() < -1.0) || (vsup2d.x() > 1.0) || 00041 (vinf2d.y() < -1.0) || (vsup2d.y() > 1.0)) 00042 { 00043 HxGlobalError::instance()->reportError(fname, im.name(), "2D values are not in [-1:1]", HxGlobalError::HX_GE_OUTOFRANGE); 00044 } 00045 } 00046 else if (im.signature().pixelDimensionality() == 3) 00047 { 00048 HxVec3Double vinf3d = (HxVec3Double) vinf; 00049 HxVec3Double vsup3d = (HxVec3Double) vsup; 00050 if ((vinf3d.x() < -1.0) || (vsup3d.x() > 1.0) || 00051 (vinf3d.y() < -1.0) || (vsup3d.y() > 1.0) || 00052 (vinf3d.z() < -1.0) || (vsup3d.z() > 1.0)) 00053 { 00054 HxGlobalError::instance()->reportError(fname, im.name(), "3D values are not in [-1:1]", HxGlobalError::HX_GE_OUTOFRANGE); 00055 } 00056 } 00057 00058 return im.unaryPixOp("acos"); 00059 } |