HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_DeepPixelReader Class Reference

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

#include <IMG_DeepShadow.h>

+ Inheritance diagram for IMG_DeepPixelReader:

Public Member Functions

 IMG_DeepPixelReader ()
 
 IMG_DeepPixelReader (const IMG_DeepShadow &dsm)
 
 ~IMG_DeepPixelReader ()
 
bool isValid () const
 
void init (const IMG_DeepShadow &dsm)
 
void clear ()
 
bool open (int x, int y)
 Open a pixel for reading. More...
 
void close ()
 
int getDepth () const
 Returns the number of z-records. More...
 
const floatgetData (const IMG_DeepShadowChannel &chp, int depth_index)
 Return the data for the channel at the given depth index. More...
 
bool readPixel (int x, int y, PXL_DeepSampleList &pixel) const
 
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:

for (x, y) in raster {
if (pixel.open(x, y)) {
for (int i = 0; i < pixel.getDepth(); i++)
data = pixel.getData(chp, i);
}
}
Examples:
standalone/dsmprint.C.

Definition at line 60 of file IMG_DeepShadow.h.

Constructor & Destructor Documentation

IMG_DeepPixelReader::IMG_DeepPixelReader ( )
inline

Definition at line 64 of file IMG_DeepShadow.h.

IMG_DeepPixelReader::IMG_DeepPixelReader ( const IMG_DeepShadow dsm)
inline

Definition at line 67 of file IMG_DeepShadow.h.

IMG_DeepPixelReader::~IMG_DeepPixelReader ( )
inline

Definition at line 72 of file IMG_DeepShadow.h.

Member Function Documentation

void IMG_DeepPixelReader::clear ( )
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 float* 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.
void IMG_DeepPixelReader::init ( const IMG_DeepShadow dsm)
bool IMG_DeepPixelReader::isValid ( ) const
inline

Definition at line 80 of file IMG_DeepShadow.h.

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

Open a pixel for reading.

Examples:
standalone/dsmprint.C.
bool IMG_DeepPixelReader::readPixel ( int  x,
int  y,
PXL_DeepSampleList pixel 
) const

Alternately, just fill a PXL_DeepSampleList with the appropriate data. This manages zback, coverage, flags and other special deep channels.

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: