|
|
PDS_JP2
|
#include <JP2_Decoder.hh>
Collaboration diagram for JP2_Decoder:

Public Member Functions | |
| JP2_Decoder () | |
| Constructs a JP2_Decoder. | |
| std::string | source () const |
| Get the JP2 source pathname. | |
| JP2_Decoder & | source (const std::string &pathname) |
| Set the pathname to the JP2 source. | |
| Size_2D | image_size () const |
| Get the size of the JP2 source image. | |
| unsigned int | image_width () const |
| Get the width of the JP2 source image. | |
| unsigned int | image_height () const |
| Get the height of the JP2 source image. | |
| unsigned int | image_bands () const |
| Get the number of bands (components) in the JP2 image. | |
| unsigned int | resolution_levels () const |
| Get the total number of codestream resolution levels. | |
| unsigned int | pixel_bytes () const |
| Get the number of bytes per pixel. | |
| unsigned int | pixel_bits () const |
| Get the pixel precision. | |
| bool | signed_data () const |
| Get the signedness of the pixel data. | |
| unsigned char *const | producer_UUID () const |
| Get the UUID found in the JP2 source. | |
| std::string | URL () const |
| Get the URL found in the JP2 source. | |
| std::string | destination () const |
| Get the destination file pathname for the rendered image data. | |
| JP2_Decoder & | destination (const std::string &pathname) |
| Set the destination file pathname for the rendered image data. | |
| Size_2D | rendered_size () const |
| Get the size of the rendered image. | |
| unsigned int | rendered_width () const |
| Get the width of the rendered image. | |
| unsigned int | rendered_height () const |
| Get the height of the rendered image. | |
| Rectangle | image_region () const |
| Get the image region that will be rendered from the JP2 source. | |
| JP2_Decoder & | image_region (const Rectangle ®ion) |
| Set the image region that will be rendered from the JP2 source. | |
| JP2_Decoder & | image_region (int x, int y, int width, int height) |
| Set the image region that will be rendered from the JP2 source. | |
| unsigned int | resolution_level () const |
| Get the resolution level at which the codestream will be rendered. | |
| JP2_Decoder & | resolution_level (unsigned int level) |
| Set the resolution level at which the codestream will be rendered. | |
| bool | swap_pixel_bytes () const |
| Tests if multi-byte pixels will be reordered before being written. | |
| JP2_Decoder & | swap_pixel_bytes (bool swap_data) |
| Sets whether multi-byte pixels will be reordered before being written. | |
| unsigned long long | bytes_written () const |
| Get the number of image data bytes written. | |
| bool | ready () const |
| Tests if the decoder has the information it needs to do its job. | |
| std::string | reasons () const |
| Describe the reasons that the decoder is not ready. | |
| unsigned long long | decode () |
| Deocde the pixel data from the JPEG2000 JP2 source and write the rendered results to the image data destination. | |
| void | open () |
| Open the source JP2 file. | |
| bool | is_open () const |
| Test if the decoder is open. | |
| unsigned long long | write_image_data () |
| Write rendered image data. | |
| void | close () |
| Close access to the JP2 source. | |
| JP2_Decoder_Error * | decoder_error () const |
Static Public Attributes | |
| static const char *const | ID |
| Class identification name with source code version and date. | |
| static const char *const | UUID_INFO_BOX_NAME = "uinf" |
| PDS label reference information UUID Info JP2 container box name. | |
| static const char *const | UUID_BOX_NAME = "ulst" |
| Data provider UUID JP2 box name. | |
| static const char *const | URL_BOX_NAME = "url " |
| PDS label relative filename URL JP2 box name. | |
| static const int | MIN_STRIPE_HEIGHT = 256 |
| Image data stripe minimum and maximum number of lines. | |
| static const int | MAX_STRIPE_HEIGHT = 8192 |
| static const int | DECODER_EXCEPTION = 67 |
| JP2_Decoder_Error exception signal value. | |
Protected Member Functions | |
| std::streamsize | write_stripe (std::ostream &destination, std::streamoff file_offset, int band, int line, int lines, kdu_int16 *buffer) |
| Write an image data buffer with pixel data to a stream. | |
| std::streamsize | write_stripe (std::ostream &destination, std::streamoff file_offset, int band, int line, int lines, kdu_int32 *buffer) |
| Write an image data buffer with pixel data to a stream. | |
| void | set_resolution_and_region (unsigned int level, const Rectangle ®ion) |
| Set the effective rendering resolution level and image region. | |
Protected Attributes | |
| std::string | JP2_Pathname |
| JP2 source pathname. | |
| unsigned int | Image_Bands |
| Total image bands (components). | |
| Size_2D | Image_Size |
| Dimensions of the source image. | |
| unsigned int | Pixel_Bytes |
| Pixel datum size in bytes. | |
| unsigned int | Pixel_Bits |
| Pixel precision bits. | |
| bool | Signed_Data |
| Whether pixel data is signed. | |
| unsigned int | Resolution_Levels |
| Resolution levels available. | |
| unsigned char * | UUID_Info_UUID |
| First UUID value found in a UUID List box of a UUID Info super box. | |
| std::string | UUID_Info_URL |
| First URL value found in a URL box of a UUID Info super box. | |
| std::string | Image_Destination |
| Image data destination pathname. | |
| Size_2D | Rendered_Size |
| Rendered image size. | |
| Rectangle | Image_Region |
| Image region to be rendered. | |
| unsigned int | Resolution_Level |
| Resolution level to render. | |
| bool | Swap_Pixel_Bytes |
| Whether pixel bytes should be reordered when written. | |
| unsigned long long | Bytes_Written |
| Total number of pixel bytes written. | |
After a JP2_Decoder is constructed it must be configured. The decoder must be configured with at least an input JP2 source file before it can be opened. Once opened numerous accessors can be used to get information from the JP2 file, especially image data characterization. A JP2_Decoder may be configured to reorder muli-byte pixel data (the codestream is expected to produce MSB ordered data by default), decompress a selected region of the entire image or render at less than the full resolution level. It must also be configured with an output image data destination file to be ready to decode the source which includes opening the source and writing the image data.
A JP2_Decoder may be reused with or without between uses. Other than the source and destination, its configuration is reset to the default values whenever it is closed.
This implementation employs the Kakadu Software libraries.
|
|
Constructs a JP2_Decoder. The decoder must be configured with at least an input JP2 source before it can be opened. It must also be configured with an output image data destination to be ready to do its job. |
|
|
Get the JP2 source pathname.
|
|
|
Set the pathname to the JP2 source. N.B.: If the source has already been opened and the pathname is different than the previous pathname, the source is closed.
|
|
|
Get the size of the JP2 source image. N.B.: Use the image_width() and image_height() methods for fast access to the image size values.
|
|
|
Get the width of the JP2 source image.
|
|
|
Get the height of the JP2 source image.
|
|
|
Get the number of bands (components) in the JP2 image.
|
|
|
Get the total number of codestream resolution levels. N.B.: The number of resolution levels is one more than the number of JPEG2000 decomposition levels. The number of resolution levels is determined from the default codestream (COD segment) values. Tile segments may override this value.
|
|
|
Get the number of bytes per pixel.
|
|
|
Get the pixel precision.
|
|
|
Get the signedness of the pixel data.
|
|
|
Get the UUID found in the JP2 source. The first UUID value in a UUID List box of a UUID Info super box is copied. There may be additional UUID values, List boxes or Info boxes but these are ignored.
|
|
|
Get the URL found in the JP2 source. The first URL box contents of a UUID Info super box is copied. There may be additional URL boxes but they are ignored.
|
|
|
Get the destination file pathname for the rendered image data.
|
|
|
Set the destination file pathname for the rendered image data.
|
|
|
Get the size of the rendered image.
|
|
|
Get the width of the rendered image.
|
|
|
Get the height of the rendered image.
|
|
|
Get the image region that will be rendered from the JP2 source.
|
|
|
Set the image region that will be rendered from the JP2 source. The image region is specified relative to the full resolution image. Specifying a rendering resolution level greater than 1 will result in a correspondingly smaller image region. The actual image region rendered will be the intersection of the region with the image size.
|
|
||||||||||||||||||||
|
Set the image region that will be rendered from the JP2 source.
|
|
|
Get the resolution level at which the codestream will be rendered.
|
|
|
Set the resolution level at which the codestream will be rendered. Level 1 is full resolution. Level 2 renders the image at half size, level 3 at quarter size, etc.; i.e. the image size is divided by 2**(level-1). N.B.: The resolution level is one more than the JPEG2000 decomposition level.
|
|
|
Tests if multi-byte pixels will be reordered before being written.
|
|
|
Sets whether multi-byte pixels will be reordered before being written. By default multi-byte pixels will not be reordered. N.B.: The pixel data rendered from the JP2 file has no defined order. It is necessary to obtain correct pixel data ordering information elsewhere.
|
|
|
Get the number of image data bytes written.
|
|
|
Tests if the decoder has the information it needs to do its job. Both the JP2 source and rendered image destination must be specified.
|
|
|
Describe the reasons that the decoder is not ready.
|
|
|
Deocde the pixel data from the JPEG2000 JP2 source and write the rendered results to the image data destination. The JP2 source is opened, the contents are rendered and written to the destination file, and then the source is closed.
|
|
|
Open the source JP2 file. If the source is already open nothing is done. Access to the JP2 source is opened and checked that it contains the required JP2 format content. The producer_UUID() and URL are extracted, if present. The image characterization - image_bands(), image_size(), pixel_bytes(), pixel_bits() and resolution_levels() - are determined. If the resolution level to be rendered is greater than the number of resolution levels, it is reduced to the maximum value. All the bands are compared to make suse they have the same image and pixel structure. The selected image_region(const Rectangle&), if any, is clipped to the image extent.
|
|
|
Test if the decoder is open.
|
|
|
Write rendered image data. The JP2 source is opened if this has not yet been done, and the decoder is checked that it is ready. Data buffers to hold horizontal stripes of rendered image data are allocated. The destination file is opened for writing. N.B.: If the file already exists the image data will be appended to the current content.
|
|
|
Close access to the JP2 source. The JP2 source stream is closed and all resources associated with it are deleted. In addition, the JP2 source image characterization information - image_bands(), image_size(), pixel_bytes(), pixel_bits(), resolution_levels() producer_UUID() and URL() - is reset to the unknown state. However, neither the source() nor destination() pathname is reset so this JP2_Decoder is ready to be reused. N.B.: Output specifications remain unchanged. |
|
|
|
|
||||||||||||||||||||||||||||
|
Write an image data buffer with pixel data to a stream. The contents of the data buffer are expected to contain the results of codestream decoding of a horizontal stripe of the source image. This data is modified in place to adjust for data order and signedness. The lines of image data starting with the specified line of the specified band are written to the buffer as a contiguous sequence of bytes.
|
|
||||||||||||||||||||||||||||
|
Write an image data buffer with pixel data to a stream. The contents of the data buffer are expected to contain the results of codestream decoding of a horizontal stripe of the source image. This data is modified in place to adjust for data order and signedness. The lines of image data starting with the specified line of the specified band are written to the buffer as a contiguous sequence of bytes.
|
|
||||||||||||
|
Set the effective rendering resolution level and image region. The resolution level and image region interact to affect the rendered image size so they are set together. If the decoder has not been opened nothing is done. The efective resolution level is limited to the range 1-resolution levels and applied as an input restriction on the codestream rendering machinery. Any existing image area restriction is lifted at the same time. If the image region is empty the entire image size is used as the effective image region. Otherwise the dimensions of the image region are adjusted by the resolution level (divided by 2**(level - 1)), intersected with the image size at the rendering resolution and the resulting effective image region is applied as an input restriction on the codestream rendering machinery. The effective rendered image size is set.
|
|
|
Initial value:
"UA::HiRISE::JP2_Decoder (1.16 2007/12/13 05:18:37)"
|
|
|
PDS label reference information UUID Info JP2 container box name.
|
|
|
Data provider UUID JP2 box name.
|
|
|
PDS label relative filename URL JP2 box name.
|
|
|
Image data stripe minimum and maximum number of lines.
|
|
|
|
|
|
JP2_Decoder_Error exception signal value.
|
|
|
JP2 source pathname.
|
|
|
Total image bands (components).
|
|
|
Dimensions of the source image.
|
|
|
Pixel datum size in bytes.
|
|
|
Pixel precision bits.
|
|
|
Whether pixel data is signed.
|
|
|
Resolution levels available. This is the minimum number of available resolution levels as determined from the default coding style (COD) information. The minimum resolution level available in the tile segments may be lower still, but that won't be known until the tiles have been read. N.B.: The number of resolution levels is one more than the number of JPEG2000 decomposition levels. |
|
|
First UUID value found in a UUID List box of a UUID Info super box. This will be NULL if no UUID has been found. It will be a 16 byte (UUID_SIZE) array otherwise. |
|
|
First URL value found in a URL box of a UUID Info super box.
|
|
|
Image data destination pathname.
|
|
|
Rendered image size.
|
|
|
Image region to be rendered.
|
|
|
Resolution level to render. N.B.: The resolution level is one more than the JPEG2000 decomposition level. |
|
|
Whether pixel bytes should be reordered when written.
|
|
|
Total number of pixel bytes written.
|
1.4.6