Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qgar::GenImage< T, CheckPolicy > Class Template Reference
[Images]

#include <qgarlib/GenImage.H>

Inheritance diagram for qgar::GenImage< T, CheckPolicy >:

qgar::CleanedBinaryImage qgar::CloseImage qgar::ErodedImage qgar::GeodesicRecBinaryImage qgar::GeodesicRecEroImage qgar::GeodesicRecImage qgar::GradientLocalMaxImage qgar::GradientModuleImage qgar::IsotropicDilatedBinaryImage qgar::KanungoBinaryImage qgar::LaplacianOfGaussianImage qgar::LinDilatedBinaryImage qgar::LinErodedBinaryImage qgar::LinErodedImage qgar::NiblackBinaryImage qgar::OpenBinaryImage qgar::OpenImage qgar::PruneSmallCCBinaryImage qgar::RegionalMaxImage qgar::RegionalMinBinaryImage qgar::StandardDeviationImage List of all members.

Detailed Description

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
class qgar::GenImage< T, CheckPolicy >

Template class for a generic image with pixels of type T.

Predefined types:

The implementation code uses some of Scott Meyers' tips from [Meyer, 1996]. See especially item #20, pages 101-104, about the return value optimization (RVO).

Warning:
The following operators and functions are not normalized:
Author:
Gérald Masini
Date:
March 4, 2003 14:09
Since:
Qgar 2.1

Definition at line 384 of file GenImage.H.

Public Types

Types
typedef T value_type
 Type of the elements stored in the pixel map.
typedef value_typereference
 Reference to qgar::GenImage::value_type.
typedef const value_typeconst_reference
 Constant reference to qgar::GenImage::value_type.
typedef value_typepointer
 Pointer to qgar::GenImage::value_type.
typedef const value_typeconst_pointer
 Constant pointer to qgar::GenImage::value_type.

Public Member Functions

template<class T, template< class > class CheckPolicy>
 GenImage (unsigned int aWidth, unsigned int aHeight, T *aPtPixMap) throw (QgarErrorInvalidArg)
template<class T, template< class > class CheckPolicy>
 GenImage (unsigned int aBytesCnt, int *aPtRefCnt, unsigned int aWidth, unsigned int aHeight, T *aPtPixMap)
Constructors
 GenImage ()
 Default constructor.
 GenImage (unsigned int aWidth, unsigned int aHeight)
 Initialize with given width and height.
Constructor from raw data
 GenImage (unsigned int aWidth, unsigned int aHeight, pointer aPtPixMap) throw (QgarErrorInvalidArg)
 Initialize from a pixmap.
Constructors from images
 GenImage (const GenImage &anImg)
 Copy constructor.
