Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ImageFrame Class Referenceabstract

Image with static geometry. More...

#include <ImageFrame.h>

Inheritance diagram for ImageFrame:
Inheritance graph
[legend]
Collaboration diagram for ImageFrame:
Collaboration graph
[legend]

Public Types

typedef CastableIterator const_iterator
 
typedef CastableIterator iterator
 

Public Member Functions

 ImageFrame (const ImageFrame &src)
 
virtual const ImageConfgetConf () const
 
void setPhysicalRange (const Range< double > &range, bool rescale=false)
 Sets the supported range for physical values and optionally adjusts the scaling for maximal resolution.
 
void setPhysicalRange (double min, double max, bool rescale=false)
 Sets the supported range for physical values and optionally adjusts the scaling for maximal resolution.
 
const iteratorbegin ()
 Returns iterator pointing to the first image element.
 
const iteratorend ()
 Returns the iterator pointing to the element after the last element of the image buffer.
 
const const_iteratorbegin () const
 Returns iterator pointing to the first image element.
 
const const_iteratorend () const
 Returns the iterator pointing to the element after the last element of the image buffer.
 
size_t address (size_t i) const
 Computes the index location from image coordinates. Does not involve bit resolution. More...
 
size_t address (size_t i, size_t j) const
 Computes the index location from image coordinates. Does not involve bit resolution. More...
 
size_t address (size_t i, size_t j, size_t k) const
 Computes the index location from image coordinates. Does not involve bit resolution. More...
 
const void * getBuffer () const
 Returns the pointer to the start of the image array. More...
 
void * getBuffer ()
 Returns the pointer to the start of the image array. More...
 
template<class T >
void put (size_t i, T x)
 Sets the intensity in location i to x. See \address. More...
 
template<class T >
void put (size_t i, size_t j, T x)
 Sets the intensity at location i,j to x. See address(). More...
 
template<class T >
void put (size_t i, size_t j, size_t k, T x)
 Sets the intensity at location i,j,k to x. More...
 
template<class T , class P >
void put (const Point2D< P > &p, T x)
 Gets the intensity at location p=(i,j) . More...
 
void putScaled (size_t i, size_t j, double x)
 Put intensity using original physical value. More...
 
template<class T >
get (size_t i) const
 Gets the intensity at location i. See address(). More...
 
template<class T >
get (size_t i, size_t j) const
 Gets the intensity at location i,j . More...
 
template<class T >
get (size_t i, size_t j, size_t k) const
 Gets the intensity at location i,j,k . More...
 
double getScaled (size_t i, size_t j) const
 Get intensity in original physical scale. More...
 
template<class T , class P >
get (const Point2D< P > &p) const
 Gets the intensity at location p=(i,j) . More...
 
template<class T , class P >
void putPixel (const Point2D< P > &p, const std::vector< T > &pixel) const
 
template<class T , class P >
void getPixel (const Point2D< P > &p, std::vector< T > &pixel) const
 
void clear ()
 Sets the intensities to zero. Does not change image geometry. See resetGeometry().
 
template<class T >
void fill (T x)
 Sets the intensities to given value. Does not change image geometry.
 
void copyData (const ImageFrame &src)
 Copies data. Does not change encoding, geometry, or coordinate policy.
 
bool hasOverlap (const ImageFrame &image) const
 Checks if images have a common memory segment.
 
bool hasSameSegment (const ImageFrame &image) const
 Return true, if both frames have same type and are using the same data segment. More...
 
virtual const FlexVariableMapgetProperties () const
 
void setName (const std::string &s)
 
const std::string & getName () const
 
void toStream (std::ostream &ostr=std::cout) const
 Prints images geometry, buffer size and type information.
 
virtual ChannelgetChannel (size_t i)=0
 
virtual const ChannelgetChannel (size_t i) const =0
 
virtual ChannelgetAlphaChannel (size_t i=0)=0
 
virtual const ChannelgetAlphaChannel (size_t i=0) const =0
 
virtual void initialize (const std::type_info &t, const Geometry &geometry)
 Returns numeric channel index from "r", "g", "b", or "a" or a non-negative number in string format. More...
 
virtual void initialize (const std::type_info &t, size_t width, size_t height, size_t imageChannels=1, size_t alphaChannels=0)
 Sets the type and allocates a data buffer.
 
- Public Member Functions inherited from ImageLike
 ImageLike (const ImageLike &image)
 
const std::type_info & getType () const
 Get the storage type.
 
bool typeIsSet () const
 
virtual const GeometrygetGeometry () const
 
size_t getWidth () const
 
size_t getHeight () const
 
size_t getArea () const
 
size_t getChannelCount () const
 
const size_t getImageChannelCount () const
 
const size_t getAlphaChannelCount () const
 
bool hasAlphaChannel () const
 
size_t getVolume () const
 
bool isEmpty () const
 
const CoordinatePolicygetCoordinatePolicy () const
 Coord policy.
 
CoordinatePolicygetCoordinatePolicy ()
 Coord policy.
 
template<class T >
void setCoordinatePolicy (const T &policy)
 
void setCoordinatePolicy (EdgePolicy::index_t xUnderFlowPolicy, EdgePolicy::index_t yUnderFlowPolicy, EdgePolicy::index_t xOverFlowPolicy, EdgePolicy::index_t yOverFlowPolicy)
 
virtual const drain::ValueScalinggetScaling () const
 
virtual drain::ValueScalinggetScaling ()
 
virtual void setScaling (const drain::ValueScaling &scaling)
 
virtual void setScaling (double scale, double offset)
 
