O2Plib.image
Class PpxLoader

java.lang.Object
  extended by O2Plib.image.PpxLoader

public class PpxLoader
extends java.lang.Object


Field Summary
 int bitpp
          bits per pixel (one band)
 boolean blackIsZeroFlag
          1 if BLACK is gray value 0, else 0 if WHITE is gray value 0
 boolean blkaln
          block alignment flag 0 = aligned)
private  byte[] bPixels
          pixels [0:nPixels-1] for the image
 int bytpp
          bytes per pixel (one band)
 java.awt.image.ColorModel cm
           
 int cMapMode
          color map flag.
 int domain
          0 = optical density, 1 = transmittance 2 = gray value ...
 int endDataDict
          (unsigned int) if non-zero, then byte # of file where data dictionary ends.
 int filtyp
          type of file.
 int fversn
          (unsigned short) Set to PPX_VRSION by program creating header
 float[] genNdwvalues
          ND (od) or CPM wedge step values
 int[] grayCalWedge
          (16-bit unsigned) gray scale peaks calibration corresponding to step wedge values.
 int imEncode
          Image encoding method 0 = none (just raw raster data) 1 = UNIX 'compress/uncompress' 2 = run length 3 = 1D modified Huffman 4 = 2D modified Huffman 5 = delta coding 6 = run length with delta coding ...
 java.awt.Image img
          Image structure required for PPX loader
 int imOrientation
          Image orientation bits where: Default 00==>011: 01 = left to right 02 = bottom to top 04 = right to left 010= top to bottom
 java.lang.String initl
          initials of person doing scan
 int isptsz
          (unsigned short) s.s.d in microns*1024
 int istpx
          (unsigned short) X step sizes in microns*1024
 int istpy
          (unsigned short) Y step sizes in microns*1024
 java.lang.String name
          name of the picture - was [16]
 int nbands
          # of scanning bands (colors)
 int ncols
          (unsigned short) full image size # columns in pixels
 int nexcpt
          (unsigned int) number of exception entries
 int nPixels
          # of pixels for the image is (nrows*ncols)
 int nrows
          (unsigned short) full image size # rows in pixels
 int nWedgeSteps
          will contain WEDGE_PPX to be set by user
 int nx
          (unsigned short) X size of region of interest
 int ny
          (unsigned short) Y size of region of interest
 int odmn
          Min Pixel value.
 int odmx
          Max Pixel value.
private  int[] pixels
          pixels [0:nPixels-1] for the image
static int PPX_VRSION
          Code version 3.5 as 35
 java.lang.String ppxFileName
          full path of PPX input file
 int rix
          (unsigned short) X top left corner of region of interest (0,0) is U.L.H.C.
 int riy
          (unsigned short) X top left corner of region of interest (0,0) is U.L.H.C.
 java.lang.String scprog
          name of scanning program
 java.lang.String scpvrs
          version of scanning program
 java.lang.String scsys
          ID of the scanning system
 java.lang.String sdate
          date of scan
 java.lang.String sid
          further identification - (sample ID)
 int startDataDict
          (unsigned int) if non-zero, then byte # of file where data dictionary starts.
 int startImageData
          (unsigned int) if non-zero, then byte # of file where image data starts.
 java.lang.String stime
          time of scan
 int tessl
          (unsigned int) tesselation code ??? bits???
 boolean trnsl
          translation flag (0 = raw, 1 = done)
static java.lang.String VERSION
          Version for this module
 java.lang.String vism
          visualization method
static int WEDGE_PPX
          Max number of wedge steps if applicable
 int wedgeType
          Type of step wedge if any in the image: 0 = none 1 = ND, neutral density 2 = CPM, counts per minute 3 = DPM, disintegrations per minute 4 to 255 =
 int[] wedgeVal
          (24-bit unsigned) ND*1024 or CPM wedge step values
 int x0
          (unsigned short) top left X corner of image in cm*1024
 int y0
          (unsigned short) top left Y corner of image in cm*1024
 
Constructor Summary
PpxLoader()
          PpxLoader() - constuctor()
