Class ReadAnnotationFromFile

Object
org.anchoranalysis.plugin.annotation.bean.strategy.ReadAnnotationFromFile

public class ReadAnnotationFromFile
extends Object
Utility class for reading ImageLabelAnnotation from a file.
  • Method Summary

    Modifier and Type Method Description
    static Optional<org.anchoranalysis.annotation.image.ImageLabelAnnotation> readAssumeExists​(Path path, org.anchoranalysis.core.time.OperationContext context)
    Reads an ImageLabelAnnotation from a file, assuming the file exists.
    static Optional<org.anchoranalysis.annotation.image.ImageLabelAnnotation> readCheckExists​(Path path, org.anchoranalysis.core.time.OperationContext context)
    Reads an ImageLabelAnnotation from a file if it exists.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • readCheckExists

      public static Optional<org.anchoranalysis.annotation.image.ImageLabelAnnotation> readCheckExists​(Path path, org.anchoranalysis.core.time.OperationContext context) throws org.anchoranalysis.io.input.InputReadFailedException
      Reads an ImageLabelAnnotation from a file if it exists.
      Parameters:
      path - the Path to the file to read from.
      context - the OperationContext for the read operation.
      Returns:
      an Optional containing the ImageLabelAnnotation if the file exists and can be read, or an empty Optional otherwise.
      Throws:
      org.anchoranalysis.io.input.InputReadFailedException - if an error occurs while reading the file.
    • readAssumeExists

      public static Optional<org.anchoranalysis.annotation.image.ImageLabelAnnotation> readAssumeExists​(Path path, org.anchoranalysis.core.time.OperationContext context) throws org.anchoranalysis.io.input.InputReadFailedException
      Reads an ImageLabelAnnotation from a file, assuming the file exists.
      Parameters:
      path - the Path to the file to read from.
      context - the OperationContext for the read operation.
      Returns:
      an Optional containing the ImageLabelAnnotation if it can be read, or an empty Optional otherwise.
      Throws:
      org.anchoranalysis.io.input.InputReadFailedException - if an error occurs while reading the file.