public class OMEXMLServiceImpl extends AbstractService implements OMEXMLService
Modifier and Type | Field and Description |
---|---|
static String |
LATEST_VERSION
Latest OME-XML version namespace.
|
private static org.slf4j.Logger |
LOGGER
Logger for this class.
|
static String |
NO_OME_XML_MSG |
private static Templates |
reorderXSLT
Reordering stylesheet.
|
private static String |
SCHEMA_PATH |
private static Templates |
update2003FC
Stylesheets for updating from previous schema releases.
|
private static Templates |
update200706 |
private static Templates |
update200802 |
private static Templates |
update200809 |
private static Templates |
update200909 |
private static Templates |
update201004 |
private static Templates |
update201006 |
private static Templates |
update201106 |
private static Templates |
update201206 |
private static Templates |
update201306 |
private static String |
XSLT_2003FC |
private static String |
XSLT_200706 |
private static String |
XSLT_200802 |
private static String |
XSLT_200809 |
private static String |
XSLT_200909 |
private static String |
XSLT_201004 |
private static String |
XSLT_201006 |
private static String |
XSLT_201106 |
private static String |
XSLT_201206 |
private static String |
XSLT_201306 |
private static String |
XSLT_PATH |
Constructor and Description |
---|
OMEXMLServiceImpl()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addMetadataOnly(OMEXMLMetadata omexmlMeta,
int image)
Insert a MetadataOnly element under the Image specified by 'index' in the
given OME-XML metadata object.
|
void |
addMetadataOnly(OMEXMLMetadata omexmlMeta,
int image,
boolean resolve)
Insert a MetadataOnly element under the Image specified by 'index' in the
given OME-XML metadata object.
|
void |
addModuloAlong(OMEXMLMetadata meta,
CoreMetadata core,
int imageIdx)
Adds ModuloAlong* annotations to the given OME-XML metadata object,
using the given CoreMetadata object to determine modulo dimensions.
|
MetadataRetrieve |
asRetrieve(MetadataStore meta)
Gets the given
MetadataStore object as a MetadataRetrieve . |
MetadataStore |
asStore(MetadataRetrieve meta)
Gets the given
MetadataRetrieve object as a MetadataStore . |
void |
convertMetadata(MetadataRetrieve src,
MetadataStore dest)
Copies information from a metadata retrieval object
(source) into a metadata store (destination).
|
void |
convertMetadata(String xml,
MetadataStore dest)
Converts information from an OME-XML string (source)
into a metadata store (destination).
|
private void |
createModulo(OMEXMLMetadata meta,
Modulo modulo,
StructuredAnnotations annotations,
Image image,
int imageIdx,
int annotationIndex,
int imageAnnotation)
Create a ModuloAlong* annotation corresponding to the given
Modulo . |
OMEXMLMetadata |
createOMEXMLMetadata()
Creates an OME-XML metadata object using reflection, to avoid
direct dependencies on the optional
loci.formats.ome package. |
OMEXMLMetadata |
createOMEXMLMetadata(String xml)
Creates an OME-XML metadata object using reflection, to avoid
direct dependencies on the optional
loci.formats.ome package,
wrapping a DOM representation of the given OME-XML string. |
OMEXMLMetadata |
createOMEXMLMetadata(String xml,
String version)
Creates an OME-XML metadata object using reflection, to avoid
direct dependencies on the optional
loci.formats.ome package,
wrapping a DOM representation of the given OME-XML string. |
OMEModelObject |
createOMEXMLRoot(String xml)
Constructs an OME root node.
|
private OMEXMLMetadataRoot |
createRoot(String xml)
Constructs an OME root node.
|
boolean |
equals(Node e1,
Node e2)
Compares two Elements for equality.
|
private Node |
findChildWithID(Node root,
String name,
String id)
Return the child node with specified value for the "ID" attribute.
|
private Node |
findRootNode(Node child)
Return the absolute root node for the specified child node.
|
String |
getLatestVersion()
Retrieves the latest supported version of the OME-XML schema.
|
private Modulo |
getModuloAlong(OMEXMLMetadata omexml,
String tag,
int image)
Create a
Modulo corresponding to the given ModuloAlong* tag. |
Modulo |
getModuloAlongC(OMEXMLMetadata omexml,
int image)
Retrieve the ModuloAlongC annotation in the given Image in the given
OME-XML metadata object.
|
Modulo |
getModuloAlongT(OMEXMLMetadata omexml,
int image)
Retrieve the ModuloAlongT annotation in the given Image in the given
OME-XML metadata object.
|
Modulo |
getModuloAlongZ(OMEXMLMetadata omexml,
int image)
Retrieve the ModuloAlongZ annotation in the given Image in the given
OME-XML metadata object.
|
OMEXMLMetadata |
getOMEMetadata(MetadataRetrieve src)
Returns a
OMEXMLMetadata object with the same
contents as the given MetadataRetrieve, converting it if necessary. |
String |
getOMEXML(MetadataRetrieve src)
Extracts an OME-XML metadata string from the given metadata object,
by converting to an OME-XML metadata object if necessary.
|
String |
getOMEXMLVersion(Object o)
Gets the schema version for the given OME-XML metadata or root object
(e.g., "2007-06" or "2003-FC").
|
Hashtable |
getOriginalMetadata(OMEXMLMetadata omexmlMeta)
Parse any OriginalMetadata annotations from the given OME-XML metadata
object and store them in a Hashtable.
|
boolean |
isEqual(OMEXMLMetadata src1,
OMEXMLMetadata src2)
Determine whether or not two OMEXMLMetadata objects are equal.
|
boolean |
isOMEXMLMetadata(Object o)
Checks whether the given object is an OME-XML metadata object.
|
boolean |
isOMEXMLRoot(Object o)
Checks whether the given object is an OME-XML root object.
|
void |
populateOriginalMetadata(OMEXMLMetadata omexmlMeta,
Hashtable<String,Object> metadata)
Adds the key/value pairs in the specified Hashtable as new
OriginalMetadata annotations in the given OME-XML metadata object.
|
void |
populateOriginalMetadata(OMEXMLMetadata omexmlMeta,
String key,
String value)
Adds the specified key/value pair as a new OriginalMetadata node
to the given OME-XML metadata object.
|
void |
removeBinData(OMEXMLMetadata omexmlMeta)
Remove all of the BinData elements from the given OME-XML metadata object.
|
void |
removeChannels(OMEXMLMetadata omexmlMeta,
int image,
int sizeC)
Remove all but the first sizeC valid Channel elements from the given
OME-XML metadata object.
|
String |
transformToLatestVersion(String xml)
Transforms the given OME-XML string to the latest supported version of
of the OME-XML schema.
|
boolean |
validateOMEXML(String xml)
Attempts to validate the given OME-XML string using
Java's XML validation facility.
|
boolean |
validateOMEXML(String xml,
boolean pixelsHack)
Attempts to validate the given OME-XML string using
Java's XML validation facility.
|
private String |
verifyOMENamespace(String xml)
Ensures that an xmlns:ome element exists.
|
checkClassDependency
public static final String LATEST_VERSION
public static final String NO_OME_XML_MSG
private static final org.slf4j.Logger LOGGER
private static final String XSLT_PATH
private static final String XSLT_2003FC
private static final String XSLT_200706
private static final String XSLT_200802
private static final String XSLT_200809
private static final String XSLT_200909
private static final String XSLT_201004
private static final String XSLT_201006
private static final String XSLT_201106
private static final String XSLT_201206
private static final String XSLT_201306
private static Templates reorderXSLT
private static Templates update2003FC
private static Templates update200706
private static Templates update200802
private static Templates update200809
private static Templates update200909
private static Templates update201004
private static Templates update201006
private static Templates update201106
private static Templates update201206
private static Templates update201306
private static final String SCHEMA_PATH
public String getLatestVersion()
OMEXMLService
getLatestVersion
in interface OMEXMLService
OMEXMLService.getLatestVersion()
public String transformToLatestVersion(String xml) throws ServiceException
OMEXMLService
transformToLatestVersion
in interface OMEXMLService
ServiceException
OMEXMLService.transformToLatestVersion(String)
public OMEXMLMetadata createOMEXMLMetadata() throws ServiceException
OMEXMLService
loci.formats.ome
package.createOMEXMLMetadata
in interface OMEXMLService
AbstractOMEXMLMetadata
,
or null if the class is not available.ServiceException
- If there is an error creating the OME-XML
metadata object.OMEXMLService.createOMEXMLMetadata()
public OMEXMLMetadata createOMEXMLMetadata(String xml) throws ServiceException
OMEXMLService
loci.formats.ome
package,
wrapping a DOM representation of the given OME-XML string.createOMEXMLMetadata
in interface OMEXMLService
AbstractOMEXMLMetadata
,
or null if the class is not available.ServiceException
- If there is an error creating the OME-XML
metadata object.OMEXMLService.createOMEXMLMetadata(java.lang.String)
public OMEXMLMetadata createOMEXMLMetadata(String xml, String version) throws ServiceException
OMEXMLService
loci.formats.ome
package,
wrapping a DOM representation of the given OME-XML string.createOMEXMLMetadata
in interface OMEXMLService
xml
- The OME-XML string to use for initial population of the
metadata object.version
- The OME-XML version to use (e.g., "2003-FC" or "2007-06").
If the xml and version parameters are both null, the newest version is
used.AbstractOMEXMLMetadata
,
or null if the class is not available.ServiceException
- If there is an error creating the OME-XML
metadata object.OMEXMLService.createOMEXMLMetadata(java.lang.String, java.lang.String)
public OMEModelObject createOMEXMLRoot(String xml) throws ServiceException
OMEXMLService
createOMEXMLRoot
in interface OMEXMLService
xml
- String of XML to create the root node from.ServiceException
- If there is an error creating the OME-XML
metadata object.OMEXMLService.createOMEXMLRoot(java.lang.String)
public boolean isOMEXMLMetadata(Object o)
OMEXMLService
isOMEXMLMetadata
in interface OMEXMLService
OMEXMLMetadata
.OMEXMLService.isOMEXMLMetadata(java.lang.Object)
public boolean isOMEXMLRoot(Object o)
OMEXMLService
isOMEXMLRoot
in interface OMEXMLService
OME
.OMEXMLService.isOMEXMLRoot(java.lang.Object)
private OMEXMLMetadataRoot createRoot(String xml) throws ServiceException
xml
- String of XML to create the root node from.IOException
- If there is an error reading from the string.SAXException
- If there is an error parsing the XML.ParserConfigurationException
- If there is an error preparing the
parsing infrastructure.ServiceException
public String getOMEXMLVersion(Object o)
OMEXMLService
getOMEXMLVersion
in interface OMEXMLService
OMEXMLMetadata
.OMEXMLService.getOMEXMLVersion(java.lang.Object)
public OMEXMLMetadata getOMEMetadata(MetadataRetrieve src) throws ServiceException
OMEXMLService
OMEXMLMetadata
object with the same
contents as the given MetadataRetrieve, converting it if necessary.getOMEMetadata
in interface OMEXMLService
ServiceException
- If there is an error creating the OME-XML
metadata object.OMEXMLService.getOMEMetadata(loci.formats.meta.MetadataRetrieve)
public String getOMEXML(MetadataRetrieve src) throws ServiceException
OMEXMLService
getOMEXML
in interface OMEXMLService
ServiceException
- If there is an error creating the OME-XML
metadata object.OMEXMLService.getOMEXML(loci.formats.meta.MetadataRetrieve)
public boolean validateOMEXML(String xml)
OMEXMLService
validateOMEXML
in interface OMEXMLService
xml
- XML string to validate.OMEXMLService.validateOMEXML(java.lang.String)
public boolean validateOMEXML(String xml, boolean pixelsHack)
OMEXMLService
validateOMEXML
in interface OMEXMLService
xml
- XML string to validate.pixelsHack
- Whether to ignore validation errors
due to childless Pixels elementsOMEXMLService.validateOMEXML(java.lang.String, boolean)
public Modulo getModuloAlongZ(OMEXMLMetadata omexml, int image)
OMEXMLService
getModuloAlongZ
in interface OMEXMLService
omexml
- An object of type
OMEXMLMetadata
image
- the index of the Image to which the Annotation is linkedOMEXMLService.getModuloAlongZ(OMEXMLMetadata, int)
public Modulo getModuloAlongC(OMEXMLMetadata omexml, int image)
OMEXMLService
getModuloAlongC
in interface OMEXMLService
omexml
- An object of type
OMEXMLMetadata
image
- the index of the Image to which the Annotation is linkedOMEXMLService.getModuloAlongC(OMEXMLMetadata, int)
public Modulo getModuloAlongT(OMEXMLMetadata omexml, int image)
OMEXMLService
getModuloAlongT
in interface OMEXMLService
omexml
- An object of type
OMEXMLMetadata
image
- the index of the Image to which the Annotation is linkedOMEXMLService.getModuloAlongT(OMEXMLMetadata, int)
private Modulo getModuloAlong(OMEXMLMetadata omexml, String tag, int image)
Modulo
corresponding to the given ModuloAlong* tag.omexml
- the OMEXMLMetadata from which to retrieve the ModuloAlong* tagtag
- the tag name (e.g. "ModuloAlongC")image
- the Image index within the OMEXMLMetadatapublic Hashtable getOriginalMetadata(OMEXMLMetadata omexmlMeta)
OMEXMLService
getOriginalMetadata
in interface OMEXMLService
omexmlMeta
- An object of type
OMEXMLMetadata
.OMEXMLService.getOriginalMetadata(loci.formats.ome.OMEXMLMetadata)
public void populateOriginalMetadata(OMEXMLMetadata omexmlMeta, Hashtable<String,Object> metadata)
OMEXMLService
populateOriginalMetadata
in interface OMEXMLService
omexmlMeta
- An object of type
OMEXMLMetadata
.metadata
- A hashtable containing metadata key/value pairs.OMEXMLService.populateOriginalMetadata(loci.formats.ome.OMEXMLMetadata, Hashtable)
public void populateOriginalMetadata(OMEXMLMetadata omexmlMeta, String key, String value)
OMEXMLService
populateOriginalMetadata
in interface OMEXMLService
omexmlMeta
- An object of type
OMEXMLMetadata
.key
- Metadata key to populate.value
- Metadata value corresponding to the specified key.OMEXMLService.populateOriginalMetadata(loci.formats.ome.OMEXMLMetadata, java.lang.String, java.lang.String)
public void convertMetadata(String xml, MetadataStore dest) throws ServiceException
OMEXMLService
convertMetadata
in interface OMEXMLService
ServiceException
- If there is an error creating the OME-XML
metadata object.OMEXMLService.convertMetadata(java.lang.String, loci.formats.meta.MetadataStore)
public void convertMetadata(MetadataRetrieve src, MetadataStore dest)
OMEXMLService
convertMetadata
in interface OMEXMLService
OMEXMLService.convertMetadata(loci.formats.meta.MetadataRetrieve, loci.formats.meta.MetadataStore)
public void removeBinData(OMEXMLMetadata omexmlMeta)
OMEXMLService
removeBinData
in interface OMEXMLService
OMEXMLService.removeBinData(OMEXMLMetadata)
public void removeChannels(OMEXMLMetadata omexmlMeta, int image, int sizeC)
OMEXMLService
removeChannels
in interface OMEXMLService
OMEXMLService.removeChannels(OMEXMLMetadata, int, int)
public void addMetadataOnly(OMEXMLMetadata omexmlMeta, int image)
OMEXMLService
addMetadataOnly
in interface OMEXMLService
OMEXMLService.addMetadataOnly(OMEXMLMetadata, int)
public void addMetadataOnly(OMEXMLMetadata omexmlMeta, int image, boolean resolve)
OMEXMLService
addMetadataOnly
in interface OMEXMLService
OMEXMLService.addMetadataOnly(OMEXMLMetadata, int, boolean)
public boolean isEqual(OMEXMLMetadata src1, OMEXMLMetadata src2)
OMEXMLService
isEqual
in interface OMEXMLService
OMEXMLService.isEqual(OMEXMLMetadata, OMEXMLMetadata)
public void addModuloAlong(OMEXMLMetadata meta, CoreMetadata core, int imageIdx)
OMEXMLService
addModuloAlong
in interface OMEXMLService
meta
- An object of type OMEXMLMetadata
core
- A fully populated object of type
CoreMetadata
imageIdx
- Index of the Image to which the annotation should be linked.private void createModulo(OMEXMLMetadata meta, Modulo modulo, StructuredAnnotations annotations, Image image, int imageIdx, int annotationIndex, int imageAnnotation)
Modulo
.meta
- the OMEXMLMetadata in which to create the annotationmodulo
- the Modulo object that contains the annotation dataannotations
- the list of existing annotationsimage
- the Image to which the new annotation should be linkedimageIdx
- the index of the ImageannotationIndex
- the index to be assigned to the new annotationimageAnnotation
- the index to be assigned to the new annotation linkpublic MetadataStore asStore(MetadataRetrieve meta)
OMEXMLService
MetadataRetrieve
object as a MetadataStore
.
Returns null if the object is incompatible and cannot be casted.asStore
in interface OMEXMLService
OMEXMLService.asStore(loci.formats.meta.MetadataRetrieve)
public MetadataRetrieve asRetrieve(MetadataStore meta)
OMEXMLService
MetadataStore
object as a MetadataRetrieve
.
Returns null if the object is incompatible and cannot be casted.asRetrieve
in interface OMEXMLService
OMEXMLService.asRetrieve(loci.formats.meta.MetadataStore)
private String verifyOMENamespace(String xml)
private Node findRootNode(Node child)
Copyright © 2016 Open Microscopy Environment