VTK  9.3.20240423
Public Member Functions | Static Public Member Functions | List of all members
vtkPixelExtent Class Reference

Representation of a cartesian pixel plane and common operations on it. More...

#include <vtkPixelExtent.h>

Public Member Functions

 vtkPixelExtent ()
 
template<typename T >
 vtkPixelExtent (const T *ext)
 
template<typename T >
 vtkPixelExtent (T ilo, T ihi, T jlo, T jhi)
 
template<typename T >
 vtkPixelExtent (T width, T height)
 
 vtkPixelExtent (const vtkPixelExtent &other)
 
vtkPixelExtentoperator= (const vtkPixelExtent &other)
 
int & operator[] (int i)
 Element access.
 
const int & operator[] (int i) const
 
void SetData (const vtkPixelExtent &ext)
 Set the extent.
 
template<typename T >
void SetData (const T *ext)
 
template<typename T >
void SetData (T ilo, T ihi, T jlo, T jhi)
 
void Clear ()
 
int * GetData ()
 Direct access to internal data.
 
const int * GetData () const
 
template<typename T >
void GetData (T data[4]) const
 
unsigned int * GetDataU ()
 
const unsigned int * GetDataU () const
 
int Empty () const
 Return true if empty.
 
bool operator== (const vtkPixelExtent &other) const
 Test for equivalence.
 
int Disjoint (vtkPixelExtent other) const
 Return non-zero if the extent is disjoint from the other.
 
template<typename T >
void Size (T nCells[2]) const
 Get the number in each direction.
 
size_t Size () const
 Get the total number.
 
void operator&= (const vtkPixelExtent &other)
 In place intersection.
 
void operator|= (const vtkPixelExtent &other)
 In place union.
 
void Shift ()
 Shifts by low corner of this, moving to the origin.
 
void Shift (const vtkPixelExtent &ext)
 Shift by low corner of the given extent.
 
void Shift (int *n)
 Shift by the given amount.
 
void Shift (int q, int n)
 Shift by the given amount in the given direction.
 
vtkPixelExtent Split (int dir)
 Divide the extent in half in the given direction.
 
void GetStartIndex (int first[2]) const
 Get the start/end index.
 
void GetStartIndex (int first[2], const int origin[2]) const
 Get the start/end index.
 
void GetEndIndex (int last[2]) const
 Get the start/end index.
 
int Contains (const vtkPixelExtent &other) const
 Return non-zero if this extent contains the other.
 
int Contains (int i, int j) const
 Return non-zero if this extent contains the other.
 
void Grow (int n)
 Expand the extents by n.
 
void Grow (int q, int n)
 Expand the extents by n.
 
void GrowLow (int q, int n)
 Expand the extents by n.
 
void GrowHigh (int q, int n)
 Expand the extents by n.
 
void Shrink (int n)
 Shrink the extent by n.
 
void Shrink (int q, int n)
 Shrink the extent by n.
 
void CellToNode ()
 In-place conversion from cell based to node based extent, and vise-versa.
 
void NodeToCell ()
 In-place conversion from cell based to node based extent, and vise-versa.
 

Static Public Member Functions

template<typename T >
static void Size (const vtkPixelExtent &ext, T nCells[2])
 Get the number in each direction.
 
static size_t Size (const vtkPixelExtent &ext)
 Get the total number.
 
static vtkPixelExtent Grow (const vtkPixelExtent &inputExt, int n)
 Add or remove ghost cells.
 
static vtkPixelExtent Grow (const vtkPixelExtent &inputExt, const vtkPixelExtent &problemDomain, int n)
 
static vtkPixelExtent GrowLow (const vtkPixelExtent &ext, int q, int n)
 
static vtkPixelExtent GrowHigh (const vtkPixelExtent &ext, int q, int n)
 
static vtkPixelExtent Shrink (const vtkPixelExtent &inputExt, const vtkPixelExtent &problemDomain, int n)
 Remove ghost cells.
 
static vtkPixelExtent Shrink (const vtkPixelExtent &inputExt, int n)
 
static vtkPixelExtent NodeToCell (const vtkPixelExtent &inputExt)
 Convert from point extent to cell extent while respecting the dimensionality of the data.
 
