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 theChannel
s.How to name the aggregated channel in the output.boolean
When true, a 3D image is added slice-by-slice to the aggregation, treating each slice as a separate image.protected String
The first-level output-name used for determining if groups are written.protected void
processIndividual
(String name, Channel individual, boolean partOfGroup, CheckedBiConsumer<String, Channel, OperationFailedException> consumeIndividual, InputOutputContext context) Processes each derived individual element from aChannel
, callingconsumeIndividual
one or more times.void
setAggregator
(ChannelAggregator aggregator) How to aggregate theChannel
s.void
setOutputName
(String outputName) How to name the aggregated channel in the output.void
setSlicewise
(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, setSelectChannels
Methods inherited from class org.anchoranalysis.experiment.bean.task.Task
executeJob, isInputCompatibleWith
Methods 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:Task
If specified, default rules for determine which outputs are enabled or not.- Overrides:
defaultOutputs
in classTask<ProvidesStackInput,
GroupedSharedState<Channel, ChannelAggregator>> - Returns:
- the default rules if they exist.
-
subdirectoryForGroupOutputs
Description copied from class:GroupedStackBase
An optional subdirectory where the group outputs are placed.- Specified by:
subdirectoryForGroupOutputs
in classGroupedStackBase<Channel,
ChannelAggregator> - Returns:
- an
Optional
containing the subdirectory name as aString
, orOptional.empty()
if no subdirectory is specified.
-
outputNameForGroups
Description copied from class:GroupedStackBase
The 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:
outputNameForGroups
in 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:GroupedStackBase
Creates a map for the storing an aggregate-data-object for each group.- Specified by:
createGroupMap
in 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:GroupedStackBase
Processes each derived individual element from aChannel
, callingconsumeIndividual
one or more times.- Specified by:
processIndividual
in 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:GroupedStackBase
A function to derive the individual type used for aggregation from aChannel
.- Specified by:
createChannelDeriver
in classGroupedStackBase<Channel,
ChannelAggregator> - Parameters:
source
- how to retrieve aChannel
, appropriately-sized.- Returns:
- a function, that given a
Channel
will 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 theChannel
s. -
setAggregator
How to aggregate theChannel
s. -
getOutputName
How to name the aggregated channel in the output. -
setOutputName
How to name the aggregated channel in the output.
-