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 TypeMethodDescriptionvoidclose()Release any resources used by the Storage, for example open file descriptors.voidfreeze()Freeze the Storage, preventing any changes to its contents.Return any Image, or null if there are no images.getAxes()Return a List of all axis names for Images we know about.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.getImagesMatching(Coords coords) Retrieve a list of all images whose Coords match the given incomplete Coords instance.intgetMaxIndex(String axis) Return the largest stored position along the specified axis.Return a Coords that provides the maximum index along all available axes.intReturn 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.booleanReturns whether or not an image exists at the specified coordinates.voidInsert an Image into the Storage, so that it may be returned by later getImage() calls.
-
Method Details
-
freeze
Freeze the Storage, preventing any changes to its contents.- Throws:
IOException
-
putImage
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
Retrieve the Image located at the specified coordinates.- Parameters:
coords- Coordinates specifying which image to retrieve- Returns:
- desired Image
- Throws:
IOException
-
hasImage
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
-
getImagesMatching
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
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 Coordst=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 imagesignoreTheseAxes- Axes to be ignored in the images collection when looking for matches- Returns:
- matching images
- Throws:
IOException- happens with disk based storage
-
getMaxIndex
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
-
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
Release any resources used by the Storage, for example open file descriptors.- Throws:
IOException
-