DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Static Public Member Functions
DGtal::ImageFromSet< TImage > Struct Template Reference

#include <ImageFromSet.h>

Public Types

typedef TImage Image
typedef TImage::Value Value

Static Public Member Functions

template<typename Set >
static Image create (const Set &aSet, const Value &defaultValue, const bool addBorder, typename Set::ConstIterator itBegin, typename Set::ConstIterator itEnd)
template<typename Set >
static Image create (const Set &aSet, const Value &defaultValue, const bool addBorder=false)
template<typename Set >
static void append (Image &aImage, const Value &defaultValue, typename Set::ConstIterator itBegin, typename Set::ConstIterator itEnd)
template<typename Set >
static void append (Image &aImage, const Set &aSet, const Value &defaultValue)

Detailed Description

template<typename TImage>
struct DGtal::ImageFromSet< TImage >

Aim: Define utilities to convert a digital set into an image.

Description of template class 'ImageFromSet'

Template Parameters:
TImagean model of CImageContainer concept.

Definition at line 63 of file ImageFromSet.h.


Member Typedef Documentation

template<typename TImage >
typedef TImage DGtal::ImageFromSet< TImage >::Image

Definition at line 65 of file ImageFromSet.h.

template<typename TImage >
typedef TImage::Value DGtal::ImageFromSet< TImage >::Value

Definition at line 66 of file ImageFromSet.h.


Member Function Documentation

template<typename Image >
template<typename Set >
void DGtal::ImageFromSet< Image >::append ( Image aImage,
const Value defaultValue,
typename Set::ConstIterator  itBegin,
typename Set::ConstIterator  itEnd 
)
inlinestatic

Append a Set to an existing image. Only points in the Set between itBegin and itEnd contained in the image domain are considered.

Template Parameters:
Setmodel of CDigitalSet
Parameters:
aImagean image
defaultValuethe default value for points in the set
itBeginConstIterator on the set to specify the first point to copy of a Set.
itEndConstIterator on the set to specify the last point to copy of a Set.

Definition at line 70 of file ImageFromSet.ih.

{
// BOOST_CONCEPT_ASSERT(( CDigitalSet<Set> ));
typename Image::Domain domain = aImage.domain();
for( ; itBegin != itEnd; ++itBegin)
if (domain.isInside( *itBegin))
aImage.setValue( *itBegin, defaultValue);
}
template<typename TImage >
template<typename Set >
static void DGtal::ImageFromSet< TImage >::append ( Image aImage,
const Set &  aSet,
const Value defaultValue 
)
inlinestatic

Append a Set to an existing image. Only points in the Set contained in the image domain are considered.

Template Parameters:
Setmodel of CDigitalSet
Parameters:
aImagean image
aSetan instance of Set to convert into an image
defaultValuethe default value for points in the set to copy.

Definition at line 145 of file ImageFromSet.h.

{
append<Set>(aImage,defaultValue,aSet.begin(),aSet.end());
}
template<typename Image >
template<typename Set >
Image DGtal::ImageFromSet< Image >::create ( const Set &  aSet,
const Value defaultValue,
const bool  addBorder,
typename Set::ConstIterator  itBegin,
typename Set::ConstIterator  itEnd 
)
inlinestatic

Create an Image from a DigitalSet. The size of the output image is given from the set bounding box.

Template Parameters:
Setmodel of CDigitalSet
Parameters:
aSetan instance of Set to convert into an image
defaultValuethe default value for points in the set
addBorderif true, we add a border of size 1 of defaultValue around the set.
itBeginConstIterator on the set to specify the first point to copy.
itEndConstIterator on the set to specify the last point to copy.
Returns:
an image.

Definition at line 43 of file ImageFromSet.ih.

Referenced by DGtal::ImageFromSet< TImage >::create().

{
// BOOST_CONCEPT_ASSERT(( CDigitalSet<Set> ));
typename Set::Point lower,upper;
typename Set::Point dec;
if (addBorder)
dec = Set::Point::diagonal(1);
aSet.computeBoundingBox(lower,upper);
Image image(typename Image::Domain(lower - dec ,upper + dec));
append<Set>(image,defaultValue, itBegin, itEnd);
return image;
}
template<typename TImage >
template<typename Set >
static Image DGtal::ImageFromSet< TImage >::create ( const Set &  aSet,
const Value defaultValue,
const bool  addBorder = false 
)
inlinestatic

Create an Image from a DigitalSet. The size of the output image is given from the set bounding box.

Template Parameters:
Setmodel of CDigitalSet
Parameters:
aSetan instance of Set to convert into an image
defaultValuethe default value for points in the set
addBorderif true, we add a border of size 1 of defaultValue around the set.
Returns:
an image.

Definition at line 108 of file ImageFromSet.h.

References DGtal::ImageFromSet< TImage >::create().

{
return create(aSet,defaultValue,addBorder,aSet.begin(), aSet.end());
}

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