Isis 3.0 Programmer Reference
Back | Home
JP2Decoder.h
Go to the documentation of this file.
1 #ifndef JP2Decoder_h
2 #define JP2Decoder_h
3 
25 #include <string>
26 
27 #if ENABLEJP2K
28 #include "jp2.h"
29 #include "kdu_stripe_decompressor.h"
30 #endif
31 
32 #define MIN_STRIPE_HEIGHT 256
33 #define MAX_STRIPE_HEIGHT 8192
34 
35 namespace Isis {
36  class JP2Error;
37 
92  class JP2Decoder {
93  public:
94  JP2Decoder(const QString &jp2file);
95  ~JP2Decoder();
96 
97  // Register with the Kakadu error facility
98  JP2Error *kakadu_error() const {
99  return Kakadu_Error;
100  };
101 
102  // Open and initialize the JP2 file for reading
103  void OpenFile();
104 
105  // Get the sample dimension of the JP2 file
106  inline int GetSampleDimension() const {
107  return ((int) p_numSamples);
108  }
109 
110  // Get the line dimension of the JP2 file
111  inline int GetLineDimension() const {
112  return ((int) p_numLines);
113  }
114 
115  // Get the band dimension of the JP2 file
116  inline int GetBandDimension() const {
117  return ((int) p_numBands);
118  }
119 
120  // Get number of bytes per pixel in the JP2 file
121  inline int GetPixelBytes() const {
122  return (p_pixelBytes);
123  }
124 
125  // Determine if data in JP2 file is signed
126  inline bool GetSignedData() const {
127  return (p_signedData);
128  }
129 
130  // Read byte data from the JP2 file
131  void Read(unsigned char **inbuf);
132 
133  // Read 16-bit data from the JP2 file
134  void Read(short int **inbuf);
135 
136  static bool IsJP2(QString filename);
137 
138  private:
139  QString p_jp2File;
140  unsigned int p_numSamples;
141  unsigned int p_numLines;
142  unsigned int p_numBands;
143  unsigned int p_pixelBytes;
145 
146 #if ENABLEJP2K
147  unsigned int p_resolutionLevel;
148  unsigned int p_highestResLevel;
150  int *p_maxStripeHeights;
152  int *p_precisions;
154  bool *p_isSigned;
156  int *p_stripeHeights;
158 
160  unsigned int p_pixelBits;
161  bool p_readStripes;
162 
163 
164  kdu_dims p_imageDims;
165  jp2_family_src *JP2_Stream;
166  jp2_source *JP2_Source;
167  kdu_codestream *JPEG2000_Codestream;
168  kdu_stripe_decompressor p_decompressor;
169 #endif
172 
173  void SetResolutionAndRegion();
174  };
177 };
178 #endif
JPEG2000 decoder class.
Definition: JP2Decoder.h:92
~JP2Decoder()
JP2Decoder destructor.
Definition: JP2Decoder.cpp:206
bool p_signedData
Set to true if data in JP2 file is signed.
Definition: JP2Decoder.h:144
unsigned int p_numBands
Number of bands in JP2 file.
Definition: JP2Decoder.h:142
Kakadu error messaging class.
Definition: JP2Error.h:52
QString p_jp2File
Input file name.
Definition: JP2Decoder.h:139
JP2Error * Kakadu_Error
JP2 Error handling facility.
Definition: JP2Decoder.h:171
void Read(unsigned char **inbuf)
Read data from JP2 file containing 8-bit data.
Definition: JP2Decoder.cpp:178
unsigned int p_numSamples
Number of samples in JP2 file.
Definition: JP2Decoder.h:140
unsigned int p_pixelBytes
Number of bytes per pixel in JP2 file.
Definition: JP2Decoder.h:143
JP2Decoder(const QString &jp2file)
Constructs a JPEG2000 decoder object.
Definition: JP2Decoder.cpp:42
void SetResolutionAndRegion()
Sets resolution of data that will be decompressed. &lt;Also determines th...
Definition: JP2Decoder.cpp:155
unsigned int p_numLines
Number of lines in JP2 file.
Definition: JP2Decoder.h:141
void OpenFile()
Open the JPEG2000 file.
Definition: JP2Decoder.cpp:62

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:21:21