Class OpenedNamedChannels
Object
OpenedNamedChannels
- All Implemented Interfaces:
ChannelGetter,NamedChannelsMap
A set of named
Channels available from an OpenedImageFile.
Channels 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 newOpenedNamedChannelsinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAsSeparateChannels(NamedProviderStore<TimeSeries> destination, int timeIndex, Logger logger) voidaddAsSeparateChannels(NamedStacks destination, int timeIndex, Logger logger) allChannelsAsStack(int t, Logger logger) Combines all channels as a singleStackat a particular time-frame.All channel-names.dimensions(Logger logger) The dimensions of eachChannel.getChannel(String channelName, int timeIndex, Logger logger) Retrieve theChannelcorresponding tochannelNameat a particular time-frame.getChannelOptional(String channelName, int timeIndex, Logger logger) Gets a channel if it exists, returning empty if it doesn't.booleanhasChannel(String channelName) Does a particular channel-name exist?booleanWhether the channels describe an RGB image.intThe number of channels that exist for the series.intThe number of frames along the time-axis.
-
Constructor Details
-
OpenedNamedChannels
Creates a newOpenedNamedChannelsinstance.- Parameters:
openedFile- The underlying opened image-file that provides the channels.channelMap- A mapping between names to indices ofChannels.seriesIndex- Which series to open inOpenedImageFile.
-
-
Method Details
-
dimensions
Description copied from interface:NamedChannelsMapThe dimensions of eachChannel.- Specified by:
dimensionsin 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:ChannelGetterRetrieve theChannelcorresponding tochannelNameat a particular time-frame.- Specified by:
getChannelin 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 withchannelNameat time-pointtimeIndex.
-
getChannelOptional
public Optional<Channel> getChannelOptional(String channelName, int timeIndex, Logger logger) throws GetOperationFailedException Description copied from interface:NamedChannelsMapGets a channel if it exists, returning empty if it doesn't.- Specified by:
getChannelOptionalin 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:NamedChannelsMapThe number of frames along the time-axis.- Specified by:
sizeTin 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:NamedChannelsMapAll channel-names.- Specified by:
channelNamesin interfaceNamedChannelsMap- Returns:
- a set view of all channel-names in the map.
-
numberChannels
public int numberChannels()Description copied from interface:NamedChannelsMapThe number of channels that exist for the series.- Specified by:
numberChannelsin interfaceNamedChannelsMap- Returns:
- the number of channels.
-
hasChannel
Description copied from interface:ChannelGetterDoes a particular channel-name exist?- Specified by:
hasChannelin 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:
addAsSeparateChannelsin interfaceNamedChannelsMap- Parameters:
destination- theNamedStacksinto which eachChannelis 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:NamedChannelsMapAdds eachChannelas a separateTimeSeriesin aNamedProviderStore.Although added as a
TimeSeries, each addedStackwill have only a single-time frame at point 0, representing the channel found attimeIndex.- Specified by:
addAsSeparateChannelsin interfaceNamedChannelsMap- Parameters:
destination- theNamedStacksinto which eachChannelis 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:NamedChannelsMapWhether the channels describe an RGB image.In this case, there should be exactly three channels, named "red", "green" and "blue".
- Specified by:
isRGBin 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:NamedChannelsMapCombines all channels as a singleStackat a particular time-frame.- Specified by:
allChannelsAsStackin 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 allChannels. The order depends on implementation.
-