public class AggregateChannelTask extends GroupedStackBase<Channel,ChannelAggregator>
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 |
Constructor and Description |
---|
AggregateChannelTask() |
Modifier and Type | Method and Description |
---|---|
protected CheckedFunction<Channel,Channel,CreateException> |
createChannelDeriver(ChannelSource source)
A function to derive the individual type used for aggregation from a
Channel . |
protected GroupMapByName<Channel,ChannelAggregator> |
createGroupMap(ConsistentChannelChecker channelChecker,
Optional<java.util.stream.Stream<String>> groupIdentifiers,
Optional<InputOutputContext> outputContext,
OperationContext operationContext)
Creates a map for the storing an aggregate-data-object for each group.
|
OutputEnabledMutable |
defaultOutputs()
If specified, default rules for determine which outputs are enabled or not.
|
ChannelAggregator |
getAggregator()
How to aggregate the
Channel s. |
String |
getOutputName()
How to name the aggregated channel in the output.
|
boolean |
isSlicewise()
When true, a 3D image is added slice-by-slice to the aggregation, treating each slice as a
separate image.
|
protected String |
outputNameForGroups()
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 a
Channel , calling consumeIndividual one or more times. |
void |
setAggregator(ChannelAggregator aggregator)
How to aggregate the
Channel 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.
|
protected Optional<String> |
subdirectoryForGroupOutputs()
An optional subdirectory where the group outputs are placed.
|
afterAllJobsAreExecuted, beforeAnyJobIsExecuted, doJobOnInput, getGroup, getInterpolator, getResizeTo, getSelectChannels, hasVeryQuickPerInputExecution, inputTypesExpected, setGroup, setInterpolator, setResizeTo, setSelectChannels
executeJob, isInputCompatibleWith
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
public OutputEnabledMutable defaultOutputs()
Task
defaultOutputs
in class Task<ProvidesStackInput,GroupedSharedState<Channel,ChannelAggregator>>
protected Optional<String> subdirectoryForGroupOutputs()
GroupedStackBase
subdirectoryForGroupOutputs
in class GroupedStackBase<Channel,ChannelAggregator>
protected String outputNameForGroups()
GroupedStackBase
Second-level matches against this, will determine which specific groups may or may not be written.
outputNameForGroups
in class GroupedStackBase<Channel,ChannelAggregator>
protected GroupMapByName<Channel,ChannelAggregator> createGroupMap(ConsistentChannelChecker channelChecker, Optional<java.util.stream.Stream<String>> groupIdentifiers, Optional<InputOutputContext> outputContext, OperationContext operationContext)
GroupedStackBase
createGroupMap
in class GroupedStackBase<Channel,ChannelAggregator>
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.protected void processIndividual(String name, Channel individual, boolean partOfGroup, CheckedBiConsumer<String,Channel,OperationFailedException> consumeIndividual, InputOutputContext context) throws OperationFailedException
GroupedStackBase
Channel
, calling consumeIndividual
one or more times.processIndividual
in class GroupedStackBase<Channel,ChannelAggregator>
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.OperationFailedException
- if anything goes wrong during processing.protected CheckedFunction<Channel,Channel,CreateException> createChannelDeriver(ChannelSource source) throws OperationFailedException
GroupedStackBase
Channel
.createChannelDeriver
in class GroupedStackBase<Channel,ChannelAggregator>
source
- how to retrieve a Channel
, appropriately-sized.Channel
will return an individual element of type
T
.OperationFailedException
public boolean isSlicewise()
public void setSlicewise(boolean slicewise)
public ChannelAggregator getAggregator()
Channel
s.public void setAggregator(ChannelAggregator aggregator)
Channel
s.public String getOutputName()
public void setOutputName(String outputName)
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.