Class AnnotationWithStrategy<T extends AnnotatorStrategy>

Object
org.anchoranalysis.io.input.InputFromManagerDelegate<ProvidesStackInput>
org.anchoranalysis.annotation.io.AnnotationWithStrategy<T>
Type Parameters:
T - type of annotation-strategy.
All Implemented Interfaces:
org.anchoranalysis.io.input.InputFromManager

public class AnnotationWithStrategy<T extends AnnotatorStrategy>
extends org.anchoranalysis.io.input.InputFromManagerDelegate<ProvidesStackInput>
One particular annotation, associated with its strategy.
Author:
Owen Feehan
  • Constructor Summary

    Constructors 
    Constructor Description
    AnnotationWithStrategy​(ProvidesStackInput input, T strategy)
    Creates for a particular input and associated annotation strategy.
  • Method Summary

    Modifier and Type Method Description
    Optional<File> associatedFile()
    The file associated with the annotation, if such a file exists.
    Path getPath()
    Path to annotation.
    T getStrategy()
    The strategy on how annotation occurs.
    Optional<String> label​(org.anchoranalysis.core.time.OperationContext context)
    A human-friendly textual description of the annotation, or Optional.empty() if no label is available.
    org.anchoranalysis.image.core.stack.named.NamedStacksSupplier stacks​(org.anchoranalysis.core.log.Logger logger)
    All stacks associated with the input, lazily evaluated.

    Methods inherited from class org.anchoranalysis.io.input.InputFromManagerDelegate

    close, getDelegate, identifier, pathForBinding, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.anchoranalysis.io.input.InputFromManager

    allAssociatedPaths, asFile, identifierAsPath, pathForBindingRequired
  • Constructor Details

    • AnnotationWithStrategy

      public AnnotationWithStrategy​(ProvidesStackInput input, T strategy) throws org.anchoranalysis.core.exception.OperationFailedException
      Creates for a particular input and associated annotation strategy.
      Parameters:
      input - the input.
      strategy - the strategy.
      Throws:
      org.anchoranalysis.core.exception.OperationFailedException - if a path cannot be determined by strategy for the respective input.
  • Method Details

    • associatedFile

      public Optional<File> associatedFile()
      The file associated with the annotation, if such a file exists.
      Returns:
      the file, if it exists.
    • label

      public Optional<String> label​(org.anchoranalysis.core.time.OperationContext context) throws org.anchoranalysis.core.exception.OperationFailedException
      A human-friendly textual description of the annotation, or Optional.empty() if no label is available.
      Parameters:
      context - context for reading a stack from the file-system.
      Returns:
      the label, if available.
      Throws:
      org.anchoranalysis.core.exception.OperationFailedException - if a label cannot be successfully determined.
    • stacks

      public org.anchoranalysis.image.core.stack.named.NamedStacksSupplier stacks​(org.anchoranalysis.core.log.Logger logger)
      All stacks associated with the input, lazily evaluated.

      The stacks are cached the first time they are evaluated, to avoid repeated computation.

      Parameters:
      logger - a logger for any non-fatal errors. Fatal errors throw an exception.
      Returns:
      a supplier of the stacks.
    • getStrategy

      public T getStrategy()
      The strategy on how annotation occurs.
    • getPath

      public Path getPath()
      Path to annotation.