DGtal  1.4.beta
DGtal::Image< TImageContainer > Class Template Reference

Aim: implements association bewteen points lying in a digital domain and values. More...

#include <DGtal/images/Image.h>

Public Types

typedef TImageContainer ImageContainer
 Types copied from the container. More...
 
typedef TImageContainer::Domain Domain
 
typedef TImageContainer::Point Point
 
typedef TImageContainer::Value Value
 
typedef TImageContainer::ConstRange ConstRange
 
typedef TImageContainer::Range Range
 
typedef TImageContainer::OutputIterator OutputIterator
 
typedef CowPtr< TImageContainerImagePointer
 Pointer to the image container data. More...
 

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CImage< TImageContainer >))
 Checking concepts. More...
 
 BOOST_CONCEPT_ASSERT ((concepts::CVertexMap< TImageContainer >))
 
 Image ()
 
 Image (ImageContainer *anImageContainer)
 
 Image (const CowPtr< ImageContainer > &anImageContainerCowPointer)
 
 Image (const ImageContainer &other)
 
 Image (const Image &other)
 
Imageoperator= (const Image &other)
 
 ~Image ()
 
const Domaindomain () const
 
ConstRange constRange () const
 
Range range ()
 
Value operator() (const Point &aPoint) const
 
void setValue (const Point &aPoint, const Value &aValue)
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
const ImagePointer getPointer () const
 

Protected Attributes

ImagePointer myImagePointer
 Owning smart pointer on the image container. More...
 

Detailed Description

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

Aim: implements association bewteen points lying in a digital domain and values.

Description of template class 'Image'

This class is a lightweight proxy on ImageContainers (models of CImage). Image class is also a model of CImage.

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

Definition at line 69 of file Image.h.

Member Typedef Documentation

◆ ConstRange

template<typename TImageContainer >
typedef TImageContainer::ConstRange DGtal::Image< TImageContainer >::ConstRange

Definition at line 85 of file Image.h.

◆ Domain

template<typename TImageContainer >
typedef TImageContainer::Domain DGtal::Image< TImageContainer >::Domain

Definition at line 82 of file Image.h.

◆ ImageContainer

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

Types copied from the container.

Definition at line 81 of file Image.h.

◆ ImagePointer

template<typename TImageContainer >
typedef CowPtr<TImageContainer> DGtal::Image< TImageContainer >::ImagePointer

Pointer to the image container data.

Definition at line 90 of file Image.h.

◆ OutputIterator

template<typename TImageContainer >
typedef TImageContainer::OutputIterator DGtal::Image< TImageContainer >::OutputIterator

Definition at line 87 of file Image.h.

◆ Point

template<typename TImageContainer >
typedef TImageContainer::Point DGtal::Image< TImageContainer >::Point

Definition at line 83 of file Image.h.

◆ Range

template<typename TImageContainer >
typedef TImageContainer::Range DGtal::Image< TImageContainer >::Range

Definition at line 86 of file Image.h.

◆ Value

template<typename TImageContainer >
typedef TImageContainer::Value DGtal::Image< TImageContainer >::Value
Examples
tutorial-examples/volDTGranulo.cpp.

Definition at line 84 of file Image.h.

Constructor & Destructor Documentation

◆ Image() [1/5]

template<typename TImageContainer >
DGtal::Image< TImageContainer >::Image ( )
inline

Default constructor.

Definition at line 99 of file Image.h.

99  {
100 #ifdef DEBUG_VERBOSE
101 trace.warning() << "Image Ctor default "<<std::endl;
102 #endif
103 
104  };
std::ostream & warning()
Trace trace
Definition: Common.h:153

References DGtal::trace, and DGtal::Trace::warning().

◆ Image() [2/5]

template<typename TImageContainer >
DGtal::Image< TImageContainer >::Image ( ImageContainer anImageContainer)
inline

Constructor from a pointer on the underlying image container. (data pointer is acquired, ownership transfer)

Definition at line 110 of file Image.h.

110  :
111  myImagePointer(anImageContainer)
112  {
113 #ifdef DEBUG_VERBOSE
114  trace.warning() << "Image Ctor fromPointer "<<std::endl;
115 #endif
116  }
ImagePointer myImagePointer
Owning smart pointer on the image container.
Definition: Image.h:287

References DGtal::trace, and DGtal::Trace::warning().

◆ Image() [3/5]

template<typename TImageContainer >
DGtal::Image< TImageContainer >::Image ( const CowPtr< ImageContainer > &  anImageContainerCowPointer)
inline

Constructor from Copy on write pointer. (data is not copied if read-only)

Parameters
anImageContainerCowPointera COW-pointer on the underlying container.

Definition at line 123 of file Image.h.

123  :
124  myImagePointer(anImageContainerCowPointer)
125  {
126  #ifdef DEBUG_VERBOSE
127 trace.warning() << "Image Ctor fromCow "<<std::endl;
128 #endif
129  }

References DGtal::trace, and DGtal::Trace::warning().

◆ Image() [4/5]

template<typename TImageContainer >
DGtal::Image< TImageContainer >::Image ( const ImageContainer other)
inline

Constructor from ImageContainer const reference (data is duplicated).

Parameters
otheran object of same type to copy.

Definition at line 136 of file Image.h.