PpxLoader(byte[] byteData)
          PpxLoader() - constuctor to parse the PPX header and set up the state
 
Method Summary
private  int cvByte2Int(byte b)
          cvByte2Int() - convert unsigned byte [0:255] to int in range [0:255]
 byte cvInt2Byte(int i)
          cvInt2Byte() - convert unsignged int [0:255] to signed byte [-128:+127]
 boolean cvP2Ihdr(byte[] byteData)
          cvP2Ihdr() - Convert portable header byteData[0:511] into PpxLoader state.
 byte[] getBytePixels()
          getBytePixels() - get pixels from the raster
 java.awt.Image getImage()
          getImage() - get pixels from the raster
 boolean makePPXimage()
          makePPXimage() - make img and pixels[] from the byte bPixels[] data
 boolean readPPXfile(java.lang.String ppxFileName)
          readPPXfile() - read loca PPX file or PPX file URL.
 java.lang.String toString()
          toString() - return string representation of this PpxLoader instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
Version for this module

See Also:
Constant Field Values

ppxFileName

public java.lang.String ppxFileName
full path of PPX input file


PPX_VRSION

public static int PPX_VRSION
Code version 3.5 as 35


WEDGE_PPX

public static int WEDGE_PPX
Max number of wedge steps if applicable


fversn

public int fversn
(unsigned short) Set to PPX_VRSION by program creating header


filtyp

public int filtyp
type of file. = 0 for unknown. = 1 for raw image. = 2 for processed image. = 3 for synthetic image. = 4 for spot file. = 5 for exception list file. = ... 6 to 255 are free.


nrows

public int nrows
(unsigned short) full image size # rows in pixels


ncols

public int ncols
(unsigned short) full image size # columns in pixels


name

public java.lang.String name
name of the picture - was [16]


sid

public java.lang.String sid
further identification - (sample ID)


vism

public java.lang.String vism
visualization method


sdate

public java.lang.String sdate
date of scan


stime

public java.lang.String stime
time of scan


initl

public java.lang.String initl
initials of person doing scan


scsys

public java.lang.String scsys
ID of the scanning system


scprog

public java.lang.String scprog
name of scanning program


scpvrs

public java.lang.String scpvrs
version of scanning program


nbands

public int nbands
# of scanning bands (colors)


bitpp

public int bitpp
bits per pixel (one band)


bytpp

public int bytpp
bytes per pixel (one band)


x0

public int x0
(unsigned short) top left X corner of image in cm*1024


y0

public int y0
(unsigned short) top left Y corner of image in cm*1024


isptsz

public int isptsz
(unsigned short) s.s.d in microns*1024


istpx

public int istpx
(unsigned short) X step sizes in microns*1024


istpy

public int istpy
(unsigned short) Y step sizes in microns*1024


tessl

public int tessl
(unsigned int) tesselation code ??? bits???


domain

public int domain
0 = optical density, 1 = transmittance 2 = gray value ... 3 to 255 are free.


rix

public int rix
(unsigned short) X top left corner of region of interest (0,0) is U.L.H.C.


riy

public int riy
(unsigned short) X top left corner of region of interest (0,0) is U.L.H.C.


nx

public int nx
(unsigned short) X size of region of interest


ny

public int ny
(unsigned short) Y size of region of interest


blkaln

public boolean blkaln
block alignment flag 0 = aligned)


trnsl

public boolean trnsl
translation flag (0 = raw, 1 = done)


nexcpt

public int nexcpt
(unsigned int) number of exception entries


odmn

public int odmn
Min Pixel value. (float odmn) Min optical densities


odmx

public int odmx
Max Pixel value. (float odmn) Max optical densities


blackIsZeroFlag

public boolean blackIsZeroFlag
1 if BLACK is gray value 0, else 0 if WHITE is gray value 0


wedgeType

public int wedgeType
Type of step wedge if any in the image: 0 = none 1 = ND, neutral density 2 = CPM, counts per minute 3 = DPM, disintegrations per minute 4 to 255 =


nWedgeSteps

