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
ConstructorsModifierConstructorDescriptionprotected
SingleRowPerInput
(String headerIdentifier) Creates with a single non-group header that should be describe an identifier.SingleRowPerInput
(String[] nonGroupHeaders) Creates a newSingleRowPerInput
instance. -
Method Summary
Modifier and TypeMethodDescriptionadditionalLabelsFor
(T input) Additional labels for an input to include (after the identifier, and before any group labels).void
calculateAndOutput
(T input, FeatureCalculationContext<FeatureList<S>> context) Processes one input to calculate feature-results and output them to the file-system.protected abstract ResultsVectorWithThumbnail
calculateResultsForInput
(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 theFeatureExporter
to 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, inputTypesExpected
Methods 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 newSingleRowPerInput
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 theFeatureExporter
to be used for calculating and exporting feature-results.- Specified by:
createExporter
in 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
FeatureExporter
as matches this source of features. - Throws:
CreateException
- if it cannot be created.
-
headers
Description copied from class:FeatureSource
Generates label-headers for the non-feature-result columns in the CSV.- Specified by:
headers
in classFeatureSource<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 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
- theFeatureCalculationContext
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
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
-