Buffer to contain data for an image. More...
#include <spatmod/imagebuffer.h>
Public Types | |
| enum | COPYFLAGS { COPYFLAG_None = 0x0000, COPYFLAG_KeepValid = 0x0001, COPYFLAG_NoInvalid = 0x0002 } |
Public Member Functions | |
| BUFFER (const BUFFER &rhs) | |
| BUFFER () | |
| ~BUFFER () | |
| ERRVALUE | CheckRectangle (INT32 StartColumn, INT32 StartRow, UINT32 NumColumns, UINT32 NumRows) const |
| ERRVALUE | CopyFrom (INT32 TgtMinColumn, INT32 TgtMinRow, const BUFFER &SrcBuffer, INT32 SrcMinColumn, INT32 SrcMinRow, UINT32 SrcNumColumns, UINT32 SrcNumRows) |
| ERRVALUE | Create (BUFFER &existing, INT32 ColOffset, INT32 RowOffset, UINT32 WinColumns, UINT32 WinRows) |
| ERRVALUE | Create (const PIXEL &PixelProperties, UINT32 NumColumns, UINT32 NumRows, void **data=0, UINT8 *validity=0) |
| ERRVALUE | CreateSubset (BUFFER &existing, const UINT16 *SampleIdxs, UINT16 NumSamples, bool OwnValidity) |
| void | Destroy () |
| ERRVALUE | ExportRowBIP (void *target, const PIXEL &nullpixel, UINT32 row, UINT32 StartColumn=0, UINT32 NumColumns=0) const |
| ERRVALUE | ExportRowBIP (void *target, UINT32 row, UINT32 StartColumn=0, UINT32 NumColumns=0, bool SkipInvalid=false, const UINT16 *SampleTrans=0, UINT16 NumSamplesTrans=0, int OutputPixelBytes=0) const |
| ERRVALUE | GetIterator (SAMPLEITERATOR &iterator, UINT16 SampleNum, INT32 row, INT32 column=0) |
| ERRVALUE | GetIterator (SAMPLEITERATOR_CONST &iterator, UINT16 SampleNum, INT32 row, INT32 column=0) const |
| UINT32 | GetNumColumns () const |
| UINT32 | GetNumRowBytes (UINT16 SampleNum) const |
| UINT32 | GetNumRows () const |
| UINT32 | GetNumSampleBytes (UINT16 SampleNum) const |
| UINT16 | GetNumSamples () const |
| const PIXEL & | GetPixelProperties () const |
| void * | GetPtrSample (UINT16 SampleNum, INT32 row, INT32 column=0) |
| const void * | GetPtrSample (UINT16 SampleNum, INT32 row, INT32 column=0) const |
| void * | GetPtrSampleFast (UINT16 SampleNum, INT32 row, INT32 column=0) |
| const void * | GetPtrSampleFast (UINT16 SampleNum, INT32 row, INT32 column=0) const |
| void ** | GetPtrSamplesBase () |
| UINT8 * | GetPtrValidity (INT32 row, INT32 column=0) |
| const UINT8 * | GetPtrValidity (INT32 row, INT32 column=0) const |
| UINT8 * | GetPtrValidityFast (INT32 row, INT32 column=0) |
| const UINT8 * | GetPtrValidityFast (INT32 row, INT32 column=0) const |
| UINT32 | GetTotalColumns () const |
| UINT32 | GetTotalRowBytes (UINT16 SampleNum) const |
| UINT32 | GetTotalRows () const |
| UINT32 | GetWindowColumn () const |
| UINT32 | GetWindowRow () const |
| ERRVALUE | ImportRowBIP (const void *source, const PIXEL &nullpixel, UINT32 row, UINT32 StartColumn=0, UINT32 NumColumns=0) |
| ERRVALUE | ImportRowBIP (const void *source, const UINT8 *validity, UINT32 row, UINT32 StartColumn=0, UINT32 NumColumns=0) |
| bool | IsContiguous () const |
| bool | IsCreated () const |
| BUFFER & | operator= (const BUFFER &rhs) |
| ERRVALUE | SetInvalid (INT32 StartColumn, INT32 StartRow, UINT32 NumColumns, UINT32 NumRows) |
| void | SetValidityAll (bool validity) |
| ERRVALUE | SetValidityLogical (LOGICALOP operation, const BUFFER &buffer) |
| void | ShiftWindowFast (INT32 DeltaColumn, INT32 DeltaRow) |
Buffer to contain data for an image.
| SPATMOD::IMAGE::BUFFER::BUFFER | ( | ) |
Default contructor.
Buffer will not be usable until Create() method is called.
| SPATMOD::IMAGE::BUFFER::BUFFER | ( | const BUFFER & | rhs | ) |
Copy contructor.
If source buffer has been created then copy will reference same memory.
| SPATMOD::IMAGE::BUFFER::~BUFFER | ( | ) |
Destructor.
| ERRVALUE SPATMOD::IMAGE::BUFFER::CheckRectangle | ( | INT32 | StartColumn, | |
| INT32 | StartRow, | |||
| UINT32 | NumColumns, | |||
| UINT32 | NumRows | |||
| ) | const |
Check if rectangle is valid.
| ERRVALUE SPATMOD::IMAGE::BUFFER::CopyFrom | ( | INT32 | TgtMinColumn, | |
| INT32 | TgtMinRow, | |||
| const BUFFER & | SrcBuffer, | |||
| INT32 | SrcMinColumn, | |||
| INT32 | SrcMinRow, | |||
| UINT32 | SrcNumColumns, | |||
| UINT32 | SrcNumRows | |||
| ) |
Copy rectangle from another buffer.
| ERRVALUE SPATMOD::IMAGE::BUFFER::Create | ( | BUFFER & | existing, | |
| INT32 | ColOffset, | |||
| INT32 | RowOffset, | |||
| UINT32 | WinColumns, | |||
| UINT32 | WinRows | |||
| ) |
Create buffer as 'window' into existing buffer.
Window must be within limits of existing buffer or error will be returned Existing buffer may be destroyed after returns as actual data is reference counted.
| existing | Existing buffer to reference | |
| ColOffset | Column offset relative to existing buffer | |
| RowOffset | Row offset relative to existing buffer | |
| WinColumns | Number of columns in window | |
| WinRows | Number of rows in window |
| ERRVALUE SPATMOD::IMAGE::BUFFER::Create | ( | const PIXEL & | PixelProperties, | |
| UINT32 | NumColumns, | |||
| UINT32 | NumRows, | |||
| void ** | data = 0, |
|||
| UINT8 * | validity = 0 | |||
| ) |
Create buffer with specified pixel properties, size and optional external data buffers.
If data buffers are provided, the BUFFER will not take ownership. Specified data buffers must also point to contiguous area of memory of (at least) NumColumns * NumRows * [bytes per sample] bytes with suitable alignment based on sample type. Data buffers must remain valid until this referencing BUFFER is destroyed. If no 'validity' is specified the initial validity will be true if 'data' specified and false if not.
| ERRVALUE SPATMOD::IMAGE::BUFFER::CreateSubset | ( | BUFFER & | existing, | |
| const UINT16 * | SampleIdxs, | |||
| UINT16 | NumSamples, | |||
| bool | OwnValidity | |||
| ) |
Create buffer with subset of samples in existing buffer.
Existing buffer may be destroyed after returns as actual data is reference counted. PixelProperties for new buffer will be derived from specified sample subset.
| existing | Existing buffer to reference | |
| SampleIdxs | Sample indices in existing buffer | |
| NumSamples | Number of sample indices | |
| OwnValidity | True to keep own validity data, false to use from existing buffer |
| void SPATMOD::IMAGE::BUFFER::Destroy | ( | ) |
Destroy buffer.
| ERRVALUE SPATMOD::IMAGE::BUFFER::ExportRowBIP | ( | void * | target, | |
| const PIXEL & | nullpixel, | |||
| UINT32 | row, | |||
| UINT32 | StartColumn = 0, |
|||
| UINT32 | NumColumns = 0 | |||
| ) | const |
Export row of pixels to external BIP buffer with specified null pixel.
| target | Target buffer, will be packed as band interleaved by pixel, no padding for alignment | |
| nullpixel | Pixel value to export non-valid pixels as | |
| row | Row number | |
| StartColumn | Starting column | |
| NumColumns | Number of column, 0 for number of remaining columns in row |
| ERRVALUE SPATMOD::IMAGE::BUFFER::ExportRowBIP | ( | void * | target, | |
| UINT32 | row, | |||
| UINT32 | StartColumn = 0, |
|||
| UINT32 | NumColumns = 0, |
|||
| bool | SkipInvalid = false, |
|||
| const UINT16 * | SampleTrans = 0, |
|||
| UINT16 | NumSamplesTrans = 0, |
|||
| int | OutputPixelBytes = 0 | |||
| ) | const |
Export row of pixels to external BIP buffer.
No special processing for invalid pixels. Allows a translation array to select which sample is mapped to each output sample position.
| target | Target buffer, will be packed as band interleaved by pixel, no padding for alignment | |
| row | Row number | |
| StartColumn | Starting column | |
| NumColumns | Number of column, 0 for number of remaining columns in row | |
| SkipInvalid | Skip invalid pixels, leaving unchanged in target buffer | |
| SampleTrans | Sample translation array, NULL if not used | |
| NumSamplesTrans | Number of entries in sample translation array | |
| OutputPixelBytes | Number of bytes per output pixel, 0 to derive from buffer |
| ERRVALUE SPATMOD::IMAGE::BUFFER::GetIterator | ( | SAMPLEITERATOR & | iterator, | |
| UINT16 | SampleNum, | |||
| INT32 | row, | |||
| INT32 | column = 0 | |||
| ) |
Get SAMPLEITERATOR starting at specified sample location.
| iterator | Iterator returned | |
| SampleNum | Sample index | |
| row | Row number | |
| column | Column number |
| ERRVALUE SPATMOD::IMAGE::BUFFER::GetIterator | ( | SAMPLEITERATOR_CONST & | iterator, | |
| UINT16 | SampleNum, | |||
| INT32 | row, | |||
| INT32 | column = 0 | |||
| ) | const |
Get SAMPLEITERATOR_CONST starting at specified sample location.
| iterator | Iterator returned | |
| SampleNum | Sample index | |
| row | Row number | |
| column | Column number |
| UINT32 SPATMOD::IMAGE::BUFFER::GetNumColumns | ( | ) | const [inline] |
Get number of columns in buffer.
Get number of bytes in (window) row.
| UINT32 SPATMOD::IMAGE::BUFFER::GetNumRows | ( | ) | const [inline] |
Get number of rows in buffer.
Get number of bytes per specified sample.
| UINT16 SPATMOD::IMAGE::BUFFER::GetNumSamples | ( | ) | const [inline] |
Get number of samples.
Same as GetPixelProperties().GetNumSamples().
| const PIXEL& SPATMOD::IMAGE::BUFFER::GetPixelProperties | ( | ) | const [inline] |
Get pixel properties for buffer.
Get pointer to sample.
If sample index is >= number of samples, a pointer to the validity buffer position will be returned. This is useful when have additional validity samples. Note that samples for row are always contiguous in memory, and for efficiency this method should therefore not be used to iterate through the samples in a single row.
| SampleNum | Sample index, UINT16_MAX for validity | |
| row | Row number | |
| column | Column number |
| const void* SPATMOD::IMAGE::BUFFER::GetPtrSample | ( | UINT16 | SampleNum, | |
| INT32 | row, | |||
| INT32 | column = 0 | |||
| ) | const |
Get pointer to sample.
If sample index is >= number of samples, a pointer to the validity buffer position will be returned. This is useful when have additional validity samples. Note that samples for row are always contiguous in memory, and for efficiency this method should therefore not be used to iterate through the samples in a single row.
| SampleNum | Sample index, UINT16_MAX for validity | |
| row | Row number | |
| column | Column number |
| void* SPATMOD::IMAGE::BUFFER::GetPtrSampleFast | ( | UINT16 | SampleNum, | |
| INT32 | row, | |||
| INT32 | column = 0 | |||
| ) | [inline] |
Get pointer to sample with no validation.
Note that samples for row are always contiguous in memory, and for efficiency this method should therefore not be used to iterate through the samples in a single row.
| SampleNum | Sample index | |
| row | Row number | |
| column | Column number |
| const void* SPATMOD::IMAGE::BUFFER::GetPtrSampleFast | ( | UINT16 | SampleNum, | |
| INT32 | row, | |||
| INT32 | column = 0 | |||
| ) | const [inline] |
Get pointer to sample with no validation.
Note that samples for row are always contiguous in memory, and for efficiency this method should therefore not be used to iterate through the samples in a single row.
| SampleNum | Sample index | |
| row | Row number | |
| column | Column number |
| void** SPATMOD::IMAGE::BUFFER::GetPtrSamplesBase | ( | ) | [inline] |
Get array of pointers to base sample buffers.
Get pointer to validity mask.
Note that validity values for row are always contiguous in memory, and for efficiency this method should therefore not be used to iterate through the validity for a single row.
| row | Row number | |
| column | Column number |
Get pointer to validity mask.
Note that validity values for row are always contiguous in memory, and for efficiency this method should therefore not be used to iterate through the validity for a single row.
| row | Row number | |
| column | Column number |
Get pointer to validity mask with no validation.
Note that validity values for row are always contiguous in memory, and for efficiency this method should therefore not be used to iterate through the validity for a single row.
| row | Row number | |
| column | Column number |
| const UINT8* SPATMOD::IMAGE::BUFFER::GetPtrValidityFast | ( | INT32 | row, | |
| INT32 | column = 0 | |||
| ) | const [inline] |
Get pointer to validity mask with no validation.
Note that validity values for row are always contiguous in memory, and for efficiency this method should therefore not be used to iterate through the validity for a single row.
| row | Row number | |
| column | Column number |
| UINT32 SPATMOD::IMAGE::BUFFER::GetTotalColumns | ( | ) | const [inline] |
Get total number of columns.
Used for specialized windowed processing.
Get total number of bytes in row.
Used for specialized processing.
| UINT32 SPATMOD::IMAGE::BUFFER::GetTotalRows | ( | ) | const [inline] |
Get total number of rows.
Used for specialized windowed processing.
| UINT32 SPATMOD::IMAGE::BUFFER::GetWindowColumn | ( | ) | const [inline] |
Get window offset column.
Used for specialized windowed processing.
| UINT32 SPATMOD::IMAGE::BUFFER::GetWindowRow | ( | ) | const [inline] |
Get window offset row.
Used for specialized windowed processing.
| ERRVALUE SPATMOD::IMAGE::BUFFER::ImportRowBIP | ( | const void * | source, | |
| const PIXEL & | nullpixel, | |||
| UINT32 | row, | |||
| UINT32 | StartColumn = 0, |
|||
| UINT32 | NumColumns = 0 | |||
| ) |
Import row of pixels from external BIP buffer.
| source | Source buffer, packed as band interleave by pixel, no padding for alignment | |
| nullpixel | Null pixel value | |
| row | Row number | |
| StartColumn | Starting column | |
| NumColumns | Number of column, 0 for number of remaining columns in row |
| ERRVALUE SPATMOD::IMAGE::BUFFER::ImportRowBIP | ( | const void * | source, | |
| const UINT8 * | validity, | |||
| UINT32 | row, | |||
| UINT32 | StartColumn = 0, |
|||
| UINT32 | NumColumns = 0 | |||
| ) |
Import row of pixels from external BIP buffer.
| source | Source buffer, packed as band interleaved by pixel, no padding for alignment | |
| validity | Validity buffer, NULL if all pixels valid | |
| row | Row number | |
| StartColumn | Starting column | |
| NumColumns | Number of column, 0 for number of remaining columns in row |
| bool SPATMOD::IMAGE::BUFFER::IsContiguous | ( | ) | const [inline] |
Determine if entire buffer for each sample is contiguous in memory.
Note that individual rows are alway contiguous.
| bool SPATMOD::IMAGE::BUFFER::IsCreated | ( | ) | const |
Determine if buffer has been created yet.
Assignment.
If source buffer has been created then copy will reference same memory.
| ERRVALUE SPATMOD::IMAGE::BUFFER::SetInvalid | ( | INT32 | StartColumn, | |
| INT32 | StartRow, | |||
| UINT32 | NumColumns, | |||
| UINT32 | NumRows | |||
| ) |
Set rectangular portion of buffer to be invalid.
| StartColumn | Starting column in buffer | |
| StartRow | Starting row | |
| NumColumns | Number of columns | |
| NumRows | Number of rows |
| void SPATMOD::IMAGE::BUFFER::SetValidityAll | ( | bool | validity | ) |
Set validity for all pixels in buffer window.
| validity | Validity to set, true for valid, false for not |
Set validity for all pixels using logical operation with validity from specified buffer.
The LOGICALOP_And, LOGICALOP_Or are supported. Both buffers must have the same window dimensions, but may have different pixel properties.
| operation | Logical operation to perform | |
| buffer | Buffer to use in operation |
Shift window position by specified deltas without validation.
1.6.1