Class ncsa.horizon.coordinates.CoordMetadata
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.coordinates.CoordMetadata

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----ncsa.horizon.util.Metadata
                           |
                           +----ncsa.horizon.coordinates.CoordMetadata

public class CoordMetadata
extends Metadata
a Metadata object with extra help for describing Coordinate Systems.

Coordinate-related classes in the Horizon package (e.g. CoordinateSystem, CoordPos, etc.) make use of specific set of metadata, the so-called horizon schema, which assumes specific types and meanings for them. This class provides special methods for setting values for these metadata in a way that ensures their proper type. Constructors provide sensible defaults for values not specifically set.

Below is a list of metadata that have specific meanings for coordinate systems and specific assumed types. Any that are not specified during construction are set to the default values shown.

   Key            Type              Default Value
   -------------------------------------------------------------
   naxes          Integer	       1                            
   name           String	       --not set--
   Axes           Metavector        Metadata object for each of
                                    naxes axes; -see next table-
   schema         String            "horizon"
   schemaVersion  String            --release-specific--
   -------------------------------------------------------------
Since this class is for the horizon schema, the schema and schemaVersion would not normally need updating later.

The Axes object is an array of Metadata objects, each containing sub-metadata that describes a particular axis. The Axes that have specified meanings and types are shown in the next table, along with values set for them by default:

   Axes sub-metadata:  
   Key            Type              Default Value
   -------------------------------------------------------------
   axisSchema     String            "referenced"
   name           String            "Pixels"
   label          String            -not set-
   type           String            "linear"
   refposition    Double	       0.0
   refvalue       Double	       0.0
   stepsize       Double	       0.0
   refoffset      Double	       0.0
   formatter      AxisPosFormatter  GenericAxisPosFormatter
   -------------------------------------------------------------
Note that the "axisSchema" metadatum is similar to "schema" in that it indicates what metadata are used to parameterize the axis. A value of "referenced" means that it is defined via a reference pixel using the above metadata names. Thus, one would normally not need to update the "axisSchema" metadatum.

