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.
-
Axes
-
-
axisSchema
-
-
formatter
-
-
horizonSchema
-
-
label
-
-
name
-
-
naxes
-
-
refoffset
-
-
refposition
-
-
refvalue
-
-
stepsize
-
-
type
-
-
version
- version of horizon schema supported by this object
-
CoordMetadata()
- Construct a CoordMetadata object with one axis with default
values for the standard coordinate metadata
-
CoordMetadata(boolean)
-
-
CoordMetadata(int)
- Creates an empty metadatum list with specified defaults.
-
CoordMetadata(int, Metadata)
- Create a Metadata object describing a coordinate system with a
given number of axes.
-
CoordMetadata(Metadata)
- Creates an empty metadatum list with specified defaults.
-
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.
-
axesMatchingName(Metadata, String, int)
- same as Integer[] axesMatchingName(in, 0, value, 0, len)
-
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.
-
axesMatchingType(Metadata, String, int)
- same as Integer[] axesMatchingType(in, 0, value, 0, len)
-
axisExactlyMatchingName(Metadata, String)
-
return index for the axis in input Metadata with type exactly matching
input value.
-
axisExactlyMatchingType(Metadata, String)
-
return index for the axis in input Metadata with type exactly matching
input value.
-
firstAxisMatchingName(Metadata, int, String, int, int)
- return index for the first axis in the input Metadata
with a type matching the input value.
-
firstAxisMatchingName(Metadata, String)
- same as String firstAxisMatchingName(in, 0, value, 0, 0)
-
firstAxisMatchingType(Metadata, int, String, int, int)
- return index for the first axis in the input Metadata
with a type matching the input value.
-
firstAxisMatchingType(Metadata, String)
- same as String firstAxisMatchingType(in, 0, value, 0, 0)
-
getAxisNames(Metadata)
- extract the String array of axis names from the metadatum list
(i.e.
-
getAxisStrings(String, Metadata)
-
-
getAxisTypes(Metadata)
- extract the String array of axis types from the metadatum list
(i.e.
-
getNaxes()
- return the current number of axes in the coordinate system
-
getNaxes(Metadata)
- return the current number of axes in the coordinate system
described by the input Metadata
-
indicesMatchingString(String[], int, String, int, int)
-
-
initMetadata(int)
-
-
put(Object, Object)
- update the value of a metadatum.
-
setAxes(Metadata, Metavector)
- set the Axes object
-
setAxes(Metavector)
- set the Axes object
-
setAxisFormatter(AxisPosFormatter[])
- set the axis formatter objects for all axes.
-
setAxisFormatter(int, AxisPosFormatter)
- set the axis formatter object for a specified axis.
-
setAxisFormatter(Metadata, AxisPosFormatter[])
- set the axis formatter objects for all axes.
-
setAxisFormatter(Metadata, int, AxisPosFormatter)
- set the axis formatter object for a specified axis.
-
setAxisLabel(int, Object)
- set the axis label for the specified axis.
-
setAxisLabel(Metadata, int, String)
- set the axis label for the specified axis.
-
setAxisLabel(Metadata, String[])
- set the axis labels which are usually
used when printing out coordinate positions.
-
setAxisLabel(String[])
- set the axis labels which are usually
used when printing out coordinate positions.
-
setAxisName(int, String)
- set the axis name for the specified axis.
-
setAxisName(Metadata, int, String)
- set the axis name for the specified axis.
-
setAxisName(Metadata, String[])
- set the axis names.
-
setAxisName(String[])
- set the axis names.
-
setAxisObject(Metadata, int, String, Object)
- set an Axes metadatum
-
setAxisRefoffset(double[])
- set the axis reference offsets for all axes.
-
setAxisRefoffset(int, double)
- set the axis reference offset for the specified axis.
-
setAxisRefoffset(Metadata, double[])
- set the axis reference offsets for all axes.
-
setAxisRefoffset(Metadata, int, double)
- set the axis reference offset for the specified axis.
-
setAxisRefposition(double[])
- set the axis reference position for all axes.
-
setAxisRefposition(int, double)
- set the axis reference position for the specified axis.
-
setAxisRefposition(Metadata, double[])
- set the axis reference position for all axes.
-
setAxisRefposition(Metadata, int, double)
- set the axis reference position for the specified axis.
-
setAxisRefvalue(double[])
- set the axis reference values for all axes.
-
setAxisRefvalue(int, double)
- set the axis reference value for the specified axis.
-
setAxisRefvalue(Metadata, double[])
- set the axis reference values for all axes.
-
setAxisRefvalue(Metadata, int, double)
- set the axis reference value for the specified axis.
-
setAxisStepsize(double[])
- set the axis step size for all axes.
-
setAxisStepsize(int, double)
- set the axis step size for the specified axis.
-
setAxisStepsize(Metadata, double[])
- set the axis step size for all axes.
-
setAxisStepsize(Metadata, int, double)
- set the axis step size for the specified axis.
-
setAxisType(int, String)
- set the axis type for the specified axis.
-
setAxisType(Metadata, int, String)
- set the axis type for the specified axis.
-
setAxisType(Metadata, String[])
- set the axis types.
-
setAxisType(String[])
- set the axis types.
-
setName(Metadata, String)
- set the name of the coordinate system
-
setName(String)
- set the name of the coordinate system
-
setNaxes(int)
- set the number of axes in the coordinate system
-
setNaxes(Metadata, int)
- set the number of axes in the coordinate system
-
usesHorizonSchema(Metadata)
- returns true if Metadata claims to use the "horizon" schema
-
usesReferencedAxis(Metadata, int)
- returns true if Metadata claims to use the "horizon" schema
horizonSchema
public final static String horizonSchema
version
public final static String version
- version of horizon schema supported by this object
Axes
public final static String Axes
naxes
public final static String naxes
name
public final static String name
axisSchema
public final static String axisSchema
type
public final static String type
label
public final static String label
formatter
public final static String formatter
refposition
public final static String refposition
refvalue
public final static String refvalue
stepsize
public final static String stepsize
refoffset
public final static String refoffset
CoordMetadata
public CoordMetadata()
- Construct a CoordMetadata object with one axis with default
values for the standard coordinate metadata
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
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
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.
CoordMetadata
protected CoordMetadata(boolean setDefaults)
initMetadata
protected void initMetadata(int nax)
getNaxes
public static int getNaxes(Metadata md)
- return the current number of axes in the coordinate system
described by the input Metadata
getNaxes
public int getNaxes()
- return the current number of axes in the coordinate system
setNaxes
public static void setNaxes(Metadata md,
int nax) throws ArrayIndexOutOfBoundsException
- set the number of axes in the coordinate system
setNaxes
public void setNaxes(int nax) throws ArrayIndexOutOfBoundsException
- set the number of axes in the coordinate system
setName
public static void setName(Metadata md,
String in)
- set the name of the coordinate system
setName
public void setName(String in)
- set the name of the coordinate system
setAxes
protected static void setAxes(Metadata md,
Metavector axmv)
- set the Axes object
setAxes
protected void setAxes(Metavector mv)
- set the Axes object
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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).
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).
getAxisStrings
protected static String[] getAxisStrings(String mdname,
Metadata in)
indicesMatchingString
protected static Integer[] indicesMatchingString(String s[],
int toffset,
String value,
int ooffset,
int len)
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.
axesMatchingType
public static Integer[] axesMatchingType(Metadata in,
String value,
int len)
- same as Integer[] axesMatchingType(in, 0, value, 0, len)
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).
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.
firstAxisMatchingType
public static Integer firstAxisMatchingType(Metadata in,
String value)
- same as String firstAxisMatchingType(in, 0, value, 0, 0)
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.
axesMatchingName
public static Integer[] axesMatchingName(Metadata in,
String value,
int len)
- same as Integer[] axesMatchingName(in, 0, value, 0, len)
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).
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.
firstAxisMatchingName
public static Integer firstAxisMatchingName(Metadata in,
String value)
- same as String firstAxisMatchingName(in, 0, value, 0, 0)
usesHorizonSchema
public static boolean usesHorizonSchema(Metadata in)
- returns true if Metadata claims to use the "horizon" schema
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