Package skyview.survey
Class HDecompressor
java.lang.Object
skyview.survey.HDecompressor
HDecompressor. Uncompress astronomical images compressed
using the H-compression algorithm.
Examples :
DataInputStream dis = new DataInputStream( new FileInputStream(arg[0])); byte [] pixels=Hdecomp.decomp( (InputStream)dis );where the user needs to translate the byte stream back into a series of shorts.
DataInputStream dis = new DataInputStream( new FileInputStream(arg[0])); Hdecomp hd = new Hdecomp(dis); hd.decomp(); int[] pixels = hd.getImage(); int nx = hd.getNx(); int ny = hd.getNy();
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a bare decompressor object.HDecompressor
(InputStream dis) Create a decompressor associating it with a given input stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Decompress the input stream.static int[]
decompress
(InputStream fdis) Hdecompress static method.int[]
getImage()
Get decompressed image as a one-d array of ints.int
getNx()
Get the X-dimension of the decompressed image.int
getNy()
Get the Y-dimension of the decompressed image.void
Set the input stream for an Hdecomp object.
-
Constructor Details
-
HDecompressor
public HDecompressor()Create a bare decompressor object. -
HDecompressor
Create a decompressor associating it with a given input stream.- Parameters:
dis
- The input stream from which the compressed data is derived.
-
-
Method Details
-
setInputStream
Set the input stream for an Hdecomp object.- Parameters:
dis
- The input stream from which the compressed data is derived.
-
decompress
Hdecompress static method.- Parameters:
fdis
- The input stream from which compressed data is to be extracted. It should begin with the magic characters [0xDD, 0x99]. If the compressed data is preceded by a FITS header it is the responsibility of the program to skip past the header before calling this routine.- Returns:
- byte[] The uncompressed Fits image. Note that this image is actually an array of shorts and the calling program should combine pairs of bytes to get the value for each pixel.
- Throws:
Exception
-
decompress
Decompress the input stream. The result is left in the a[] array and can be accessed using the various get methods.- Throws:
Exception
-
getNx
public int getNx()Get the X-dimension of the decompressed image.- Returns:
- The number of columns in the image.
-
getNy
public int getNy()Get the Y-dimension of the decompressed image.- Returns:
- The number of rows in the image.
-
getImage
public int[] getImage()Get decompressed image as a one-d array of ints. Note that this returns a pointer to the internal array. If another image is compressed it may overwrite the current image in place. The caller should copy the array if multiple files are being decompressed using the same Hdecomp object.- Returns:
- The decompressed image as a 1-D int array.
-