Hi,
I cannot open FITS file downloaded from HLA (i.e. http://archive.stsci.edu/cgi-bin/hla/getdata.cgi?download=1&dataset=hlsp_coma_hst_acs-wfc_v19_f814w&filename=hlsp_coma_hst_acs-wfc_v19_f814w_v1_ivm-drz-cl.fits ) The file has extended FITS header and I believe it confuses ImageJ. The message I get is "This does not appear to be a FITS file." The image can be opened with no problem by SAO DS9 viewer. SAO shows both headers. I just downloaded latest release of ImageJ 1.41 and the problem is still there. Is there any work around? Thank you. Sergei The header of the image above looks like: SIMPLE = T / Fits standard BITPIX = 16 / Bits per pixel NAXIS = 0 / Number of axes EXTEND = T / File may contain extensions ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator IRAF-TLM= '10:58:58 (24/07/2007)' / Time of last modification NEXTEND = 3 / Number of standard extensions DATE = '2007-02-19T22:26:34' / date this file was written (yyyy-mm-dd) ............. END XTENSION= 'IMAGE ' / Image extension BITPIX = -32 / Bits per pixel NAXIS = 2 / Number of axes NAXIS1 = 4225 / Axis length NAXIS2 = 4300 / Axis length PCOUNT = 0 / No 'random' parameters GCOUNT = 1 / Only one group ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator EXTNAME = 'SCI ' / Extension name EXTVER = 1 / Extension version DATE = '2007-02-19T22:26:35' / Date FITS file was generated IRAF-TLM= '11:00:08 (24/07/2007)' / Time of last modification INHERIT = T / inherit the primary header EXPNAME = 'j9ty19xyq ' / exposure identifier BUNIT = 'ELECTRONS' / brightness units .................... END <binary data> |
ImageJ does not handle extensions, as far as I can know. Your file
has an "image" extension where the data is held, so that's why it gets confused (it also has -32bits which might be confusing too). I use table extensions regularly, and am working on a plugin to deal with those, but the FITS standards cover many cases and writing something to suit everyone's FITs files would take a lot of work. I'd be interested to hear from anyone who has written an even half- working version of code to do this! Dr Adrian Martin Sensor Sciences, 3333 Vincent Road, Suite 103, Pleasant Hill, CA 94523 (925) 296 0848 phone, (925) 296 0849 fax On Jun 1, 2009, at 12:02 AM, Sergei Goshko wrote: > Hi, > > I cannot open FITS file downloaded from HLA (i.e. http://archive.stsci.edu/cgi-bin/hla/getdata.cgi?download=1&dataset=hlsp_coma_hst_acs-wfc_v19_f814w&filename=hlsp_coma_hst_acs-wfc_v19_f814w_v1_ivm-drz-cl.fits > ) > > The file has extended FITS header and I believe it confuses ImageJ. > The message I get is "This does not appear to be a FITS file." > The image can be opened with no problem by SAO DS9 viewer. SAO shows > both headers. > I just downloaded latest release of ImageJ 1.41 and the problem is > still there. > Is there any work around? > > Thank you. > Sergei > > > The header of the image above looks like: > > SIMPLE = T / Fits standard > BITPIX = 16 / Bits per pixel > NAXIS = 0 / Number of axes > EXTEND = T / File may contain extensions > ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file > originator > IRAF-TLM= '10:58:58 (24/07/2007)' / Time of last modification > NEXTEND = 3 / Number of standard extensions > DATE = '2007-02-19T22:26:34' / date this file was written (yyyy- > mm-dd) > ............. > END > XTENSION= 'IMAGE ' / Image extension > BITPIX = -32 / Bits per pixel > NAXIS = 2 / Number of axes > NAXIS1 = 4225 / Axis length > NAXIS2 = 4300 / Axis length > PCOUNT = 0 / No 'random' parameters > GCOUNT = 1 / Only one group > ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file > originator > EXTNAME = 'SCI ' / Extension name > EXTVER = 1 / Extension version > DATE = '2007-02-19T22:26:35' / Date FITS file was generated > IRAF-TLM= '11:00:08 (24/07/2007)' / Time of last modification > INHERIT = T / inherit the primary header > EXPNAME = 'j9ty19xyq ' / exposure identifier > BUNIT = 'ELECTRONS' / brightness units > .................... > END > <binary data> |
Hi,
I used nom.tam.fits package that worked for me just file. The simplified code that I used is following: import nom.tam.fits.BasicHDU; import nom.tam.fits.Fits; import nom.tam.fits.FitsException; import nom.tam.fits.Header; public ImagePlus readFITS(String fitsFile) throws FitsException { Fits f = new Fits(fitsFile); try { BasicHDU[] hh = f.read(); for (BasicHDU bh: hh) { Header h = bh.getHeader(); int naxis = h.getIntValue("NAXIS"); if (naxis >= 2 && bh.getData().getData()!=null) { return new ImagePlus(path, new FloatProcessor((float[][])bh.getData().getData())); } } } finally { try { f.getStream().close(); } catch(Exception e) {} } return null; } It can open only FITS with data type float that is enough for me, but with little extra code it is possible to handle any data types. Sergei ----- Original Message ----- From: "Adrian Martin" <[hidden email]> To: <[hidden email]> Sent: Monday, June 01, 2009 12:45 Subject: Re: cannot open FITS image with extended header > ImageJ does not handle extensions, as far as I can know. Your file has > an "image" extension where the data is held, so that's why it gets > confused (it also has -32bits which might be confusing too). I use table > extensions regularly, and am working on a plugin to deal with those, but > the FITS standards cover many cases and writing something to suit > everyone's FITs files would take a lot of work. > > I'd be interested to hear from anyone who has written an even half- > working version of code to do this! > > Dr Adrian Martin > Sensor Sciences, 3333 Vincent Road, Suite 103, Pleasant Hill, CA 94523 > (925) 296 0848 phone, (925) 296 0849 fax > > > On Jun 1, 2009, at 12:02 AM, Sergei Goshko wrote: > >> Hi, >> >> I cannot open FITS file downloaded from HLA (i.e. >> http://archive.stsci.edu/cgi-bin/hla/getdata.cgi?download=1&dataset=hlsp_coma_hst_acs-wfc_v19_f814w&filename=hlsp_coma_hst_acs-wfc_v19_f814w_v1_ivm-drz-cl.fits ) >> >> The file has extended FITS header and I believe it confuses ImageJ. >> The message I get is "This does not appear to be a FITS file." >> The image can be opened with no problem by SAO DS9 viewer. SAO shows >> both headers. >> I just downloaded latest release of ImageJ 1.41 and the problem is still >> there. >> Is there any work around? >> >> Thank you. >> Sergei >> >> >> The header of the image above looks like: >> >> SIMPLE = T / Fits standard >> BITPIX = 16 / Bits per pixel >> NAXIS = 0 / Number of axes >> EXTEND = T / File may contain extensions >> ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator >> IRAF-TLM= '10:58:58 (24/07/2007)' / Time of last modification >> NEXTEND = 3 / Number of standard extensions >> DATE = '2007-02-19T22:26:34' / date this file was written (yyyy- >> mm-dd) >> ............. >> END >> XTENSION= 'IMAGE ' / Image extension >> BITPIX = -32 / Bits per pixel >> NAXIS = 2 / Number of axes >> NAXIS1 = 4225 / Axis length >> NAXIS2 = 4300 / Axis length >> PCOUNT = 0 / No 'random' parameters >> GCOUNT = 1 / Only one group >> ORIGIN = 'NOAO-IRAF FITS Image Kernel July 2003' / FITS file originator >> EXTNAME = 'SCI ' / Extension name >> EXTVER = 1 / Extension version >> DATE = '2007-02-19T22:26:35' / Date FITS file was generated >> IRAF-TLM= '11:00:08 (24/07/2007)' / Time of last modification >> INHERIT = T / inherit the primary header >> EXPNAME = 'j9ty19xyq ' / exposure identifier >> BUNIT = 'ELECTRONS' / brightness units >> .................... >> END >> <binary data> > |
Free forum by Nabble | Edit this page |