Isis Developer Reference
JP2Decoder.h
Go to the documentation of this file.
1 #ifndef JP2Decoder_h
2 #define JP2Decoder_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include <string>
11 
12 #if ENABLEJP2K
13 #include "jp2.h"
14 #include "kdu_stripe_decompressor.h"
15 #endif
16 
17 #define MIN_STRIPE_HEIGHT 256
18 #define MAX_STRIPE_HEIGHT 8192
19 
20 namespace Isis {
21  class JP2Error;
22 
83  class JP2Decoder {
84  public:
85  JP2Decoder(const QString &jp2file);
86  ~JP2Decoder();
87 
88  // Register with the Kakadu error facility
90  return Kakadu_Error;
91  };
92 
93  // Open and initialize the JP2 file for reading
94  void OpenFile();
95 
96  // Get the sample dimension of the JP2 file
97  inline int GetSampleDimension() const {
98  return ((int) p_numSamples);
99  }
100 
101  // Get the line dimension of the JP2 file
102  inline int GetLineDimension() const {
103  return ((int) p_numLines);
104  }
105 
106  // Get the band dimension of the JP2 file
107  inline int GetBandDimension() const {
108  return ((int) p_numBands);
109  }
110 
111  // Get number of bytes per pixel in the JP2 file
112  inline int GetPixelBytes() const {
113  return (p_pixelBytes);
114  }
115 
116  // Determine if data in JP2 file is signed
117  inline bool GetSignedData() const {
118  return (p_signedData);
119  }
120 
121  // Read byte data from the JP2 file
122  void Read(unsigned char **inbuf);
123 
124  // Read 16-bit data from the JP2 file
125  void Read(short int **inbuf);
126 
127  static bool IsJP2(QString filename);
128 
129  private:
130  QString p_jp2File;
131  unsigned int p_numSamples;
132  unsigned int p_numLines;
133  unsigned int p_numBands;
134  unsigned int p_pixelBytes;
135  bool p_signedData;
136 
137 #if ENABLEJP2K
138  unsigned int p_resolutionLevel;
139  unsigned int p_highestResLevel;
141  int *p_maxStripeHeights;
143  int *p_precisions;
145  bool *p_isSigned;
147  int *p_stripeHeights;
149 
151  unsigned int p_pixelBits;
152  bool p_readStripes;
153 
154 
155  kdu_core::kdu_dims p_imageDims;
156  kdu_supp::jp2_family_src *JP2_Stream;
157  kdu_supp::jp2_source *JP2_Source;
158  kdu_core::kdu_codestream *JPEG2000_Codestream;
159  kdu_supp::kdu_stripe_decompressor p_decompressor;
160 #endif
162  JP2Error *Kakadu_Error;
163 
164  void SetResolutionAndRegion();
165  };
168 };
169 #endif
Isis::JP2Decoder::GetSampleDimension
int GetSampleDimension() const
Definition: JP2Decoder.h:97
Isis::JP2Decoder::GetPixelBytes
int GetPixelBytes() const
Definition: JP2Decoder.h:112
JP2Error.h
Isis::JP2Decoder::OpenFile
void OpenFile()
Open the JPEG2000 file.
Definition: JP2Decoder.cpp:52
Isis::JP2Decoder::Read
void Read(unsigned char **inbuf)
Read data from JP2 file containing 8-bit data.
Definition: JP2Decoder.cpp:168
Isis::JP2Decoder::GetLineDimension
int GetLineDimension() const
Definition: JP2Decoder.h:102
Isis::JP2Decoder::GetSignedData
bool GetSignedData() const
Definition: JP2Decoder.h:117
Isis::JP2Decoder::JP2Decoder
JP2Decoder(const QString &jp2file)
Constructs a JPEG2000 decoder object.
Definition: JP2Decoder.cpp:32
IString.h
Isis::JP2Error
Kakadu error messaging class.
Definition: JP2Error.h:38
Isis::JP2Decoder::GetBandDimension
int GetBandDimension() const
Definition: JP2Decoder.h:107
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::IException
Isis exception class.
Definition: IException.h:91
MAX_STRIPE_HEIGHT
#define MAX_STRIPE_HEIGHT
Definition: JP2Decoder.h:18
Isis::JP2Decoder::kakadu_error
JP2Error * kakadu_error() const
Definition: JP2Decoder.h:89
Isis::JP2Decoder
JPEG2000 decoder class.
Definition: JP2Decoder.h:83
IException.h
std
Namespace for the standard library.
JP2Decoder.h
Isis::JP2Decoder::~JP2Decoder
~JP2Decoder()
JP2Decoder destructor.
Definition: JP2Decoder.cpp:196
Isis::JP2Decoder::IsJP2
static bool IsJP2(QString filename)
Definition: JP2Decoder.cpp:228
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
MIN_STRIPE_HEIGHT
#define MIN_STRIPE_HEIGHT
This is free and unencumbered software released into the public domain.
Definition: JP2Decoder.h:17