public final class MetadataTools
extends java.lang.Object
MetadataStore
, MetadataRetrieve
,
and OME-XML strings.
Most of the methods require the optional loci.formats.ome
package, and optional ome-xml.jar library, to be present at runtime.Modifier and Type | Field and Description |
---|---|
private static boolean |
defaultDateEnabled |
private static org.slf4j.Logger |
LOGGER |
Modifier | Constructor and Description |
---|---|
private |
MetadataTools() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
createLSID(java.lang.String type,
int... indices)
Constructs an LSID, given the object type and indices.
|
static IMetadata |
createOMEXMLMetadata()
Creates an OME-XML metadata object using reflection, to avoid
direct dependencies on the optional
loci.formats.ome package. |
static ome.xml.model.enums.AcquisitionMode |
getAcquisitionMode(java.lang.String value)
Retrieves an
AcquisitionMode enumeration
value for the given String. |
static ome.xml.model.enums.ArcType |
getArcType(java.lang.String value)
Retrieves an
ArcType enumeration
value for the given String. |
static ome.xml.model.enums.Binning |
getBinning(java.lang.String value)
Retrieves an
Binning enumeration
value for the given String. |
static ome.xml.model.enums.Compression |
getCompression(java.lang.String value)
Retrieves an
Compression enumeration
value for the given String. |
static ome.xml.model.enums.ContrastMethod |
getContrastMethod(java.lang.String value)
Retrieves an
ContrastMethod enumeration
value for the given String. |
static ome.xml.model.enums.Correction |
getCorrection(java.lang.String value)
Retrieves an
Correction enumeration
value for the given String. |
static ome.xml.model.enums.DetectorType |
getDetectorType(java.lang.String value)
Retrieves an
DetectorType enumeration
value for the given String. |
static ome.xml.model.enums.DimensionOrder |
getDimensionOrder(java.lang.String value)
Retrieves an
DimensionOrder enumeration
value for the given String. |
static ome.xml.model.enums.ExperimentType |
getExperimentType(java.lang.String value)
Retrieves an
ExperimentType enumeration
value for the given String. |
static ome.xml.model.enums.FilamentType |
getFilamentType(java.lang.String value)
Retrieves an
FilamentType enumeration
value for the given String. |
static ome.xml.model.enums.FillRule |
getFillRule(java.lang.String value)
Retrieves an
FillRule enumeration
value for the given String. |
static ome.xml.model.enums.FilterType |
getFilterType(java.lang.String value)
Retrieves an
FilterType enumeration
value for the given String. |
static ome.xml.model.enums.FontFamily |
getFontFamily(java.lang.String value)
Retrieves an
FontFamily enumeration
value for the given String. |
static ome.xml.model.enums.FontStyle |
getFontStyle(java.lang.String value)
Retrieves an
FontStyle enumeration
value for the given String. |
static ome.xml.model.enums.IlluminationType |
getIlluminationType(java.lang.String value)
Retrieves an
IlluminationType enumeration
value for the given String. |
static ome.xml.model.enums.Immersion |
getImmersion(java.lang.String value)
Retrieves an
Immersion enumeration
value for the given String. |
static ome.xml.model.enums.LaserMedium |
getLaserMedium(java.lang.String value)
Retrieves an
LaserMedium enumeration
value for the given String. |
static ome.xml.model.enums.LaserType |
getLaserType(java.lang.String value)
Retrieves an
LaserType enumeration
value for the given String. |
static ome.xml.model.enums.Marker |
getMarker(java.lang.String value)
Retrieves an
Marker enumeration
value for the given String. |
static ome.xml.model.enums.Medium |
getMedium(java.lang.String value)
Retrieves an
Medium enumeration
value for the given String. |
static ome.xml.model.enums.MicrobeamManipulationType |
getMicrobeamManipulationType(java.lang.String value)
Retrieves an
MicrobeamManipulationType
enumeration value for the given String. |
static ome.xml.model.enums.MicroscopeType |
getMicroscopeType(java.lang.String value)
Retrieves an
MicroscopeType enumeration
value for the given String. |
static ome.xml.model.enums.NamingConvention |
getNamingConvention(java.lang.String value)
Retrieves an
NamingConvention enumeration
value for the given String. |
static ome.xml.model.enums.PixelType |
getPixelType(java.lang.String value)
Retrieves an
PixelType enumeration
value for the given String. |
static ome.xml.model.enums.Pulse |
getPulse(java.lang.String value)
Retrieves an
Pulse enumeration
value for the given String. |
static java.lang.String[] |
keys(java.util.Hashtable<java.lang.String,java.lang.Object> meta)
Gets a sorted list of keys from the given hashtable.
|
static java.lang.String |
makeSaneDimensionOrder(java.lang.String dimensionOrder)
Adjusts the given dimension order as needed so that it contains exactly
one of each of the following characters: 'X', 'Y', 'Z', 'C', 'T'.
|
static void |
merge(java.util.Map<java.lang.String,java.lang.Object> src,
java.util.Map<java.lang.String,java.lang.Object> dest,
java.lang.String prefix)
Merges the given lists of metadata, prepending the
specified prefix for the destination keys.
|
static void |
populateMetadata(MetadataStore store,
int series,
java.lang.String imageName,
boolean littleEndian,
java.lang.String dimensionOrder,
java.lang.String pixelType,
int sizeX,
int sizeY,
int sizeZ,
int sizeC,
int sizeT,
int samplesPerPixel)
Populates the given
MetadataStore , for the specified series, using
the provided values. |
static void |
populateMetadata(MetadataStore store,
int series,
java.lang.String imageName,
CoreMetadata coreMeta)
Populates the given
MetadataStore , for the specified series, using
the values from the provided CoreMetadata . |
static void |
populateMetadata(MetadataStore store,
java.lang.String file,
int series,
java.lang.String imageName,
boolean littleEndian,
java.lang.String dimensionOrder,
java.lang.String pixelType,
int sizeX,
int sizeY,
int sizeZ,
int sizeC,
int sizeT,
int samplesPerPixel)
Populates the given
MetadataStore , for the specified series, using
the provided values. |
static void |
populatePixels(MetadataStore store,
IFormatReader r)
Populates the Pixels element of the given metadata store, using core
metadata from the given reader.
|
static void |
populatePixels(MetadataStore store,
IFormatReader r,
boolean doPlane)
Populates the Pixels element of the given metadata store, using core
metadata from the given reader.
|
static void |
populatePixels(MetadataStore store,
IFormatReader r,
boolean doPlane,
boolean doImageName)
Populates the Pixels element of the given metadata store, using core
metadata from the given reader.
|
static void |
populatePixelsOnly(MetadataStore store,
IFormatReader r) |
static void |
populatePixelsOnly(MetadataStore store,
int series,
boolean littleEndian,
java.lang.String dimensionOrder,
java.lang.String pixelType,
int sizeX,
int sizeY,
int sizeZ,
int sizeC,
int sizeT,
int samplesPerPixel) |
static void |
setDefaultCreationDate(MetadataStore store,
java.lang.String id,
int series)
Sets a default creation date.
|
static void |
setDefaultDateEnabled(boolean enabled)
Disables the setting of a default creation date.
|
static void |
verifyMinimumPopulated(MetadataRetrieve src)
Checks whether the given metadata object has the minimum metadata
populated to successfully describe an Image.
|
static void |
verifyMinimumPopulated(MetadataRetrieve src,
int n)
Checks whether the given metadata object has the minimum metadata
populated to successfully describe the nth Image.
|
private static final org.slf4j.Logger LOGGER
private static boolean defaultDateEnabled
public static void populatePixels(MetadataStore store, IFormatReader r)
populatePixels(MetadataStore, IFormatReader, boolean, boolean)
with doPlane
set to false
and doImageName
set to
true
.store
- The metadata store whose Pixels should be populatedr
- The format reader whose core metadata should be usedpublic static void populatePixels(MetadataStore store, IFormatReader r, boolean doPlane)
doPlane
flag is set,
then the Plane elements will be populated as well.
Delegates to
populatePixels(MetadataStore, IFormatReader, boolean, boolean)
with doImageName
set to true
.store
- The metadata store whose Pixels should be populatedr
- The format reader whose core metadata should be useddoPlane
- Specifies whether Plane elements should be populatedpublic static void populatePixels(MetadataStore store, IFormatReader r, boolean doPlane, boolean doImageName)
doPlane
flag is set,
then the Plane elements will be populated as well. If the
doImageName
flag is set, then the image name will be populated as
well.store
- The metadata store whose Pixels should be populatedr
- The format reader whose core metadata should be useddoPlane
- Specifies whether Plane elements should be populateddoImageName
- Specifies whether the Image name should be populatedpublic static void populateMetadata(MetadataStore store, int series, java.lang.String imageName, CoreMetadata coreMeta)
MetadataStore
, for the specified series, using
the values from the provided CoreMetadata
.
After calling this method, the metadata store will be sufficiently
populated for use with an IFormatWriter
(assuming it is also a
MetadataRetrieve
).
public static void populateMetadata(MetadataStore store, int series, java.lang.String imageName, boolean littleEndian, java.lang.String dimensionOrder, java.lang.String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel)
MetadataStore
, for the specified series, using
the provided values.
After calling this method, the metadata store will be sufficiently
populated for use with an IFormatWriter
(assuming it is also a
MetadataRetrieve
).
public static void populateMetadata(MetadataStore store, java.lang.String file, int series, java.lang.String imageName, boolean littleEndian, java.lang.String dimensionOrder, java.lang.String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel)
MetadataStore
, for the specified series, using
the provided values.
After calling this method, the metadata store will be sufficiently
populated for use with an IFormatWriter
(assuming it is also a
MetadataRetrieve
).
public static void populatePixelsOnly(MetadataStore store, IFormatReader r)
public static void populatePixelsOnly(MetadataStore store, int series, boolean littleEndian, java.lang.String dimensionOrder, java.lang.String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel)
public static java.lang.String createLSID(java.lang.String type, int... indices)
public static void verifyMinimumPopulated(MetadataRetrieve src) throws FormatException
FormatException
- if there is a missing metadata field,
or the metadata object is uninitializedpublic static void verifyMinimumPopulated(MetadataRetrieve src, int n) throws FormatException
FormatException
- if there is a missing metadata field,
or the metadata object is uninitializedpublic static void setDefaultDateEnabled(boolean enabled)
enabled
- See above.setDefaultCreationDate(MetadataStore, String, int)
public static void setDefaultCreationDate(MetadataStore store, java.lang.String id, int series)
setDefaultDateEnabled(boolean)
public static java.lang.String makeSaneDimensionOrder(java.lang.String dimensionOrder)
public static java.lang.String[] keys(java.util.Hashtable<java.lang.String,java.lang.Object> meta)
public static void merge(java.util.Map<java.lang.String,java.lang.Object> src, java.util.Map<java.lang.String,java.lang.Object> dest, java.lang.String prefix)
public static IMetadata createOMEXMLMetadata()
loci.formats.ome
package.AbstractOMEXMLMetadata
,
or null if one cannot be created.public static ome.xml.model.enums.AcquisitionMode getAcquisitionMode(java.lang.String value) throws FormatException
AcquisitionMode
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.ArcType getArcType(java.lang.String value) throws FormatException
ArcType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.Binning getBinning(java.lang.String value) throws FormatException
Binning
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.Compression getCompression(java.lang.String value) throws FormatException
Compression
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.ContrastMethod getContrastMethod(java.lang.String value) throws FormatException
ContrastMethod
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.Correction getCorrection(java.lang.String value) throws FormatException
Correction
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.DetectorType getDetectorType(java.lang.String value) throws FormatException
DetectorType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.DimensionOrder getDimensionOrder(java.lang.String value) throws FormatException
DimensionOrder
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.ExperimentType getExperimentType(java.lang.String value) throws FormatException
ExperimentType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.FilamentType getFilamentType(java.lang.String value) throws FormatException
FilamentType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.FillRule getFillRule(java.lang.String value) throws FormatException
FillRule
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.FilterType getFilterType(java.lang.String value) throws FormatException
FilterType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.FontFamily getFontFamily(java.lang.String value) throws FormatException
FontFamily
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.FontStyle getFontStyle(java.lang.String value) throws FormatException
FontStyle
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.IlluminationType getIlluminationType(java.lang.String value) throws FormatException
IlluminationType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.Immersion getImmersion(java.lang.String value) throws FormatException
Immersion
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.LaserMedium getLaserMedium(java.lang.String value) throws FormatException
LaserMedium
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.LaserType getLaserType(java.lang.String value) throws FormatException
LaserType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.Marker getMarker(java.lang.String value) throws FormatException
Marker
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.Medium getMedium(java.lang.String value) throws FormatException
Medium
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.MicrobeamManipulationType getMicrobeamManipulationType(java.lang.String value) throws FormatException
MicrobeamManipulationType
enumeration value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.MicroscopeType getMicroscopeType(java.lang.String value) throws FormatException
MicroscopeType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.NamingConvention getNamingConvention(java.lang.String value) throws FormatException
NamingConvention
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.PixelType getPixelType(java.lang.String value) throws FormatException
PixelType
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
public static ome.xml.model.enums.Pulse getPulse(java.lang.String value) throws FormatException
Pulse
enumeration
value for the given String.ome.xml.model.enums.EnumerationException
- if an appropriate
enumeration value is not found.FormatException
Copyright © 2024 Open Microscopy Environment