public class ChannelMap extends Object
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
.
Constructor and Description |
---|
ChannelMap() |
Modifier and Type | Method and Description |
---|---|
void |
add(IndexedChannel channel)
Adds a
IndexedChannel into the map. |
int |
get(String name)
Gets the index corresponding to a particular channel-name.
|
int |
getException(String name)
Like
get(java.lang.String) but throws an exception if a particular channel-name does not exist in the
map. |
Set<String> |
names()
The names of the
Channel s in the map. |
Collection<IndexedChannel> |
values()
All
IndexedChannel s that exist in the map. |
public void add(IndexedChannel channel)
IndexedChannel
into the map.channel
- the channel to add.public int get(String name)
name
- the channel name to find a corresponding index for.public int getException(String name)
get(java.lang.String)
but throws an exception if a particular channel-name does not exist in the
map.name
- the channel name to find a corresponding index for.IndexOutOfBoundsException
- if the channel doesn't exist in the map.public Collection<IndexedChannel> values()
IndexedChannel
s that exist in the map.IndexedChannel
s in the map.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.