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 typeS- 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 Summary
ConstructorsModifierConstructorDescriptionprotectedSingleRowPerInput(String headerIdentifier) Creates with a single non-group header that should be describe an identifier.SingleRowPerInput(String[] nonGroupHeaders) Creates a newSingleRowPerInputinstance. -
Method Summary
Modifier and TypeMethodDescriptionadditionalLabelsFor(T input) Additional labels for an input to include (after the identifier, and before any group labels).voidcalculateAndOutput(T input, FeatureCalculationContext<FeatureList<S>> context) Processes one input to calculate feature-results and output them to the file-system.protected abstract ResultsVectorWithThumbnailcalculateResultsForInput(T input, FeatureCalculationContext<FeatureList<S>> context) Calculates feature-results for a particular input.createExporter(LabelHeaders metadataHeaders, List<NamedBean<FeatureListProvider<S>>> features, FeatureOutputNames outputNames, Optional<InputGrouper> grouper, FeatureExporterContext context) Creates theFeatureExporterto be used for calculating and exporting feature-results.headers(boolean groupsEnabled) Generates label-headers for the non-feature-result columns in the CSV.Methods inherited from class org.anchoranalysis.plugin.image.task.bean.feature.source.FeatureSource
includeGroupInExperiment, inputTypesExpectedMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
SingleRowPerInput
Creates with a single non-group header that should be describe an identifier.- Parameters:
headerIdentifier- the column-name to describe an identifier.
-
SingleRowPerInput
Creates a newSingleRowPerInputinstance.- 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:FeatureSourceCreates theFeatureExporterto be used for calculating and exporting feature-results.- Specified by:
createExporterin classFeatureSource<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
FeatureExporteras matches this source of features. - Throws:
CreateException- if it cannot be created.
-
headers
Description copied from class:FeatureSourceGenerates label-headers for the non-feature-result columns in the CSV.- Specified by:
headersin classFeatureSource<T extends InputFromManager,FeatureList<S extends FeatureInput>, S extends FeatureInput> - Parameters:
groupsEnabled- whether groups are enabled- Returns:
- a
LabelHeadersobject for the non-feature-result columns
-
calculateAndOutput
public void calculateAndOutput(T input, FeatureCalculationContext<FeatureList<S>> context) throws OperationFailedException Description copied from class:FeatureSourceProcesses one input to calculate feature-results and output them to the file-system.- Specified by:
calculateAndOutputin classFeatureSource<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-tablecontext- theFeatureCalculationContextfor 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
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
-