template<template< class > class OtherCheckPolicy>
 GenImage (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Conversion of an image of the same type, using policies.
template<class U, template< class > class UCheckPolicy>
 GenImage (const GenImage< U, UCheckPolicy > &anImg)
 Initialize from an image with pixels of a type different from T.
template<template< class > class OtherCheckPolicy>
 GenImage (const GenImage< value_type, OtherCheckPolicy > &anImg, const BoundingBox &aBox, value_type aPixVal=static_cast< value_type >(0))
 Initialize by copying a rectangular area, defined by a bounding box, of a given image.
template<template< class > class OtherCheckPolicy>
 GenImage (const GenImage< value_type, OtherCheckPolicy > &anImg, unsigned int aXTopLeft, unsigned int aYTopLeft, unsigned int aXBottomRight, unsigned int aYBottomRight, value_type aPixVal=static_cast< value_type >(0))
 Initialize by copying a rectangular area, defined by the coordinates of its top left and bottom right corners, of a given image.
Constructors from image files
 GenImage (AbstractPbmPlusFile &aPbmPlusFile)
 Initialize with an image in a PBM+ file.
Destructor
virtual ~GenImage ()
 Free space allocated to the pixel map if and only if the reference counter is null.
Access to image characteristics
int width () const
 Get the image width.
int height () const
 Get the image height.
int bytesPerPixel () const
 Get the number of bytes per pixel.
Access to pixel values
value_type pixel (unsigned int aX, unsigned int aY) const
 Get a pixel value.
void row (unsigned int aRowIdx, pointer aRow) const
 Get a row of pixels.
void column (unsigned int aColIdx, pointer aCol) const
 Get a column of pixels.
Access to direct transformations of the pixel map
pointer pPixel (unsigned int aRowIdx, unsigned int aColIdx) const
 Get a pointer on a given pixel of the image.
pointer pRow (unsigned int aRowIdx) const
 Get a pointer on a row of pixels.
pointer pColumn (unsigned int aColIdx) const
 Get a pointer on a column of pixels.
pointer pPixMap () const
 Get the pointer to the pixel map.
Set pixel values
void setPixel (unsigned int aX, unsigned int aY, value_type aPixVal)
 Set a pixel value.
void setRow (unsigned int aRowIdx, const_pointer const aRow)
 Set a given row of pixels.
void setColumn (unsigned int aColIdx, const_pointer const aCol)
 Set a given column of pixels.
Draw in the pixel map
void draw (const Segment &aSeg, value_type aPixVal=(value_type) 1)
 Draw a segment in the pixel map.
Copy
GenImage shallowCopy ()
 Shallow copy: The pixel map of the current image is not duplicated.
Operators
Warning:
Using stand-alone versions of operators (operator+, operator-, operator*) is much less efficient then using assignment versions (operator+=, operator-=, operator*=). For example, an expression like:
    res = a + b - c;
uses 2 temporary objects, one for each call to operator+ and operator-(the pixel map of the last temporary object is then copied into the pixel map of res). These considerations also apply to functional operators (see the corresponding section). To preserve efficiency, the code should be written in this way:
    res = a;
    res += b;  // no temporary needed
    res -= c;  // no temporary needed


GenImageoperator= (const GenImage &anImg)
 Assign given image to current image.
template<template< class > class OtherCheckPolicy>
GenImageoperator= (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Assign given image to current image.
template<template< class > class OtherCheckPolicy>
GenImage< value_type, GenImage_NoCheckoperator+ (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Same as function qgar::GenImage::plus.
template<template< class > class OtherCheckPolicy>
GenImageoperator+= (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Same as function qgar::GenImage::plusEqual.
template<template< class > class OtherCheckPolicy>
GenImage< value_type, GenImage_NoCheckoperator- (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Same as function qgar::GenImage::minus.
template<template< class > class OtherCheckPolicy>
GenImageoperator-= (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Same as function qgar::GenImage::minusEqual.
template<template< class > class OtherCheckPolicy>
GenImage< value_type, GenImage_NoCheckoperator * (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Same as function qgar::GenImage::times.
template<template< class > class OtherCheckPolicy>
GenImageoperator *= (const GenImage< value_type, OtherCheckPolicy > &anImg)
 Same as function qgar::GenImage::timesEqual.
Functional operators
Warning:
Using stand-alone versions of these functions (plus, minus, times) is much less efficient then using assignment versions (plusEqual, minusEqual, timesEqual). For example, an expression like:
    res = a.plus(b).minus(c);
uses 2 temporary objects, one for each call to plusEqual and minusEqual (the pixel map of the last temporary object is then copied into the pixel map of res). These considerations also apply to operators (see the corresponding section). To preserve efficiency, the code should be written in this way:
    res = a;
    res.plusEqual(b);   // no temporary needed
    res.minusEqual(c);  // no temporary needed
Operators implementation uses Scott Meyers' tips from [Meyer, 1996]: item #22, pages 107-110.

template<template< class > class OtherCheckPolicy>
GenImage< value_type, GenImage_NoCheckplus (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Add each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
template<template< class > class OtherCheckPolicy>
GenImageplusEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain)
 Add a given image to the current image.
template<template< class > class OtherCheckPolicy>
GenImage< value_type, GenImage_NoCheckminus (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Subtract each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
template<template< class > class OtherCheckPolicy>
GenImageminusEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain)
 Subtract a given image to the current image.
template<template< class > class OtherCheckPolicy>
GenImage< value_type, GenImage_NoChecktimes (const GenImage< value_type, OtherCheckPolicy > &anImg) const
 Multiply each pixel of the given image to the corresponding pixel of the current image and store each result in a new pixel map.
template<template< class > class OtherCheckPolicy>
GenImagetimesEqual (const GenImage< value_type, OtherCheckPolicy > &anImg) throw (QgarErrorDomain)
 Multiply a given image by the current image.
File storage
void save (AbstractPbmPlusFile &aPbmPlusFile) const
 Store current image into a PBM+ file.
Border mirroring
int borderRows (int aRowIdx) const
 Mirror border rows for convolutions.
int borderCols (int aColIdx) const
 Mirror border columns for convolutions.

Protected Member Functions

Constructor from raw data
 GenImage (unsigned int aBytesCnt, int *aPtRefCnt, unsigned int aWidth, unsigned int aHeight, pointer aPtPixMap)
 Initialize from all data.
Auxiliaries
void copyBox (const GenImage< value_type, CheckPolicy > &anImg, unsigned int aXTopLeft, unsigned int aYTopLeft, unsigned int aXBottomRight, unsigned int aYBottomRight, value_type aPixVal=static_cast< value_type >(0))
 Copy a rectangular area of the given image into the current image.

Protected Attributes

Representation of an image
unsigned int _bytesPerPixel
 Number of bytes per pixel.
int * _pRefCnt
 Reference counter.
int _width
 Image width.
int _height
 Image height.
pointer _pPixMap
 Pointer to the pixel map, organized as consecutive rows.


Member Typedef Documentation

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
typedef const value_type* qgar::GenImage< T, CheckPolicy >::const_pointer
 

Constant pointer to qgar::GenImage::value_type.

Reimplemented in qgar::CleanedBinaryImage, qgar::CloseImage, qgar::ContrastEnhancedImage, qgar::DilatedBinaryImage, qgar::DilatedImage, qgar::Dist34BlackCCImage, qgar::Dist34Image, qgar::Dist8cBlackCCImage, qgar::ErodedBinaryImage, qgar::ErodedImage, qgar::GenConvolImage< T, CheckingPolicy >, qgar::GeodesicRecBinaryImage, qgar::GeodesicRecEroBinaryImage, qgar::GeodesicRecEroImage, qgar::GeodesicRecImage, qgar::GradientLocalMaxImage, qgar::GradientModuleImage, qgar::HysteresisBinaryImage, qgar::IsotropicDilatedBinaryImage, qgar::KanungoBinaryImage, qgar::LaplacianOfGaussianImage, qgar::LinDilatedBinaryImage, qgar::LinDilatedImage, qgar::LinErodedBinaryImage, qgar::LinErodedImage, qgar::NiblackBinaryImage, qgar::OpenBinaryImage, qgar::OpenImage, qgar::RegionalMaxBinaryImage, qgar::RegionalMaxImage, qgar::RegionalMinBinaryImage, qgar::RegionalMinImage, qgar::StandardDeviationImage, qgar::ThresBinaryImage, qgar::TTBinaryImage, and qgar::UltimateErodedBinaryImage.

Definition at line 422 of file GenImage.H.

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
typedef const value_type& qgar::GenImage< T, CheckPolicy >::const_reference
 

Constant reference to qgar::GenImage::value_type.

Reimplemented in qgar::CleanedBinaryImage, qgar::CloseImage, qgar::ContrastEnhancedImage, qgar::DilatedBinaryImage, qgar::DilatedImage, qgar::Dist34BlackCCImage, qgar::Dist34Image, qgar::Dist8cBlackCCImage, qgar::ErodedBinaryImage, qgar::ErodedImage, qgar::GenConvolImage< T, CheckingPolicy >, qgar::GeodesicRecBinaryImage, qgar::GeodesicRecEroBinaryImage, qgar::GeodesicRecEroImage, qgar::GeodesicRecImage, qgar::GradientLocalMaxImage, qgar::GradientModuleImage, qgar::HysteresisBinaryImage, qgar::IsotropicDilatedBinaryImage, qgar::KanungoBinaryImage, qgar::LaplacianOfGaussianImage, qgar::LinDilatedBinaryImage, qgar::LinDilatedImage, qgar::LinErodedBinaryImage, qgar::LinErodedImage, qgar::NiblackBinaryImage, qgar::OpenBinaryImage, qgar::OpenImage, qgar::RegionalMaxBinaryImage, qgar::RegionalMaxImage, qgar::RegionalMinBinaryImage, qgar::RegionalMinImage, qgar::StandardDeviationImage, qgar::ThresBinaryImage, qgar::TTBinaryImage, and qgar::UltimateErodedBinaryImage.

Definition at line 412 of file GenImage.H.

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
typedef value_type* qgar::GenImage< T, CheckPolicy >::pointer
 

Pointer to qgar::GenImage::value_type.

Reimplemented in qgar::CleanedBinaryImage, qgar::CloseImage, qgar::ContrastEnhancedImage, qgar::DilatedBinaryImage, qgar::DilatedImage, qgar::Dist34BlackCCImage, qgar::Dist34Image, qgar::Dist8cBlackCCImage, qgar::ErodedBinaryImage, qgar::ErodedImage, qgar::GenConvolImage< T, CheckingPolicy >, qgar::GeodesicRecBinaryImage, qgar::GeodesicRecEroBinaryImage, qgar::GeodesicRecEroImage, qgar::GeodesicRecImage, qgar::GradientLocalMaxImage, qgar::GradientModuleImage, qgar::HysteresisBinaryImage, qgar::IsotropicDilatedBinaryImage, qgar::KanungoBinaryImage, qgar::LaplacianOfGaussianImage, qgar::LinDilatedBinaryImage, qgar::LinDilatedImage, qgar::LinErodedBinaryImage, qgar::LinErodedImage, qgar::NiblackBinaryImage, qgar::OpenBinaryImage, qgar::OpenImage, qgar::RegionalMaxBinaryImage, qgar::RegionalMaxImage, qgar::RegionalMinBinaryImage, qgar::RegionalMinImage, qgar::StandardDeviationImage, qgar::ThresBinaryImage, qgar::TTBinaryImage, and qgar::UltimateErodedBinaryImage.

Definition at line 417 of file GenImage.H.

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
typedef value_type& qgar::GenImage< T, CheckPolicy >::reference
 

Reference to qgar::GenImage::value_type.

Reimplemented in qgar::CleanedBinaryImage, qgar::CloseImage, qgar::ContrastEnhancedImage, qgar::DilatedBinaryImage, qgar::DilatedImage, qgar::Dist34BlackCCImage, qgar::Dist34Image, qgar::Dist8cBlackCCImage, qgar::ErodedBinaryImage, qgar::ErodedImage, qgar::GenConvolImage< T, CheckingPolicy >, qgar::GeodesicRecBinaryImage, qgar::GeodesicRecEroBinaryImage, qgar::GeodesicRecEroImage, qgar::GeodesicRecImage, qgar::GradientLocalMaxImage, qgar::GradientModuleImage, qgar::HysteresisBinaryImage, qgar::IsotropicDilatedBinaryImage, qgar::KanungoBinaryImage, qgar::LaplacianOfGaussianImage, qgar::LinDilatedBinaryImage, qgar::LinDilatedImage, qgar::LinErodedBinaryImage, qgar::LinErodedImage, qgar::NiblackBinaryImage, qgar::OpenBinaryImage, qgar::OpenImage, qgar::RegionalMaxBinaryImage, qgar::RegionalMaxImage, qgar::RegionalMinBinaryImage, qgar::RegionalMinImage, qgar::StandardDeviationImage, qgar::ThresBinaryImage, qgar::TTBinaryImage, and qgar::UltimateErodedBinaryImage.

Definition at line 407 of file GenImage.H.

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
typedef T qgar::GenImage< T, CheckPolicy >::value_type
 

Type of the elements stored in the pixel map.

Reimplemented in qgar::CleanedBinaryImage, qgar::CloseImage, qgar::ContrastEnhancedImage, qgar::DilatedBinaryImage, qgar::DilatedImage, qgar::Dist34BlackCCImage, qgar::Dist34Image, qgar::Dist8cBlackCCImage, qgar::ErodedBinaryImage, qgar::ErodedImage, qgar::GenConvolImage< T, CheckingPolicy >, qgar::GeodesicRecBinaryImage, qgar::GeodesicRecEroBinaryImage, qgar::GeodesicRecEroImage, qgar::GeodesicRecImage, qgar::GradientLocalMaxImage, qgar::GradientModuleImage, qgar::HysteresisBinaryImage, qgar::IsotropicDilatedBinaryImage, qgar::KanungoBinaryImage, qgar::LaplacianOfGaussianImage, qgar::LinDilatedBinaryImage, qgar::LinDilatedImage, qgar::LinErodedBinaryImage, qgar::LinErodedImage, qgar::NiblackBinaryImage, qgar::OpenBinaryImage, qgar::OpenImage, qgar::RegionalMaxBinaryImage, qgar::RegionalMaxImage, qgar::RegionalMinBinaryImage, qgar::RegionalMinImage, qgar::StandardDeviationImage, qgar::ThresBinaryImage, qgar::TTBinaryImage, and qgar::UltimateErodedBinaryImage.

Definition at line 402 of file GenImage.H.


Constructor & Destructor Documentation

template<class T, template< class > class CheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage  ) 
 

Default constructor.

Set 0 to width, to height, to pointer to pixel map, and to reference counter.

Definition at line 60 of file GenImage.TCC.

Referenced by qgar::GenImage< T, CheckPolicy >::minus(), qgar::GenImage< T, CheckPolicy >::plus(), and qgar::GenImage< T, CheckPolicy >::times().

template<class T, template< class > class CheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage unsigned int  aWidth,
unsigned int  aHeight
 

Initialize with given width and height.

Parameters:
aWidth width of the image (in pixels)
aHeight height of the image (in pixels)
Warning:
The pixel map is allocated but is not initialized.

Definition at line 77 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_pPixMap.

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
qgar::GenImage< T, CheckPolicy >::GenImage unsigned int  aWidth,
unsigned int  aHeight,
pointer  aPtPixMap
throw (QgarErrorInvalidArg)
 

Initialize from a pixmap.

Parameters:
aWidth width of the image (in pixels)
aHeight height of the image (in pixels)
aPtPixMap pointer to a pixel map
Warning:
This constructor takes the ownership of the given pixmap. The created instance will be responsible for deleting it.
Exceptions:
qgar::QgarErrorInvalidArg (pixel map not allocated)

template<class T, template< class > class CheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage const GenImage< T, CheckPolicy > &  anImg  ) 
 

Copy constructor.

Perform a deep copy: The pixel map of the source image is duplicated.

Parameters:
anImg image to be copied
See also:
qgar::GenImage::operator= and qgar::GenImage::shallowCopy

Definition at line 153 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_height, qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_width.

template<class T, template< class > class CheckPolicy>
template<class U, template< class > class UCheck>
qgar::GenImage< T, CheckPolicy >::GenImage const GenImage< value_type, OtherCheckPolicy > &  anImg  ) 
 

Conversion of an image of the same type, using policies.

Parameters:
anImg an image with the same pixel type having different policies

Definition at line 172 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_height, qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::_width, and qgar::GenImage< T, CheckPolicy >::pPixMap().

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
template<class U, template< class > class UCheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage const GenImage< U, UCheckPolicy > &  anImg  )  [explicit]
 

Initialize from an image with pixels of a type different from T.

Parameters:
anImg an image with pixels of type U (different from T)
Warning:
Perform a deep copy: The pixel map of the source image is duplicated. This kind of conversion must be explicitely specified by the client.

template<class T, template< class > class CheckPolicy>
template<template< class > class OtherCheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage const GenImage< value_type, OtherCheckPolicy > &  anImg,
const BoundingBox aBox,
value_type  aPixVal = static_cast< value_type >(0)
 

Initialize by copying a rectangular area, defined by a bounding box, of a given image.

The rectangle sides are parallel to the coordinate axis.

Parameters:
anImg initial image
aBox box defining the rectangular area to copy
aPixVal pixel value to fill non-overlaping zones (default (T)0)
Warning:
The intersection between the rectangle and the given image must be non-empty. If the overlaping zone is only partial, the non-overlaping zone(s) are filled with pixels having value aPixVal.

Definition at line 226 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::_width, qgar::GenImage< T, CheckPolicy >::copyBox(), qgar::BoundingBox::xBottomRight(), qgar::BoundingBox::xTopLeft(), qgar::BoundingBox::yBottomRight(), and qgar::BoundingBox::yTopLeft().

template<class T, template< class > class CheckPolicy>
template<template< class > class OtherCheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage const GenImage< value_type, OtherCheckPolicy > &  anImg,
unsigned int  aXTopLeft,
unsigned int  aYTopLeft,
unsigned int  aXBottomRight,
unsigned int  aYBottomRight,
value_type  aPixVal = static_cast< value_type >(0)
 

Initialize by copying a rectangular area, defined by the coordinates of its top left and bottom right corners, of a given image.

The rectangle sides are parallel to the coordinate axis.

Parameters:
anImg initial image
aXTopLeft X coordinate of the area top left corner
aYTopLeft Y coordinate of the area top left corner
aXBottomRight X coordinate of the area bottom right corner
aYBottomRight Y coordinate of the area bottom right corner
aPixVal pixel value to fill non-overlaping zones (default (T)0)
Warning:
The intersection between the rectangle and the given image must be non-empty. If the overlaping zone is only partial, the non-overlaping zone(s) are filled with pixels having value aPixVal.

Definition at line 258 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::_width, and qgar::GenImage< T, CheckPolicy >::copyBox().

template<class T, template< class > class CheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage AbstractPbmPlusFile aPbmPlusFile  )  [explicit]
 

Initialize with an image in a PBM+ file.

The given PBM+ file is opened (in READ ONLY mode) at the call, and closed before returning.

Parameters:
aPbmPlusFile a PBM+ file containing an image
Warning:
This kind of conversion must be explicitely specified by the client.
Todo:
Constructor qgar::GenImage::GenImage(AbstractPbmPlusFile&) should just work when T is instantiated by an unsigned char because function qgar::AbstractPbmPlusFile::readRow only works with rows of unsigned integers whereas the first argument of function qgar::GenImage::setRow is a pointer to a row of type T!

Definition at line 295 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::_width, qgar::AbstractFile::close(), qgar::AbstractPbmPlusFile::colCnt(), qgar::AbstractFile::openRONLY(), qgar::AbstractPbmPlusFile::pRow(), qgar::AbstractPbmPlusFile::readRow(), qgar::AbstractPbmPlusFile::rowCnt(), and qgar::GenImage< T, CheckPolicy >::setRow().

template<class T, template< class > class CheckPolicy>
qgar::GenImage< T, CheckPolicy >::~GenImage  )  [virtual]
 

Free space allocated to the pixel map if and only if the reference counter is null.

Definition at line 323 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_pRefCnt.

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
qgar::GenImage< T, CheckPolicy >::GenImage unsigned int  aBytesCnt,
int *  aPtRefCnt,
unsigned int  aWidth,
unsigned int  aHeight,
pointer  aPtPixMap
[protected]
 

Initialize from all data.

Parameters:
aBytesCnt bytes per pixel
aPtRefCnt pointer to a reference counter
aWidth width of the image
aHeight height of the image
aPtPixMap pointer to a pixel map
Warning:
Using this constructor may lead to serious bugs due to dynamic memory space management. Be sure that the value of the given reference counter (pointed by aPtRefCnt) is correct: If the given pixel map (pointed by aPtPixMap) is not shared by another object, this value must be 0. Otherwise, one must add 1 to the value, before using the constructor:
(*_pRefCnt)++;

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
template<class T, template< class > class CheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage unsigned int  aWidth,
unsigned int  aHeight,
T *  aPtPixMap
throw (QgarErrorInvalidArg)
 

Definition at line 98 of file GenImage.TCC.

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
template<class T, template< class > class CheckPolicy>
qgar::GenImage< T, CheckPolicy >::GenImage unsigned int  aBytesCnt,
int *  aPtRefCnt,
unsigned int  aWidth,
unsigned int  aHeight,
T *  aPtPixMap
 

Definition at line 127 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_height, qgar::GenImage< T, CheckPolicy >::_pPixMap, and qgar::GenImage< T, CheckPolicy >::_width.


Member Function Documentation

template<class T, template< class > class CheckPolicy>
int qgar::GenImage< T, CheckPolicy >::borderCols int  aColIdx  )  const
 

