Isis 3.0
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
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;
144  bool p_signedData;
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
171  JP2Error *Kakadu_Error;
172 
173  void SetResolutionAndRegion();
174  };
177 };
178 #endif
JPEG2000 decoder class.
Definition: JP2Decoder.h:92
int GetPixelBytes() const
Definition: JP2Decoder.h:121
~JP2Decoder()
JP2Decoder destructor.
Definition: JP2Decoder.cpp:206
static bool IsJP2(QString filename)
Definition: JP2Decoder.cpp:232
bool GetSignedData() const
Definition: JP2Decoder.h:126
Kakadu error messaging class.
Definition: JP2Error.h:52
int GetBandDimension() const
Definition: JP2Decoder.h:116
void Read(unsigned char **inbuf)
Read data from JP2 file containing 8-bit data.
Definition: JP2Decoder.cpp:178
int GetSampleDimension() const
Definition: JP2Decoder.h:106
JP2Decoder(const QString &jp2file)
Constructs a JPEG2000 decoder object.
Definition: JP2Decoder.cpp:42
int GetLineDimension() const
Definition: JP2Decoder.h:111
JP2Error * kakadu_error() const
Definition: JP2Decoder.h:98
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:16