[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]

| Algorithms to Initialize Images |
--- | --- | ---

## Functions
template<...> void | initImage (ImageIterator upperleft, ImageIterator lowerright, Accessor a, VALUETYPE v)
| Write a value to every pixel in an image or rectangular ROI.
template<...> void | initImageWithFunctor (ImageIterator upperleft, ImageIterator lowerright, Accessor a, FUNCTOR f)
| Write the result of a functor call to every pixel in an image or rectangular ROI.
template<...> void | initImageIf (ImageIterator upperleft, ImageIterator lowerright, Accessor a, MaskImageIterator mask_upperleft, MaskAccessor ma, VALUETYPE v)
| Write value to pixel in the image if mask is true.
template<...> void | initImageBorder (ImageIterator upperleft, ImageIterator lowerright, Accessor a, int border_width, VALUETYPE v)
| Write value to the specified border pixels in the image.

## Detailed Description

Init images or image borders

## Function Documentation

void initImage (...)

| Write a value to every pixel in an image or rectangular ROI. This function can be used to init the image. It uses an accessor to access the pixel data. Declarations: pass arguments explicitly:
        namespace vigra {
            template <class ImageIterator, class Accessor, class VALUETYPE>
            void
            initImage(ImageIterator upperleft, ImageIterator lowerright,
                  Accessor a, VALUETYPE v)
        }
use argument objects in conjunction with Argument Object Factories:
        namespace vigra {
            template <class ImageIterator, class Accessor, class VALUETYPE>
            void
            initImage(triple<ImageIterator, ImageIterator, Accessor> img, VALUETYPE v)
        }
Usage: #include "vigra/initimage.hxx" Namespace: vigra
        vigra::BImage img(100, 100);

        // zero the image
        vigra::initImage(destImageRange(img),
                         vigra::NumericTraits<vigra::BImage::PixelType>::zero());
Required Interface:
        ImageIterator upperleft, lowerright;
        ImageIterator::row_iterator ix = upperleft.rowIterator();

        Accessor accessor;
        VALUETYPE v;

        accessor.set(v, ix);

void initImageBorder (...)

| Write value to the specified border pixels in the image. A pixel is initialized if its distance to the border is at most 'borderwidth'. It uses an accessor to access the pixel data. Declarations: pass arguments explicitly:
        namespace vigra {
            template <class ImageIterator, class Accessor, class VALUETYPE>
            void
            initImageBorder(ImageIterator upperleft, ImageIterator lowerright,
                    Accessor a,  int border_width, VALUETYPE v)
        }
use argument objects in conjunction with Argument Object Factories:
        namespace vigra {
            template <class ImageIterator, class Accessor, class VALUETYPE>
            void
            initImageBorder(triple<ImageIterator, ImageIterator, Accessor> img,
                    int border_width, VALUETYPE v)
        }
Usage: #include "vigra/initimage.hxx" Namespace: vigra
        vigra::BImage img(100, 100);

        // zero a border of 5 pixel
        vigra::initImageBorder(destImageRange(img),
                        5, vigra::NumericTraits<vigra::BImage::PixelType>::zero());
Required Interface: see initImage()

void initImageIf (...)

| Write value to pixel in the image if mask is true. This function can be used to init a region-of-interest of the image. It uses an accessor to access the pixel data. Declarations: pass arguments explicitly:
        namespace vigra {
            template <class ImageIterator, class Accessor,
                  class MaskImageIterator, class MaskAccessor,
                  class VALUETYPE>
            void
            initImageIf(ImageIterator upperleft, ImageIterator lowerright, Accessor a,
                  MaskImageIterator mask_upperleft, MaskAccessor ma,
                  VALUETYPE v)
        }
use argument objects in conjunction with Argument Object Factories:
        namespace vigra {
            template <class ImageIterator, class Accessor,
                  class MaskImageIterator, class MaskAccessor,
                  class VALUETYPE>
            void
            initImageIf(triple<ImageIterator, ImageIterator, Accessor> img,
                pair<MaskImageIterator, MaskAccessor> mask,
                VALUETYPE v)
        }
Usage: #include "vigra/initimage.hxx" Namespace: vigra
        vigra::BImage img(100, 100);
        vigra::BImage mask(100, 100);

        // zero the ROI
        vigra::initImageIf(destImageRange(img),
                    maskImage(mask),
                    vigra::NumericTraits<vigra::BImage::PixelType>::zero());
Required Interface:
        ImageIterator upperleft, lowerright;
        MaskImageIterator mask_upperleft;
        ImageIterator::row_iterator ix = upperleft.rowIterator();
        MaskImageIterator::row_iterator mx = mask_upperleft.rowIterator();

        Accessor accessor;
        MaskAccessor mask_accessor;
        VALUETYPE v;

        if(mask_accessor(mx)) accessor.set(v, ix);

void initImageWithFunctor (...)

| Write the result of a functor call to every pixel in an image or rectangular ROI. This function can be used to init the image by calling the given functor for each pixel. It uses an accessor to access the pixel data. Declarations: pass arguments explicitly:
        namespace vigra {
            template <class ImageIterator, class Accessor, class FUNCTOR>
            void
            initImageWithFunctor(ImageIterator upperleft, ImageIterator lowerright,
                      Accessor a,  FUNCTOR f);
        }
use argument objects in conjunction with Argument Object Factories:
        namespace vigra {
            template <class ImageIterator, class Accessor, class FUNCTOR>
            void
            initImageWithFunctor(triple<ImageIterator, ImageIterator, Accessor> img, FUNCTOR f);
        }
Usage: #include "vigra/initimage.hxx" Namespace: vigra
        struct Counter {
            Counter() : count(0) {}

            int operator()() const { return count++; }

            mutable int count;
        };

        vigra::IImage img(100, 100);

        // write the current count in every pixel
        vigra::initImageWithFunctor(destImageRange(img), Counter());
Required Interface:
        ImageIterator upperleft, lowerright;
        ImageIterator::row_iterator ix = upperleft.rowIterator();

        Accessor accessor;
        Functor f;

        accessor.set(f(), ix);

© Ullrich Köthe (koethe@informatik.uni-hamburg.de) Cognitive Systems Group, University of Hamburg, Germany | html generated using doxygen and Python VIGRA 1.3.2 (27 Jan 2005)