#include "HxImageRep.h"
Go to the source code of this file.
Functions | |
HxImageRep L_HXIMAGEREP | HxGaussDerivative3d (HxImageRep img, double sigma, int orderDerivx, int orderDerivy, int orderDerivz, double accuracy=3.0) |
Convolution Gaussian. More... |
|
Convolution Gaussian. Equivalent to : img.genConv3dSep( gaussx, gaussy, gaussx, "mul", "addAssign", HxImageRep::ARITH_PREC) where gauss{x,y,z} is the 1d double-precision Gaussian kernel based on sigma, orderDeriv{x,y,z}, and accuracy. Notice that the kernel is applied to every dimension of the image separately and that the result image has a double-precision pixel type.
00018 { 00019 HxString fname("HxGaussDerivative3d"); 00020 00021 if (img.isNull()) 00022 { 00023 HxGlobalError::instance()->reportError(fname, img.name(), "null image", HxGlobalError::HX_GE_INVALID); 00024 return HxImageRep(); 00025 } 00026 00027 if (sigma <= 0.0) 00028 { 00029 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of sigma", HxGlobalError::HX_GE_INVALID); 00030 return HxImageRep(); 00031 } 00032 if (orderDerivx < 0) 00033 { 00034 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of OrderDerivx", HxGlobalError::HX_GE_INVALID); 00035 return HxImageRep(); 00036 } 00037 if (orderDerivy < 0) 00038 { 00039 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of OrderDerivy", HxGlobalError::HX_GE_INVALID); 00040 return HxImageRep(); 00041 } 00042 if (orderDerivz < 0) 00043 { 00044 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of OrderDerivz", HxGlobalError::HX_GE_INVALID); 00045 return HxImageRep(); 00046 } 00047 00048 if (truncation < 0.0) 00049 { 00050 HxGlobalError::instance()->reportError(fname, img.name(), "invalid value of truncation", HxGlobalError::HX_GE_INVALID); 00051 return HxImageRep(); 00052 } 00053 00054 if (img.dimensionality() != 3) 00055 { 00056 HxGlobalError::instance()->reportError(fname, img.name(), "function only valid for 3D images", HxGlobalError::HX_GE_INVALID); 00057 return HxImageRep(); 00058 } 00059 00060 HxImageRep gaussx, gaussy, gaussz; 00061 00062 gaussx = HxMakeGaussian1d(sigma, orderDerivx, truncation, 00063 img.dimensionSize(1)); 00064 gaussy = HxMakeGaussian1d(sigma, orderDerivy, truncation, 00065 img.dimensionSize(2)); 00066 gaussz = HxMakeGaussian1d(sigma, orderDerivz, truncation, 00067 img.dimensionSize(3)); 00068 00069 return img.genConv3dSep(gaussx, gaussy, gaussz, 00070 "mul", "addAssign", HxImageRep::ARITH_PREC); 00071 } |