Isis 3 Developer Reference
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 
98  class JP2Decoder {
99  public:
100  JP2Decoder(const QString &jp2file);
101  ~JP2Decoder();
102 
103  // Register with the Kakadu error facility
105  return Kakadu_Error;
106  };
107 
108  // Open and initialize the JP2 file for reading
109  void OpenFile();
110 
111  // Get the sample dimension of the JP2 file
112  inline int GetSampleDimension() const {
113  return ((int) p_numSamples);
114  }
115 
116  // Get the line dimension of the JP2 file
117  inline int GetLineDimension() const {
118  return ((int) p_numLines);
119  }
120 
121  // Get the band dimension of the JP2 file
122  inline int GetBandDimension() const {
123  return ((int) p_numBands);
124  }
125 
126  // Get number of bytes per pixel in the JP2 file
127  inline int GetPixelBytes() const {
128  return (p_pixelBytes);
129  }
130 
131  // Determine if data in JP2 file is signed
132  inline bool GetSignedData() const {
133  return (p_signedData);
134  }
135 
136  // Read byte data from the JP2 file
137  void Read(unsigned char **inbuf);
138 
139  // Read 16-bit data from the JP2 file
140  void Read(short int **inbuf);
141 
142  static bool IsJP2(QString filename);
143 
144  private:
145  QString p_jp2File;
146  unsigned int p_numSamples;
147  unsigned int p_numLines;
148  unsigned int p_numBands;
149  unsigned int p_pixelBytes;
150  bool p_signedData;
151 
152 #if ENABLEJP2K
153  unsigned int p_resolutionLevel;
154  unsigned int p_highestResLevel;
156  int *p_maxStripeHeights;
158  int *p_precisions;
160  bool *p_isSigned;
162  int *p_stripeHeights;
164 
166  unsigned int p_pixelBits;
167  bool p_readStripes;
168 
169 
170  kdu_core::kdu_dims p_imageDims;
171  kdu_supp::jp2_family_src *JP2_Stream;
172  kdu_supp::jp2_source *JP2_Source;
173  kdu_core::kdu_codestream *JPEG2000_Codestream;
174  kdu_supp::kdu_stripe_decompressor p_decompressor;
175 #endif
177  JP2Error *Kakadu_Error;
178 
179  void SetResolutionAndRegion();
180  };
183 };
184 #endif
bool GetSignedData() const
Definition: JP2Decoder.h:132
JPEG2000 decoder class.
Definition: JP2Decoder.h:98
JP2Error * kakadu_error() const
Definition: JP2Decoder.h:104
int GetLineDimension() const
Definition: JP2Decoder.h:117
~JP2Decoder()
JP2Decoder destructor.
Definition: JP2Decoder.cpp:212
static bool IsJP2(QString filename)
Definition: JP2Decoder.cpp:244
Kakadu error messaging class.
Definition: JP2Error.h:54
int GetPixelBytes() const
Definition: JP2Decoder.h:127
void Read(unsigned char **inbuf)
Read data from JP2 file containing 8-bit data.
Definition: JP2Decoder.cpp:184
JP2Decoder(const QString &jp2file)
Constructs a JPEG2000 decoder object.
Definition: JP2Decoder.cpp:48
int GetSampleDimension() const
Definition: JP2Decoder.h:112
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
int GetBandDimension() const
Definition: JP2Decoder.h:122
void OpenFile()
Open the JPEG2000 file.
Definition: JP2Decoder.cpp:68