public int nWedgeSteps
will contain WEDGE_PPX to be set by user


wedgeVal

public int[] wedgeVal
(24-bit unsigned) ND*1024 or CPM wedge step values


grayCalWedge

public int[] grayCalWedge
(16-bit unsigned) gray scale peaks calibration corresponding to step wedge values.


genNdwvalues

public float[] genNdwvalues
ND (od) or CPM wedge step values


cMapMode

public int cMapMode
color map flag. 0 = no color map 1 = color map is the first 1024 bytes of data after header where 3x256 bytes are Red, Green,Blue maps stored as sequential arrays. 2 = same as 1 but image data is true-color image consisting of three sequential images (R,G,B). 3 = same as 2 but pixels are 24-bits specifying 8-bits each of (R,G,B). 4 = color map is first 12,298 bytes of data after the header where 3x4096 (12-bit lookup table entries) are stored as sequential arrays.


imOrientation

public int imOrientation
Image orientation bits where: Default 00==>011: 01 = left to right 02 = bottom to top 04 = right to left 010= top to bottom


imEncode

public int imEncode
Image encoding method 0 = none (just raw raster data) 1 = UNIX 'compress/uncompress' 2 = run length 3 = 1D modified Huffman 4 = 2D modified Huffman 5 = delta coding 6 = run length with delta coding ... 7 to 255 are free.


startDataDict

public int startDataDict
(unsigned int) if non-zero, then byte # of file where data dictionary starts. This should be multiple of 512 bytes.


endDataDict

public int endDataDict
(unsigned int) if non-zero, then byte # of file where data dictionary ends. This should be multiple of 512 bytes -1.


startImageData

public int startImageData
(unsigned int) if non-zero, then byte # of file where image data starts. This should be multiple of 512 bytes.


bPixels

private byte[] bPixels
pixels [0:nPixels-1] for the image


pixels

private int[] pixels
pixels [0:nPixels-1] for the image


nPixels

public int nPixels
# of pixels for the image is (nrows*ncols)


img

public java.awt.Image img
Image structure required for PPX loader


cm

public java.awt.image.ColorModel cm
Constructor Detail

PpxLoader

public PpxLoader()
PpxLoader() - constuctor()


PpxLoader

public PpxLoader(byte[] byteData)
PpxLoader() - constuctor to parse the PPX header and set up the state

Parameters:
byteData - is 512 byte header read from PPX file
Method Detail

cvByte2Int

private final int cvByte2Int(byte b)
cvByte2Int() - convert unsigned byte [0:255] to int in range [0:255]

Parameters:
b - is byte to convert
Returns:
int value

cvInt2Byte

public final byte cvInt2Byte(int i)
cvInt2Byte() - convert unsignged int [0:255] to signed byte [-128:+127]

Parameters:
i - is int to convert
Returns:

cvP2Ihdr

public boolean cvP2Ihdr(byte[] byteData)
cvP2Ihdr() - Convert portable header byteData[0:511] into PpxLoader state.

Parameters:
byteData - is 512 byte header read from PPX file
Returns:
true if valid header

getImage

public java.awt.Image getImage()
getImage() - get pixels from the raster

Parameters:
r - is the image raster instance
Returns:
1D array encoding a raster 2D image of size width X height.

getBytePixels

public byte[] getBytePixels()
getBytePixels() - get pixels from the raster

Parameters:
r - is the image raster instance
Returns:
1D array encoding a raster 2D image of size width X height.

readPPXfile

public boolean readPPXfile(java.lang.String ppxFileName)
readPPXfile() - read loca PPX file or PPX file URL.

Parameters:
ppxFileName - is the full path file name to be read
Returns:
true if succeed and the data is in the class instance.

makePPXimage

public boolean makePPXimage()
makePPXimage() - make img and pixels[] from the byte bPixels[] data

Returns:
true if generate the Image instance and colorModel

toString

public java.lang.String toString()
toString() - return string representation of this PpxLoader instance

Overrides:
toString in class java.lang.Object
Returns:
string PpxLoader instance