Class NamedChannelsConcatenate
Object
NamedChannelsConcatenate
- All Implemented Interfaces:
ChannelGetter
,NamedChannelsMap
Exposes one or more instances of a
NamedChannelsMap
as a single aggregated NamedChannelsMap
.
The aggregated map contains all the channels from each underlying map.
If a channel-name is non-unique, it is undefined which channel will be retrieved for this name.
Channel
s are added to a Stack
in the order they appear successively in the
list
.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionNamedChannelsConcatenate
(NamedChannelsMap... maps) Create with arguments to concatenate. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAsSeparateChannels
(NamedProviderStore<TimeSeries> stackCollection, int timeIndex, Logger logger) void
addAsSeparateChannels
(NamedStacks stackCollection, int t, Logger logger) allChannelsAsStack
(int t, Logger logger) Combines all channels as a singleStack
at a particular time-frame.All channel-names.dimensions
(Logger logger) The dimensions of eachChannel
.getChannel
(String channelName, int timeIndex, Logger logger) Retrieve theChannel
corresponding tochannelName
at a particular time-frame.getChannelOptional
(String channelName, int timeIndex, Logger logger) Gets a channel if it exists, returning empty if it doesn't.boolean
hasChannel
(String channelName) Does a particular channel-name exist?boolean
Whether the channels describe an RGB image.int
The number of channels that exist for the series.int
The number of frames along the time-axis.
-
Constructor Details
-
NamedChannelsConcatenate
Create with arguments to concatenate.- Parameters:
maps
- eachNamedChannelsMap
to be concatenated.
-
-
Method Details
-
getChannel
public Channel getChannel(String channelName, int timeIndex, Logger logger) throws GetOperationFailedException Description copied from interface:ChannelGetter
Retrieve theChannel
corresponding tochannelName
at a particular time-frame.- Specified by:
getChannel
in interfaceChannelGetter
- Parameters:
channelName
- the name of theChannel
.timeIndex
- the index (beginning at 0) of the frame.logger
- logger to write informative messes or non-fatal errors.- Returns:
- the retrieved
Channel
. - Throws:
GetOperationFailedException
- if no channel exists withchannelName
at time-pointtimeIndex
.
-
getChannelOptional
public Optional<Channel> getChannelOptional(String channelName, int timeIndex, Logger logger) throws GetOperationFailedException Description copied from interface:NamedChannelsMap
Gets a channel if it exists, returning empty if it doesn't.- Specified by:
getChannelOptional
in interfaceNamedChannelsMap
- Parameters:
channelName
- name of channel.timeIndex
- point in time-series.logger
- a logger for any non-fatal errors. Fatal errors throw an exception.- Returns:
- the channel if it exists, or empty otherwise.
- Throws:
GetOperationFailedException
- if something goes wrong getting an existing channel (but never if a channel doesn't exist).
-
addAsSeparateChannels
public void addAsSeparateChannels(NamedStacks stackCollection, int t, Logger logger) throws OperationFailedException Description copied from interface:NamedChannelsMap
- Specified by:
addAsSeparateChannels
in interfaceNamedChannelsMap
- Parameters:
stackCollection
- theNamedStacks
into which eachChannel
is copied.t
- the index of the time-frame, beginning at zero.logger
- a logger for any non-fatal errors. Fatal errors throw an exception.- Throws:
OperationFailedException
- if unable to add aChannel
.
-
addAsSeparateChannels
public void addAsSeparateChannels(NamedProviderStore<TimeSeries> stackCollection, int timeIndex, Logger logger) throws OperationFailedException Description copied from interface:NamedChannelsMap
Adds eachChannel
as a separateTimeSeries
in aNamedProviderStore
.Although added as a
TimeSeries
, each addedStack
will have only a single-time frame at point 0, representing the channel found attimeIndex
.- Specified by:
addAsSeparateChannels
in interfaceNamedChannelsMap
- Parameters:
stackCollection
- theNamedStacks
into which eachChannel
is copied.timeIndex
- the index of the time-frame, beginning at zero.logger
- a logger for any non-fatal errors. Fatal errors throw an exception.- Throws:
OperationFailedException
- if unable to add aChannel
.
-
numberChannels
public int numberChannels()Description copied from interface:NamedChannelsMap
The number of channels that exist for the series.- Specified by:
numberChannels
in interfaceNamedChannelsMap
- Returns:
- the number of channels.
-
channelNames
Description copied from interface:NamedChannelsMap
All channel-names.- Specified by:
channelNames
in interfaceNamedChannelsMap
- Returns:
- a set view of all channel-names in the map.
-
sizeT
Description copied from interface:NamedChannelsMap
The number of frames along the time-axis.- Specified by:
sizeT
in interfaceNamedChannelsMap
- Parameters:
logger
- a logger for any non-fatal errors. Fatal errors throw an exception.- Returns:
- the number of time-frames.
- Throws:
ImageIOException
- if unable to successfully determine the number of frames.
-
hasChannel
Description copied from interface:ChannelGetter
Does a particular channel-name exist?- Specified by:
hasChannel
in interfaceChannelGetter
- Parameters:
channelName
- the name of the channel to check.- Returns:
- true iff the channel-name exists.
-
dimensions
Description copied from interface:NamedChannelsMap
The dimensions of eachChannel
.- Specified by:
dimensions
in interfaceNamedChannelsMap
- Parameters:
logger
- a logger for any non-fatal errors. Fatal errors throw an exception.- Returns:
- the dimensions.
- Throws:
ImageIOException
- if unable to successfully determine the dimensions.
-
allChannelsAsStack
Description copied from interface:NamedChannelsMap
Combines all channels as a singleStack
at a particular time-frame.- Specified by:
allChannelsAsStack
in interfaceNamedChannelsMap
- Parameters:
t
- the index of the time-frame, beginning at zero.logger
- a logger for any non-fatal errors. Fatal errors throw an exception.- Returns:
- a supplier for a newly created
Stack
, containing allChannel
s. The order depends on implementation.
-
isRGB
Description copied from interface:NamedChannelsMap
Whether the channels describe an RGB image.In this case, there should be exactly three channels, named "red", "green" and "blue".
- Specified by:
isRGB
in interfaceNamedChannelsMap
- Parameters:
logger
- a logger for any non-fatal errors. Fatal errors throw an exception.- Returns:
- true if the channels describe an RGB image.
- Throws:
ImageIOException
- if this cannot be successfully inferred.
-