template<class T >
drain::typeLimiter< T >::value_t getLimiter () const
 

Public Attributes

FlexVariableMap properties
 Container for user-defined KEY=VALUE metadata.
 

Protected Member Functions

void init ()
 
void adjustBuffer ()
 Resize data buffer to match the geometry.
 
void setStorageType (const std::type_info &type)
 Sets the storage type of the image - typically unsigned char, unsigned int or float. Calls setDefaultLimits().
 
void unsetType ()
 
void setView (const ImageFrame &src, size_t channelStart, size_t channelCount, bool catenate=false)
 Sets the image to view the data and scaling of another image. More...
 
bool isView () const
 Returns true, if the image "points to" another image. For example, channels are views.
 
virtual void updateChannelVector () const
 Updates channel vector. Copies scaling of the host image. More...
 
template<class T >
T * retrieve (size_t a)
 
template<class T >
const T * retrieve (size_t a) const
 

Protected Attributes

unsigned char * bufferPtr
 
iterator segmentBegin
 
iterator segmentEnd
 
FlexVariableMap const * propertiesPtr
 
std::string name
 
std::vector< unsigned char > buffer
 
- Protected Attributes inherited from ImageLike
ImageConf conf
 

Detailed Description

Image with static geometry.

ImageFrame is an image which has predefined area and channel geometry. Its pixel array is readable and writable, supporting 2D (i,j) and 3D (i,j,k) coordinates.

Instead of ImageFrame, one should use MultiChannel that provides extracting separate channels with getChannel() and getAlphaChannel() .

Member Function Documentation

◆ address() [1/3]

size_t address ( size_t  i) const
inline

Computes the index location from image coordinates. Does not involve bit resolution.

Practical in precomputing a location when several images are processed in parallel.

◆ address() [2/3]

size_t address ( size_t  i,
size_t  j 
) const
inline

Computes the index location from image coordinates. Does not involve bit resolution.

Practical in precomputing a location when several images are processed in parallel.

◆ address() [3/3]

size_t address ( size_t  i,
size_t  j,
size_t  k 
) const
inline

Computes the index location from image coordinates. Does not involve bit resolution.

Practical in precomputing a location when several images are processed in parallel.

◆ get() [1/4]

T get ( const Point2D< P > &  p) const
inline

Gets the intensity at location p=(i,j) .

Parameters
p- point in two-dimensions

◆ get() [2/4]

T get ( size_t  i) const
inline

Gets the intensity at location i. See address().

Parameters
i- location (index)

◆ get() [3/4]

T get ( size_t  i,
size_t  j 
) const
inline

Gets the intensity at location i,j .

Parameters
i- column coordinate
j- row coordinate

◆ get() [4/4]

T get ( size_t  i,
size_t  j,
size_t  k 
) const
inline

Gets the intensity at location i,j,k .

Parameters
i- column coordinate
j- row coordinate
k- channel coordinate

◆ getBuffer() [1/2]

void* getBuffer ( )
inline

Returns the pointer to the start of the image array.

CHECK?

◆ getBuffer() [2/2]

const void* getBuffer ( ) const
inline

Returns the pointer to the start of the image array.

CHECK?

◆ getScaled()

double getScaled ( size_t  i,
size_t  j 
) const
inline

Get intensity in original physical scale.

The value becomes scaled so that it (hopefully) fits in the limits of the storage type, say unsigned char (0...255).

◆ hasSameSegment()

bool hasSameSegment ( const ImageFrame image) const
inline

Return true, if both frames have same type and are using the same data segment.

Return true, if both frames are using the same data segment. When calling this, consider calling isView() as well.

Note that two frames viewing the same segment should also have the same type.

◆ initialize()

virtual void initialize ( const std::type_info &  t,
const Geometry geometry 
)
inlinevirtual

Returns numeric channel index from "r", "g", "b", or "a" or a non-negative number in string format.

Given a numeric channel index, returns it as a number. Sets the type and allocates a data buffer.

Reimplemented in ModifiableImage.

◆ put() [1/4]

void put ( const Point2D< P > &  p,
x 
)
inline

Gets the intensity at location p=(i,j) .

Parameters
p- point in two-dimensions

◆ put() [2/4]

void put ( size_t  i,
size_t  j,
size_t  k,
x 
)
inline

Sets the intensity at location i,j,k to x.

Parameters
i- column coordinate
j- row coordinate
k- channel coordinate
x- intensity

See address().

◆ put() [3/4]

void put ( size_t  i,
size_t  j,
x 
)
inline

Sets the intensity at location i,j to x. See address().

Parameters
i- column coordinate
j- row coordinate
x- intensity

◆ put() [4/4]

void put ( size_t  i,
x 
)
inline

Sets the intensity in location i to x. See \address.

Parameters
i- location (index)
i- intensity

◆ putScaled()

void putScaled ( size_t  i,
size_t  j,
double  x 
)
inline

Put intensity using original physical value.

The value becomes scaled so that it (hopefully) fits in the limits of the storage type, say unsigned char (0...255).

◆ setView()

void setView ( const ImageFrame src,
size_t  channelStart,
size_t  channelCount,
bool  catenate = false 
)
protected

Sets the image to view the data and scaling of another image.

Scaling to that of the source (src).

Changes the image to view another image instead of its own.

ENCODING

Image channel range

Alpha channel range

◆ updateChannelVector()

virtual void updateChannelVector ( ) const
inlineprotectedvirtual

Updates channel vector. Copies scaling of the host image.

Designed for derived classes, called by setView().

Reimplemented in MultiChannel.


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