IMG_DeepPixelReader Class Reference

Thread-safe convenience class to make reading DSM pixels easy. More...

#include <IMG_DeepShadow.h>

List of all members.

Public Member Functions

 IMG_DeepPixelReader (IMG_DeepShadow &dsm)
 ~IMG_DeepPixelReader ()
bool open (int x, int y)
 Open a pixel for reading.
void close ()
int getDepth () const
 Returns the number of z-records.
const fprealgetData (const IMG_DeepShadowChannel &chp, int depth_index)
 Return the data for the channel at the given depth index.
void composite (const IMG_DeepShadowChannel &pz, const IMG_DeepShadowChannel &of, bool force=false)
void uncomposite (const IMG_DeepShadowChannel &pz, const IMG_DeepShadowChannel &of, bool force=false)


Detailed Description

Thread-safe convenience class to make reading DSM pixels easy.

This is a thread-safe convenience class to wrap around reading pixels which ensures that the pixel is closed properly.

Warning:
Beware when declaring an IMG_DeepPixelReader in the same scope as an IMG_DeepShadow. Since the pixel reader keeps a reference to the file, the destruction order is important -- though calling close() should avoid any problems.
The class should be used as follows:
             IMG_DeepPixelReader     pixel(dsm);
             for (x, y) in raster {
                 if (pixel.open(x, y)) {
                     for (i = 0; i < pixel.getDepth(); i++)
                          data = pixel.getData(chp, i);
                 }
             }
Examples:

standalone/dsmprint.C.

Definition at line 66 of file IMG_DeepShadow.h.


Constructor & Destructor Documentation

IMG_DeepPixelReader::IMG_DeepPixelReader ( IMG_DeepShadow dsm  ) 

IMG_DeepPixelReader::~IMG_DeepPixelReader (  ) 


Member Function Documentation

void IMG_DeepPixelReader::close (  ) 

Close the pixel. This is called automatically on destruction. However, if an IMG_DeepPixelReader and IMG_DeepShadow are created in the same scope, the IMG_DeepPixelReader may hold onto references (and cause crashing errors). Calling close() manually is a safe thing to do.

void IMG_DeepPixelReader::composite ( const IMG_DeepShadowChannel pz,
const IMG_DeepShadowChannel of,
bool  force = false 
)

After opening, you can call either of these methods to ensure that the data is in the correct form for your application. "composited" pixels will have the data accumulated over from front to back. "uncomposited" pixels will have the raw data for each z-record.

If the force flag is false, then the state of the file will be used to determine whether the deep records need to be processed or not.

These methods should be called after the pixel has been opened.

const fpreal* IMG_DeepPixelReader::getData ( const IMG_DeepShadowChannel chp,
int  depth_index 
)

Return the data for the channel at the given depth index.

Examples:
standalone/dsmprint.C.

int IMG_DeepPixelReader::getDepth (  )  const

Returns the number of z-records.

Examples:
standalone/dsmprint.C.

bool IMG_DeepPixelReader::open ( int  x,
int  y 
)

Open a pixel for reading.

Examples:
standalone/dsmprint.C.

void IMG_DeepPixelReader::uncomposite ( const IMG_DeepShadowChannel pz,
const IMG_DeepShadowChannel of,
bool  force = false 
)


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

Generated on Fri May 25 00:10:30 2012 for HDK by  doxygen 1.5.9