Package loci.formats
Class MetadataTools
java.lang.Object
loci.formats.MetadataTools
A utility class for working with metadata objects,
including
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.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateLSID(String type, int... indices) Constructs an LSID, given the object type and indices.static IMetadataCreates an OME-XML metadata object using reflection, to avoid direct dependencies on the optionalloci.formats.omepackage.static AcquisitionModegetAcquisitionMode(String value) Retrieves anAcquisitionModeenumeration value for the given String.static ArcTypegetArcType(String value) Retrieves anArcTypeenumeration value for the given String.static BinninggetBinning(String value) Retrieves anBinningenumeration value for the given String.static CompressiongetCompression(String value) Retrieves anCompressionenumeration value for the given String.static ContrastMethodgetContrastMethod(String value) Retrieves anContrastMethodenumeration value for the given String.static CorrectiongetCorrection(String value) Retrieves anCorrectionenumeration value for the given String.static DetectorTypegetDetectorType(String value) Retrieves anDetectorTypeenumeration value for the given String.static DimensionOrdergetDimensionOrder(String value) Retrieves anDimensionOrderenumeration value for the given String.static ExperimentTypegetExperimentType(String value) Retrieves anExperimentTypeenumeration value for the given String.static FilamentTypegetFilamentType(String value) Retrieves anFilamentTypeenumeration value for the given String.static FillRulegetFillRule(String value) Retrieves anFillRuleenumeration value for the given String.static FilterTypegetFilterType(String value) Retrieves anFilterTypeenumeration value for the given String.static FontFamilygetFontFamily(String value) Retrieves anFontFamilyenumeration value for the given String.static FontStylegetFontStyle(String value) Retrieves anFontStyleenumeration value for the given String.static IlluminationTypegetIlluminationType(String value) Retrieves anIlluminationTypeenumeration value for the given String.static ImmersiongetImmersion(String value) Retrieves anImmersionenumeration value for the given String.static LaserMediumgetLaserMedium(String value) Retrieves anLaserMediumenumeration value for the given String.static LaserTypegetLaserType(String value) Retrieves anLaserTypeenumeration value for the given String.static MarkerRetrieves anMarkerenumeration value for the given String.static MediumRetrieves anMediumenumeration value for the given String.static MicrobeamManipulationTypeRetrieves anMicrobeamManipulationTypeenumeration value for the given String.static MicroscopeTypegetMicroscopeType(String value) Retrieves anMicroscopeTypeenumeration value for the given String.static NamingConventiongetNamingConvention(String value) Retrieves anNamingConventionenumeration value for the given String.static PixelTypegetPixelType(String value) Retrieves anPixelTypeenumeration value for the given String.static PulseRetrieves anPulseenumeration value for the given String.static String[]Gets a sorted list of keys from the given hashtable.static StringmakeSaneDimensionOrder(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 voidMerges the given lists of metadata, prepending the specified prefix for the destination keys.static voidpopulateMetadata(MetadataStore store, int series, String imageName, boolean littleEndian, String dimensionOrder, String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel) Populates the givenMetadataStore, for the specified series, using the provided values.static voidpopulateMetadata(MetadataStore store, int series, String imageName, CoreMetadata coreMeta) Populates the givenMetadataStore, for the specified series, using the values from the providedCoreMetadata.static voidpopulateMetadata(MetadataStore store, String file, int series, String imageName, boolean littleEndian, String dimensionOrder, String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel) Populates the givenMetadataStore, for the specified series, using the provided values.static voidpopulatePixels(MetadataStore store, IFormatReader r) Populates the Pixels element of the given metadata store, using core metadata from the given reader.static voidpopulatePixels(MetadataStore store, IFormatReader r, boolean doPlane) Populates the Pixels element of the given metadata store, using core metadata from the given reader.static voidpopulatePixels(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 voidpopulatePixelsOnly(MetadataStore store, int series, boolean littleEndian, String dimensionOrder, String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel) static voidpopulatePixelsOnly(MetadataStore store, IFormatReader r) static voidsetDefaultCreationDate(MetadataStore store, String id, int series) Sets a default creation date.static voidsetDefaultDateEnabled(boolean enabled) Disables the setting of a default creation date.static voidChecks whether the given metadata object has the minimum metadata populated to successfully describe an Image.static voidverifyMinimumPopulated(MetadataRetrieve src, int n) Checks whether the given metadata object has the minimum metadata populated to successfully describe the nth Image.
-
Method Details
-
populatePixels
Populates the Pixels element of the given metadata store, using core metadata from the given reader. Delegate topopulatePixels(MetadataStore, IFormatReader, boolean, boolean)withdoPlaneset tofalseanddoImageNameset totrue.- Parameters:
store- The metadata store whose Pixels should be populatedr- The format reader whose core metadata should be used
-
populatePixels
Populates the Pixels element of the given metadata store, using core metadata from the given reader. If thedoPlaneflag is set, then the Plane elements will be populated as well. Delegates topopulatePixels(MetadataStore, IFormatReader, boolean, boolean)withdoImageNameset totrue.- Parameters:
store- The metadata store whose Pixels should be populatedr- The format reader whose core metadata should be useddoPlane- Specifies whether Plane elements should be populated
-
populatePixels
public 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. If thedoPlaneflag is set, then the Plane elements will be populated as well. If thedoImageNameflag is set, then the image name will be populated as well.- Parameters:
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 populated
-
populateMetadata
public static void populateMetadata(MetadataStore store, int series, String imageName, CoreMetadata coreMeta) Populates the givenMetadataStore, for the specified series, using the values from the providedCoreMetadata.After calling this method, the metadata store will be sufficiently populated for use with an
IFormatWriter(assuming it is also aMetadataRetrieve). -
populateMetadata
public static void populateMetadata(MetadataStore store, int series, String imageName, boolean littleEndian, String dimensionOrder, String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel) Populates the givenMetadataStore, 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 aMetadataRetrieve). -
populateMetadata
public static void populateMetadata(MetadataStore store, String file, int series, String imageName, boolean littleEndian, String dimensionOrder, String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel) Populates the givenMetadataStore, 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 aMetadataRetrieve). -
populatePixelsOnly
-
populatePixelsOnly
public static void populatePixelsOnly(MetadataStore store, int series, boolean littleEndian, String dimensionOrder, String pixelType, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int samplesPerPixel) -
createLSID
Constructs an LSID, given the object type and indices. For example, if the arguments are "Detector", 1, and 0, the LSID will be "Detector:1:0". -
verifyMinimumPopulated
Checks whether the given metadata object has the minimum metadata populated to successfully describe an Image.- Throws:
FormatException- if there is a missing metadata field, or the metadata object is uninitialized
-
verifyMinimumPopulated
Checks whether the given metadata object has the minimum metadata populated to successfully describe the nth Image.- Throws:
FormatException- if there is a missing metadata field, or the metadata object is uninitialized
-
setDefaultDateEnabled
public static void setDefaultDateEnabled(boolean enabled) Disables the setting of a default creation date. By default, missing creation dates will be replaced with the corresponding file's last modification date, or the current time if the modification date is not available. Calling this method with the 'enabled' parameter set to 'false' causes missing creation dates to be left as null.- Parameters:
enabled- See above.- See Also:
-
setDefaultCreationDate
Sets a default creation date. If the named file exists, then the creation date is set to the file's last modification date. Otherwise, it is set to the current date.- See Also:
-
makeSaneDimensionOrder
Adjusts the given dimension order as needed so that it contains exactly one of each of the following characters: 'X', 'Y', 'Z', 'C', 'T'. -
keys
Gets a sorted list of keys from the given hashtable. -
merge
Merges the given lists of metadata, prepending the specified prefix for the destination keys. -
createOMEXMLMetadata
Creates an OME-XML metadata object using reflection, to avoid direct dependencies on the optionalloci.formats.omepackage.- Returns:
- A new instance of
AbstractOMEXMLMetadata, or null if one cannot be created.
-
getAcquisitionMode
Retrieves anAcquisitionModeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getArcType
Retrieves anArcTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getBinning
Retrieves anBinningenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getCompression
Retrieves anCompressionenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getContrastMethod
Retrieves anContrastMethodenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getCorrection
Retrieves anCorrectionenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getDetectorType
Retrieves anDetectorTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getDimensionOrder
Retrieves anDimensionOrderenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getExperimentType
Retrieves anExperimentTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getFilamentType
Retrieves anFilamentTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getFillRule
Retrieves anFillRuleenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getFilterType
Retrieves anFilterTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getFontFamily
Retrieves anFontFamilyenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getFontStyle
Retrieves anFontStyleenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getIlluminationType
Retrieves anIlluminationTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getImmersion
Retrieves anImmersionenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getLaserMedium
Retrieves anLaserMediumenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getLaserType
Retrieves anLaserTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getMarker
Retrieves anMarkerenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getMedium
Retrieves anMediumenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getMicrobeamManipulationType
public static MicrobeamManipulationType getMicrobeamManipulationType(String value) throws FormatException Retrieves anMicrobeamManipulationTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getMicroscopeType
Retrieves anMicroscopeTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getNamingConvention
Retrieves anNamingConventionenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getPixelType
Retrieves anPixelTypeenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-
getPulse
Retrieves anPulseenumeration value for the given String.- Throws:
EnumerationException- if an appropriate enumeration value is not found.FormatException
-