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 anImageLabelAnnotationfrom a file, assuming the file exists.static Optional<org.anchoranalysis.annotation.image.ImageLabelAnnotation>readCheckExists(Path path, org.anchoranalysis.core.time.OperationContext context)Reads anImageLabelAnnotationfrom a file if it exists.
-
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.InputReadFailedExceptionReads anImageLabelAnnotationfrom a file if it exists.- Parameters:
path- thePathto the file to read from.context- theOperationContextfor the read operation.- Returns:
- an
Optionalcontaining theImageLabelAnnotationif 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.InputReadFailedExceptionReads anImageLabelAnnotationfrom a file, assuming the file exists.- Parameters:
path- thePathto the file to read from.context- theOperationContextfor the read operation.- Returns:
- an
Optionalcontaining theImageLabelAnnotationif it can be read, or an empty Optional otherwise. - Throws:
org.anchoranalysis.io.input.InputReadFailedException- if an error occurs while reading the file.
-