Mirror border columns for convolutions.

Parameters:
aColIdx index of the column

Definition at line 1052 of file GenImage.TCC.

template<class T, template< class > class CheckPolicy>
int qgar::GenImage< T, CheckPolicy >::borderRows int  aRowIdx  )  const
 

Mirror border rows for convolutions.

Parameters:
aRowIdx index of the row

Definition at line 1036 of file GenImage.TCC.

template<class T, template< class > class CheckPolicy>
int qgar::GenImage< T, CheckPolicy >::bytesPerPixel  )  const [inline]
 

Get the number of bytes per pixel.

Definition at line 369 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_bytesPerPixel.

template<class T, template< class > class CheckPolicy = GenImage_NoCheck>
void qgar::GenImage< T, CheckPolicy >::column unsigned int  aColIdx,
pointer  aCol
const
 

Get a column of pixels.

Parameters:
aColIdx column index in image
aCol buffer to store the column of pixels
Warning:
The behavior of the function is undefined if the buffer size is smaller than the column size.

template<class T, template< class > class CheckPolicy>
void qgar::GenImage< T, CheckPolicy >::copyBox const GenImage< value_type, CheckPolicy > &  anImg,
unsigned int  aXTopLeft,
unsigned int  aYTopLeft,
unsigned int  aXBottomRight,
unsigned int  aYBottomRight,
value_type  aPixVal = static_cast< value_type >(0)
[protected]
 

