IMAGE_TILE_ITERATOR Class Reference

Allow iteration through a raster image in tile order. More...

#include <mi32/imgtilit.h>

List of all members.

Public Member Functions

INT32 GetColumn () const
INT32 GetLine () const
INT32 GetNumColumns () const
INT32 GetNumSpans () const
INT32 GetSpan () const
 IMAGE_TILE_ITERATOR (const RVCRASTINFO &rastinfo)
 IMAGE_TILE_ITERATOR (INT32 numcols, INT32 numlins, INT32 tilecols, INT32 tilelins)
 IMAGE_TILE_ITERATOR (const RVC::RASTER &RastObj)
bool IsDone () const
IMAGE_TILE_ITERATORoperator++ ()
void Reset ()


Detailed Description

Allow iteration through a raster image in tile order.

In many cases, all cells in an image are to be processed, but the order is not important to the algorithm. In this case, it is most efficient to read or write the image in tile order, processing all cells in one tile before moving to the next tile. This class simplifies and encapsulates the details of iterating through the tiles and spans within each tile.

The following code fragment shows how this class is used for RVC rasters to compute the minimum and maximum cell values in the raster. Error checking and null cell handling issues are ignored for simplicity.

         RVCRASTINFO rastinfo;
         int rhandle = MfOpenRast(fhandle,rastinode,&rastinfo,RVCMODE_Read);
         double *linebuf;
         MmAllocC((void**)&linebuf,rastinfo.TileCols*sizeof(linebuf[0]));
         double minval = DBL_MAX, maxval = DBL_MIN;
         for (IMAGE_TILE_ITERATOR it(rastinfo); (!it.IsDone()); ++it) {
            MfReadRastConv(rhandle,it.GetLine(),it.GetColumn(),it.GetNumColumns(),linebuf,RASTMODE_ConvToDouble);
            for (int col = 0; (col < it.GetNumColumns()); ++col) {
               if (linebuf[col] < minval) minval = linebuf[col];
               if (linebuf[col] > maxval) maxval = linebuf[col];
               }
            }

Definition at line 72 of file imgtilit.h.


Constructor & Destructor Documentation

IMAGE_TILE_ITERATOR::IMAGE_TILE_ITERATOR const RVC::RASTER RastObj  ) 
 

Construct iterator using raster object.

Parameters:
RastObj  RVC::RASTER object that is already opened

IMAGE_TILE_ITERATOR::IMAGE_TILE_ITERATOR INT32  numcols,
INT32  numlins,
INT32  tilecols,
INT32  tilelins
 

Construct iterator for given image and tile size.

Parameters:
numcols  Number of columns in raster image
numlins  Number of lines in raster image
tilecols  Number of columns in a single tile
tilelins  Number of lines in a single tile

IMAGE_TILE_ITERATOR::IMAGE_TILE_ITERATOR const RVCRASTINFO rastinfo  ) 
 

Construct iterator using raster image header.


Member Function Documentation

INT32 IMAGE_TILE_ITERATOR::GetColumn  )  const [inline]
 

Get starting column for current span.

Definition at line 104 of file imgtilit.h.

INT32 IMAGE_TILE_ITERATOR::GetLine  )  const [inline]
 

Get line within image for current span.

Definition at line 110 of file imgtilit.h.

INT32 IMAGE_TILE_ITERATOR::GetNumColumns  )  const [inline]
 

Get number of columns in current span.

Definition at line 116 of file imgtilit.h.

INT32 IMAGE_TILE_ITERATOR::GetNumSpans  )  const [inline]
 

Get total number of spans.

Definition at line 122 of file imgtilit.h.

INT32 IMAGE_TILE_ITERATOR::GetSpan  )  const [inline]
 

Get current span number.

Definition at line 128 of file imgtilit.h.

bool IMAGE_TILE_ITERATOR::IsDone  )  const [inline]
 

Determine if at end of image.

Definition at line 134 of file imgtilit.h.

IMAGE_TILE_ITERATOR& IMAGE_TILE_ITERATOR::operator++  ) 
 

Increment to next span.

void IMAGE_TILE_ITERATOR::Reset  ) 
 

Reset to beginning.


The documentation for this class was generated from the following file:
Generated on Wed May 31 15:28:44 2006 for TNTsdk by  doxygen 1.3.8-20040913