Class ReadVoxelExtentXml
Reads
Resolution
from an XML file associated an image.
Any existing Resolution
is replaced.
The XML file is expected at the file path of the image, with .xml
appended. e.g.
someImage.tif would have metadata at someImage.tif.xml
The format of the XML is described in ResolutionAsXML
.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReads an image before a resolution is imposed.boolean
If false, an exception is thrown if the resolution file is missing for a particular image.openFile
(Path path, ExecutionTimeRecorder executionTimeRecorder) Opens a file containing one or more images.static Optional
<Resolution> readMetadata
(Path filePath, boolean acceptNoResolution) Looks for a metadata file describing the resolutionvoid
setAcceptNoResolution
(boolean acceptNoResolution) If false, an exception is thrown if the resolution file is missing for a particular image.void
setStackReader
(StackReader stackReader) Reads an image before a resolution is imposed.Methods inherited from class org.anchoranalysis.image.io.bean.stack.reader.StackReader
readStack
Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
ReadVoxelExtentXml
public ReadVoxelExtentXml()
-
-
Method Details
-
readMetadata
public static Optional<Resolution> readMetadata(Path filePath, boolean acceptNoResolution) throws ImageIOException Looks for a metadata file describing the resolutionGiven an existing image filepath, the filePath.xml is checked e.g. given /somePath/stackReader.tif it will look for /somePath/RasterRader.tif.xml
- Parameters:
filePath
- the filepath of the imageacceptNoResolution
- if false, an exception is thrown if the resolution file is missing for a particular image.- Returns:
- the scene res if the metadata file exists and was parsed. null otherwise.
- Throws:
ImageIOException
-
openFile
public OpenedImageFile openFile(Path path, ExecutionTimeRecorder executionTimeRecorder) throws ImageIOException Description copied from class:StackReader
Opens a file containing one or more images.This method should run as computationally quicky as possible. Image voxels should not yet be read.
- Specified by:
openFile
in classStackReader
- Parameters:
path
- where the file is located.executionTimeRecorder
- records the execution-times of certain operations.- Returns:
- an interface to the opened file that should be closed when no longer in use.
- Throws:
ImageIOException
- if the file cannot be read.
-
getStackReader
Reads an image before a resolution is imposed. -
setStackReader
Reads an image before a resolution is imposed. -
isAcceptNoResolution
public boolean isAcceptNoResolution()If false, an exception is thrown if the resolution file is missing for a particular image. -
setAcceptNoResolution
public void setAcceptNoResolution(boolean acceptNoResolution) If false, an exception is thrown if the resolution file is missing for a particular image.
-