Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxNgbLocalMode Class Template Reference

Neighbourhood functor for local mode filter. More...

#include <HxNgbLocalMode.h>

List of all members.

Public Types

typedef HxTagLoop IteratorCategory
 Loop version. More...

typedef HxTag1Phase PhaseCategory
 1 phase. More...


Public Methods

 HxNgbLocalMode (HxTagList &tags)
 Constructor. More...

HxSizes size ()
 Size of the neighbourhood. More...

void init (int, int, const SrcT &, const SrcT &v2)
 Initialization. More...

void check (int i, int j)
void next (int x, int y, const SrcT &v1, const SrcT &)
 Processing one pixel. More...

DstT result () const
 Produce the result value. More...


Static Public Methods

HxString className ()
 The name : "localMode". More...


Detailed Description

template<class DstT, class SrcT>
class HxNgbLocalMode< DstT, SrcT >

Neighbourhood functor for local mode filter.


Member Typedef Documentation

template<class DstT, class SrcT>
typedef HxTagLoop HxNgbLocalMode::IteratorCategory
 

Loop version.

template<class DstT, class SrcT>
typedef HxTag1Phase HxNgbLocalMode::PhaseCategory
 

1 phase.


Constructor & Destructor Documentation

template<class DstT, class SrcT>
HxNgbLocalMode< DstT, SrcT >::HxNgbLocalMode HxTagList   tags [inline]
 

Constructor.

00039                             {
00040                                 _size = HxGetTag(tags, "ngbSize", HxSizes(11, 11, 1));
00041                                 if (_size.x()<1&&_size.x()%2!=0&&_size.y()<1&&_size.y()%2!=0&&_size.z()!=1)
00042                                     throw HxString("Error: HxNgbLocalMode kernel must be 2D odd sized");
00043                                 hsx = (_size.x()+0)/2; // e.g. s=11, half=5, xin=[0..11> xwork=[-5..+5]
00044                                 hsy = (_size.y()+0)/2;
00045                                 _tags=tags;
00046                                 double sx = HxGetTag(tags, "sigmax", 2.0);
00047                                 double sy = HxGetTag(tags, "sigmay", 2.0);
00048                                 double sval = HxGetTag(tags, "sigmaval", 10.0);
00049                                 _sigmax = -0.5/sx/sx;
00050                                 _sigmay = -0.5/sy/sy;
00051                                 _sigmaval = -0.5/sval/sval;
00052                             }


Member Function Documentation

template<class DstT, class SrcT>
HxSizes HxNgbLocalMode< DstT, SrcT >::size   [inline]
 

Size of the neighbourhood.

00056                             {
00057                                 return _size;
00058                             }

template<class DstT, class SrcT>
void HxNgbLocalMode< DstT, SrcT >::init int   ,
int   ,
const SrcT &   ,
const SrcT &    v2
[inline]
 

Initialization.

00062                             {
00063                                 _v2=v2;
00064                                 teller = HxScalarDouble(0.0);
00065                                 noemer=0.0;
00066                             }

template<class DstT, class SrcT>
void HxNgbLocalMode< DstT, SrcT >::next int    x,
int    y,
const SrcT &    v1,
const SrcT &   
[inline]
 

Processing one pixel.

00076                             {
00077                                 int i=x-hsx;
00078                                 int j=y-hsy;
00079 #ifdef _DEBUG
00080                                 check(i,j);
00081 #endif
00082                                 double po=0;
00083                                 po += i*i*_sigmax;
00084                                 po += j*j*_sigmay;
00085                                 po += norm2sqr(v1-_v2)*_sigmaval;
00086                                 double w=exp(po);
00087                                 teller += v1*DstT(HxScalarDouble(w));
00088                                 noemer += w;
00089                             }

template<class DstT, class SrcT>
DstT HxNgbLocalMode< DstT, SrcT >::result   const [inline]
 

Produce the result value.

00093                             {
00094                                 return teller/DstT(HxScalarDouble(noemer));
00095                             }

template<class DstT, class SrcT>
HxString HxNgbLocalMode< DstT, SrcT >::className   [inline, static]
 

The name : "localMode".

00099                             {
00100                                 return HxString("localMode");
00101                             }


The documentation for this class was generated from the following file:
Generated on Tue Feb 3 14:19:06 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001