S
- individual-typeT
- aggregate-typepublic abstract class GroupedStackBase<S,T> extends Task<ProvidesStackInput,GroupedSharedState<S,T>>
Two types of entities are considered:
Channel
is converted in the image.
Constructor and Description |
---|
GroupedStackBase() |
Modifier and Type | Method and Description |
---|---|
void |
afterAllJobsAreExecuted(GroupedSharedState<S,T> sharedState,
InputOutputContext context)
Called once after all calls to
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>) . |
GroupedSharedState<S,T> |
beforeAnyJobIsExecuted(Outputter outputter,
ConcurrencyPlan concurrencyPlan,
List<ProvidesStackInput> inputs,
ParametersExperiment parameters)
Called once before all calls to
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>) . |
protected abstract CheckedFunction<Channel,S,CreateException> |
createChannelDeriver(ChannelSource source)
A function to derive the individual type used for aggregation from a
Channel . |
protected abstract GroupMapByName<S,T> |
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.
|
void |
doJobOnInput(InputBound<ProvidesStackInput,GroupedSharedState<S,T>> input)
Performs the task on a particular input.
|
Grouper |
getGroup()
How to partition the inputs into groups.
|
Interpolator |
getInterpolator()
The interpolator to use for scaling images.
|
SizeXY |
getResizeTo()
If set, each channel is scaled to a specific size before aggregation (useful for combining
different sized images).
|
FromStacks |
getSelectChannels()
Selects which channels are included, optionally renaming.
|
boolean |
hasVeryQuickPerInputExecution()
Is the execution-time of the task per-input expected to be very quick to execute?
|
InputTypesExpected |
inputTypesExpected()
Highest class(es) that will function as a valid input.
|
protected abstract String |
outputNameForGroups()
The first-level output-name used for determining if groups are written.
|
protected abstract void |
processIndividual(String name,
S individual,
boolean partOfGroup,
CheckedBiConsumer<String,S,OperationFailedException> consumeIndividual,
InputOutputContext context)
Processes each derived individual element from a
Channel , calling consumeIndividual one or more times. |
void |
setGroup(Grouper group)
How to partition the inputs into groups.
|
void |
setInterpolator(Interpolator interpolator)
The interpolator to use for scaling images.
|
void |
setResizeTo(SizeXY resizeTo)
If set, each channel is scaled to a specific size before aggregation (useful for combining
different sized images).
|
void |
setSelectChannels(FromStacks selectChannels)
Selects which channels are included, optionally renaming.
|
protected abstract Optional<String> |
subdirectoryForGroupOutputs()
An optional subdirectory where the group outputs are placed.
|
defaultOutputs, executeJob, isInputCompatibleWith
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
public InputTypesExpected inputTypesExpected()
Task
This is usually the class of T (or sometimes the absolute base class InputFromManager).
inputTypesExpected
in class Task<ProvidesStackInput,GroupedSharedState<S,T>>
public boolean hasVeryQuickPerInputExecution()
Task
hasVeryQuickPerInputExecution
in class Task<ProvidesStackInput,GroupedSharedState<S,T>>
public GroupedSharedState<S,T> beforeAnyJobIsExecuted(Outputter outputter, ConcurrencyPlan concurrencyPlan, List<ProvidesStackInput> inputs, ParametersExperiment parameters) throws ExperimentExecutionException
Task
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.beforeAnyJobIsExecuted
in class Task<ProvidesStackInput,GroupedSharedState<S,T>>
outputter
- the output-manager for the experiment (not for an individual job)concurrencyPlan
- available numbers of processors that can call Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
inputs
- a list of inputs, each will result in at least one call to Task.executeJob(ParametersUnbound)
.parameters
- the experiment-parameters.Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
and to Task.afterAllJobsAreExecuted(S, org.anchoranalysis.io.output.outputter.InputOutputContext)
.ExperimentExecutionException
- if a fatal error occurs executing this step of the
experiment.public void doJobOnInput(InputBound<ProvidesStackInput,GroupedSharedState<S,T>> input) throws JobExecutionException
Task
doJobOnInput
in class Task<ProvidesStackInput,GroupedSharedState<S,T>>
input
- the input for the job.JobExecutionException
- if an error occurs executing a particular job, that is not
otherwise suppressed.public void afterAllJobsAreExecuted(GroupedSharedState<S,T> sharedState, InputOutputContext context) throws ExperimentExecutionException
Task
Task.executeJob(org.anchoranalysis.experiment.task.ParametersUnbound<T, S>)
.afterAllJobsAreExecuted
in class Task<ProvidesStackInput,GroupedSharedState<S,T>>
sharedState
- the shared-statecontext
- IO-context for experiment (not for an individual job)ExperimentExecutionException
- if a fatal error occurs executing this step of the
experiment.protected abstract String outputNameForGroups()
Second-level matches against this, will determine which specific groups may or may not be written.
protected abstract Optional<String> subdirectoryForGroupOutputs()
protected abstract GroupMapByName<S,T> createGroupMap(ConsistentChannelChecker channelChecker, Optional<java.util.stream.Stream<String>> groupIdentifiers, Optional<InputOutputContext> outputContext, OperationContext operationContext)
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 abstract CheckedFunction<Channel,S,CreateException> createChannelDeriver(ChannelSource source) throws OperationFailedException
Channel
.source
- how to retrieve a Channel
, appropriately-sized.Channel
will return an individual element of type
T
.OperationFailedException
protected abstract void processIndividual(String name, S individual, boolean partOfGroup, CheckedBiConsumer<String,S,OperationFailedException> consumeIndividual, InputOutputContext context) throws OperationFailedException
Channel
, calling consumeIndividual
one or more times.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.public Interpolator getInterpolator()
public void setInterpolator(Interpolator interpolator)
public Grouper getGroup()
public void setGroup(Grouper group)
public FromStacks getSelectChannels()
public void setSelectChannels(FromStacks selectChannels)
public SizeXY getResizeTo()
public void setResizeTo(SizeXY resizeTo)
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.