public class ExportImageHistograms extends GroupedStackBase<Histogram,Histogram>
Additionally, a histogram with the summation of voxel intensities for all channels in each image is produced.
Optionally, one channel can be used as a mask, to restrict which voxels are included in the histogram.
These steps occur:
The following outputs are produced:
Output Name | Default? | Description |
---|---|---|
yes | A separate CSV histogram for each channel's voxels intensity. | |
yes | A histogram for the sum of each voxel's intensity across all channels. | |
inherited from Task |
Constructor and Description |
---|
ExportImageHistograms() |
Modifier and Type | Method and Description |
---|---|
protected CheckedFunction<Channel,Histogram,CreateException> |
createChannelDeriver(ChannelSource source)
A function to derive the individual type used for aggregation from a
Channel . |
protected GroupMapByName<Histogram,Histogram> |
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.
|
String |
getChannelMask()
If defined, this is the name of channel used as a mask over the values which are fed into the
histogram
|
int |
getMaskValue()
What voxel value to read as "On" in the mask above.
|
boolean |
isCsvIgnoreZeros()
Iff true, bins with zero-counts are not written as a row in the CSV file.
|
protected String |
outputNameForGroups()
The first-level output-name used for determining if groups are written.
|
protected void |
processIndividual(String name,
Histogram individual,
boolean partOfGroup,
CheckedBiConsumer<String,Histogram,OperationFailedException> consumeIndividual,
InputOutputContext context)
Processes each derived individual element from a
Channel , calling consumeIndividual one or more times. |
void |
setChannelMask(String channelMask)
If defined, this is the name of channel used as a mask over the values which are fed into the
histogram
|
void |
setCsvIgnoreZeros(boolean csvIgnoreZeros)
Iff true, bins with zero-counts are not written as a row in the CSV file.
|
void |
setMaskValue(int maskValue)
What voxel value to read as "On" in the mask above.
|
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<Histogram,Histogram>>
protected GroupMapByName<Histogram,Histogram> createGroupMap(ConsistentChannelChecker channelChecker, Optional<java.util.stream.Stream<String>> groupIdentifiers, Optional<InputOutputContext> outputContext, OperationContext operationContext)
GroupedStackBase
createGroupMap
in class GroupedStackBase<Histogram,Histogram>
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 Optional<String> subdirectoryForGroupOutputs()
GroupedStackBase
subdirectoryForGroupOutputs
in class GroupedStackBase<Histogram,Histogram>
protected CheckedFunction<Channel,Histogram,CreateException> createChannelDeriver(ChannelSource source) throws OperationFailedException
GroupedStackBase
Channel
.createChannelDeriver
in class GroupedStackBase<Histogram,Histogram>
source
- how to retrieve a Channel
, appropriately-sized.Channel
will return an individual element of type
T
.OperationFailedException
protected void processIndividual(String name, Histogram individual, boolean partOfGroup, CheckedBiConsumer<String,Histogram,OperationFailedException> consumeIndividual, InputOutputContext context) throws OperationFailedException
GroupedStackBase
Channel
, calling consumeIndividual
one or more times.processIndividual
in class GroupedStackBase<Histogram,Histogram>
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 String outputNameForGroups()
GroupedStackBase
Second-level matches against this, will determine which specific groups may or may not be written.
outputNameForGroups
in class GroupedStackBase<Histogram,Histogram>
public String getChannelMask()
public void setChannelMask(String channelMask)
public int getMaskValue()
public void setMaskValue(int maskValue)
public boolean isCsvIgnoreZeros()
public void setCsvIgnoreZeros(boolean csvIgnoreZeros)
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.