Class SingleRowPerInput<T extends InputFromManager, S extends FeatureInput>

Object
AnchorBean<FeatureSource<T, FeatureList<S>, S>>
FeatureSource<T, FeatureList<S>, S>
SingleRowPerInput<T,S>
Type Parameters:
T - input-manager type
S - feature-input type
Direct Known Subclasses:
FromHistogram, FromImage, FromImageMetadata

public abstract class SingleRowPerInput<T extends InputFromManager, S extends FeatureInput> extends FeatureSource<T, FeatureList<S>, S>
Base class for exporting features, where features are calculated per-image using a NamedFeatureStore.
Author:
Owen Feehan
  • Constructor Details

    • SingleRowPerInput

      protected SingleRowPerInput(String headerIdentifier)
      Creates with a single non-group header that should be describe an identifier.
      Parameters:
      headerIdentifier - the column-name to describe an identifier.
    • SingleRowPerInput

      public SingleRowPerInput(String[] nonGroupHeaders)
      Creates a new SingleRowPerInput instance.
      Parameters:
      nonGroupHeaders - The column names (not pertaining to groups), the first of which should refer to an identifier.
  • Method Details

    • createExporter

      public FeatureExporter<FeatureList<S>> createExporter(LabelHeaders metadataHeaders, List<NamedBean<FeatureListProvider<S>>> features, FeatureOutputNames outputNames, Optional<InputGrouper> grouper, FeatureExporterContext context) throws CreateException
      Description copied from class: FeatureSource
      Creates the FeatureExporter to be used for calculating and exporting feature-results.
      Specified by:
      createExporter in class FeatureSource<T extends InputFromManager, FeatureList<S extends FeatureInput>, S extends FeatureInput>
      Parameters:
      metadataHeaders - headers to use for additional "metadata" before feature-results.
      features - the features to calculate.
      outputNames - the names of various kind of outputs.
      grouper - when defined, assigns each input to a group.
      context - IO-context.
      Returns:
      a newly created FeatureExporter as matches this source of features.
      Throws:
      CreateException - if it cannot be created.
    • headers

      public LabelHeaders headers(boolean groupsEnabled)
      Description copied from class: FeatureSource
      Generates label-headers for the non-feature-result columns in the CSV.
      Specified by:
      headers in class FeatureSource<T extends InputFromManager, FeatureList<S extends FeatureInput>, S extends FeatureInput>
      Parameters:
      groupsEnabled - whether groups are enabled
      Returns:
      a LabelHeaders object for the non-feature-result columns
    • calculateAndOutput

      public void calculateAndOutput(T input, FeatureCalculationContext<FeatureList<S>> context) throws OperationFailedException
      Description copied from class: FeatureSource
      Processes one input to calculate feature-results and output them to the file-system.
      Specified by:
      calculateAndOutput in class FeatureSource<T extends InputFromManager, FeatureList<S extends FeatureInput>, S extends FeatureInput>
      Parameters:
      input - one particular input that will create one or more "rows" in a feature-table
      context - the FeatureCalculationContext for calculation
      Throws:
      OperationFailedException - if the operation fails
    • calculateResultsForInput

      protected abstract ResultsVectorWithThumbnail calculateResultsForInput(T input, FeatureCalculationContext<FeatureList<S>> context) throws NamedFeatureCalculateException
      Calculates feature-results for a particular input.
      Parameters:
      input - the input.
      context - context for calculating features.
      Returns:
      the results, with optionally associated thumbnail.
      Throws:
      NamedFeatureCalculateException - if any feature cannot calculate.
    • additionalLabelsFor

      protected abstract Optional<String[]> additionalLabelsFor(T input) throws OperationFailedException
      Additional labels for an input to include (after the identifier, and before any group labels).

      These should always correspond (when appended to the identifier) exactly to the nonGroupHeaders.

      Parameters:
      input - the input.
      Returns:
      any additional labels for the input.
      Throws:
      OperationFailedException - if the operation fails