Copy a rectangular area of the given image into the current image.

The sides of the rectangle are parallel to the coordinate axis.

Parameters:
anImg initial image
aXTopLeft X coordinate of the area top left corner
aYTopLeft Y coordinate of the area left corner
aXBottomRight X coordinate of the area bottom right corner
aYBottomRight Y coordinate of the area bottom right corner
aPixVal pixel value to fill non-overlaping zones (default (T)0)
Warning:
The intersection between the rectangle and the given image must be non-empty. If the overlaping zone is only partial, the non-overlaping zone(s) are filled with pixels having value aPixVal.
Todo:
To be reimplemented.

Definition at line 1074 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::_pPixMap, qgar::GenImage< T, CheckPolicy >::height(), qgar::GenImage< T, CheckPolicy >::pPixMap(), qgar::qgFill(), and qgar::GenImage< T, CheckPolicy >::width().

Referenced by qgar::GenImage< T, CheckPolicy >::GenImage().

template<class T, template< class > class CheckPolicy>
void qgar::GenImage< T, CheckPolicy >::draw const Segment aSeg,
value_type  aPixVal = (value_type) 1
 

Draw a segment in the pixel map.

The segment pixels are set using Bresenham's algorithm. See W.M. Newman and R.F. Sproull, Principles of Interactive Computer Graphics, pp. 25-26.

