Class HeaderFormat
Object
org.anchoranalysis.bean.AnchorBean<HeaderFormat>
org.anchoranalysis.plugin.io.bean.metadata.header.HeaderFormat
public abstract class HeaderFormat extends org.anchoranalysis.bean.AnchorBean<HeaderFormat>
Populates
ImageMetadata from the header of an image-file.
The metadata-extractor from Drew Noakes is used to read the metadata.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description HeaderFormat() -
Method Summary
Modifier and Type Method Description protected abstract org.anchoranalysis.core.format.ImageFileFormatformat()The associatedImageFileFormatwith this header.Optional<org.anchoranalysis.image.core.stack.ImageMetadata>populateFrom(Path path)Creates aImageMetadata, if possible, from the metadata atpath.protected abstract Optional<org.anchoranalysis.image.core.stack.ImageMetadata>populateFromMetadata(com.drew.metadata.Metadata metadata, org.anchoranalysis.image.core.stack.ImageFileAttributes attributes)Creates aImageMetadata, if possible, frommetadata.
-
Constructor Details
-
HeaderFormat
public HeaderFormat()
-
-
Method Details
-
populateFrom
public Optional<org.anchoranalysis.image.core.stack.ImageMetadata> populateFrom(Path path) throws org.anchoranalysis.image.io.ImageIOExceptionCreates aImageMetadata, if possible, from the metadata atpath.- Parameters:
path- the path to an image file.- Returns:
- the metadata associated with
path, if it was possible to infer it. - Throws:
org.anchoranalysis.image.io.ImageIOException- if the metadata does not meet expectations or I/O fails.
-
format
protected abstract org.anchoranalysis.core.format.ImageFileFormat format()The associatedImageFileFormatwith this header.Only files whose paths end with an extension for this format will be accepted.
- Returns:
- the format.
-
populateFromMetadata
protected abstract Optional<org.anchoranalysis.image.core.stack.ImageMetadata> populateFromMetadata(com.drew.metadata.Metadata metadata, org.anchoranalysis.image.core.stack.ImageFileAttributes attributes) throws org.anchoranalysis.image.io.ImageIOExceptionCreates aImageMetadata, if possible, frommetadata.- Parameters:
metadata- theMetadatato inferImageMetadatafrom.attributes- timestamps and other file-attributes associated with the metadata.- Returns:
- the inferred metadata, if it was possible to infer it.
- Throws:
org.anchoranalysis.image.io.ImageIOException- if the metadata does not meet expectations.
-