HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ROI Struct Reference

#include <imageio.h>

Public Member Functions

constexpr ROI ()
 
constexpr ROI (int xbegin, int xend, int ybegin, int yend, int zbegin=0, int zend=1, int chbegin=0, int chend=10000)
 
constexpr bool defined () const
 Is a region defined? More...
 
constexpr int width () const
 
constexpr int height () const
 
constexpr int depth () const
 
constexpr int nchannels () const
 
constexpr imagesize_t npixels () const
 Total number of pixels in the region. More...
 
constexpr bool contains (int x, int y, int z=0, int ch=0) const
 Test if the coordinate is within the ROI. More...
 
constexpr bool contains (const ROI &other) const
 Test if another ROI is entirely within our ROI. More...
 

Static Public Member Functions

static constexpr ROI All ()
 

Public Attributes

int xbegin
 
int xend
 
int ybegin
 
int yend
 
int zbegin
 
int zend
 
int chbegin
 
int chend
 

Friends

constexpr bool operator== (const ROI &a, const ROI &b)
 Test equality of two ROIs. More...
 
constexpr bool operator!= (const ROI &a, const ROI &b)
 Test inequality of two ROIs. More...
 
std::ostream & operator<< (std::ostream &out, const ROI &roi)
 Stream output of the range. More...
 

Detailed Description

Helper struct describing a region of interest in an image. The region is [xbegin,xend) x [begin,yend) x [zbegin,zend), with the "end" designators signifying one past the last pixel, a la STL style.

Definition at line 115 of file imageio.h.

Constructor & Destructor Documentation

constexpr ROI::ROI ( )
inline

Default constructor is an undefined region. Note that this is also interpreted as All().

Definition at line 121 of file imageio.h.

constexpr ROI::ROI ( int  xbegin,
int  xend,
int  ybegin,
int  yend,
int  zbegin = 0,
int  zend = 1,
int  chbegin = 0,
int  chend = 10000 
)
inline

Constructor with an explicitly defined region.

Definition at line 127 of file imageio.h.

Member Function Documentation

static constexpr ROI ROI::All ( )
inlinestatic

All() is an alias for the default constructor, which indicates that it means "all" of the image, or no region restruction. For example, float myfunc (ImageBuf &buf, ROI roi = ROI::All()); Note that this is equivalent to: float myfunc (ImageBuf &buf, ROI roi = {});

Definition at line 158 of file imageio.h.

constexpr bool ROI::contains ( int  x,
int  y,
int  z = 0,
int  ch = 0 
) const
inline

Test if the coordinate is within the ROI.

Definition at line 176 of file imageio.h.

constexpr bool ROI::contains ( const ROI other) const
inline

Test if another ROI is entirely within our ROI.

Definition at line 182 of file imageio.h.

constexpr bool ROI::defined ( ) const
inline

Is a region defined?

Definition at line 134 of file imageio.h.

constexpr int ROI::depth ( ) const
inline

Definition at line 139 of file imageio.h.

constexpr int ROI::height ( void  ) const
inline

Definition at line 138 of file imageio.h.

constexpr int ROI::nchannels ( ) const
inline

Number of channels in the region. Beware – this defaults to a huge number, and to be meaningful you must consider std::min (imagebuf.nchannels(), roi.nchannels()).

Definition at line 144 of file imageio.h.

constexpr imagesize_t ROI::npixels ( ) const
inline

Total number of pixels in the region.

Definition at line 147 of file imageio.h.

constexpr int ROI::width ( void  ) const
inline

Definition at line 137 of file imageio.h.

Friends And Related Function Documentation

constexpr bool operator!= ( const ROI a,
const ROI b 
)
friend

Test inequality of two ROIs.

Definition at line 168 of file imageio.h.

std::ostream& operator<< ( std::ostream &  out,
const ROI roi 
)
friend

Stream output of the range.

Definition at line 190 of file imageio.h.

constexpr bool operator== ( const ROI a,
const ROI b 
)
friend

Test equality of two ROIs.

Definition at line 161 of file imageio.h.

Member Data Documentation

int ROI::chbegin

Definition at line 117 of file imageio.h.

int ROI::chend

Definition at line 117 of file imageio.h.

int ROI::xbegin

Definition at line 116 of file imageio.h.

int ROI::xend

Definition at line 116 of file imageio.h.

int ROI::ybegin

Definition at line 116 of file imageio.h.

int ROI::yend

Definition at line 116 of file imageio.h.

int ROI::zbegin

Definition at line 116 of file imageio.h.

int ROI::zend

Definition at line 116 of file imageio.h.


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