/* the simplest(?) code to read a votable uses VOTWrap from ivoa download */ package readfits; import edu.jhu.pha.ivoa.*; import java.io.*; import nom.tam.fits.*; import java.text.*; class ReadFits { public static void main(String[] args) throws Exception{ int ind =0; if (args.length > 0 ) { } else { System.out.println("You need to suply the filename of a fits "); System.exit(1); } read(args[0]); } public static void read(String fname) throws Exception{ System.out.println("Reading "+fname); Fits theFits = new nom.tam.fits.Fits(fname); //or a url ! ImageHDU h = (ImageHDU) theFits.readHDU(); // it may not be an image so then we would get an exception Header head = h.getHeader(); System.out.println (fname + " has naxis1 "+ head.getDoubleValue("NAXIS1") ); System.out.println (fname + " has naxis2 "+ head.getDoubleValue("NAXIS2") ); float[][] img = (float[][])h.getKernel(); // could use get tile for (int i =0; i <10; i++) { System.out.println(img[i][i]); } } }