Class ChannelMap
Object
ChannelMap
A mapping of assigned channel-names to particular indices.
This can be useful for opening an image file that contains many Channels and mapping
all, or some subset, of the channels to semantically-meaningful identifiers.
The class preserves insertion order (via add(org.anchoranalysis.image.io.bean.channel.IndexedChannel) by internally using a LinkedHashMap.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(IndexedChannel channel) Adds aIndexedChannelinto the map.intGets the index corresponding to a particular channel-name.intgetException(String name) Likeget(java.lang.String)but throws an exception if a particular channel-name does not exist in the map.names()The names of theChannels in the map.values()AllIndexedChannels that exist in the map.
-
Constructor Details
-
ChannelMap
public ChannelMap()
-
-
Method Details
-
add
Adds aIndexedChannelinto the map.- Parameters:
channel- the channel to add.
-
get
Gets the index corresponding to a particular channel-name.- Parameters:
name- the channel name to find a corresponding index for.- Returns:
- the index (beginning at 0) for the channel-name, or -1 if no such name exists in the map.
-
getException
Likeget(java.lang.String)but throws an exception if a particular channel-name does not exist in the map.- Parameters:
name- the channel name to find a corresponding index for.- Returns:
- the index (beginning at 0) for the channel-name.
- Throws:
IndexOutOfBoundsException- if the channel doesn't exist in the map.
-
names
The names of theChannels in the map. -
values
AllIndexedChannels that exist in the map.- Returns:
- a view on the
IndexedChannels in the map.
-