Class SingleRowPerInput<T extends org.anchoranalysis.io.input.InputFromManager,S extends org.anchoranalysis.feature.input.FeatureInput>
Object
org.anchoranalysis.bean.AnchorBean<FeatureSource<T,S,U>>
org.anchoranalysis.plugin.image.task.bean.feature.source.FeatureSource<T,org.anchoranalysis.feature.bean.list.FeatureList<S>,S>
org.anchoranalysis.plugin.image.task.bean.feature.source.SingleRowPerInput<T,S>
- Type Parameters:
T- input-manager typeS- feature-input type
- Direct Known Subclasses:
FromHistogram,FromImage,FromImageMetadata
public abstract class SingleRowPerInput<T extends org.anchoranalysis.io.input.InputFromManager,S extends org.anchoranalysis.feature.input.FeatureInput> extends FeatureSource<T,org.anchoranalysis.feature.bean.list.FeatureList<S>,S>
Base class for exporting features, where features are calculated per-image using a
NamedFeatureStore.- Author:
- Owen Feehan
-
Constructor Summary
Constructors Modifier Constructor Description protectedSingleRowPerInput(String headerIdentifier)Creates with a single non-group header that should be describe an identifier.SingleRowPerInput(String[] nonGroupHeaders) -
Method Summary
Modifier and Type Method Description protected abstract Optional<String[]>additionalLabelsFor(T input)Additional labels for an input to include (after the identifier, and before any group labels).voidcalculateAndOutput(T input, FeatureCalculationContext<org.anchoranalysis.feature.bean.list.FeatureList<S>> context)Processes one input to calculate feature-results and output them to the file-system.protected abstract ResultsVectorWithThumbnailcalculateResultsForInput(T input, FeatureCalculationContext<org.anchoranalysis.feature.bean.list.FeatureList<S>> context)Calculates feature-results for a particular input.FeatureExporter<org.anchoranalysis.feature.bean.list.FeatureList<S>>createExporter(org.anchoranalysis.feature.io.csv.metadata.LabelHeaders metadataHeaders, List<org.anchoranalysis.bean.NamedBean<org.anchoranalysis.feature.bean.list.FeatureListProvider<S>>> features, org.anchoranalysis.feature.io.results.FeatureOutputNames outputNames, Optional<org.anchoranalysis.io.input.grouper.InputGrouper> grouper, FeatureExporterContext context)Creates theFeatureExporterto be used for calculating and exporting feature-results.org.anchoranalysis.feature.io.csv.metadata.LabelHeadersheaders(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
-
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
-
-
Method Details
-
createExporter
public FeatureExporter<org.anchoranalysis.feature.bean.list.FeatureList<S>> createExporter(org.anchoranalysis.feature.io.csv.metadata.LabelHeaders metadataHeaders, List<org.anchoranalysis.bean.NamedBean<org.anchoranalysis.feature.bean.list.FeatureListProvider<S>>> features, org.anchoranalysis.feature.io.results.FeatureOutputNames outputNames, Optional<org.anchoranalysis.io.input.grouper.InputGrouper> grouper, FeatureExporterContext context) throws org.anchoranalysis.core.exception.CreateExceptionDescription copied from class:FeatureSourceCreates theFeatureExporterto be used for calculating and exporting feature-results.- Specified by:
createExporterin classFeatureSource<T extends org.anchoranalysis.io.input.InputFromManager,org.anchoranalysis.feature.bean.list.FeatureList<S extends org.anchoranalysis.feature.input.FeatureInput>,S extends org.anchoranalysis.feature.input.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:
org.anchoranalysis.core.exception.CreateException- if it cannot be created.
-
headers
public org.anchoranalysis.feature.io.csv.metadata.LabelHeaders headers(boolean groupsEnabled)Description copied from class:FeatureSourceGenerates label-headers for the non-feature-result columns in the CSV.- Specified by:
headersin classFeatureSource<T extends org.anchoranalysis.io.input.InputFromManager,org.anchoranalysis.feature.bean.list.FeatureList<S extends org.anchoranalysis.feature.input.FeatureInput>,S extends org.anchoranalysis.feature.input.FeatureInput>- Parameters:
groupsEnabled- whether groups are enabled- Returns:
- a
LabelHeadersobject for the non-feature-result columns
-
calculateAndOutput
public void calculateAndOutput(T input, FeatureCalculationContext<org.anchoranalysis.feature.bean.list.FeatureList<S>> context) throws org.anchoranalysis.core.exception.OperationFailedExceptionDescription copied from class:FeatureSourceProcesses one input to calculate feature-results and output them to the file-system.- Specified by:
calculateAndOutputin classFeatureSource<T extends org.anchoranalysis.io.input.InputFromManager,org.anchoranalysis.feature.bean.list.FeatureList<S extends org.anchoranalysis.feature.input.FeatureInput>,S extends org.anchoranalysis.feature.input.FeatureInput>- Parameters:
input- one particular input that will create one or more "rows" in a feature-tablecontext- theFeatureCalculationContextfor calculation- Throws:
org.anchoranalysis.core.exception.OperationFailedException- if the operation fails
-
calculateResultsForInput
protected abstract ResultsVectorWithThumbnail calculateResultsForInput(T input, FeatureCalculationContext<org.anchoranalysis.feature.bean.list.FeatureList<S>> context) throws org.anchoranalysis.feature.calculate.NamedFeatureCalculateExceptionCalculates feature-results for a particular input.- Parameters:
input- the input.context- context for calculating features.- Returns:
- the results, with optionally associated thumbnail.
- Throws:
org.anchoranalysis.feature.calculate.NamedFeatureCalculateException- if any feature cannot calculate.
-
additionalLabelsFor
protected abstract Optional<String[]> additionalLabelsFor(T input) throws org.anchoranalysis.core.exception.OperationFailedExceptionAdditional 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:
org.anchoranalysis.core.exception.OperationFailedException- if the operation fails
-