static vtkPixelExtent CellToNode (const vtkPixelExtent &inputExt)
 Convert from cell extent to point extent while respecting the dimensionality of the data.
 
static void Split (int i, int j, const vtkPixelExtent &ext, std::deque< vtkPixelExtent > &newExts)
 Split ext at i,j, resulting extents (up to 4) are appended to newExts.
 
static void Subtract (const vtkPixelExtent &A, const vtkPixelExtent &B, std::deque< vtkPixelExtent > &C)
 A - B = C C is a set of disjoint extents such that the intersection of B and C is empty and the intersection of A and C is C.
 
static void Merge (std::deque< vtkPixelExtent > &exts)
 Merge compatible extents in the list.
 
static void Shift (int *ij, int n)
 Shift by the given amount while respecting mode.
 
static void Shift (int *ij, int *n)
 Shift by the given amount while respecting mode.
 

Detailed Description

Representation of a cartesian pixel plane and common operations on it.

The implementation is intended to be fast and light so that it may be used in place of int[4] with little or no performance penalty.

NOTE in most cases operation on an empty object produces incorrect results. If it an issue query Empty() first.

Tests:
vtkPixelExtent (Tests)

Definition at line 30 of file vtkPixelExtent.h.

Constructor & Destructor Documentation

◆ vtkPixelExtent() [1/5]

vtkPixelExtent::vtkPixelExtent ( )
inline

Definition at line 317 of file vtkPixelExtent.h.

◆ vtkPixelExtent() [2/5]

template<typename T >
vtkPixelExtent::vtkPixelExtent ( const T *  ext)

Definition at line 324 of file vtkPixelExtent.h.

◆ vtkPixelExtent() [3/5]

template<typename T >
vtkPixelExtent::vtkPixelExtent ( ilo,
ihi,
jlo,
jhi 
)

Definition at line 331 of file vtkPixelExtent.h.

◆ vtkPixelExtent() [4/5]

template<typename T >
vtkPixelExtent::vtkPixelExtent ( width,
height 
)
inline

Definition at line 42 of file vtkPixelExtent.h.

◆ vtkPixelExtent() [5/5]

vtkPixelExtent::vtkPixelExtent ( const vtkPixelExtent other)
inline

Definition at line 350 of file vtkPixelExtent.h.

Member Function Documentation

◆ operator=()

vtkPixelExtent & vtkPixelExtent::operator= ( const vtkPixelExtent other)
inline

Definition at line 337 of file vtkPixelExtent.h.

◆ operator[]() [1/2]

int & vtkPixelExtent::operator[] ( int  i)
inline

Element access.

Definition at line 54 of file vtkPixelExtent.h.

◆ operator[]() [2/2]

const int & vtkPixelExtent::operator[] ( int  i) const
inline

Definition at line 55 of file vtkPixelExtent.h.

◆ SetData() [1/3]

void vtkPixelExtent::SetData ( const vtkPixelExtent ext)
inline

Set the extent.

Definition at line 295 of file vtkPixelExtent.h.

◆ SetData() [2/3]

template<typename T >
void vtkPixelExtent::SetData ( const T *  ext)

Definition at line 278 of file vtkPixelExtent.h.

◆ SetData() [3/3]

template<typename T >
void vtkPixelExtent::SetData ( ilo,
ihi,
jlo,
jhi 
)

Definition at line 288 of file vtkPixelExtent.h.

◆ Clear()

void vtkPixelExtent::Clear ( )
inline

Definition at line 311 of file vtkPixelExtent.h.

◆ GetData() [1/3]

int * vtkPixelExtent::GetData ( )
inline

Direct access to internal data.

Definition at line 72 of file vtkPixelExtent.h.

◆ GetData() [2/3]

const int * vtkPixelExtent::GetData ( ) const
inline

Definition at line 73 of file vtkPixelExtent.h.

◆ GetData() [3/3]

template<typename T >
void vtkPixelExtent::GetData ( data[4]) const

Definition at line 302 of file vtkPixelExtent.h.

◆ GetDataU() [1/2]

unsigned int * vtkPixelExtent::GetDataU ( )
inline

Definition at line 78 of file vtkPixelExtent.h.

◆ GetDataU() [2/2]

