MrSID Decode SDK for Raster Reference Manual  9.5.4.4709
lti_sceneBuffer.h
Go to the documentation of this file.
1 /* $Id$ */
2 /* //////////////////////////////////////////////////////////////////////////
3 // //
4 // This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
5 // Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
6 // prohibited. Access to and use of this code is permitted only under //
7 // license from LizardTech, Inc. Portions of the code are protected by //
8 // US and foreign patents and other filings. All Rights Reserved. //
9 // //
11 /* PUBLIC */
12 
13 #ifndef LTI_SCENEBUFFER_H
14 #define LTI_SCENEBUFFER_H
15 
16 // lt_lib_mrsid_core
17 #include "lti_types.h"
18 
19 
21 
22 
58 {
59  LT_DISALLOW_COPY_CONSTRUCTOR(LTISceneBuffer);
60 public:
61  static const double DefaultFuzzyThreshold;
62 
68  ~LTISceneBuffer();
69 
85  LTISceneBuffer(const LTIPixel &pixelProps,
86  lt_uint32 numCols,
87  lt_uint32 numRows,
88  void **bsqData,
89  lt_uint32 totalNumCols = 0);
90 
111  LTISceneBuffer(const LTIPixel &pixelProps,
112  lt_uint32 totalNumCols,
113  lt_uint32 totalNumRows,
114  lt_uint32 colOffset,
115  lt_uint32 rowOffset,
116  lt_uint32 numCols,
117  lt_uint32 numRows,
118  void **bsqData);
119 
135  LTISceneBuffer(const LTISceneBuffer &original,
136  lt_uint32 colOffset,
137  lt_uint32 rowOffset,
138  lt_uint32 numCols,
139  lt_uint32 numRows);
140 
153  LTISceneBuffer(const LTISceneBuffer &original,
154  lt_uint32 colOffset,
155  lt_uint32 rowOffset);
156 
163 
171  lt_int32 getNumCols() const;
172 
180  lt_int32 getNumRows() const;
181 
190  lt_int32 getTotalNumCols() const;
191 
192 
202  lt_int32 getNumPixels() const;
203 
211  const LTIPixel &getPixelProps() const;
212 
222  lt_uint16 getNumBands() const;
223 
224  lt_uint16 getSourceBandIndex(lt_uint16 dstBand) const;
225 
226  // return -1 for not wanted
227  int getDestinationBandIndex(lt_uint16 srcBand) const;
234 
235 
244  void **getBSQData() const;
245 
254  void *getBandData(lt_uint16 band) const;
255 
267  void *getSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const;
268 
280 
290  LT_STATUS importData(const LTISceneBuffer &sourceData);
291 
303  LT_STATUS importDataBand(lt_uint16 dstBand,
304  const LTISceneBuffer& sourceData,
305  lt_uint16 srcBand);
306 
325  LT_STATUS mergeData(LTIPixelFillMethod fillMethod,
326  const LTISceneBuffer& srcBuf,
327  const LTIPixel *srcNodata,
328  const LTIPixel *dstNodata,
329  double mag,
330  double fuzzyThreshold,
331  bool blend);
332 
343  LT_STATUS importDataBSQ(void** data);
344 
354  LT_STATUS importDataBSQ(void* data);
355 
365  LT_STATUS importDataBIP(void* data);
366 
376  LT_STATUS importDataBSQ(LTIOStreamInf& stream);
377 
387  LT_STATUS importDataBIP(LTIOStreamInf& stream);
390  // for LizardTech internal use only
391  LT_STATUS importData(const LTIMask *binaryMask,
392  const LTISceneBuffer &sourceData,
393  bool blend);
394 
395  // for LizardTech internal use only
396  LT_STATUS importDataBand(lt_uint16 dstBand,
397  const LTISceneBuffer& sourceData,
398  lt_uint16 srcBand,
399  const LTIMask *binaryMask);
400 
401  // for LizardTech internal use only
402  LT_STATUS mergeData(LTIPixelFillMethod fillMethod,
403  const LTISceneBuffer& srcBuf,
404  const LTIPixel *srcNodata,
405  const LTIPixel *dstNodata,
406  LTIMaskSource *mask,
407  LTIScene &scene,
408  double fuzzyThreshold,
409  bool blend);
410 
420 
435  LT_STATUS exportDataBSQ(void**& data) const;
436 
451  LT_STATUS exportDataBSQ(void*& data) const;
452 
467  LT_STATUS exportDataBIP(void*& data) const;
468 
478  LT_STATUS exportDataBSQ(LTIOStreamInf& stream) const;
479 
489  LT_STATUS exportDataBIP(LTIOStreamInf& stream) const;
490 
509  LT_STATUS exportData(void* data,
510  lt_uint32 pixelBytes,
511  lt_uint32 rowBytes,
512  lt_uint32 bandBytes) const;
515  void byteSwap();
516 
517  // for LizardTech internal use only
518  LT_STATUS applyMask(const LTIMask &mask, const LTIPixel &color);
519  void applyMask(const LTIMask &mask, const LTIPixel &color, lt_uint16 band);
520 
521  LT_STATUS fill(const LTIPixel &color);
522  void fill(const LTIPixel &color, lt_uint16 band);
523 
524  void zero(void);
525  void zero(lt_uint16 band);
526 
527 
543  static lt_uint32 addAlignment(lt_uint32 value, lt_uint32 byteAlignment);
544 
545  // for LizardTech internal use only
546  static LT_STATUS buildMask(LTIPixelFillMethod fillMethod,
547  double mag,
548  double fuzzyThreshold,
549  bool blend,
550  const LTISceneBuffer &dstBuffer,
551  const LTIPixel *dstNodata,
552  const LTISceneBuffer &srcBuffer,
553  const LTIPixel *srcNodata,
554  LTIMask &binaryMask);
555  LT_STATUS calculateMask(LTIPixelFillMethod fillMethod,
556  double mag,
557  double fuzzyThreshold,
558  bool blend,
559  const LTIPixel *srcNodata,
560  LTIMask &mask) const;
561  static void shiftNoDataValue(LTIPixelFillMethod fillMethod,
562  double fuzzyThreshold,
563  double mag,
564  const LTIPixel &dstMin,
565  const LTIPixel &dstMax,
566  const LTIPixel &dstNoData,
567  LTIPixel &shiftedValue);
568 
569 
570 #if !defined(SWIG) && 1
571 #define DEPRECATE(OLD, NEW) LT_DEPRECATED(NEW) OLD { return NEW; }
572  DEPRECATE(lt_int32 getTotalNumRows() const, getNumRows());
573  DEPRECATE(lt_int32 getWindowColOffset() const, 0);
574  DEPRECATE(lt_int32 getWindowRowOffset() const, 0);
575  DEPRECATE(lt_int32 getWindowNumCols() const, getNumCols());
576  DEPRECATE(lt_int32 getWindowNumRows() const, getNumRows());
577  DEPRECATE(lt_int32 getTotalNumPixels() const, getNumPixels());
578  DEPRECATE(lt_int32 getWindowNumPixels() const, getNumPixels());
579  DEPRECATE(void** getTotalBSQData() const, getBSQData());
580  DEPRECATE(void* getTotalBandData(lt_uint16 band) const, getBandData(band));
581  DEPRECATE(void** getWindowBSQData() const, getBSQData());
582  DEPRECATE(void* getWindowBandData(lt_uint16 band) const, getBandData(band));
583  DEPRECATE(void* getTotalSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const, getSample(x, y, band));
584  DEPRECATE(void* getWindowSample(lt_uint32 x, lt_uint32 y, lt_uint16 band) const, getSample(x, y, band));
585  DEPRECATE(bool inWindow(lt_int32 x, lt_int32 y) const, (x < getNumCols() && y < getNumRows()));
586 #undef DEPRECATE
587 #endif
588 protected:
592  LT_STATUS checkImpedance(const LTIPixel &p) const;
593 
594 private:
595  void init(const LTIPixel& pixelProps,
596  lt_uint32 colOffset,
597  lt_uint32 rowOffset,
598  lt_uint32 numCols,
599  lt_uint32 numRows,
600  void **bsqData,
601  lt_uint32 totalNumCols,
602  lt_uint32 totalNumRows);
603 
604  lt_uint16 m_numBands;
605  LTIPixel *m_pixelProps;
606 
607  lt_uint32 m_numCols;
608  lt_uint32 m_numRows;
609  lt_uint32 m_totalNumCols;
610 
611  void **m_data;
612  bool m_ownsData;
613 
614 
615  bool operator==(const LTISceneBuffer&) const;
616  bool operator!=(const LTISceneBuffer&) const;
617 };
618 
620 
621 #endif // LTI_SCENEBUFFER_H
representation of a scene
Definition: lti_scene.h:64
#define DEPRECATE(OLD, NEW)
#define LT_END_NAMESPACE(theNameSpace)
compiler does not support namespaces
Definition: lt_define.h:85
signed int lt_int32
signed 32-bit integer
Definition: lt_types.h:52
lt_uint32 LT_STATUS
An integral status code.
Definition: lt_status.h:39
Abstract definition of a stream.
basic properties of a pixel
Definition: lti_pixel.h:36
LTIPixelFillMethod
constants representing pixel filling methods
Definition: lti_types.h:187
static const double DefaultFuzzyThreshold
unsigned short lt_uint16
unsigned 16-bit integer
Definition: lt_types.h:50
class to hold data passed between image stages
This file contains a number of enums, typedefs, etc, that are used throughout the MrSID SDK...
#define LT_BEGIN_NAMESPACE(theNameSpace)
compiler does not support namespaces
Definition: lt_define.h:84
unsigned int lt_uint32
unsigned 32-bit integer
Definition: lt_types.h:54

LizardTech