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,
00548 double fuzzyThreshold,
00549 bool blend,
00550 const LTISceneBuffer &dstBuffer,
00551 const LTIPixel *dstNodata,
00552 const LTISceneBuffer &srcBuffer,
00553 const LTIPixel *srcNodata,
00554 LTIMask &binaryMask);
00555 LT_STATUS calculateMask(LTIPixelFillMethod fillMethod,
00556 double mag,
00557 double fuzzyThreshold,
00558 bool blend,
00559 const LTIPixel *srcNodata,
00560 LTIMask &mask) const;
00561 static void shiftNoDataValue(LTIPixelFillMethod fillMethod,
00562 double fuzzyThreshold,
00563 double mag,
00564 const LTIPixel &dstMin,
00565 const LTIPixel &dstMax,
00566 const LTIPixel &dstNoData,
00567 LTIPixel &shiftedValue);
00568
00569
00570 #if !defined(SWIG) && 1
00571 #define DEPRECATE(OLD, NEW) LT_DEPRECATED(NEW) OLD { return NEW; }
00572 DEPRECATE(lt_int32 getTotalNumRows() const, getNumRows());
00573 DEPRECATE(lt_int32 getWindowColOffset() const, 0);
00574 DEPRECATE(lt_int32 getWindowRowOffset() const, 0);
00575 DEPRECATE(lt_int32 getWindowNumCols() const, getNumCols());
00576 DEPRECATE(lt_int32 getWindowNumRows() const, getNumRows());
00577 DEPRECATE(lt_int32 getTotalNumPixels() const, getNumPixels());
00578 DEPRECATE(lt_int32 getWindowNumPixels() const, getNumPixels());
00579 DEPRECATE(void** getTotalBSQData() const, getBSQData());
00580 DEPRECATE(void* getTotalBandData(lt_uint16 band) const, getBandData(band));
00581 DEPRECATE(void** getWindowBSQData() const, getBSQData());
00582 DEPRECATE(void* getWindowBandData(lt_uint16 band) const, getBandData(band));
00583 DEPRECATE(void* getTotalSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const, getSample(x, y, band));
00584 DEPRECATE(void* getWindowSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const, getSample(x, y, band));
00585 DEPRECATE(bool inWindow(lt_int32 x, lt_int32 y) const, (x < getNumCols() && y < getNumRows()));
00586 #undef DEPRECATE
00587 #endif
00588 protected:
00592 LT_STATUS checkImpedance(const LTIPixel &p) const;
00593
00594 private:
00595 void init(const LTIPixel& pixelProps,
00596 lt_uint32 colOffset,
00597 lt_uint32 rowOffset,
00598 lt_uint32 numCols,
00599 lt_uint32 numRows,
00600 void **bsqData,
00601 lt_uint32 totalNumCols,
00602 lt_uint32 totalNumRows);
00603
00604 lt_uint16 m_numBands;
00605 LTIPixel *m_pixelProps;
00606
00607 lt_uint32 m_numCols;
00608 lt_uint32 m_numRows;
00609 lt_uint32 m_totalNumCols;
00610
00611 void **m_data;
00612 bool m_ownsData;
00613
00614
00615 bool operator==(const LTISceneBuffer&) const;
00616 bool operator!=(const LTISceneBuffer&) const;
00617 };
00618
00619 LT_END_NAMESPACE(LizardTech)
00620
00621 #endif // LTI_SCENEBUFFER_H