const unsigned int * vtkPixelExtent::GetDataU ( ) const
inline

Definition at line 80 of file vtkPixelExtent.h.

◆ GetStartIndex() [1/2]

void vtkPixelExtent::GetStartIndex ( int  first[2]) const
inline

Get the start/end index.

Definition at line 383 of file vtkPixelExtent.h.

◆ GetStartIndex() [2/2]

void vtkPixelExtent::GetStartIndex ( int  first[2],
const int  origin[2] 
) const
inline

Get the start/end index.

Definition at line 390 of file vtkPixelExtent.h.

◆ GetEndIndex()

void vtkPixelExtent::GetEndIndex ( int  last[2]) const
inline

Get the start/end index.

Definition at line 397 of file vtkPixelExtent.h.

◆ Empty()

int vtkPixelExtent::Empty ( ) const
inline

Return true if empty.

Definition at line 404 of file vtkPixelExtent.h.

◆ operator==()

bool vtkPixelExtent::operator== ( const vtkPixelExtent other) const
inline

Test for equivalence.

Definition at line 414 of file vtkPixelExtent.h.

◆ Contains() [1/2]

int vtkPixelExtent::Contains ( const vtkPixelExtent other) const
inline

Return non-zero if this extent contains the other.

Definition at line 425 of file vtkPixelExtent.h.

◆ Contains() [2/2]

int vtkPixelExtent::Contains ( int  i,
int  j 
) const
inline

Return non-zero if this extent contains the other.

Definition at line 436 of file vtkPixelExtent.h.

◆ Disjoint()

int vtkPixelExtent::Disjoint ( vtkPixelExtent  other) const
inline

Return non-zero if the extent is disjoint from the other.

Definition at line 491 of file vtkPixelExtent.h.

◆ Size() [1/4]

template<typename T >
void vtkPixelExtent::Size ( nCells[2]) const

Get the number in each direction.

Definition at line 371 of file vtkPixelExtent.h.

◆ Size() [2/4]

size_t vtkPixelExtent::Size ( ) const
inline

Get the total number.

Definition at line 377 of file vtkPixelExtent.h.

◆ operator&=()

void vtkPixelExtent::operator&= ( const vtkPixelExtent other)
inline

In place intersection.

Definition at line 446 of file vtkPixelExtent.h.

◆ operator|=()

void vtkPixelExtent::operator|= ( const vtkPixelExtent other)
inline

In place union.

Definition at line 471 of file vtkPixelExtent.h.

◆ Grow() [1/4]

void vtkPixelExtent::Grow ( int  n)
inline

Expand the extents by n.

Definition at line 498 of file vtkPixelExtent.h.

◆ Grow() [2/4]

void vtkPixelExtent::Grow ( int  q,
int  n 
)
inline

Expand the extents by n.

Definition at line 507 of file vtkPixelExtent.h.

◆ GrowLow() [1/2]

void vtkPixelExtent::GrowLow ( int  q,
int  n 
)
inline

Expand the extents by n.

Definition at line 516 of file vtkPixelExtent.h.

◆ GrowHigh() [1/2]

void vtkPixelExtent::GrowHigh ( int  q,
int  n 
)
inline

Expand the extents by n.

Definition at line 522 of file vtkPixelExtent.h.

◆ Shrink() [1/4]

void vtkPixelExtent::Shrink ( int  n)
inline

Shrink the extent by n.

Definition at line 528 of file vtkPixelExtent.h.

◆ Shrink() [2/4]

void vtkPixelExtent::Shrink ( int  q,
int  n 
)
inline

Shrink the extent by n.

Definition at line 537 of file vtkPixelExtent.h.

◆ Shift() [1/6]

void vtkPixelExtent::Shift ( )
inline

Shifts by low corner of this, moving to the origin.

Definition at line 575 of file vtkPixelExtent.h.

◆ Shift() [2/6]

void vtkPixelExtent::Shift ( const vtkPixelExtent ext)
inline

Shift by low corner of the given extent.

Definition at line 562 of file vtkPixelExtent.h.

◆ Shift() [3/6]

void vtkPixelExtent::Shift ( int *  n)
inline

Shift by the given amount.

Definition at line 545 of file vtkPixelExtent.h.

◆ Shift() [4/6]

