Class ReadVoxelExtentXml


public class ReadVoxelExtentXml extends StackReader
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 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 resolution

      Given 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 image
      acceptNoResolution - 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 class StackReader
      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

      public StackReader getStackReader()
      Reads an image before a resolution is imposed.
    • setStackReader

      public void setStackReader(StackReader stackReader)
      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.