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 Channel
s 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 TypeMethodDescriptionvoid
add
(IndexedChannel channel) Adds aIndexedChannel
into the map.int
Gets the index corresponding to a particular channel-name.int
getException
(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 theChannel
s in the map.values()
AllIndexedChannel
s that exist in the map.
-
Constructor Details
-
ChannelMap
public ChannelMap()
-
-
Method Details
-
add
Adds aIndexedChannel
into 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 theChannel
s in the map. -
values
AllIndexedChannel
s that exist in the map.- Returns:
- a view on the
IndexedChannel
s in the map.
-