Class OpenedNamedChannels
Object
OpenedNamedChannels
- All Implemented Interfaces:
ChannelGetter
,NamedChannelsMap
A set of named
Channel
s available from an OpenedImageFile
.
Channel
s are added to a Stack
in the order they appear in the
channelMap
.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionOpenedNamedChannels
(OpenedImageFile openedFile, ChannelMap channelMap, int seriesIndex) Creates a newOpenedNamedChannels
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAsSeparateChannels
(NamedProviderStore<TimeSeries> destination, int timeIndex, Logger logger) void
addAsSeparateChannels
(NamedStacks destination, int timeIndex, 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
-
OpenedNamedChannels
Creates a newOpenedNamedChannels
instance.- Parameters:
openedFile
- The underlying opened image-file that provides the channels.channelMap
- A mapping between names to indices ofChannel
s.seriesIndex
- Which series to open inOpenedImageFile
.
-
-
Method Details
-
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.
-
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).
-
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.
-
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.
-
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.
-
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.
-
addAsSeparateChannels
public void addAsSeparateChannels(NamedStacks destination, int timeIndex, Logger logger) throws OperationFailedException Description copied from interface:NamedChannelsMap
- Specified by:
addAsSeparateChannels
in interfaceNamedChannelsMap
- Parameters:
destination
- 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
.
-
addAsSeparateChannels
public void addAsSeparateChannels(NamedProviderStore<TimeSeries> destination, 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:
destination
- 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
.
-
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.
-
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.
-