DGtal  0.9.3beta
Public Types | Public Member Functions | Protected Attributes | Private Member Functions
DGtal::ImageFactoryFromImage< TImageContainer > Class Template Reference

#include <DGtal/images/ImageFactoryFromImage.h>

Public Types

typedef ImageFactoryFromImage< TImageContainer > Self
 
typedef TImageContainer ImageContainer
 
typedef ImageContainer::Domain Domain
 
typedef ImageContainer OutputImage
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CImage< TImageContainer >))
 
 ImageFactoryFromImage (Alias< ImageContainer > anImage)
 
 ~ImageFactoryFromImage ()
 
const Domaindomain () const
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
OutputImagerequestImage (const Domain &aDomain)
 
void flushImage (OutputImage *outputImage)
 
void detachImage (OutputImage *outputImage)
 

Protected Attributes

ImageContainermyImagePtr
 

Private Member Functions

 ImageFactoryFromImage (const ImageFactoryFromImage &other)
 
ImageFactoryFromImageoperator= (const ImageFactoryFromImage &other)
 

Detailed Description

template<typename TImageContainer>
class DGtal::ImageFactoryFromImage< TImageContainer >

Aim: implements a factory to produce images from a "bigger/original" one according to a given domain.

Description of template class 'ImageFactoryFromImage'

Template Parameters
TImageContaineran image container type (model of CImage).

The factory images production (images are copied, so it's a creation process) is done with the function 'requestImage' so the deletion must be done with the function 'detachImage'.

The update of the original image is done with the function 'flushImage'.

Examples:
images/exampleImageFactoryFromHDF5.cpp, and images/exampleTiledImage.cpp.

Definition at line 66 of file ImageFactoryFromImage.h.

Member Typedef Documentation

template<typename TImageContainer >
typedef ImageContainer::Domain DGtal::ImageFactoryFromImage< TImageContainer >::Domain

Definition at line 79 of file ImageFactoryFromImage.h.

template<typename TImageContainer >
typedef TImageContainer DGtal::ImageFactoryFromImage< TImageContainer >::ImageContainer

Types copied from the container.

Definition at line 78 of file ImageFactoryFromImage.h.

template<typename TImageContainer >
typedef ImageContainer DGtal::ImageFactoryFromImage< TImageContainer >::OutputImage

New types.

Definition at line 82 of file ImageFactoryFromImage.h.

template<typename TImageContainer >
typedef ImageFactoryFromImage<TImageContainer> DGtal::ImageFactoryFromImage< TImageContainer >::Self

Definition at line 72 of file ImageFactoryFromImage.h.

Constructor & Destructor Documentation

template<typename TImageContainer >
DGtal::ImageFactoryFromImage< TImageContainer >::ImageFactoryFromImage ( Alias< ImageContainer anImage)
inline

Constructor.

Parameters
anImagealias on the underlying image container.

Definition at line 92 of file ImageFactoryFromImage.h.

92  :
93  myImagePtr(&anImage)
94  {
95  }
ImageContainer * myImagePtr
Alias on the image container.
template<typename TImageContainer >
DGtal::ImageFactoryFromImage< TImageContainer >::~ImageFactoryFromImage ( )
inline

Destructor. Does nothing

Definition at line 101 of file ImageFactoryFromImage.h.

101 {}
template<typename TImageContainer >
DGtal::ImageFactoryFromImage< TImageContainer >::ImageFactoryFromImage ( const ImageFactoryFromImage< TImageContainer > &  other)
private

Member Function Documentation

template<typename TImageContainer >
DGtal::ImageFactoryFromImage< TImageContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CImage< TImageContainer >)  )

Checking concepts.

template<typename TImageContainer >
void DGtal::ImageFactoryFromImage< TImageContainer >::detachImage ( OutputImage outputImage)
inline

Free (i.e. delete) an OutputImage.

Parameters
outputImagethe OutputImage.

Definition at line 185 of file ImageFactoryFromImage.h.

186  {
187  delete outputImage;
188  }
template<typename TImageContainer >
const Domain& DGtal::ImageFactoryFromImage< TImageContainer >::domain ( ) const
inline

Returns a reference to the underlying image domain.

Returns
a reference to the domain.

Definition at line 119 of file ImageFactoryFromImage.h.

References DGtal::ImageFactoryFromImage< TImageContainer >::myImagePtr.

120  {
121  return myImagePtr->domain();
122  }
ImageContainer * myImagePtr
Alias on the image container.
template<typename TImageContainer >
void DGtal::ImageFactoryFromImage< TImageContainer >::flushImage ( OutputImage outputImage)
inline

Flush (i.e. write/synchronize) an OutputImage.

Parameters
outputImagethe OutputImage.

Definition at line 170 of file ImageFactoryFromImage.h.

References DGtal::ImageFactoryFromImage< TImageContainer >::myImagePtr.

171  {
172  typename Domain::Iterator it = outputImage->domain().begin();
173  typename Domain::Iterator it_end = outputImage->domain().end();
174  for (; it != it_end; ++it)
175  {
176  myImagePtr->setValue(*it, (*outputImage)(*it));
177  }
178  }
ImageContainer * myImagePtr
Alias on the image container.
template<typename TImageContainer >
bool DGtal::ImageFactoryFromImage< TImageContainer >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

Definition at line 139 of file ImageFactoryFromImage.h.

References DGtal::ImageFactoryFromImage< TImageContainer >::myImagePtr.

140  {
141  return (myImagePtr->isValid());
142  }
ImageContainer * myImagePtr
Alias on the image container.
template<typename TImageContainer >
ImageFactoryFromImage& DGtal::ImageFactoryFromImage< TImageContainer >::operator= ( const ImageFactoryFromImage< TImageContainer > &  other)
private
template<typename TImageContainer >
OutputImage* DGtal::ImageFactoryFromImage< TImageContainer >::requestImage ( const Domain aDomain)
inline

Returns a pointer of an OutputImage created with the Domain aDomain.

Parameters
aDomainthe domain.
Returns
an ImagePtr.

Definition at line 151 of file ImageFactoryFromImage.h.

References DGtal::ImageFactoryFromImage< TImageContainer >::myImagePtr.

152  {
153  OutputImage* outputImage = new OutputImage(aDomain);
154 
155  typename Domain::Iterator it = outputImage->domain().begin();
156  typename Domain::Iterator it_end = outputImage->domain().end();
157  for (; it != it_end; ++it)
158  {
159  outputImage->setValue(*it, (*myImagePtr)(*it));
160  }
161 
162  return outputImage;
163  }
ImageContainer OutputImage
New types.
ImageContainer * myImagePtr
Alias on the image container.
template<typename TImageContainer >
void DGtal::ImageFactoryFromImage< TImageContainer >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

Field Documentation

template<typename TImageContainer >
ImageContainer* DGtal::ImageFactoryFromImage< TImageContainer >::myImagePtr
protected

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