USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::JP2Decoder Class Reference
[High Level Cube I/O]

JPEG2000 decoder class. More...

#include <JP2Decoder.h>

List of all members.

Public Member Functions

 JP2Decoder (const QString &jp2file)
 Constructs a JPEG2000 decoder object.
 ~JP2Decoder ()
 JP2Decoder destructor.
JP2Errorkakadu_error () const
void OpenFile ()
 Open the JPEG2000 file.
int GetSampleDimension () const
int GetLineDimension () const
int GetBandDimension () const
int GetPixelBytes () const
bool GetSignedData () const
void Read (unsigned char **inbuf)
 Read data from JP2 file containing 8-bit data.
void Read (short int **inbuf)
 Read data from JP2 file containing 16-bit data.

Static Public Member Functions

static bool IsJP2 (QString filename)

Detailed Description

JPEG2000 decoder class.

This class is used to decode a JPEG2000 image.

Here is an example of how to use JP2Decoder

   JP2Decoder *JP2_decoder;
   JP2_decoder = new JP2Decoder(QString(ui.GetFileName("FROM")));
   JP2_decoder->OpenFile();
   int nsamps = JP2_decoder->GetSampleDimension();
   int nlines = JP2_decoder->GetLineDimension();
   int nbands = JP2_decoder->GetBandDimension();
   int pixelbytes = JP2_decoder->GetPixelBytes();
   bool is_signed = JP2_decoder->GetSignedData();
   delete JP2_decoder;
   ProcessImport jp;
   jp.SetDimensions(nsamps,nlines,nbands);
   if (pixelbytes == 1) {
     jp.SetPixelType(Isis::UnsignedByte);
   } else if (pixelbytes == 2) {
     if (is_signed) {
       jp.SetPixelType(Isis::SignedWord);
     } else {
       jp.SetPixelType(Isis::UnsignedWord);
     }
   } else {
     throw iException::Message(iException::User,
       "The file [" + ui.GetFileName("FROM") + "] contains unsupported data type.",
       _FILEINFO_);
   }
   jp.SetInputFile(QString(ui.GetFileName("FROM")));
   jp.SetOutputCube("TO");
   jp.SetOrganization(ProcessImport::JP2);
   jp.StartProcess();
   jp.EndProcess();

If you would like to see JP2Decoder being used in implementation, see std2isis.cpp or for a class that implements JP2Decoder, see ProcessImport

Author:
2009-12-18 Janet Barrett

Constructor & Destructor Documentation

Isis::JP2Decoder::JP2Decoder ( const QString &  jp2file  ) 

Constructs a JPEG2000 decoder object.

Parameters:
jp2file The name of the JP2 file that needs to be decoded.

References _FILEINFO_, and Isis::IException::Programmer.

Isis::JP2Decoder::~JP2Decoder (  ) 

JP2Decoder destructor.


Member Function Documentation

int Isis::JP2Decoder::GetBandDimension (  )  const [inline]
int Isis::JP2Decoder::GetLineDimension (  )  const [inline]
int Isis::JP2Decoder::GetPixelBytes (  )  const [inline]
int Isis::JP2Decoder::GetSampleDimension (  )  const [inline]
bool Isis::JP2Decoder::GetSignedData (  )  const [inline]
bool Isis::JP2Decoder::IsJP2 ( QString  filename  )  [static]
JP2Error* Isis::JP2Decoder::kakadu_error (  )  const [inline]
void Isis::JP2Decoder::OpenFile (  ) 
void Isis::JP2Decoder::Read ( short int **  inbuf  ) 

Read data from JP2 file containing 16-bit data.

Parameters:
inbuf The array of pointers to byte buffers that will be used to read in the image data. One byte buffer is required for each band in the image. Kakadu reads in a BIL manner. It is up to the calling routine to do the casting necessary to convert the byte data to the actual pixel type (UnsignedByte, UnsignedWord, SignedWord).
void Isis::JP2Decoder::Read ( unsigned char **  inbuf  ) 

Read data from JP2 file containing 8-bit data.

Parameters:
inbuf The array of pointers to byte buffers that will be used to read in the image data. One byte buffer is required for each band in the image. Kakadu reads in a BIL manner. It is up to the calling routine to do the casting necessary to convert the byte data to the actual pixel type (UnsignedByte, UnsignedWord, SignedWord).

Referenced by Isis::JP2Importer::updateRawBuffer().


The documentation for this class was generated from the following files: