view
Class AstroKernel

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by view.AstroKernel
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public abstract class AstroKernel
extends PropertyBundles
implements Initializable

A kernel is used for filtering an image to detect stars. I hope that any kernel one can think of consists of a (quadratic) matrix of floats. Therefore, methods are supported, getAstroKernel(), getSizeX() and getSizeY(). Additionally, for least-square fitting, the quadratic sum of the kernel minus the sum of the kernel squared divided by the kernel size is return in the (abstract) getWeight() method. Note that this latter method is only useful for quadratic kernels. This class is abstract and not an interface to stress the importance that the computation of the kernel via the protected computeAstroKernel() method should always be done directly after the construction phase using the init() method.

This class work together with the Kernel class by invoking toImageKernel() on it.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  float[][] kernel
          The kernel matrix.
static String KEY_CLASS
          The key mapping to the CommandLaunching class name.
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG
 
Constructor Summary
protected AstroKernel(Map prop)
          Constructs the kernel.
 
Method Summary
protected abstract  float[][] computeAstroKernel()
          Computes the kernel.
static AstroKernel createAstroKernel(Map prop)
          Constructs a new kernel instance using the mapping of the KEY_CLASS to the class name to derive the class to instantiate.
 float[][] getAstroKernel()
          Returns the kernel as a two-dimensional float array.
 int getSizeX()
          Returns the size of the kernel in x.
 int getSizeY()
          Returns the size of the kernel in y.
abstract  double getWeight()
          Returns the weight of the kernel.
 void init()
          Initializes the kernel.
 Kernel toImageKernel()
          Uses the astro-kernel data to construct a image-kernel, as used in the java.awt.image.Kernel class.
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

KEY_CLASS

public static final String KEY_CLASS
The key mapping to the CommandLaunching class name.

See Also:
Constant Field Values

kernel

private float[][] kernel
The kernel matrix. It is stored as a two-dimensional float array.

Constructor Detail

AstroKernel

protected AstroKernel(Map prop)
Constructs the kernel. It is important to compute the kernel in the construction phase to have it ready for calculation. Therefore, the constructor calls the computeAstroKernel() method. To allow concrete subclasses to carry some properties, a map can be included in the construction phase.

Method Detail

init

public void init()
Initializes the kernel. This method should be called right after construction, which is ensured if the factory method createAstroKernel(java.util.Map) is used to build a kernel.

Specified by:
init in interface Initializable
Overrides:
init in class PropertyResources

getAstroKernel

public float[][] getAstroKernel()
Returns the kernel as a two-dimensional float array.


toImageKernel

public Kernel toImageKernel()
Uses the astro-kernel data to construct a image-kernel, as used in the java.awt.image.Kernel class.


getSizeX

public int getSizeX()
Returns the size of the kernel in x. This method returns the length of the first kernel array.


getSizeY

public int getSizeY()
Returns the size of the kernel in y. This method returns the length of the second kernel array.


getWeight

public abstract double getWeight()
Returns the weight of the kernel. This is defined for quadratic kernels only and is the sum of the kernel-squared minus the squared sum of the kernel, the latter divided by the kernel size.


computeAstroKernel

protected abstract float[][] computeAstroKernel()
Computes the kernel. This method is called in the init() method, i.e. right after the construction of the kernel.


createAstroKernel

public static final AstroKernel createAstroKernel(Map prop)
Constructs a new kernel instance using the mapping of the KEY_CLASS to the class name to derive the class to instantiate. If this property is defined, a new AstroKernel instance with the stated class name is created, the supplied properties used as an argument in the constructor. As all kernels are Initializable, the init() method is called immediately after the construction.