Class AggregateChannelTask

Object
AnchorBean<Task<ProvidesStackInput, GroupedSharedState<Channel, ChannelAggregator>>>
Task<ProvidesStackInput, GroupedSharedState<Channel, ChannelAggregator>>
GroupedStackBase<Channel, ChannelAggregator>
AggregateChannelTask

public class AggregateChannelTask extends GroupedStackBase<Channel, ChannelAggregator>
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 NameDefault?Description
outputNameyesAn image with the aggregated voxel value for each corresponding voxel.
inherited from AggregateChannelTask
Author:
Owen Feehan
  • Constructor Details

    • AggregateChannelTask

      public AggregateChannelTask()
  • Method Details

    • defaultOutputs

      public OutputEnabledMutable defaultOutputs()
      Overrides:
      defaultOutputs in class Task<ProvidesStackInput, GroupedSharedState<Channel, ChannelAggregator>>
    • subdirectoryForGroupOutputs

      protected Optional<String> subdirectoryForGroupOutputs()
      Description copied from class: GroupedStackBase
      An optional subdirectory where the group outputs are placed.
      Specified by:
      subdirectoryForGroupOutputs in class GroupedStackBase<Channel, ChannelAggregator>
      Returns:
      an Optional containing the subdirectory name as a String, or Optional.empty() if no subdirectory is specified.
    • outputNameForGroups

      protected String 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 class GroupedStackBase<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 class GroupedStackBase<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, OperationFailedException> consumeIndividual, InputOutputContext context) throws OperationFailedException
      Description copied from class: GroupedStackBase
      Processes each derived individual element from a Channel, calling consumeIndividual one or more times.
      Specified by:
      processIndividual in class GroupedStackBase<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, CreateException> createChannelDeriver(ChannelSource source) throws OperationFailedException
      Description copied from class: GroupedStackBase
      A function to derive the individual type used for aggregation from a Channel.
      Specified by:
      createChannelDeriver in class GroupedStackBase<Channel, ChannelAggregator>
      Parameters:
      source - how to retrieve a Channel, appropriately-sized.
      Returns:
      a function, that given a Channel will return an individual element of type T.
      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

      public ChannelAggregator getAggregator()
      How to aggregate the Channels.
    • setAggregator

      public void setAggregator(ChannelAggregator aggregator)
      How to aggregate the Channels.
    • getOutputName

      public String getOutputName()
      How to name the aggregated channel in the output.
    • setOutputName

      public void setOutputName(String outputName)
      How to name the aggregated channel in the output.