136  :
137  myImagePointer(new ImageContainer(other) )
138  {
139 #ifdef DEBUG_VERBOSE
140 trace.warning() << "Image Ctor fromConstRef "<<std::endl;
141 #endif
142  }
TImageContainer ImageContainer
Types copied from the container.
Definition: Image.h:81

References DGtal::trace, and DGtal::Trace::warning().

◆ Image() [5/5]

template<typename TImageContainer >
DGtal::Image< TImageContainer >::Image ( const Image< TImageContainer > &  other)
inline

Copy Constructor (data is not copied here).

Parameters
otheran object of same type to copy.

Definition at line 150 of file Image.h.

150  :
151  myImagePointer(other.myImagePointer )
152  {
153  #ifdef DEBUG_VERBOSE
154 trace.warning() << "Image copy Ctor "<<std::endl;
155 #endif
156  }

References DGtal::trace, and DGtal::Trace::warning().

◆ ~Image()

template<typename TImageContainer >
DGtal::Image< TImageContainer >::~Image ( )
inline

Destructor. Does nothing, the cow pointer takes care of everything

Definition at line 180 of file Image.h.

180 {}

Member Function Documentation

◆ BOOST_CONCEPT_ASSERT() [1/2]

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

Checking concepts.

◆ BOOST_CONCEPT_ASSERT() [2/2]

template<typename TImageContainer >
DGtal::Image< TImageContainer >::BOOST_CONCEPT_ASSERT ( (concepts::CVertexMap< TImageContainer >)  )

◆ constRange()

template<typename TImageContainer >
ConstRange DGtal::Image< TImageContainer >::constRange ( ) const
inline

Returns the range of the underlying image to iterate over its values

Returns
a range.

Definition at line 203 of file Image.h.

204  {
205  return myImagePointer->constRange();
206  }

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::constRange(), and DGtal::Image< TImageContainer >::myImagePointer.

Referenced by test_image(), testImage(), and testImageFromSet().

◆ domain()

template<typename TImageContainer >
const Domain& DGtal::Image< TImageContainer >::domain ( ) const
inline

◆ getPointer()

template<typename TImageContainer >
const ImagePointer DGtal::Image< TImageContainer >::getPointer ( ) const
inline

Returns the smart pointer on the Image container data.

Returns
a const ImagePointer.

Definition at line 276 of file Image.h.

277  {
278  return myImagePointer;
279  }

References DGtal::Image< TImageContainer >::myImagePointer.

◆ isValid()

template<typename TImageContainer >
bool DGtal::Image< TImageContainer >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 266 of file Image.h.

267  {
268  return (myImagePointer->isValid() );
269  }

References DGtal::ImageContainerBySTLVector< TDomain, TValue >::isValid(), and DGtal::Image< TImageContainer >::myImagePointer.

Referenced by TEST_CASE(), and testImage().

◆ operator()()

template<typename TImageContainer >
Value DGtal::Image< TImageContainer >::operator() ( const Point aPoint) const
inline

Get the value of an image at a given position given by a Point.

Precondition
the point must be in the domain
Parameters
aPointthe point.
Returns
the value at aPoint.

Definition at line 231 of file Image.h.

232  {
233  return myImagePointer->operator()(aPoint);
234  }
const Point aPoint(3, 4)

References aPoint(), and DGtal::Image< TImageContainer >::myImagePointer.

◆ operator=()

template<typename TImageContainer >
Image& DGtal::Image< TImageContainer >::operator= ( const Image< TImageContainer > &  other)
inline

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

Definition at line 163 of file Image.h.

164  {
165  #ifdef DEBUG_VERBOSE
166  trace.warning() << "Image assignment "<<std::endl;
167 #endif
168  if (&other != this)
169  {
170  myImagePointer = other.myImagePointer;
171  }
172  return *this;
173  }

References DGtal::Image< TImageContainer >::myImagePointer, DGtal::trace, and DGtal::Trace::warning().

◆ range()

template<typename TImageContainer >
Range DGtal::Image< TImageContainer >::range ( )
inline

Returns the range of the underlying image to iterate over its values

Returns
a range.

Definition at line 214 of file Image.h.

215  {
216  return myImagePointer->range();
217  }

References DGtal::Image< TImageContainer >::myImagePointer, and DGtal::ImageContainerBySTLVector< TDomain, TValue >::range().

Referenced by testImage().

◆ selfDisplay()

template<typename TImageContainer >
void DGtal::Image< TImageContainer >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ setValue()

template<typename TImageContainer >
void DGtal::Image< TImageContainer >::setValue ( const Point aPoint,
const Value aValue 
)
inline

Set a value on an Image at a position specified by a Point.

Precondition
it must be a point in the image domain.
Parameters
aPointthe point.
aValuethe value.

Definition at line 247 of file Image.h.

248  {
249  myImagePointer->setValue(aPoint,aValue);
250  }
void setValue(const Point &aPoint, const Value &aValue)

References aPoint(), DGtal::Image< TImageContainer >::myImagePointer, and DGtal::ImageContainerBySTLVector< TDomain, TValue >::setValue().

Referenced by for(), generateRefImage(), main(), SECTION(), testComparison(), testDisplayDT2d(), testDisplayDT3d(), testGetSetVal(), testITKImage(), testITKImageWithMetadata(), testITKImageWithShiftDomain(), and testITKMethod().

Field Documentation

◆ myImagePointer


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