CRoiIndices Class Reference

ROI indices. More...

#include <WaveletTransform.h>

List of all members.

Public Member Functions

UINT32 GetNofTiles (int level) const

Private Member Functions

 CRoiIndices ()
 ~CRoiIndices ()
void Destroy ()
void CreateIndices ()
void ComputeIndices (UINT32 width, UINT32 height, const PGFRect &rect)
const PGFRectGetIndices (int level) const
void SetLevels (int levels)
void ComputeTileIndex (UINT32 width, UINT32 height, UINT32 pos, bool horizontal, bool isMin)

Private Attributes

int m_nLevels
 number of levels of the image
PGFRectm_indices
 array of tile indices (index is level)

Friends

class CWaveletTransform

Detailed Description

ROI indices.

PGF ROI and tile support. This is a helper class for CWaveletTransform.

Author:
C. Stamm

Definition at line 45 of file WaveletTransform.h.


Constructor & Destructor Documentation

CRoiIndices::CRoiIndices (  )  [inline, private]

Constructor: Creates a ROI helper object

Definition at line 50 of file WaveletTransform.h.

00051         : m_nLevels(0)
00052         , m_indices(0) 
00053         {}

CRoiIndices::~CRoiIndices (  )  [inline, private]

Destructor

Definition at line 57 of file WaveletTransform.h.

00057 { Destroy(); }


Member Function Documentation

void CRoiIndices::ComputeIndices ( UINT32  width,
UINT32  height,
const PGFRect rect 
) [private]

Compute tile indices for given rectangle (ROI)

Parameters:
width PGF image width
height PGF image height
rect ROI

Definition at line 603 of file WaveletTransform.cpp.

00603                                                                                  {
00604         ComputeTileIndex(width, height, rect.left, true, true);
00605         ComputeTileIndex(width, height, rect.top, false, true);
00606         ComputeTileIndex(width, height, rect.right, true, false);
00607         ComputeTileIndex(width, height, rect.bottom, false, false);
00608 }

void CRoiIndices::ComputeTileIndex ( UINT32  width,
UINT32  height,
UINT32  pos,
bool  horizontal,
bool  isMin 
) [private]

Computes a tile index either in x- or y-direction for a given image position.

Parameters:
width PGF image width
height PGF image height
pos A valid image position: (0 <= pos < width) or (0 <= pos < height)
horizontal If true, then pos must be a x-value, otherwise a y-value
isMin If true, then pos is left/top, else pos right/bottom

Definition at line 561 of file WaveletTransform.cpp.

00561                                                                                                        {
00562         ASSERT(m_indices);
00563 
00564         UINT32 m;
00565         UINT32 tileIndex = 0;
00566         UINT32 tileMin = 0, tileMax = (horizontal) ? width : height;
00567         ASSERT(pos <= tileMax);
00568 
00569         // compute tile index with binary search
00570         for (int i=m_nLevels - 1; i >= 0; i--) {
00571                 // store values
00572                 if (horizontal) {
00573                         if (isMin) {
00574                                 m_indices[i].left = tileIndex;
00575                         } else {
00576                                 m_indices[i].right = tileIndex + 1;
00577                         }
00578                 } else {
00579                         if (isMin) {
00580                                 m_indices[i].top = tileIndex;
00581                         } else {
00582                                 m_indices[i].bottom = tileIndex + 1;
00583                         }
00584                 }
00585 
00586                 // compute values
00587                 tileIndex <<= 1;
00588                 m = tileMin + (tileMax - tileMin)/2;
00589                 if (pos >= m) {
00590                         tileMin = m;
00591                         tileIndex++;
00592                 } else {
00593                         tileMax = m;
00594                 }
00595         }
00596 }

void CRoiIndices::CreateIndices (  )  [private]

Definition at line 547 of file WaveletTransform.cpp.

00547                                 {
00548         if (!m_indices) {
00549                 // create tile indices 
00550                 m_indices = new PGFRect[m_nLevels];
00551         }
00552 }

void CRoiIndices::Destroy (  )  [inline, private]

Definition at line 59 of file WaveletTransform.h.

00059 { delete[] m_indices; m_indices = 0; }

const PGFRect& CRoiIndices::GetIndices ( int  level  )  const [inline, private]

Definition at line 62 of file WaveletTransform.h.

00062 { ASSERT(m_indices); ASSERT(level >= 0 && level < m_nLevels); return m_indices[level]; }

UINT32 CRoiIndices::GetNofTiles ( int  level  )  const [inline]

Returns the number of tiles in one dimension at given level.

Parameters:
level A wavelet transform pyramid level (>= 0 && < Levels())

Definition at line 70 of file WaveletTransform.h.

00070 { ASSERT(level >= 0 && level < m_nLevels); return 1 << (m_nLevels - level - 1); }

void CRoiIndices::SetLevels ( int  levels  )  [inline, private]

Definition at line 63 of file WaveletTransform.h.

00063 { ASSERT(levels > 0); m_nLevels = levels; }


Friends And Related Function Documentation

friend class CWaveletTransform [friend]

Definition at line 46 of file WaveletTransform.h.


Member Data Documentation

array of tile indices (index is level)

Definition at line 74 of file WaveletTransform.h.

int CRoiIndices::m_nLevels [private]

number of levels of the image

Definition at line 73 of file WaveletTransform.h.


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

Generated on 18 Feb 2019 for libpgf by  doxygen 1.6.1