Each of these metadata listed in the first table may be set using a method called set<metadatum>(), where metadatum is the name of the metadatum (e.g. setName(String)). Sub-metadata for the "Axes" metadatum can be set directly using a method called setAxis<metadatum>() (e.g. setAxisRefvalue(int,double) For more information on what each of the above metadata represent, see its cooresponding set method.


Variable Index

 o Axes
 o axisSchema
 o formatter
 o horizonSchema
 o label
 o name
 o naxes
 o refoffset
 o refposition
 o refvalue
 o stepsize
 o type
 o version
version of horizon schema supported by this object

Constructor Index

 o CoordMetadata()
Construct a CoordMetadata object with one axis with default values for the standard coordinate metadata
 o CoordMetadata(boolean)
 o CoordMetadata(int)
Creates an empty metadatum list with specified defaults.
 o CoordMetadata(int, Metadata)
Create a Metadata object describing a coordinate system with a given number of axes.
 o CoordMetadata(Metadata)
Creates an empty metadatum list with specified defaults.

Method Index

 o axesMatchingName(Metadata, int, String, int, int)
return the indices for axes in the input Metadata (as an array of Integers) whose names match a particular value.
 o axesMatchingName(Metadata, String, int)
same as Integer[] axesMatchingName(in, 0, value, 0, len)
 o axesMatchingType(Metadata, int, String, int, int)
return the indices for axes in the input Metadata (as an array of Integers) whose types match a particular value.
 o axesMatchingType(Metadata, String, int)
same as Integer[] axesMatchingType(in, 0, value, 0, len)
 o axisExactlyMatchingName(Metadata, String)
return index for the axis in input Metadata with type exactly matching input value.
 o axisExactlyMatchingType(Metadata, String)
return index for the axis in input Metadata with type exactly matching input value.
 o firstAxisMatchingName(Metadata, int, String, int, int)
return index for the first axis in the input Metadata with a type matching the input value.
 o firstAxisMatchingName(Metadata, String)
same as String firstAxisMatchingName(in, 0, value, 0, 0)
 o firstAxisMatchingType(Metadata, int, String, int, int)
return index for the first axis in the input Metadata with a type matching the input value.
 o firstAxisMatchingType(Metadata, String)
same as String firstAxisMatchingType(in, 0, value, 0, 0)
 o getAxisNames(Metadata)
extract the String array of axis names from the metadatum list (i.e.
 o getAxisStrings(String, Metadata)
 o getAxisTypes(Metadata)
extract the String array of axis types from the metadatum list (i.e.
 o getNaxes()
return the current number of axes in the coordinate system
 o getNaxes(Metadata)
return the current number of axes in the coordinate system described by the input Metadata
 o indicesMatchingString(String[], int, String, int, int)
 o initMetadata(int)
 o put(Object, Object)
update the value of a metadatum.
 o setAxes(Metadata, Metavector)
set the Axes object
 o setAxes(Metavector)
set the Axes object
 o setAxisFormatter(AxisPosFormatter[])
set the axis formatter objects for all axes.
 o setAxisFormatter(int, AxisPosFormatter)
set the axis formatter object for a specified axis.
 o setAxisFormatter(Metadata, AxisPosFormatter[])
set the axis formatter objects for all axes.
 o setAxisFormatter(Metadata, int, AxisPosFormatter)
set the axis formatter object for a specified axis.
 o setAxisLabel(int, Object)
set the axis label for the specified axis.
 o setAxisLabel(Metadata, int, String)
set the axis label for the specified axis.
 o setAxisLabel(Metadata, String[])
set the axis labels which are usually used when printing out coordinate positions.
 o setAxisLabel(String[])
set the axis labels which are usually used when printing out coordinate positions.
 o setAxisName(int, String)
set the axis name for the specified axis.
 o setAxisName(Metadata, int, String)
set the axis name for the specified axis.
 o setAxisName(Metadata, String[])
set the axis names.
 o setAxisName(String[])
set the axis names.
 o setAxisObject(Metadata, int, String, Object)
set an Axes metadatum
 o setAxisRefoffset(double[])
set the axis reference offsets for all axes.
 o setAxisRefoffset(int, double)
set the axis reference offset for the specified axis.
 o setAxisRefoffset(Metadata, double[])
set the axis reference offsets for all axes.
 o setAxisRefoffset(Metadata, int, double)
set the axis reference offset for the specified axis.
 o setAxisRefposition(double[])
set the axis reference position for all axes.
 o setAxisRefposition(int, double)
set the axis reference position for the specified axis.
 o setAxisRefposition(Metadata, double[])
set the axis reference position for all axes.
 o setAxisRefposition(Metadata, int, double)
set the axis reference position for the specified axis.
 o setAxisRefvalue(double[])
set the axis reference values for all axes.
 o setAxisRefvalue(int, double)
set the axis reference value for the specified axis.
 o setAxisRefvalue(Metadata, double[])
set the axis reference values for all axes.
 o setAxisRefvalue(Metadata, int, double)
set the axis reference value for the specified axis.
 o setAxisStepsize(double[])
set the axis step size for all axes.
 o setAxisStepsize(int, double)
set the axis step size for the specified axis.
 o setAxisStepsize(Metadata, double[])
set the axis step size for all axes.
 o setAxisStepsize(Metadata, int, double)
set the axis step size for the specified axis.
 o setAxisType(int, String)
set the axis type for the specified axis.
 o setAxisType(Metadata, int, String)
set the axis type for the specified axis.
 o setAxisType(Metadata, String[])
set the axis types.
 o setAxisType(String[])
set the axis types.
 o setName(Metadata, String)
set the name of the coordinate system
 o setName(String)
set the name of the coordinate system
 o setNaxes(int)
set the number of axes in the coordinate system
 o setNaxes(Metadata, int)
set the number of axes in the coordinate system
 o usesHorizonSchema(Metadata)
returns true if Metadata claims to use the "horizon" schema
 o usesReferencedAxis(Metadata, int)
returns true if Metadata claims to use the "horizon" schema

Variables

 o horizonSchema
  public final static String horizonSchema
 o version
  public final static String version
version of horizon schema supported by this object
 o Axes
  public final static String Axes
 o naxes
  public final static String naxes
 o name
  public final static String name
 o axisSchema
  public final static String axisSchema
 o type
  public final static String type
 o label
  public final static String label
 o formatter
  public final static String formatter
 o refposition
  public final static String refposition
 o refvalue
  public final static String refvalue
 o stepsize
  public final static String stepsize
 o refoffset
  public final static String refoffset

Constructors

 o CoordMetadata
  public CoordMetadata()
Construct a CoordMetadata object with one axis with default values for the standard coordinate metadata
 o CoordMetadata
  public CoordMetadata(int naxes,
                       Metadata defaults) throws ArrayIndexOutOfBoundsException
Create a Metadata object describing a coordinate system with a given number of axes. Standard coordinate metadata not found in the given metadata will be set to default values.
Parameters:
naxes - the number of axes in the coordinate system
defaults - the defaults (can be null)
Throws: ArrayIndexOutOfBoundsException
if naxes < 1
 o CoordMetadata
  public CoordMetadata(int naxes) throws ArrayIndexOutOfBoundsException
Creates an empty metadatum list with specified defaults.
Parameters:
naxes - the number of axes in this coordinate system
Throws: ArrayIndexOutOfBoundsException
if naxes < 1
 o CoordMetadata
  public CoordMetadata(Metadata defaults) throws ArrayIndexOutOfBoundsException
Creates an empty metadatum list with specified defaults.
Parameters:
defaults - the defaults
Throws: ArrayIndexOutOfBoundsException
if defaults contains a value for "naxes" that is < 1 or not specified.
 o CoordMetadata
  protected CoordMetadata(boolean setDefaults)

Methods

 o initMetadata
  protected void initMetadata(int nax)
 o getNaxes
  public static int getNaxes(Metadata md)
return the current number of axes in the coordinate system described by the input Metadata
 o getNaxes
  public int getNaxes()
return the current number of axes in the coordinate system
 o setNaxes
  public static void setNaxes(Metadata md,
                              int nax) throws ArrayIndexOutOfBoundsException
set the number of axes in the coordinate system
 o setNaxes
  public void setNaxes(int nax) throws ArrayIndexOutOfBoundsException
set the number of axes in the coordinate system
 o setName
  public static void setName(Metadata md,
                             String in)
set the name of the coordinate system
 o setName
  public void setName(String in)
set the name of the coordinate system
 o setAxes
  protected static void setAxes(Metadata md,
                                Metavector axmv)
set the Axes object
 o setAxes
  protected void setAxes(Metavector mv)
set the Axes object
 o setAxisObject
  protected static void setAxisObject(Metadata md,
                                      int axis,
                                      String mdname,
                                      Object in)
set an Axes metadatum
Parameters:
axis - the index of the axis to be set (first axis has index 0)
mdname - name of metadatum to be updated
in - Object to be set
 o setAxisLabel
  public static void setAxisLabel(Metadata md,
                                  int axis,
                                  String in)
set the axis label for the specified axis. Axis Labels are usually used when printing out coordinate positions.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - String to be used as a label
 o setAxisLabel
  public static void setAxisLabel(Metadata md,
                                  String in[])
set the axis labels which are usually used when printing out coordinate positions.
Parameters:
in - array of Strings to be used as labels
 o setAxisLabel
  public void setAxisLabel(String in[])
set the axis labels which are usually used when printing out coordinate positions.
Parameters:
in - array of Strings to be used as labels
 o setAxisLabel
  public void setAxisLabel(int axis,
                           Object in)
set the axis label for the specified axis. Axis Labels are usually used when printing out coordinate positions.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - String to be used as a label
 o setAxisName
  public static void setAxisName(Metadata md,
                                 int axis,
                                 String in)
set the axis name for the specified axis. Axis names are usually to identify an axis. It is used as a label if an axis label is not set.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - array of Strings to be used as names
 o setAxisName
  public void setAxisName(String in[])
set the axis names. Axis names are usually to identify an axis. It is used as a label if an axis label is not set.
Parameters:
in - array of Strings to be used as names
 o setAxisName
  public static void setAxisName(Metadata md,
                                 String in[])
set the axis names. Axis names are usually to identify an axis. It is used as a label if an axis label is not set.
Parameters:
in - String to be used as a name
 o setAxisName
  public void setAxisName(int axis,
                          String in)
set the axis name for the specified axis. Axis names are usually to identify an axis. It is used as a label if an axis label is not set.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - String to be used as a name
 o setAxisType
  public static void setAxisType(Metadata md,
                                 int axis,
                                 String in)
set the axis type for the specified axis. Axis types can be used to determine how to apply a coordinate transform
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - String to be used as a name
 o setAxisType
  public static void setAxisType(Metadata md,
                                 String in[])
set the axis types. Axis types can be used to determine how to apply a coordinate transform
Parameters:
in - String to be used as a name
 o setAxisType
  public void setAxisType(String in[])
set the axis types. Axis types can be used to determine how to apply a coordinate transform
Parameters:
in - String to be used as a name
 o setAxisType
  public void setAxisType(int axis,
                          String in)
set the axis type for the specified axis. Axis types can be used to determine how to apply a coordinate transform
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - String to be used as a name
 o setAxisRefvalue
  public static void setAxisRefvalue(Metadata md,
                                     int axis,
                                     double in)
set the axis reference value for the specified axis. The reference value is position along a world coordinate axis that corresponds to the data location given by the "refposition" metadatum.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - value to be set
 o setAxisRefvalue
  public static void setAxisRefvalue(Metadata md,
                                     double in[])
set the axis reference values for all axes. The reference value is position along a world coordinate axis that corresponds to the data location given by the "refposition" metadatum.
Parameters:
in - values to be set
 o setAxisRefvalue
  public void setAxisRefvalue(double in[])
set the axis reference values for all axes. The reference value is position along a world coordinate axis that corresponds to the data location given by the "refposition" metadatum.
Parameters:
in - values to be set
 o setAxisRefvalue
  public void setAxisRefvalue(int axis,
                              double in)
set the axis reference value for the specified axis. The reference value is position along a world coordinate axis that corresponds to the data location given by the "refposition" metadatum.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - value to be set
 o setAxisRefposition
  public static void setAxisRefposition(Metadata md,
                                        int axis,
                                        double in)
set the axis reference position for the specified axis. The reference position is position along a data set axis that corresponds to the world coordinate position given by the "refvalue" metadatum.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - value to be set
 o setAxisRefposition
  public static void setAxisRefposition(Metadata md,
                                        double in[])
set the axis reference position for all axes. The reference position is position along a data set axis that corresponds to the world coordinate position given by the "refvalue" metadatum.
Parameters:
in - values to be set
 o setAxisRefposition
  public void setAxisRefposition(double in[])
set the axis reference position for all axes. The reference position is position along a data set axis that corresponds to the world coordinate position given by the "refvalue" metadatum.
Parameters:
in - values to be set
 o setAxisRefposition
  public void setAxisRefposition(int axis,
                                 double in)
set the axis reference position for the specified axis. The reference position is position along a data set axis that corresponds to the world coordinate position given by the "refvalue" metadatum.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - value to be set
 o setAxisStepsize
  public static void setAxisStepsize(Metadata md,
                                     int axis,
                                     double in)
set the axis step size for the specified axis. The step size is length of a voxel along an axis in world coordinate units.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - value to be set
 o setAxisStepsize
  public static void setAxisStepsize(Metadata md,
                                     double in[])
set the axis step size for all axes. The step size is length of a voxel along an axis in world coordinate units.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - values to be set
 o setAxisStepsize
  public void setAxisStepsize(double in[])
set the axis step size for all axes. The step size is length of a voxel along an axis in world coordinate units.
Parameters:
in - values to be set
 o setAxisStepsize
  public void setAxisStepsize(int axis,
                              double in)
set the axis step size for the specified axis. The step size is length of a voxel along an axis in world coordinate units.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - value to be set
 o setAxisRefoffset
  public void setAxisRefoffset(int axis,
                               double in)
set the axis reference offset for the specified axis. An offset equal to zero indicates that the reference position refers to the center of the reference voxel. -0.5 indicates that the position corresponds to the beginning of the voxel; +0.5, the end. If the reference voxel assumes that the first voxel has an index of 1, an extra 1 should be subtracted from the reference offset.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - value to be set
 o setAxisRefoffset
  public static void setAxisRefoffset(Metadata md,
                                      int axis,
                                      double in)
set the axis reference offset for the specified axis. An offset equal to zero indicates that the reference position refers to the center of the reference voxel. -0.5 indicates that the position corresponds to the beginning of the voxel; +0.5, the end. If the reference voxel assumes that the first voxel has an index of 1, an extra 1 should be subtracted from the reference offset.
Parameters:
axis - the index of the axis to be set (first axis has index 0)
in - value to be set
 o setAxisRefoffset
  public static void setAxisRefoffset(Metadata md,
                                      double in[])
set the axis reference offsets for all axes. An offset equal to zero indicates that the reference position refers to the center of the reference voxel. -0.5 indicates that the position corresponds to the beginning of the voxel; +0.5, the end. If the reference voxel assumes that the first voxel has an index of 1, an extra 1 should be subtracted from the reference offset.
Parameters:
in - value to be set
 o setAxisRefoffset
  public void setAxisRefoffset(double in[])
set the axis reference offsets for all axes. An offset equal to zero indicates that the reference position refers to the center of the reference voxel. -0.5 indicates that the position corresponds to the beginning of the voxel; +0.5, the end. If the reference voxel assumes that the first voxel has an index of 1, an extra 1 should be subtracted from the reference offset.
Parameters:
in - value to be set
 o setAxisFormatter
  public static void setAxisFormatter(Metadata md,
                                      int axis,
                                      AxisPosFormatter in)
set the axis formatter object for a specified axis. An AxisPosFormatter object is used to convert a coordinate position into a formatted string.
Parameters:
md - the metadata to operate on
axis - the index of the axis to be set (first axis has index 0)
in - the formatter object to be set
 o setAxisFormatter
  public static void setAxisFormatter(Metadata md,
                                      AxisPosFormatter in[])
set the axis formatter objects for all axes. An AxisPosFormatter object is used to convert a coordinate position into a formatted string.
Parameters:
md - the metadata to operate on
in - the formatter objects to be set
 o setAxisFormatter
  public void setAxisFormatter(AxisPosFormatter in[])
set the axis formatter objects for all axes. An AxisPosFormatter object is used to convert a coordinate position into a formatted string.
Parameters:
in - the formatter objects to be set
 o setAxisFormatter
  public void setAxisFormatter(int axis,
                               AxisPosFormatter in)
set the axis formatter object for a specified axis. An AxisPosFormatter object is used to convert a coordinate position into a formatted string.
 o put
  public Object put(Object inkey,
                    Object val)
update the value of a metadatum. If the key is recognized as a standard coordinate metadatum name, the value is checked to ensure it has the proper type
Parameters:
inkey - the key name (should be of type String)
val - the value to set for the metadatum with key name
Returns:
s Object the previous value, or null if either the key is not of type string or the value is of an improper type.
Overrides:
put in class Hashtable
 o getAxisNames
  public static String[] getAxisNames(Metadata in)
extract the String array of axis names from the metadatum list (i.e. the "Axes[n].name" metadatum); null is returned if not found (or is of the wrong type).
 o getAxisTypes
  public static String[] getAxisTypes(Metadata in)
extract the String array of axis types from the metadatum list (i.e. the "Axes[n].type" metadatum); null is returned if not found (or is of the wrong type).
 o getAxisStrings
  protected static String[] getAxisStrings(String mdname,
                                           Metadata in)
 o indicesMatchingString
  protected static Integer[] indicesMatchingString(String s[],
                                                   int toffset,
                                                   String value,
                                                   int ooffset,
                                                   int len)
 o axesMatchingType
  public static Integer[] axesMatchingType(Metadata in,
                                           int toffset,
                                           String value,
                                           int ooffset,
                                           int len)
return the indices for axes in the input Metadata (as an array of Integers) whose types match a particular value.
Parameters:
in - input Metadata list to search
toffset - begin search of Metadatum value at position toffset
value - metadatum value to compare to
ooffset - compare to substring of value starting at position ooffset
len - use first len characters in comparison. If len=0, compare first value.length() characters; if len<0, look for an exact match (of substrings using toffset and ooffset).
Returns:
s an Integer array containing the key names, or null if none were found.
 o axesMatchingType
  public static Integer[] axesMatchingType(Metadata in,
                                           String value,
                                           int len)
same as Integer[] axesMatchingType(in, 0, value, 0, len)
 o axisExactlyMatchingType
  public static Integer axisExactlyMatchingType(Metadata in,
                                                String value)
return index for the axis in input Metadata with type exactly matching input value. This is the like (axisMatchingType(in, 0, value, 0, -1))[0] (assuming AxisMatchingType did not return null).
 o firstAxisMatchingType
  public static Integer firstAxisMatchingType(Metadata in,
                                              int toffset,
                                              String value,
                                              int ooffset,
                                              int len)
return index for the first axis in the input Metadata with a type matching the input value.
Parameters:
in - input Metadata list to search
toffset - begin search of Metadatum value at position toffset
value - metadatum value to compare to
ooffset - compare to substring of value starting at position ooffset
len - use first len characters in comparison. If len=0, compare first value.length() characters; if len<0, look for an exact match (of substrings using toffset and ooffset).
Returns:
s an Integer containing the index of the axis, or null if a was not found.
 o firstAxisMatchingType
  public static Integer firstAxisMatchingType(Metadata in,
                                              String value)
same as String firstAxisMatchingType(in, 0, value, 0, 0)
 o axesMatchingName
  public static Integer[] axesMatchingName(Metadata in,
                                           int toffset,
                                           String value,
                                           int ooffset,
                                           int len)
return the indices for axes in the input Metadata (as an array of Integers) whose names match a particular value.
Parameters:
in - input Metadata list to search
toffset - begin search of Metadatum value at position toffset
value - metadatum value to compare to
ooffset - compare to substring of value starting at position ooffset
len - use first len characters in comparison. If len=0, compare first value.length() characters; if len<0, look for an exact match (of substrings using toffset and ooffset).
Returns:
s an Integer array containing the key names, or null if none were found.
 o axesMatchingName
  public static Integer[] axesMatchingName(Metadata in,
                                           String value,
                                           int len)
same as Integer[] axesMatchingName(in, 0, value, 0, len)
 o axisExactlyMatchingName
  public static Integer axisExactlyMatchingName(Metadata in,
                                                String value)
return index for the axis in input Metadata with type exactly matching input value. This is the like (AxisMatchingName(in, 0, value, 0, -1))[0] (assuming AxisMatchingName did not return null).
 o firstAxisMatchingName
  public static Integer firstAxisMatchingName(Metadata in,
                                              int toffset,
                                              String value,
                                              int ooffset,
                                              int len)
return index for the first axis in the input Metadata with a type matching the input value.
Parameters:
in - input Metadata list to search
toffset - begin search of Metadatum value at position toffset
value - metadatum value to compare to
ooffset - compare to substring of value starting at position ooffset
len - use first len characters in comparison. If len=0, compare first value.length() characters; if len<0, look for an exact match (of substrings using toffset and ooffset).
Returns:
s an Integer containing the index of the axis, or null if a was not found.
 o firstAxisMatchingName
  public static Integer firstAxisMatchingName(Metadata in,
                                              String value)
same as String firstAxisMatchingName(in, 0, value, 0, 0)
 o usesHorizonSchema
  public static boolean usesHorizonSchema(Metadata in)
returns true if Metadata claims to use the "horizon" schema
 o usesReferencedAxis
  public static boolean usesReferencedAxis(Metadata in,
                                           int axis)
returns true if Metadata claims to use the "horizon" schema

All Packages  Class Hierarchy  This Package  Previous  Next  Index