void vtkPixelExtent::Shift ( int  q,
int  n 
)
inline

Shift by the given amount in the given direction.

Definition at line 554 of file vtkPixelExtent.h.

◆ Split() [1/2]

vtkPixelExtent vtkPixelExtent::Split ( int  dir)
inline

Divide the extent in half in the given direction.

The operation is done in-place the other half of the split extent is returned. The return will be empty if the split could not be made.

Definition at line 588 of file vtkPixelExtent.h.

◆ CellToNode() [1/2]

void vtkPixelExtent::CellToNode ( )
inline

In-place conversion from cell based to node based extent, and vise-versa.

Definition at line 608 of file vtkPixelExtent.h.

◆ NodeToCell() [1/2]

void vtkPixelExtent::NodeToCell ( )
inline

In-place conversion from cell based to node based extent, and vise-versa.

Definition at line 615 of file vtkPixelExtent.h.

◆ Size() [3/4]

template<typename T >
void vtkPixelExtent::Size ( const vtkPixelExtent ext,
nCells[2] 
)
static

Get the number in each direction.

Definition at line 357 of file vtkPixelExtent.h.

◆ Size() [4/4]

size_t vtkPixelExtent::Size ( const vtkPixelExtent ext)
inlinestatic

Get the total number.

Definition at line 364 of file vtkPixelExtent.h.

◆ Grow() [3/4]

static vtkPixelExtent vtkPixelExtent::Grow ( const vtkPixelExtent inputExt,
int  n 
)
static

Add or remove ghost cells.

If a problem domain is provided then the result is clipled to be within the problem domain.

◆ Grow() [4/4]

static vtkPixelExtent vtkPixelExtent::Grow ( const vtkPixelExtent inputExt,
const vtkPixelExtent problemDomain,
int  n 
)
static

◆ GrowLow() [2/2]

static vtkPixelExtent vtkPixelExtent::GrowLow ( const vtkPixelExtent ext,
int  q,
int  n 
)
static

◆ GrowHigh() [2/2]

static vtkPixelExtent vtkPixelExtent::GrowHigh ( const vtkPixelExtent ext,
int  q,
int  n 
)
static

◆ Shrink() [3/4]

static vtkPixelExtent vtkPixelExtent::Shrink ( const vtkPixelExtent inputExt,
const vtkPixelExtent problemDomain,
int  n 
)
static

Remove ghost cells.

If a problem domain is provided the input is pinned at the domain.

◆ Shrink() [4/4]

static vtkPixelExtent vtkPixelExtent::Shrink ( const vtkPixelExtent inputExt,
int  n 
)
static

◆ NodeToCell() [2/2]

static vtkPixelExtent vtkPixelExtent::NodeToCell ( const vtkPixelExtent inputExt)
static

Convert from point extent to cell extent while respecting the dimensionality of the data.

◆ CellToNode() [2/2]

static vtkPixelExtent vtkPixelExtent::CellToNode ( const vtkPixelExtent inputExt)
static

Convert from cell extent to point extent while respecting the dimensionality of the data.

◆ Shift() [5/6]

static void vtkPixelExtent::Shift ( int *  ij,
int  n 
)
static

Shift by the given amount while respecting mode.

◆ Shift() [6/6]

static void vtkPixelExtent::Shift ( int *  ij,
int *  n 
)
static

Shift by the given amount while respecting mode.

◆ Split() [2/2]

static void vtkPixelExtent::Split ( int  i,
int  j,
const vtkPixelExtent ext,
std::deque< vtkPixelExtent > &  newExts 
)
static

Split ext at i,j, resulting extents (up to 4) are appended to newExts.

If i,j is outside ext, ext is passed through unmodified.

◆ Subtract()

static void vtkPixelExtent::Subtract ( const vtkPixelExtent A,
const vtkPixelExtent B,
std::deque< vtkPixelExtent > &  C 
)
static

A - B = C C is a set of disjoint extents such that the intersection of B and C is empty and the intersection of A and C is C.

◆ Merge()

static void vtkPixelExtent::Merge ( std::deque< vtkPixelExtent > &  exts)
static

Merge compatible extents in the list.

Extents are compatible if they are directly adjacent and have the same extent along the adjacent edge.


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