uk.ac.starlink.ndx
Class BridgeNdx

java.lang.Object
  extended by uk.ac.starlink.ndx.BridgeNdx
All Implemented Interfaces:
Ndx
Direct Known Subclasses:
DefaultMutableNdx

public class BridgeNdx
extends Object
implements Ndx

Default Ndx implementation. This class builds an Ndx from an NdxImpl.

The static initialiser for this class is also responsible for creating and registering the HdxResourceType which corresponds to Ndx. For this to happen, this BridgeNdx class must be named in a Hdx.properties file, as described in class HdxResourceType.

Author:
Mark Taylor (Starlink), Peter Draper (Starlink), Norman Gray (Starlink)

Nested Class Summary
protected  class BridgeNdx.BridgeNdxHdxFacade
           
 
Field Summary
protected  Document ndxDocumentCache
           
 
Constructor Summary
BridgeNdx(NdxImpl impl)
          Constructs an Ndx implementation from an NdxImpl object.
 
Method Summary
 FrameSet getAst()
          Get the world coordinate system of the NDX as an AST FrameSet.
 int getBadBits()
          Gets the value of the badBits mask.
 Source getEtc()
          Returns the XML containing extension information for this NDX.
 HdxFacade getHdxFacade()
          Obtains a HdxFacade, which enables us to examine and manipulate the Ndx in a DOM-like way.
static HdxResourceType getHdxResourceType()
          Returns the Hdx type corresponding to Ndx objects.
 NDArray getImage()
          Returns the image component of this NDX.
 String getLabel()
          Returns the label string for this Ndx.
 NDArray getQuality()
          Returns the quality component of this NDX.
 String getTitle()
          Returns the title of this Ndx.
 String getUnits()
          Returns the units string for this Ndx.
 NDArray getVariance()
          Returns the variance component of this NDX.
 boolean hasEtc()
          Find out if the NDX contains user-defined extension information.
 boolean hasLabel()
          Indicates whether there is a label component.
 boolean hasQuality()
          Indicates whether there is a quality component.
 boolean hasTitle()
          Indicates whether there is a title component.
 boolean hasUnits()
          Indicates whether there is a units component.
 boolean hasVariance()
          Indicates whether there is a variance component.
 boolean hasWCS()
          Find out if the NDX has World Coordinate System information.
 boolean isPersistent()
          Indicates whether this Ndx represents a persistent object.
 Source toXML(URL base)
          Deprecated. replaced by getHdxFacade().getSource(URLUtils.urlToUri(base))
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ndxDocumentCache

protected Document ndxDocumentCache
Constructor Detail

BridgeNdx

public BridgeNdx(NdxImpl impl)
Constructs an Ndx implementation from an NdxImpl object.

Parameters:
impl - object which provides services to this BridgeNdx
Method Detail

getImage

public NDArray getImage()
Description copied from interface: Ndx
Returns the image component of this NDX.

Note that this returns the raw image NDArray object, which should not in general be used directly for reading image data, since it has not been masked by a quality component if present. To obtain a properly masked version of the image data for read access, use the Ndxs.getMaskedImage(Ndx) method.

Specified by:
getImage in interface Ndx
Returns:
the NDArray representing the image component

getVariance

public NDArray getVariance()
Description copied from interface: Ndx
Returns the variance component of this NDX.

Note that this returns the raw variance NDArray object, which should not in general be used directly for reading variance data, since it has not been masked by a quality component if present. To obtain a properly masked version of the variance data for read access, use the Ndxs.getMaskedVariance(Ndx) method.

May only be called if Ndx.hasVariance() returns true.

Specified by:
getVariance in interface Ndx
Returns:
an NDArray representing the variance component,

getQuality

public NDArray getQuality()
Description copied from interface: Ndx
Returns the quality component of this NDX.

May only be called if Ndx.hasQuality() returns true.

Specified by:
getQuality in interface Ndx
Returns:
an NDArray of integer type representing the quality component,

hasVariance

public boolean hasVariance()
Description copied from interface: Ndx
Indicates whether there is a variance component.

Specified by:
hasVariance in interface Ndx
Returns:
true if Ndx.getVariance() may be called

hasQuality

public boolean hasQuality()
Description copied from interface: Ndx
Indicates whether there is a quality component.

Specified by:
hasQuality in interface Ndx
Returns:
true if Ndx.getQuality() may be called

hasTitle

public boolean hasTitle()
Description copied from interface: Ndx
Indicates whether there is a title component.

Specified by:
hasTitle in interface Ndx
Returns:
true if Ndx.getTitle() may be called

