This class extends the ImgReader abstract class for reading PGX files. PGX is a custom monochrome file format invented specifically to simplify the use of JPEG 2000 with images of different bit-depths in the range 1 to 31 bits per pixel.
The file consists of a one line text header followed by the data.
Header: "PG"+ ws +<endianess>+ ws +[sign]+ws + <bit-depth>+" "+<width>+" "+<height>+'\n'
where:
- ws (white-spaces) is any combination of characters ' ' and '\t'.
- endianess equals "LM" or "ML"(resp. little-endian or big-endian)
- sign equals "+" or "-" (resp. unsigned or signed). If omited, values are supposed to be unsigned.
- bit-depth that can be any number between 1 and 31.
- width and height are the image dimensions (in pixels).
Data: The image binary values appear one after the other (in raster order) immediately after the last header character ('\n') and are byte-aligned (they are packed into 1,2 or 4 bytes per sample, depending upon the bit-depth value).
If the data is unisigned, level shifting is applied subtracting 2^(bitdepth - 1)
Since it is not possible to know the input file byte-ordering before reading its header, this class can not be construct from a RandomAccessIO. So, the constructor has to open first the input file, to read only its header, and then it can create the appropriate BufferedRandomAccessFile (Big-Endian or Little-Endian byte-ordering).
NOTE: This class is not thread safe, for reasons of internal buffering.
@see jj2000.j2k.image.ImgData
@see RandomAccessIO
@see BufferedRandomAccessFile
@see BEBufferedRandomAccessFile