Class ImageLabeller<T>

Object
org.anchoranalysis.bean.AnchorBean<ImageLabeller<T>>
org.anchoranalysis.plugin.image.task.bean.labeller.ImageLabeller<T>
Type Parameters:
T - the type of shared-state used by the labeller
Direct Known Subclasses:
BinaryOutcomeImageLabeller, ImageCSVLabeller, ImageLabellerStringMap

public abstract class ImageLabeller<T>
extends org.anchoranalysis.bean.AnchorBean<ImageLabeller<T>>
Associates a label with an image.

This can be used to associate labels with images for training or evaluation in a machine-learning problem.

  • Constructor Summary

    Constructors 
    Constructor Description
    ImageLabeller()  
  • Method Summary

    Modifier and Type Method Description
    abstract Set<String> allLabels​(T initialization)
    Returns a set of identifiers for all groups that can be outputted by the labeller.
    abstract T initialize​(Path pathForBinding)
    Initializes the labeller.
    abstract String labelFor​(T sharedState, org.anchoranalysis.image.io.stack.input.ProvidesStackInput input, org.anchoranalysis.io.output.outputter.InputOutputContext context)
    Determines a particular group-identifier (label) for an input.

    Methods inherited from class org.anchoranalysis.bean.AnchorBean

    checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • initialize

      public abstract T initialize​(Path pathForBinding) throws org.anchoranalysis.core.exception.InitializeException
      Initializes the labeller. Should be called once before calling any other methods.
      Parameters:
      pathForBinding - a Path that can be used by the labeller to make file path decisions
      Returns:
      the initialized shared-state of type T
      Throws:
      org.anchoranalysis.core.exception.InitializeException - if initialization fails
    • allLabels

      public abstract Set<String> allLabels​(T initialization)
      Returns a set of identifiers for all groups that can be outputted by the labeller.

      This method should be callable at any time.

      Parameters:
      initialization - the initialized shared-state returned by initialize(Path)
      Returns:
      a Set of String labels
    • labelFor

      public abstract String labelFor​(T sharedState, org.anchoranalysis.image.io.stack.input.ProvidesStackInput input, org.anchoranalysis.io.output.outputter.InputOutputContext context) throws org.anchoranalysis.core.exception.OperationFailedException
      Determines a particular group-identifier (label) for an input.
      Parameters:
      sharedState - the shared-state returned by initialize(Path)
      input - the ProvidesStackInput to be labelled
      context - the InputOutputContext for the operation
      Returns:
      the label as a String
      Throws:
      org.anchoranalysis.core.exception.OperationFailedException - if the labelling operation fails