Class OpenedNamedChannels
Object
org.anchoranalysis.image.io.channel.map.OpenedNamedChannels
- All Implemented Interfaces:
ChannelGetter,NamedChannelsMap
public class OpenedNamedChannels extends Object implements 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
Constructors Constructor Description OpenedNamedChannels(OpenedImageFile openedFile, ChannelMap channelMap, int seriesIndex) -
Method Summary
Modifier and Type Method Description voidaddAsSeparateChannels(NamedProviderStore<TimeSeries> destination, int timeIndex, Logger logger)voidaddAsSeparateChannels(NamedStacks destination, int timeIndex, Logger logger)StoreSupplier<Stack>allChannelsAsStack(int t, Logger logger)Combines all channels as a singleStackat a particular time-frame.Set<String>channelNames()All channel-names.Dimensionsdimensions(Logger logger)The dimensions of eachChannel.ChannelgetChannel(String channelName, int timeIndex, Logger logger)Retrieve theChannelcorresponding tochannelNameat 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.booleanhasChannel(String channelName)Does a particular channel-name exist?booleanisRGB(Logger logger)Whether the channels describe an RGB image.intnumberChannels()The number of channels that exist for the series.intsizeT(Logger logger)The number of frames along the time-axis.
-
Constructor Details
-
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 GetOperationFailedExceptionDescription 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 GetOperationFailedExceptionDescription 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 OperationFailedExceptionDescription 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 OperationFailedExceptionDescription 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.
-