Class ObjectCollectionReader
Object
org.anchoranalysis.image.io.object.input.ObjectCollectionReader
public class ObjectCollectionReader extends Object
Reads an
ObjectCollection from the filesystem- Author:
- Owen Feehan
-
Method Summary
Modifier and Type Method Description static org.anchoranalysis.image.voxel.object.ObjectCollectioncreateFromPath(Path path, OperationContext context)Reads an object-collection from a path (or path prefix) trying different methods to read the objects.static booleanhasHdf5Extension(Path path)Whether a path has a suitable extension to be considered a HDF5 file?
-
Method Details
-
createFromPath
public static org.anchoranalysis.image.voxel.object.ObjectCollection createFromPath(Path path, OperationContext context) throws DeserializationFailedExceptionReads 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:
- If path ends in
.h5
it is read as a HDF5 object-mask collection. - 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
ObjectCollectiondirectory which does then a special case occurs. An emptyObjectCollectionis returned.- Parameters:
path- path or (or path missing a.h5
extension) used to search for an object-collection using the rules abovecontext- 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.
- If path ends in
-
hasHdf5Extension
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.
-