#include <mi32/imgtilit.h>
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) | |
| bool | IsDone () const |
| IMAGE_TILE_ITERATOR & | operator++ () |
| void | Reset () |
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 62 of file imgtilit.h.
|
||||||||||||||||||||
|
Construct iterator for given image and tile size.
|
|
|
Construct iterator using raster image header.
|
|
|
Get starting column for current span.
Definition at line 89 of file imgtilit.h. |
|
|
Get line within image for current span.
Definition at line 95 of file imgtilit.h. |
|
|
Get number of columns in current span.
Definition at line 101 of file imgtilit.h. |
|
|
Get total number of spans.
Definition at line 107 of file imgtilit.h. |
|
|
Get current span number.
Definition at line 113 of file imgtilit.h. |
|
|
Determine if at end of image.
Definition at line 119 of file imgtilit.h. |
|
|
Increment to next span.
|
|
|
Reset to beginning.
|
1.3.8-20040913