public class OpenedNamedChannels extends Object implements NamedChannelsMap
Channel
s available from an OpenedImageFile
.
Channel
s are added to a Stack
in the order they appear in the channelMap
.
Constructor and Description |
---|
OpenedNamedChannels(OpenedImageFile openedFile,
ChannelMap channelMap,
int seriesIndex) |
Modifier and Type | Method and Description |
---|---|
void |
addAsSeparateChannels(NamedProviderStore<TimeSeries> destination,
int timeIndex,
Logger logger)
|
void |
addAsSeparateChannels(NamedStacks destination,
int timeIndex,
Logger logger)
|
StoreSupplier<Stack> |
allChannelsAsStack(int t,
Logger logger)
Combines all channels as a single
Stack at a particular time-frame. |
Set<String> |
channelNames()
All channel-names.
|
Dimensions |
dimensions(Logger logger)
The dimensions of each
Channel . |
Channel |
getChannel(String channelName,
int timeIndex,
Logger logger)
Retrieve the
Channel corresponding to channelName at a particular time-frame. |
Optional<Channel> |
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 |
isRGB(Logger logger)
Whether the channels describe an RGB image.
|
int |
numberChannels()
The number of channels that exist for the series.
|
int |
sizeT(Logger logger)
The number of frames along the time-axis.
|
public OpenedNamedChannels(OpenedImageFile openedFile, ChannelMap channelMap, int seriesIndex)
public Dimensions dimensions(Logger logger) throws ImageIOException
NamedChannelsMap
Channel
.dimensions
in interface NamedChannelsMap
logger
- a logger for any non-fatal errors. Fatal errors throw an exception.ImageIOException
- if unable to successfully determine the dimensions.public Channel getChannel(String channelName, int timeIndex, Logger logger) throws GetOperationFailedException
ChannelGetter
Channel
corresponding to channelName
at a particular time-frame.getChannel
in interface ChannelGetter
channelName
- the name of the Channel
.timeIndex
- the index (beginning at 0) of the frame.logger
- logger to write informative messes or non-fatal errors.Channel
.GetOperationFailedException
- if no channel exists with channelName
at
time-point timeIndex
.public Optional<Channel> getChannelOptional(String channelName, int timeIndex, Logger logger) throws GetOperationFailedException
NamedChannelsMap
getChannelOptional
in interface NamedChannelsMap
channelName
- name of channel.timeIndex
- point in time-series.logger
- a logger for any non-fatal errors. Fatal errors throw an exception.GetOperationFailedException
- if something goes wrong getting an existing channel (but
never if a channel doesn't exist).public int sizeT(Logger logger) throws ImageIOException
NamedChannelsMap
sizeT
in interface NamedChannelsMap
logger
- a logger for any non-fatal errors. Fatal errors throw an exception.ImageIOException
- if unable to successfully determine the number of frames.public Set<String> channelNames()
NamedChannelsMap
channelNames
in interface NamedChannelsMap
public int numberChannels()
NamedChannelsMap
numberChannels
in interface NamedChannelsMap
public boolean hasChannel(String channelName)
ChannelGetter
hasChannel
in interface ChannelGetter
channelName
- the name of the channel to check.public void addAsSeparateChannels(NamedStacks destination, int timeIndex, Logger logger) throws OperationFailedException
NamedChannelsMap
addAsSeparateChannels
in interface NamedChannelsMap
destination
- the NamedStacks
into which each Channel
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.OperationFailedException
- if unable to add a Channel
.public void addAsSeparateChannels(NamedProviderStore<TimeSeries> destination, int timeIndex, Logger logger) throws OperationFailedException
NamedChannelsMap
Channel
as a separate TimeSeries
in a NamedProviderStore
.
Although added as a TimeSeries
, each added Stack
will have only a
single-time frame at point 0, representing the channel found at timeIndex
.
addAsSeparateChannels
in interface NamedChannelsMap
destination
- the NamedStacks
into which each Channel
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.OperationFailedException
- if unable to add a Channel
.public boolean isRGB(Logger logger) throws ImageIOException
NamedChannelsMap
In this case, there should be exactly three channels, named "red", "green" and "blue".
isRGB
in interface NamedChannelsMap
logger
- a logger for any non-fatal errors. Fatal errors throw an exception.ImageIOException
- if this cannot be successfully inferred.public StoreSupplier<Stack> allChannelsAsStack(int t, Logger logger)
NamedChannelsMap
Stack
at a particular time-frame.allChannelsAsStack
in interface NamedChannelsMap
t
- the index of the time-frame, beginning at zero.logger
- a logger for any non-fatal errors. Fatal errors throw an exception.Stack
, containing all Channel
s. The
order depends on implementation.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.