Interface Storage

All Known Subinterfaces:
RewritableStorage

public interface Storage
Storages are responsible for providing image data to Datastores when requested. Different Storages may have different mechanisms -- for example, by storing images in a file, or in RAM. In practice you are unlikely to need to implement your own Storage class, and most of its methods are simply "backings" for similar methods in Datastore.

Note that the Storage interface does not expose any "setter" methods (e.g. putImage(), setSummaryMetadata(), etc.). It is expected that any read/write Storage listen for the relevant events published by the Datastore instead.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Release any resources used by the Storage, for example open file descriptors.
    void
    Freeze the Storage, preventing any changes to its contents.
    Return any Image, or null if there are no images.
    Return a List of all axis names for Images we know about.
    getImage(Coords coords)
    Retrieve the Image located at the specified coordinates.
    getImagesIgnoringAxes(Coords coords, String... ignoreTheseAxes)
    Retrieve a list of images with Coords identical to the given Coords instance, except for the axes listed in the exception list.
    Retrieve a list of all images whose Coords match the given incomplete Coords instance.
    int
    Return the largest stored position along the specified axis.
    Return a Coords that provides the maximum index along all available axes.
    int
    Return the number of images in this dataset.
    Retrieve the SummaryMetadata associated with this dataset.
    Return an Iterable that provides access to all image coordinates in the Storage, in arbitrary order.
    boolean
    hasImage(Coords coords)
    Returns whether or not an image exists at the specified coordinates.
    void
    putImage(Image image)
    Insert an Image into the Storage, so that it may be returned by later getImage() calls.
  • Method Details

    • freeze

      void freeze() throws IOException
      Freeze the Storage, preventing any changes to its contents.
      Throws:
      IOException
    • putImage

      void putImage(Image image) throws IOException
      Insert an Image into the Storage, so that it may be returned by later getImage() calls.
      Parameters:
      image - Image to be inserted.
      Throws:
      IOException
    • getImage

      Image getImage(Coords coords) throws IOException
      Retrieve the Image located at the specified coordinates.
      Parameters:
      coords - Coordinates specifying which image to retrieve
      Returns:
      desired Image
      Throws:
      IOException
    • hasImage

      boolean hasImage(Coords coords)
      Returns whether or not an image exists at the specified coordinates.
      Parameters:
      coords - Coordinates to test
      Returns:
      True if an image exists at the coordinates, false otherwise.
    • getAnyImage

      Image getAnyImage()
      Return any Image, or null if there are no images. Only really useful if you need a representative image to work with. No guarantees are made about which image will be provided.
      Returns:
      any Image or null if there are no images
    • getUnorderedImageCoords

      Iterable<Coords> getUnorderedImageCoords()
      Return an Iterable that provides access to all image coordinates in the Storage, in arbitrary order.
      Returns:
      Iterable that provides access to all image coordinates in the Storage, in arbitrary order
    • getImagesMatching

      List<Image> getImagesMatching(Coords coords) throws IOException
      Retrieve a list of all images whose Coords match the given incomplete Coords instance. For example, providing a Coords of <"z" = 9> would return all Images whose position along the "z" axis is 9 (note that this means that Images with no defined position along that axis will not be returned). The result may be empty.
      Parameters:
      coords - Coordinates specifying images to match
      Returns:
      List with matching Images
      Throws:
      IOException
    • getImagesIgnoringAxes

      List<Image> getImagesIgnoringAxes(Coords coords, String... ignoreTheseAxes) throws IOException
      Retrieve a list of images with Coords identical to the given Coords instance, except for the axes listed in the exception list. For instance, given Coords t=1,z=3> and axes "c", the following Coords would match: <t=1, z=3>, <t=1, z=3, c=1>, <t=1, z=3, c=2>.
      Parameters:
      coords - coord looking for matching images
      ignoreTheseAxes - Axes to be ignored in the images collection when looking for matches
      Returns:
      matching images
      Throws:
      IOException - happens with disk based storage
    • getMaxIndex

      int getMaxIndex(String axis)
      Return the largest stored position along the specified axis. Will be -1 if no images have a position along that axis (or the axis is not present in the Storage)
      Parameters:
      axis - axis of interest
      Returns:
      Largest stored position along the specified axis or -1 when no images are found on the given axis
    • getAxes

      List<String> getAxes()
      Return a List of all axis names for Images we know about.
      Returns:
      List of all axis names for Images we know about
    • getMaxIndices

      Coords getMaxIndices()
      Return a Coords that provides the maximum index along all available axes.
      Returns:
      Coords that provides the maximum index along all available axes
    • getSummaryMetadata

      SummaryMetadata getSummaryMetadata()
      Retrieve the SummaryMetadata associated with this dataset.
      Returns:
      SummaryMetadata associated with this dataset
    • getNumImages

      int getNumImages()
      Return the number of images in this dataset.
      Returns:
      number of images in this dataset
    • close

      void close() throws IOException
      Release any resources used by the Storage, for example open file descriptors.
      Throws:
      IOException