Class AggregateChannelTask
Creates a an aggregated-image for each group, where each voxel-value is aggregated across each
channel in each image in the group.
Each channel is processed independently.
2D images are added in their entirety as one unit.
3D images are treated differently, depending on resizeTo. When not set, they are also
added in their entirety. When set, they are projected to 2D via a maximum-intensity-projection
and then added (unless slicewise==true.
When a particular input image is errored, it is omitted from the aggregation. The aggregation is still nevertheless produced, if possible from other successful inputs.
The following outputs are produced:
| Output Name | Default? | Description |
|---|---|---|
outputName | yes | An image with the aggregated voxel value for each corresponding voxel. |
inherited from AggregateChannelTask |
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CheckedFunction<Channel, Channel, CreateException> createChannelDeriver(ChannelSource source) A function to derive the individual type used for aggregation from aChannel.protected GroupMapByName<Channel, ChannelAggregator> createGroupMap(ConsistentChannelChecker channelChecker, Optional<Stream<String>> groupIdentifiers, Optional<InputOutputContext> outputContext, OperationContext operationContext) Creates a map for the storing an aggregate-data-object for each group.If specified, default rules for determine which outputs are enabled or not.How to aggregate theChannels.How to name the aggregated channel in the output.booleanWhen true, a 3D image is added slice-by-slice to the aggregation, treating each slice as a separate image.protected StringThe first-level output-name used for determining if groups are written.protected voidprocessIndividual(String name, Channel individual, boolean partOfGroup, CheckedBiConsumer<String, Channel, OperationFailedException> consumeIndividual, InputOutputContext context) Processes each derived individual element from aChannel, callingconsumeIndividualone or more times.voidsetAggregator(ChannelAggregator aggregator) How to aggregate theChannels.voidsetOutputName(String outputName) How to name the aggregated channel in the output.voidsetSlicewise(boolean slicewise) When true, a 3D image is added slice-by-slice to the aggregation, treating each slice as a separate image.An optional subdirectory where the group outputs are placed.Methods inherited from class org.anchoranalysis.plugin.image.task.bean.grouped.GroupedStackBase
afterAllJobsAreExecuted, beforeAnyJobIsExecuted, doJobOnInput, getGroup, getInterpolator, getResizeTo, getSelectChannels, hasVeryQuickPerInputExecution, inputTypesExpected, setGroup, setInterpolator, setResizeTo, setSelectChannelsMethods inherited from class org.anchoranalysis.experiment.bean.task.Task
executeJob, isInputCompatibleWithMethods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
-
Constructor Details
-
AggregateChannelTask
public AggregateChannelTask()
-
-
Method Details
-
defaultOutputs
Description copied from class:TaskIf specified, default rules for determine which outputs are enabled or not.- Overrides:
defaultOutputsin classTask<ProvidesStackInput,GroupedSharedState<Channel, ChannelAggregator>> - Returns:
- the default rules if they exist.
-
subdirectoryForGroupOutputs
Description copied from class:GroupedStackBaseAn optional subdirectory where the group outputs are placed.- Specified by:
subdirectoryForGroupOutputsin classGroupedStackBase<Channel,ChannelAggregator> - Returns:
- an
Optionalcontaining the subdirectory name as aString, orOptional.empty()if no subdirectory is specified.
-
outputNameForGroups
Description copied from class:GroupedStackBaseThe first-level output-name used for determining if groups are written.Second-level matches against this, and will determine which specific groups may or may not be written.
- Specified by:
outputNameForGroupsin classGroupedStackBase<Channel,ChannelAggregator> - Returns:
- the output-name.
-
createGroupMap
protected GroupMapByName<Channel,ChannelAggregator> createGroupMap(ConsistentChannelChecker channelChecker, Optional<Stream<String>> groupIdentifiers, Optional<InputOutputContext> outputContext, OperationContext operationContext) Description copied from class:GroupedStackBaseCreates a map for the storing an aggregate-data-object for each group.- Specified by:
createGroupMapin classGroupedStackBase<Channel,ChannelAggregator> - Parameters:
channelChecker- checks that the channels of all relevant stacks have the same size and data-type.groupIdentifiers- a stream with each group-identifier that should be added to the map.outputContext- where to write results to when a group is processed.operationContext- supporting entities for the operation.- Returns:
- a newly created map.
-
processIndividual
protected void processIndividual(String name, Channel individual, boolean partOfGroup, CheckedBiConsumer<String, Channel, throws OperationFailedExceptionOperationFailedException> consumeIndividual, InputOutputContext context) Description copied from class:GroupedStackBaseProcesses each derived individual element from aChannel, callingconsumeIndividualone or more times.- Specified by:
processIndividualin classGroupedStackBase<Channel,ChannelAggregator> - Parameters:
name- the name of the channel.individual- the derived-individual element.partOfGroup- true when the item is part of a group, false otherwise.consumeIndividual- a function that should be called one or more times for the individual element, or sub-elements of it.context- supporting entities for the operation.- Throws:
OperationFailedException- if anything goes wrong during processing.
-
createChannelDeriver
protected CheckedFunction<Channel,Channel, createChannelDeriverCreateException> (ChannelSource source) throws OperationFailedException Description copied from class:GroupedStackBaseA function to derive the individual type used for aggregation from aChannel.- Specified by:
createChannelDeriverin classGroupedStackBase<Channel,ChannelAggregator> - Parameters:
source- how to retrieve aChannel, appropriately-sized.- Returns:
- a function, that given a
Channelwill return an individual element of typeT. - Throws:
OperationFailedException- if the channel-deriver cannot be successfully created.
-
isSlicewise
public boolean isSlicewise()When true, a 3D image is added slice-by-slice to the aggregation, treating each slice as a separate image. -
setSlicewise
public void setSlicewise(boolean slicewise) When true, a 3D image is added slice-by-slice to the aggregation, treating each slice as a separate image. -
getAggregator
How to aggregate theChannels. -
setAggregator
How to aggregate theChannels. -
getOutputName
How to name the aggregated channel in the output. -
setOutputName
How to name the aggregated channel in the output.
-