Class ObjectCollectionReader

Object
ObjectCollectionReader

public class ObjectCollectionReader extends Object
Reads an ObjectCollection from the filesystem
Author:
Owen Feehan
  • Method Details

    • createFromPath

      public static ObjectCollection createFromPath(Path path, OperationContext context) throws DeserializationFailedException
      Reads an object-collection from a path (or path prefix) trying different methods to read the objects.

      The following order is used to look for an object-mask collection:

      1. If path ends in
        .h5
        it is read as a HDF5 object-mask collection.
      2. Otherwise,
        .h5
        is suffixed, and if this path exists, it is read as a HDF5 object-mask collection.

      In the case of 3, if the path does not exist, but it is the subpath of an ObjectCollection directory which does then a special case occurs. An empty ObjectCollection is returned.

      Parameters:
      path - path or (or path missing a
      .h5
      extension) used to search for an object-collection using the rules above
      context - context for reading a stack from the file-system.
      Returns:
      the object-collection read from this path.
      Throws:
      DeserializationFailedException - if no objects are found at this path, or anything else prevents their deserialization.
    • hasHdf5Extension

      public static boolean hasHdf5Extension(Path path)
      Whether a path has a suitable extension to be considered a HDF5 file?
      Parameters:
      path - the path whose extension is checked.
      Returns:
      true if the path ends with an extension that is considered HDF5.