cds.image
Class Hdecomp

java.lang.Object
  extended by cds.image.Hdecomp

public final class Hdecomp
extends java.lang.Object

Hdecomp. Uncompress method to astronomical images Example :

 public class ImageDemo {
       
    // To read fits header
    static void readFitsHeader(DataInputStream dis) throws Exception {
       byte [] line = new byte[80];
       do {
          dis.readFully(line);
       } while(line[0]!='E' || line[1]!='N' || line[2]!='D' || line[3]!=' ');
    }
    
    // The main method to test it
    static public void main(String [] arg) {
        
    
       try {
          // Open the first arg as a file
          DataInputStream dis = new DataInputStream( new FileInputStream(arg[0]));
          
          // read the FITS header
          System.out.println("Reading Fits header...");
          readFitsHeader(dis);
          
          // Parse the file
          System.out.println("Uncompressing...");
          byte [] pixels=Hdecomp.decomp( (InputStream)dis );
          System.out.println("I've uncompressed "+pixels.length+" bytes");
                   
       } catch( Exception e ) {
          System.err.println("There is a problem: "+e);
          e.printStackTrace();
       }
    }
 }
 

Version:
1.0 : (10 jun 2000) creation
Author:
Pierre Fernique [CDS] from hdecomp package (C language) by R. White - 1991

Constructor Summary
Hdecomp()
           
 
Method Summary
static byte[] decomp(java.io.InputStream fdis)
          Hdecompress static method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hdecomp

public Hdecomp()
Method Detail

decomp

public static byte[] decomp(java.io.InputStream fdis)
                     throws java.lang.Exception
Hdecompress static method.

Parameters:
fdis - the input Stream (begins by 0xDD 0x99 => without the Fits header)
Returns:
byte[] the uncompressed Fits image
Throws:
java.lang.Exception


Copyright © 2009 UDS/CNRS