00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013 #ifndef LTI_SCENEBUFFER_H
00014 #define LTI_SCENEBUFFER_H
00015
00016
00017 #include "lti_types.h"
00018
00019
00020 LT_BEGIN_NAMESPACE(LizardTech)
00021
00022
00057 class LTISceneBuffer
00058 {
00059 LT_DISALLOW_COPY_CONSTRUCTOR(LTISceneBuffer);
00060 public:
00061 static const double DefaultFuzzyThreshold;
00062
00068 ~LTISceneBuffer();
00069
00085 LTISceneBuffer(const LTIPixel &pixelProps,
00086 lt_uint32 numCols,
00087 lt_uint32 numRows,
00088 void **bsqData,
00089 lt_uint32 totalNumCols = 0);
00090
00111 LTISceneBuffer(const LTIPixel &pixelProps,
00112 lt_uint32 totalNumCols,
00113 lt_uint32 totalNumRows,
00114 lt_uint32 colOffset,
00115 lt_uint32 rowOffset,
00116 lt_uint32 numCols,
00117 lt_uint32 numRows,
00118 void **bsqData);
00119
00135 LTISceneBuffer(const LTISceneBuffer &original,
00136 lt_uint32 colOffset,
00137 lt_uint32 rowOffset,
00138 lt_uint32 numCols,
00139 lt_uint32 numRows);
00140
00153 LTISceneBuffer(const LTISceneBuffer &original,
00154 lt_uint32 colOffset,
00155 lt_uint32 rowOffset);
00156
00163
00171 lt_int32 getNumCols() const;
00172
00180 lt_int32 getNumRows() const;
00181
00190 lt_int32 getTotalNumCols() const;
00191
00192
00202 lt_int32 getNumPixels() const;
00203
00211 const LTIPixel &getPixelProps() const;
00212
00222 lt_uint16 getNumBands() const;
00223
00224 lt_uint16 getSourceBandIndex(lt_uint16 dstBand) const;
00225
00226
00227 int getDestinationBandIndex(lt_uint16 srcBand) const;
00234
00235
00244 void **getBSQData() const;
00245
00254 void *getBandData(lt_uint16 band) const;
00255
00267 void *getSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const;
00268
00280
00290 LT_STATUS importData(const LTISceneBuffer &sourceData);
00291
00303 LT_STATUS importDataBand(lt_uint16 dstBand,
00304 const LTISceneBuffer& sourceData,
00305 lt_uint16 srcBand);
00306
00325 LT_STATUS mergeData(LTIPixelFillMethod fillMethod,
00326 const LTISceneBuffer& srcBuf,
00327 const LTIPixel *srcNodata,
00328 const LTIPixel *dstNodata,
00329 double mag,
00330 double fuzzyThreshold,
00331 bool blend);
00332
00343 LT_STATUS importDataBSQ(void** data);
00344
00354 LT_STATUS importDataBSQ(void* data);
00355
00365 LT_STATUS importDataBIP(void* data);
00366
00376 LT_STATUS importDataBSQ(LTIOStreamInf& stream);
00377
00387 LT_STATUS importDataBIP(LTIOStreamInf& stream);
00390
00391 LT_STATUS importData(const LTIMask *binaryMask,
00392 const LTISceneBuffer &sourceData,
00393 bool blend);
00394
00395
00396 LT_STATUS importDataBand(lt_uint16 dstBand,
00397 const LTISceneBuffer& sourceData,
00398 lt_uint16 srcBand,
00399 const LTIMask *binaryMask);
00400
00401
00402 LT_STATUS mergeData(LTIPixelFillMethod fillMethod,
00403 const LTISceneBuffer& srcBuf,
00404 const LTIPixel *srcNodata,
00405 const LTIPixel *dstNodata,
00406 LTIMaskSource *mask,
00407 LTIScene &scene,
00408 double fuzzyThreshold,
00409 bool blend);
00410
00420
00435 LT_STATUS exportDataBSQ(void**& data) const;
00436
00451 LT_STATUS exportDataBSQ(void*& data) const;
00452
00467 LT_STATUS exportDataBIP(void*& data) const;
00468
00478 LT_STATUS exportDataBSQ(LTIOStreamInf& stream) const;
00479
00489 LT_STATUS exportDataBIP(LTIOStreamInf& stream) const;
00490
00509 LT_STATUS exportData(void* data,
00510 lt_uint32 pixelBytes,
00511 lt_uint32 rowBytes,
00512 lt_uint32 bandBytes) const;
00515 void byteSwap();
00516
00517
00518 LT_STATUS applyMask(const LTIMask &mask, const LTIPixel &color);
00519 void applyMask(const LTIMask &mask, const LTIPixel &color, lt_uint16 band);
00520
00521 LT_STATUS fill(const LTIPixel &color);
00522 void fill(const LTIPixel &color, lt_uint16 band);
00523
00524 void zero(void);
00525 void zero(lt_uint16 band);
00526
00527
00543 static lt_uint32 addAlignment(lt_uint32 value, lt_uint32 byteAlignment);
00544
00545
00546 static LT_STATUS buildMask(LTIPixelFillMethod fillMethod,
00547 double mag, double fuzzyThreshold, bool blend,
00548 const LTISceneBuffer &dstBuffer,
00549 const LTIPixel *dstNodata,
00550 const LTISceneBuffer &srcBuffer,
00551 const LTIPixel *srcNodata,
00552 LTIMask &binaryMask);
00553
00554
00555 #if !defined(SWIG) && 1
00556 #define DEPRECATE(OLD, NEW) LT_DEPRECATED(NEW) OLD { return NEW; }
00557 DEPRECATE(lt_int32 getTotalNumRows() const, getNumRows());
00558 DEPRECATE(lt_int32 getWindowColOffset() const, 0);
00559 DEPRECATE(lt_int32 getWindowRowOffset() const, 0);
00560 DEPRECATE(lt_int32 getWindowNumCols() const, getNumCols());
00561 DEPRECATE(lt_int32 getWindowNumRows() const, getNumRows());
00562 DEPRECATE(lt_int32 getTotalNumPixels() const, getNumPixels());
00563 DEPRECATE(lt_int32 getWindowNumPixels() const, getNumPixels());
00564 DEPRECATE(void** getTotalBSQData() const, getBSQData());
00565 DEPRECATE(void* getTotalBandData(lt_uint16 band) const, getBandData(band));
00566 DEPRECATE(void** getWindowBSQData() const, getBSQData());
00567 DEPRECATE(void* getWindowBandData(lt_uint16 band) const, getBandData(band));
00568 DEPRECATE(void* getTotalSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const, getSample(x, y, band));
00569 DEPRECATE(void* getWindowSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const, getSample(x, y, band));
00570 DEPRECATE(bool inWindow(lt_int32 x, lt_int32 y) const, (x < getNumCols() && y < getNumRows()));
00571 #undef DEPRECATE
00572 #endif
00573 protected:
00577 LT_STATUS checkImpedance(const LTIPixel &p) const;
00578
00579 private:
00580 void init(const LTIPixel& pixelProps,
00581 lt_uint32 colOffset,
00582 lt_uint32 rowOffset,
00583 lt_uint32 numCols,
00584 lt_uint32 numRows,
00585 void **bsqData,
00586 lt_uint32 totalNumCols,
00587 lt_uint32 totalNumRows);
00588
00589 lt_uint16 m_numBands;
00590 LTIPixel *m_pixelProps;
00591
00592 lt_uint32 m_numCols;
00593 lt_uint32 m_numRows;
00594 lt_uint32 m_totalNumCols;
00595
00596 void **m_data;
00597 bool m_ownsData;
00598
00599
00600 bool operator==(const LTISceneBuffer&) const;
00601 bool operator!=(const LTISceneBuffer&) const;
00602 };
00603
00604 LT_END_NAMESPACE(LizardTech)
00605
00606 #endif // LTI_SCENEBUFFER_H