hasLabel

public boolean hasLabel()
Description copied from interface: Ndx
Indicates whether there is a label component.

Specified by:
hasLabel in interface Ndx
Returns:
true if Ndx.getLabel() may be called

hasUnits

public boolean hasUnits()
Description copied from interface: Ndx
Indicates whether there is a units component.

Specified by:
hasUnits in interface Ndx
Returns:
true if Ndx.getUnits() may be called

hasEtc

public boolean hasEtc()
Description copied from interface: Ndx
Find out if the NDX contains user-defined extension information.

Specified by:
hasEtc in interface Ndx
Returns:
true if Ndx.getEtc() may be called

hasWCS

public boolean hasWCS()
Description copied from interface: Ndx
Find out if the NDX has World Coordinate System information.

If it exists, then the Ndx.getAst() method may be called to access it as an AST FrameSet.

Note: in due course, when the uk.ac.starlink.wcs package has been released a getWCS method will be provided to access it as a WCS object.

Specified by:
hasWCS in interface Ndx
Returns:
true if Ndx.getAst() (and in due course getWCS can be called

getTitle

public String getTitle()
Description copied from interface: Ndx
Returns the title of this Ndx. May only be called if Ndx.hasTitle() returns true.

Specified by:
getTitle in interface Ndx
Returns:
the title

getLabel

public String getLabel()
Description copied from interface: Ndx
Returns the label string for this Ndx. This describes the quantity held in the data array. May only be called if Ndx.hasLabel() returns true.

Specified by:
getLabel in interface Ndx
Returns:
the label string

getUnits

public String getUnits()
Description copied from interface: Ndx
Returns the units string for this Ndx. This indicates the units of the values in the data array. May only be called if Ndx.hasUnits() returns true.

Specified by:
getUnits in interface Ndx
Returns:
the units string

getEtc

public Source getEtc()
Description copied from interface: Ndx
Returns the XML containing extension information for this NDX. The base element of the returned Source is an element of type <etc> which contains an element for each extension. May only be called if Ndx.hasEtc() returns true.

Specified by:
getEtc in interface Ndx
Returns:
an XML Source containing any user-defined extension information.
See Also:
SourceReader

getBadBits

public int getBadBits()
Description copied from interface: Ndx
Gets the value of the badBits mask. This value is used in conjunction with the quality array to determine which pixels are bad; a pixel is bad if the logical AND of its quality value and the bad bits mask is not zero; hence a value of zero has no effect. Has no effect if there is no quality array.

Specified by:
getBadBits in interface Ndx
Returns:
the bad bits mask

getAst

public FrameSet getAst()
Description copied from interface: Ndx
Get the world coordinate system of the NDX as an AST FrameSet.

Note: This method is intended as a temporary measure until the uk.ac.starlink.wcs package has been released. At that time a getWCS method will be provided, and this one will be deprecated.

Specified by:
getAst in interface Ndx
Returns:
the AST FrameSet representing the world coordinate system information
See Also:
Ndx.hasWCS()

isPersistent

public boolean isPersistent()
Description copied from interface: Ndx
Indicates whether this Ndx represents a persistent object. If this returns true, then the array components in the XML source generated by the Ndx.toXML(java.net.URL) method all contain URLs referencing genuine resources. If false, then this Ndx is in some sense virtual, and one or more of the array elements in the the XML generated by toXML will reference phantom resources.

Specified by:
isPersistent in interface Ndx
Returns:
true if an XML representation capable of containing the full state of this Ndx can be generated

toXML

public Source toXML(URL base)
Deprecated. replaced by getHdxFacade().getSource(URLUtils.urlToUri(base))

Generates an XML view of this Ndx object as a Source. The XML is built using only public methods of this Ndx rather than any private values, so that this method can safely be inherited by subclasses.

Does not currently throw HdxException if the XML cannot be generated, but it should.

Specified by:
toXML in interface Ndx
Parameters:
base - URL against which others are to be relativised
Returns:
an XML Source representation of this Ndx
Throws:
PluginException - (unchecked) if the XML cannot be generated
See Also:
SourceReader

getHdxResourceType

public static HdxResourceType getHdxResourceType()
Returns the Hdx type corresponding to Ndx objects.


getHdxFacade

public HdxFacade getHdxFacade()
Description copied from interface: Ndx
Obtains a HdxFacade, which enables us to examine and manipulate the Ndx in a DOM-like way.

Specified by:
getHdxFacade in interface Ndx
Returns:
a HdxFacade representing the Ndx


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.