Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Protected Attributes
icl::filter::NeighborhoodOp Class Reference

unary operators that work on each pixels neighborhood \ More...

#include <NeighborhoodOp.h>

Inheritance diagram for icl::filter::NeighborhoodOp:
icl::filter::UnaryOp icl::utils::Configurable icl::filter::ConvolutionOp icl::filter::MedianOp icl::filter::MorphologicalOp icl::filter::WienerOp icl::filter::DynamicConvolutionOp

List of all members.

Public Member Functions

virtual ~NeighborhoodOp ()
 Destructor.
bool computeROI (const core::ImgBase *poSrc, utils::Point &oROIoffset, utils::Size &oROIsize)
 compute neccessary ROI offset and size
virtual void applyMT (const core::ImgBase *operand1, core::ImgBase **dst, unsigned int nThreads)
 *NEW* apply function for multithreaded filtering (reimplemented here for special roi handling!)
const utils::SizegetMaskSize () const
const utils::PointgetAnchor () const
const utils::PointgetROIOffset () const

Protected Member Functions

 NeighborhoodOp ()
 NeighborhoodOp (const utils::Size &size)
void setMask (const utils::Size &size)
void setMask (const utils::Size &size, const utils::Point &anchor)
void setROIOffset (const utils::Point &offs)
virtual bool prepare (core::ImgBase **ppoDst, const core::ImgBase *poSrc)
 prepare filter operation: ensure compatible image format and size
virtual bool prepare (core::ImgBase **ppoDst, const core::ImgBase *poSrc, core::depth eDepht)
 prepare filter operation: as above, but with depth parameter
virtual utils::Size adaptSize (const utils::Size &size)
 this function can be reimplemented e.g to enshure an odd mask width and height

Protected Attributes

utils::Size m_oMaskSize
 TODO: later private with getter and setter functions.
utils::Point m_oAnchor
 anchor of filter mask
utils::Point m_oROIOffset
 to-be-used ROI offset for source image

Detailed Description

unary operators that work on each pixels neighborhood \

TODO:: check!! The NeighborhoodOp class builds a base class for unary operations employing a filter mask which is moved over the ROI of the source image(s), e.g. convolution filters use some convolution masks. To this end the class provides members to store the size and anchor of the filter mask.

Special care has to be taken, when applying a filter mask to the border of an image, e.g. in case of full-image ROI. In this case the filter might access undefined pixel values outside the image, actually causing a segfault in most cases.

Hence, the used ROI size of the source image is shrinked if neccessary, such that the filter mask always fits into the image, when moved over the ROI. For this purpose the method adaptROI is provided, which computes the to-be-used ROI. The ROI of the source image is not actually changed, which makes the filter operation thread safe, because simultaneous operations running on the source image within different threads do not interfere.


Constructor & Destructor Documentation

virtual icl::filter::NeighborhoodOp::~NeighborhoodOp ( ) [inline, virtual]

Destructor.

icl::filter::NeighborhoodOp::NeighborhoodOp ( const utils::Size size) [inline, protected]

Member Function Documentation

virtual utils::Size icl::filter::NeighborhoodOp::adaptSize ( const utils::Size size) [inline, protected, virtual]

this function can be reimplemented e.g to enshure an odd mask width and height

E.g. some implementations of Neighborhood-operation could demand odd or even mask size parameters. In this case, this function can be implemented in another way. (Example: MedianOp)

Parameters:
sizesize to ajust
Returns:
the given size in this base implementation

Reimplemented in icl::filter::MedianOp.

virtual void icl::filter::NeighborhoodOp::applyMT ( const core::ImgBase operand1,
core::ImgBase **  dst,
unsigned int  nThreads 
) [virtual]

*NEW* apply function for multithreaded filtering (reimplemented here for special roi handling!)

Reimplemented from icl::filter::UnaryOp.

bool icl::filter::NeighborhoodOp::computeROI ( const core::ImgBase poSrc,
utils::Point oROIoffset,
utils::Size oROIsize 
)

compute neccessary ROI offset and size

This functions computes the to-be-used ROI for the source image, such that the filter mask of given size (oMaskSize) fits everywhere into the image if placed arbitrarily within the ROI. The original ROI of the source image is not changed, instead the adapted ROI is returned in parameters oROIsize and oROIoffset.

Parameters:
poSrcimage whose ROI is adapted
oROIoffsetnew ROI offset
oROIsizenew ROI size
Returns:
whether a valid ROI remains

Reimplemented in icl::filter::MorphologicalOp.

virtual bool icl::filter::NeighborhoodOp::prepare ( core::ImgBase **  ppoDst,
const core::ImgBase poSrc 
) [protected, virtual]

prepare filter operation: ensure compatible image format and size

Reimplemented from icl::filter::UnaryOp.

virtual bool icl::filter::NeighborhoodOp::prepare ( core::ImgBase **  ppoDst,
const core::ImgBase poSrc,
core::depth  eDepht 
) [protected, virtual]

prepare filter operation: as above, but with depth parameter

Reimplemented from icl::filter::UnaryOp.

void icl::filter::NeighborhoodOp::setMask ( const utils::Size size) [inline, protected]
void icl::filter::NeighborhoodOp::setMask ( const utils::Size size,
const utils::Point anchor 
) [inline, protected]
void icl::filter::NeighborhoodOp::setROIOffset ( const utils::Point offs) [inline, protected]

Member Data Documentation

anchor of filter mask

TODO: later private with getter and setter functions.

size of filter mask

to-be-used ROI offset for source image


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines