29 int pixelBytes =
m_decoder->GetPixelBytes();
30 if (pixelBytes == 1) {
33 else if (pixelBytes == 2) {
34 bool signedData =
m_decoder->GetSignedData();
35 m_pixelType = signedData ? Isis::SignedWord : Isis::UnsignedWord;
39 "The file [" +
filename().expanded() +
40 "] contains unsupported data type",
48 for (
int i = 0; i <
bands(); i++)
m_buffer[i] =
new char [readBytes];
52 "The file [" + inputName.
expanded() +
53 "] cannot be opened as a JPEG 2000 file",
78 return m_decoder->GetBandDimension() == 1;
88 return m_decoder->GetBandDimension() == 3;
98 return m_decoder->GetBandDimension() == 4;
223 case Isis::UnsignedByte:
224 value = (int) ((
unsigned char *)
m_buffer[b])[s];
226 case Isis::UnsignedWord:
227 value = (int) ((
unsigned short int *)
m_buffer[b])[s];
229 case Isis::SignedWord:
230 value = (int) ((
short int *)
m_buffer[b])[s];
virtual bool isRgb() const
Tests to see if the input image is triple-banded, implying RGB (no alpha).
virtual int convertRgbToGray(int pixel) const
Convert the current pixel, taken from an RGB/A image, and blend its RGB components into a single gray...
virtual int getGreen(int pixel) const
Retrieves the green component of the given pixel from the second band of the input buffer...
File name manipulation and expansion.
int samples() const
The sample dimension (width) of the output image.
FileName filename() const
The filename of the input image this instance was constructed with.
virtual bool isArgb() const
Tests to see if the input image is quadruple-banded, implying RGBA.
virtual int getAlpha(int pixel) const
Retrieves the alpha component of the given pixel from the fourth band of the input buffer...
int SizeOf(Isis::PixelType pixelType)
Returns the number of bytes of the specified PixelType.
JP2Importer(FileName inputName)
Construct the importer.
char ** m_buffer
Buffer that stores a line of JPEG 2000 data and all its color bands.
This error is for when a programmer made an API call that was illegal.
virtual int getRed(int pixel) const
Retrieves the red component of the given pixel from the first band of the input buffer.
void Read(unsigned char **inbuf)
Read data from JP2 file containing 8-bit data.
JP2Decoder * m_decoder
Takes a raw stream of JPEG 2000 data and reads it into a buffer.
virtual int getPixel(int s, int l) const
Returns a representation of a pixel for the input format that can then be broken down into specific g...
#define _FILEINFO_
Macro for the filename and line number.
void setSamples(int s)
Set the sample dimension (width) of the output image.
A type of error that could only have occurred due to a mistake on the user's part (e...
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
void setLines(int l)
Set the line dimension (height) of the output image.
void setBands(int b)
Set the band dimension (depth) of the output image.
virtual int getBlue(int pixel) const
Retrieves the blue component of the given pixel from the third band of the input buffer.
virtual int getGray(int pixel) const
Retrieves the gray component of the given pixel.
Isis::PixelType m_pixelType
Pixel type of the input image needed for reading data into the buffer.
virtual void updateRawBuffer(int line, int band) const
Updates the buffer used to store chunks of the input data at a time.
Adds specific functionality to C++ strings.
Namespace for ISIS/Bullet specific routines.
void OpenFile()
Open the JPEG2000 file.
virtual ~JP2Importer()
Destruct the importer.
virtual bool isGrayscale() const
Tests to see if the input image is single-banded, implying grayscale (no RGB/A).
Imports images with standard formats into Isis as cubes.
int getFromBuffer(int s, int b) const
Retrieves the pixel value from the input buffer corresponding to the given sample and band (the buffe...
int bands() const
The band dimension (depth) of the output image.