DD::Image::DeepInPlaceOutputPlane Class Reference

Inherits DD::Image::DeepOutputPlane.

List of all members.

Public Member Functions

 DeepInPlaceOutputPlane (DD::Image::ChannelSet channels, DD::Image::Box box, DeepPixel::Ordering ordering=DeepPixel::eUnordered)
void reserveSamples (size_t sampleCount)
void setSampleCount (int y, int x, size_t newSampleCount)
void setSampleCount (DD::Image::Box::iterator it, size_t newSampleCount)
DeepOutputPixel getPixel (const DD::Image::Box::iterator &it)
DeepOutputPixel getPixel (int y, int x)
void reviseSamples ()
bool isComplete () const
bool isInError () const

Detailed Description

DeepInPlaceOutputPlane is a subclass of DeepOutputPlane that allows the pixel data to be altered in place.

Pattern of use should be: create a DeepInPlaceOutputPlane with the required channels, box and ordering, and then call reserveSamples() to allocate storage for the samples then setSampleCount() and getPixel() at each position within that box from top left to bottom right (see Box::iterator). This results in a valid plane that can then be accessed with the accessor methods above.

Overallocated planes may be trimmed to size using reviseSamples(). setSampleCount() will increase the allocation if required but doing so is expensive.


Constructor & Destructor Documentation

DD::Image::DeepInPlaceOutputPlane::DeepInPlaceOutputPlane ( DD::Image::ChannelSet  channels,
DD::Image::Box  box,
DeepPixel::Ordering  ordering = DeepPixel::eUnordered 
)

Create a new output plane

References DD::Image::DeepPlane::_box, and DD::Image::DeepPlane::_sharedData.


Member Function Documentation

void DD::Image::DeepInPlaceOutputPlane::reserveSamples ( size_t  sampleCount)

reserve memory in DeepPlaneData for pixel sample data

References DD::Image::DeepPlane::_channels, DD::Image::DeepPlane::_sharedData, and DD::Image::ChannelMap::size().

void DD::Image::DeepInPlaceOutputPlane::setSampleCount ( int  y,
int  x,
size_t  newSampleCount 
)

set the newSampleCount amount of samples at pixel, Initialises Data for direct access

Note that sample counts should be set sequentially. setSampleCount() invalidates all pixels after (see Box::iterator) this pixel. After setting the sample count for a pixel _all_ subsequent pixels are invalid. Their sample count and pixel data must be reset.

set the newSampleCount amount of samples at pixel 'it', Initialises Data for direct access

References DD::Image::DeepPlane::_box, DD::Image::DeepPlane::_channels, DD::Image::DeepPlane::_sharedData, DD::Image::Box::r(), DD::Image::ChannelMap::size(), DD::Image::Box::t(), DD::Image::Box::x(), and DD::Image::Box::y().

void DD::Image::DeepInPlaceOutputPlane::setSampleCount ( DD::Image::Box::iterator  it,
size_t  newSampleCount 
) [inline]

set the newSampleCount amount of samples at pixel 'it', Initialises Data for direct access

Note that sample counts should be set sequentially. setSampleCount() invalidates all pixels after (see Box::iterator) this pixel. After setting the sample count for a pixel _all_ subsequent pixels are invalid. Their sample count and pixel data must be reset.

DeepOutputPixel DD::Image::DeepInPlaceOutputPlane::getPixel ( const DD::Image::Box::iterator &  it) [inline]

get a modifiable pixel, at 'it'

Note that this data is only valid after the sample count has been set using setSampleCount().

DeepOutputPixel DD::Image::DeepInPlaceOutputPlane::getPixel ( int  y,
int  x 
)
void DD::Image::DeepInPlaceOutputPlane::reviseSamples ( void  )

Reduces overallocated data.

References DD::Image::DeepPlane::_sharedData.

bool DD::Image::DeepInPlaceOutputPlane::isComplete ( ) const

Low overhead verification of a complete plane.

References DD::Image::DeepPlane::_box, and isInError().

bool DD::Image::DeepInPlaceOutputPlane::isInError ( ) const [inline]

Error checking to debug invalid use.

Referenced by isComplete().