Parameters:
aSeg segment to be drawn
aPixVal value to set pixels with (default (T)1)

Definition at line 535 of file GenImage.TCC.

References qgar::GenImage< T, CheckPolicy >::setPixel(), qgar::AbstractGenPrimitive< T >::source(), qgar::AbstractGenPrimitive< T >::target(), qgar::GenPoint< T >::x(), and qgar::GenPoint< T >::y().

template<class T, template< class > class CheckPolicy>
int qgar::GenImage< T, CheckPolicy >::height  )  const [inline]
 

Get the image height.

Definition at line 359 of file GenImage.TCC.

Referenced by qgar::GenImage< T, CheckPolicy >::copyBox(), qgar::PruneSmallCCBinaryImage::isNeighbor(), qgar::LabeledSkeletonImage::LabeledSkeletonImage(), qgar::LinkedChainList::LinkedChainList(), qgar::MapleFile::MapleFile(), qgar::GenImage< T, CheckPolicy >::minusEqual(), qgar::GenImage< T, CheckPolicy >::operator=(), qgar::UltimateErodedBinaryImage::perform(), qgar::GeodesicRecImage::perform(), qgar::GeodesicRecEroImage::perform(), qgar::GeodesicRecEroBinaryImage::perform(), qgar::GeodesicRecBinaryImage::perform(), qgar::GenImage< T, CheckPolicy >::plusEqual(), qgar::PruneSmallCCBinaryImage::PruneSmallCCBinaryImage(), qgar::GenImage< T, CheckPolicy >::timesEqual(), and qgar::TTBinaryImage::TTBinaryImage().

template<class T, template< class > class CheckPolicy>
template<template< class > class OtherCheckPolicy>
GenImage< T, GenImage_NoCheck > qgar::GenImage< T, CheckPolicy >::minus const GenImage< value_type, OtherCheckPolicy > &  anImg  )  const