Class ReadAnnotationFromFile

Object
ReadAnnotationFromFile

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

    • readCheckExists

      public static Optional<ImageLabelAnnotation> readCheckExists(Path path, OperationContext context) throws 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:
      InputReadFailedException - if an error occurs while reading the file.
    • readAssumeExists

      public static Optional<ImageLabelAnnotation> readAssumeExists(Path path, OperationContext context) throws 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:
      InputReadFailedException - if an error occurs while reading the file.