MrSID Decode SDK for Raster Reference Manual  9.5.1.4427
ImageSegment.h
Go to the documentation of this file.
00001 /* //////////////////////////////////////////////////////////////////////////
00002 //                                                                         //
00003 // This code is Copyright (c) 2010 LizardTech, Inc, 1008 Western Avenue,   //
00004 // Suite 200, Seattle, WA 98104.  Unauthorized use or distribution         //
00005 // prohibited.  Access to and use of this code is permitted only under     //
00006 // license from LizardTech, Inc.  Portions of the code are protected by    //
00007 // US and foreign patents and other filings. All Rights Reserved.          //
00008 //                                                                         //
00010 /* PUBLIC */
00011 
00012 #ifndef ImageSegment_H
00013 #define ImageSegment_H
00014 
00015 // lt_lib_base
00016 #include "lt_base.h"
00017 
00018 // lt_lib_mrsid_nitf
00019 #include "nitf_types.h"
00020 #include "Segment.h"
00021 
00022 LT_BEGIN_LIZARDTECH_NAMESPACE
00023 class LTIPixel;
00024 class LTIOSubStream;
00025 class LTIGeoCoord;
00026 
00027 namespace Nitf {
00028 class ImageSegmentMetadata;
00029 
00030 
00044 class ImageSegment : public Segment
00045 {
00046 public:
00047    // not for public use -- to get a DataSegment, use NITFReaderManager::getImageSegment
00048    ImageSegment(NITFReaderManager&, LTIOStreamInf&,
00049                 int segmentNumber,
00050                 lt_int64 headerOffset, lt_int64 headerLength,
00051                 lt_int64 dataOffset, lt_int64 dataLength);
00052    ~ImageSegment();
00053    LT_STATUS initialize();
00054 
00058    const char* getIID1() const;
00059 
00063    Format getFormat() const;
00064 
00068    Layout getLayout() const;
00069 
00073    bool isBlocked() const;
00074 
00078    bool isMasked() const;
00079 
00083    const LTIPixel& getPixelProps() const;
00084 
00088    lt_uint32 getWidth() const;
00089 
00093    lt_uint32 getHeight() const;
00094 
00098    int getBlockWidth() const;
00099 
00103    int getBlockHeight() const;
00104 
00108    int getBlocksPerRow() const;
00109 
00113    int getBlocksPerCol() const;
00114 
00118    int getNBPP() const;
00119 
00123    int getNBANDS() const;
00124 
00125    // not for public use
00126    int getILOCr() const;
00127 
00128    // not for public use
00129    int getILOCc() const;
00130 
00131    // not for public use
00132    const lt_uint8* getPadValue() const;
00133 
00134    // not for public use
00135    lt_uint32 getBlockOffset(lt_uint32 index) const;
00136 
00137    // not for public use
00138    lt_uint32 getNextBlockOffset(lt_uint32 index) const;
00139 
00140    // not for public use
00141    bool isPaddedBlock(lt_uint32 index) const;
00142 
00143    // not for public use
00144    LT_STATUS isSupported() const;
00145 
00146    // not for public use
00147    LT_STATUS addMetadataLocal(LTIMetadataDatabase& db) const;
00148 
00149    // not for public use
00150    LT_STATUS createDataStream(LTIOSubStream*&) const;
00151 
00152    // not for public use
00153    bool hasGeoInfo(void) const;
00154 
00155    // not for public use
00156    LT_STATUS setGeoCoord(LTIGeoCoord&) const;
00157 
00161    const ImageSegmentMetadata* getImageMetadata() const;
00162 
00163 private:
00164    LT_STATUS readHeader();
00165    LT_STATUS readData();
00166 
00167    LT_STATUS readMaskTable();
00168    LT_STATUS constructOffsetTable_RAW(lt_int64, bool BUGGY);
00169    LT_STATUS constructOffsetTable_JPG(lt_int64, bool BUGGY);
00170    LT_STATUS determinePixelFormat();
00171    LT_STATUS determineImageFormat();
00172 
00173    LTIPixel* m_pixel;
00174    bool m_hasLUT;
00175    Format m_format;    // IC
00176    bool m_isMasked;
00177    Layout m_layout;    // IMODE
00178 
00179    LT_STATUS m_isSupported;
00180 
00181    ImageSegmentMetadata* m_imageMetadata;
00182 
00183    int m_NROWS;
00184    int m_NCOLS;
00185    char* m_PVTYPE;      // 3
00186    char* m_IREP;        // 8
00187    char* m_ICAT;        // 8
00188    int m_ABPP;          // just precision
00189    char* m_PJUST;       // 1
00190    char* m_ICORDS;      // 1
00191    char* m_IGEOLO;      // 60
00192    char* m_IC;          // 2
00193    char* m_COMRAT;      // 4
00194    int m_NBANDS;
00195    char** m_IREPBAND;
00196    char** m_ISUBCAT;
00197    lt_uint8*** m_LUTD;
00198    int* m_NLUTS;
00199    int* m_NELUT;
00200    char* m_IMODE;       // 1
00201    int m_NBPR;
00202    int m_NBPC;
00203    int m_NPPBH;
00204    int m_NPPBV;
00205    int m_NBPP;       // actual bytes used
00206    int m_IDLVL;
00207    int m_IALVL;
00208    int m_ILOCr;
00209    int m_ILOCc;
00210    char* m_IMAG;     // 4
00211    
00212    // mask stuff
00213    lt_uint32 m_IMDATOFF;
00214    lt_uint16 m_BMRLNTH;
00215    lt_uint16 m_TMRLNTH;
00216    lt_uint16 m_TPXCDLNTH;
00217    lt_uint8* m_TPXCD;
00218    int m_TPXCDlen;
00219    lt_uint32* m_BMRBND;
00220    lt_uint32* m_TMRBND;
00221 
00222    // geo stuff
00223    double* m_geoPoints; // ulx,uly , urx,ury , lrx,lry , llx,lly
00224    int m_zone;
00225    bool m_igeoloValid;
00226 
00227    // nope
00228    ImageSegment(ImageSegment&);
00229    ImageSegment& operator=(const ImageSegment&);
00230 };
00231 
00232 
00233 }
00234 LT_END_LIZARDTECH_NAMESPACE
00235 
00236 #endif // ImageSegment_H