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 () noexcept
 
constexpr ROI (int xbegin, int xend, int ybegin, int yend, int zbegin=0, int zend=1, int chbegin=0, int chend=10000) noexcept
 
constexpr bool defined () const noexcept
 Is a region defined? More...
 
constexpr int nchannels () const noexcept
 
constexpr imagesize_t npixels () const noexcept
 Total number of pixels in the region. More...
 
constexpr bool contains (int x, int y, int z=0, int ch=0) const noexcept
 Test if the coordinate is within the ROI. More...
 
constexpr bool contains (const ROI &other) const noexcept
 Test if another ROI is entirely within our ROI. More...
 
Spatial size functions.

The width, height, and depth of the region.

constexpr int width () const noexcept
 Height. More...
 
constexpr int height () const noexcept
 Width. More...
 
constexpr int depth () const noexcept
 

Static Public Member Functions

static constexpr ROI All () noexcept
 

Public Attributes

ROI data members

The data members are:

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

These describe the spatial extent [xbegin,xend) x [ybegin,yend) x [zbegin,zend) And the channel extent: [chbegin,chend)]

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) noexcept
 Test equality of two ROIs. More...
 
constexpr bool operator!= (const ROI &a, const ROI &b) noexcept
 Test inequality of two ROIs. More...
 
std::ostream & operator<< (std::ostream &out, const ROI &roi)
 Stream output of the range. More...
 

Detailed Description

ROI is a small helper struct describing a rectangular 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 in each dimension, a la STL style.

Definition at line 85 of file imageio.h.

Constructor & Destructor Documentation

constexpr ROI::ROI ( )
inlinenoexcept

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

Definition at line 105 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 
)
inlinenoexcept

Constructor with an explicitly defined region.

Definition at line 111 of file imageio.h.

Member Function Documentation

static constexpr ROI ROI::All ( )
inlinestaticnoexcept

All() is an alias for the default constructor, which indicates that it means "all" of the image, or no region restriction. 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 145 of file imageio.h.

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

Test if the coordinate is within the ROI.

Definition at line 163 of file imageio.h.

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

Test if another ROI is entirely within our ROI.

Definition at line 169 of file imageio.h.

constexpr bool ROI::defined ( ) const
inlinenoexcept

Is a region defined?

Definition at line 118 of file imageio.h.

constexpr int ROI::depth ( ) const
inlinenoexcept

Depth

Definition at line 125 of file imageio.h.

constexpr int ROI::height ( void  ) const
inlinenoexcept

Width.

Definition at line 124 of file imageio.h.

constexpr int ROI::nchannels ( ) const
inlinenoexcept

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 131 of file imageio.h.

constexpr imagesize_t ROI::npixels ( ) const
inlinenoexcept

Total number of pixels in the region.

Definition at line 134 of file imageio.h.

constexpr int ROI::width ( void  ) const
inlinenoexcept

Height.

Definition at line 123 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 155 of file imageio.h.

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

Stream output of the range.

Definition at line 177 of file imageio.h.

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

Test equality of two ROIs.

Definition at line 148 of file imageio.h.

Member Data Documentation

int ROI::chbegin

Definition at line 100 of file imageio.h.

int ROI::chend

Definition at line 100 of file imageio.h.

int ROI::xbegin

Definition at line 97 of file imageio.h.

int ROI::xend

Definition at line 97 of file imageio.h.

int ROI::ybegin

Definition at line 98 of file imageio.h.

int ROI::yend

Definition at line 98 of file imageio.h.

int ROI::zbegin

Definition at line 99 of file imageio.h.

int ROI::zend

Definition at line 99 of file imageio.h.


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