Class FitsNdxHandler
FITS file format for NDXs
When writing an NDX into FITS format, the image array is written as the primary HDU. The headers of this HDU also contain a card with the name "NDX_XML", whose value is a relative URL (of the form '#n', where n is an HDU number) pointing to the HDU in the same FITS file in which XML metadata concerning the NDX's structure can be found. This XML is stored as the sole (character) element of a table extension. Other HDUs may be written if more are needed, for instance the variance and quality arrays. The resulting FITS file is therefore a self-contained copy of the NDX's data (array components) and metadata (XML stored in a table component). Software which is not NDX-aware can see the data just by looking at the primary HDU.When reading an NDX from a FITS file, the handler will look for the NDX_XML header; if one is found it will retrieve the metadata from the XML stored in the referenced table extension as described above. If this header is not present, it will make an NDX with no components apart from the image array it is pointed at and any WCS defined by FITS WCS headers in that HDU in the normal way.
The coordinate system information of an NDX written to a FITS file is currently written to the Image HDU for use by non-NDX-aware software. However, the WCS is read from the XML if present, so in the case of discrepancies between the two the WCS represented in the FITS headers may be out of date.
URL format
URLs are given in the same format as for theFitsArrayBuilder
class. If an HDU other than the first one is referenced, that is
where the NDX_XML header will be sought.
This is a singleton class; use getInstance()
to get an instance.
- Version:
- $Id$
- Author:
- Mark Taylor (Starlink), Norman Gray
-
Method Summary
Modifier and TypeMethodDescriptionstatic FitsNdxHandler
Returns a FitsNdxHandler.boolean
makeBlankNdx
(URL url, Ndx template) makeHdxDocument
(URL url) makeHdxSource
(URL url) Ndx
boolean
void
Writes an NDX to a given output stream.
-
Method Details
-
getInstance
Returns a FitsNdxHandler.- Returns:
- the sole instance of this class
-
makeNdx
- Throws:
IOException
-
makeBlankNdx
- Throws:
IOException
-
outputNdx
- Throws:
IOException
-
outputNdx
Writes an NDX to a given output stream. The stream is not closed following the write.- Parameters:
strm
- the stream to which the NDX should be writtenurl
- the URL represented by the stream; may be nullndx
- the ndx to write- Throws:
IOException
-
makeHdxDocument
- Throws:
HdxException
-
makeHdxSource
- Throws:
HdxException
-