degate  0.1.2
Static Public Member Functions
degate::DilateImagePolicy< ImageType, PixelType > Struct Template Reference

Policy class for image dilation. More...

#include <MorphologicalFilter.h>

List of all members.

Static Public Member Functions

static PixelType calculate (std::shared_ptr< ImageType > src, unsigned int x, unsigned int y, unsigned int min_x, unsigned int max_x, unsigned int min_y, unsigned int max_y, unsigned int dilation_threshold)

Detailed Description

template<typename ImageType, typename PixelType>
struct degate::DilateImagePolicy< ImageType, PixelType >

Policy class for image dilation.

This policy class can be used for any single channel image. Pixel values evaluate to 0 if they are <= 0 and evaluated to 1 if they are > 0.

Definition at line 82 of file MorphologicalFilter.h.


Member Function Documentation

template<typename ImageType , typename PixelType >
static PixelType degate::DilateImagePolicy< ImageType, PixelType >::calculate ( std::shared_ptr< ImageType >  src,
unsigned int  x,
unsigned int  y,
unsigned int  min_x,
unsigned int  max_x,
unsigned int  min_y,
unsigned int  max_y,
unsigned int  dilation_threshold 
) [inline, static]

Definition at line 84 of file MorphologicalFilter.h.

                                                                       {

      assert(min_x < max_x && min_y < max_y);
      assert(min_x < src->get_width());
      assert(max_x < src->get_width());
      assert(min_y < src->get_height());
      assert(max_y < src->get_height());

      unsigned int i = 0;

      for(unsigned int _y = min_y; _y < max_y; _y++)
        for(unsigned int _x = min_x; _x < max_x; _x++)
          if(src->get_pixel(_x, _y) > 0) i++;
      return i >= dilation_threshold ? 1 : src->get_pixel(x, y);
    }

The documentation for this struct was generated from the following file: