public interface ViewerState
Modifier and Type | Method and Description |
---|---|
boolean |
addGroup(SourceGroup group)
Add
group to the state (optional operation). |
boolean |
addGroups(Collection<? extends SourceGroup> collection)
Add all groups in
collection to the state (optional operation). |
boolean |
addSource(SourceAndConverter<?> source)
Add
source to the state (optional operation). |
boolean |
addSources(Collection<? extends SourceAndConverter<?>> collection)
Add all sources in
collection to the state (optional operation). |
boolean |
addSourcesToGroup(Collection<? extends SourceAndConverter<?>> collection,
SourceGroup group)
Add all sources in
collection to group (optional
operation). |
boolean |
addSourceToGroup(SourceAndConverter<?> source,
SourceGroup group)
Add
source to group (optional operation). |
org.scijava.listeners.Listeners<ViewerStateChangeListener> |
changeListeners()
ViewerStateChangeListener s can be added/removed here,
and will be notified about changes to this ViewerState. |
void |
clearGroups()
Remove all groups from the state (optional operation).
|
void |
clearSources()
Remove all sources from the state (optional operation).
|
boolean |
containsGroup(SourceGroup group)
Check whether the state contains the
group . |
boolean |
containsSource(SourceAndConverter<?> source)
Check whether the state contains the
source . |
Set<SourceGroup> |
getActiveGroups()
Get the set of active groups.
|
Set<SourceAndConverter<?>> |
getActiveSources()
Get the set of active sources.
|
SourceGroup |
getCurrentGroup()
Get the current group.
|
SourceAndConverter<?> |
getCurrentSource()
Get the current source.
|
int |
getCurrentTimepoint()
Get the current timepoint.
|
DisplayMode |
getDisplayMode()
Get the current
DisplayMode . |
String |
getGroupName(SourceGroup group)
Get the name of a
group . |
List<SourceGroup> |
getGroups()
Get the list of groups.
|
Interpolation |
getInterpolation()
Get the interpolation method.
|
int |
getNumTimepoints()
Get the number of timepoints.
|
List<SourceAndConverter<?>> |
getSources()
Get the list of sources.
|
Set<SourceAndConverter<?>> |
getSourcesInGroup(SourceGroup group)
Get the set sources in
group . |
default AffineTransform3D |
getViewerTransform()
Get the viewer transform.
|
void |
getViewerTransform(AffineTransform3D transform)
Get the viewer transform.
|
Set<SourceAndConverter<?>> |
getVisibleAndPresentSources()
Get the set of visible sources that also provide image data for the
current timepoint.
|
Set<SourceAndConverter<?>> |
getVisibleSources()
Get the set of visible sources.
|
Comparator<SourceGroup> |
groupOrder()
Returns a
Comparator that compares groups according to the order
in which they occur in the groups list. |
boolean |
isCurrentGroup(SourceGroup group)
Returns
true if group is the current group. |
boolean |
isCurrentSource(SourceAndConverter<?> source)
Returns
true if source is the current source. |
boolean |
isGroupActive(SourceGroup group)
Check whether the given
group is active. |
boolean |
isSourceActive(SourceAndConverter<?> source)
Check whether the given
source is active. |
boolean |
isSourceVisible(SourceAndConverter<?> source)
Check whether the given
source is visible. |
boolean |
isSourceVisibleAndPresent(SourceAndConverter<?> source)
Check whether the given
source is both visible and provides image
data for the current timepoint. |
boolean |
removeGroup(SourceGroup group)
Remove
group from the state (optional operation). |
boolean |
removeGroups(Collection<? extends SourceGroup> collection)
Remove all groups in
collection from the state (optional
operation). |
boolean |
removeSource(SourceAndConverter<?> source)
Remove
source from the state (optional operation). |
boolean |
removeSourceFromGroup(SourceAndConverter<?> source,
SourceGroup group)
Remove
source from group (optional operation). |
boolean |
removeSources(Collection<? extends SourceAndConverter<?>> collection)
Remove all sources in
collection from the state (optional
operation). |
boolean |
removeSourcesFromGroup(Collection<? extends SourceAndConverter<?>> collection,
SourceGroup group)
Remove all sources in
collection from group (optional
operation). |
boolean |
setCurrentGroup(SourceGroup group)
Make
group the current group (optional operation). |
boolean |
setCurrentSource(SourceAndConverter<?> source)
Make
source the current source (optional operation). |
void |
setCurrentTimepoint(int t)
Set the current timepoint (optional operation).
|
void |
setDisplayMode(DisplayMode mode)
Set the
DisplayMode (optional operation). |
boolean |
setGroupActive(SourceGroup group,
boolean active)
Set
group active or inactive (optional operation). |
void |
setGroupName(SourceGroup group,
String name)
Set the
name of a group (optional operation). |
boolean |
setGroupsActive(Collection<? extends SourceGroup> collection,
boolean active)
Set all groups in
collection active or inactive (optional
operation). |
void |
setInterpolation(Interpolation interpolation)
Set the interpolation method (optional operation).
|
void |
setNumTimepoints(int n)
Set the number of timepoints (optional operation).
|
boolean |
setSourceActive(SourceAndConverter<?> source,
boolean active)
Set
source active or inactive (optional operation). |
boolean |
setSourcesActive(Collection<? extends SourceAndConverter<?>> collection,
boolean active)
Set all sources in
collection active or inactive (optional
operation). |
void |
setViewerTransform(AffineTransform3D transform)
Set the viewer transform (optional operation).
|
ViewerState |
snapshot()
Get a snapshot of this ViewerState.
|
Comparator<SourceAndConverter<?>> |
sourceOrder()
Returns a
Comparator that compares sources according to the order
in which they occur in the sources list. |
ViewerState snapshot()
org.scijava.listeners.Listeners<ViewerStateChangeListener> changeListeners()
ViewerStateChangeListener
s can be added/removed here,
and will be notified about changes to this ViewerState.Interpolation getInterpolation()
void setInterpolation(Interpolation interpolation)
UnsupportedOperationException
- if the operation is not supported by this ViewerStateDisplayMode getDisplayMode()
DisplayMode
.
DisplayMode.SINGLE
only the current source is visible.DisplayMode.GROUP
the sources in the current group are visible.DisplayMode.FUSED
all active sources are visible.DisplayMode.FUSEDROUP
the sources in all active groups are visible.void setDisplayMode(DisplayMode mode)
DisplayMode
(optional operation).UnsupportedOperationException
- if the operation is not supported by this ViewerStateint getNumTimepoints()
void setNumTimepoints(int n)
If getCurrentTimepoint()
current timepoint} is
>= n
, it will be adjusted to n-1
.
IllegalArgumentException
- if n < 1
.UnsupportedOperationException
- if the operation is not supported by this ViewerStateint getCurrentTimepoint()
void setCurrentTimepoint(int t)
IllegalArgumentException
- if t >= getNumTimepoints()
or t < 0
.UnsupportedOperationException
- if the operation is not supported by this ViewerStatevoid getViewerTransform(AffineTransform3D transform)
transform
- is set to the viewer transformdefault AffineTransform3D getViewerTransform()
void setViewerTransform(AffineTransform3D transform)
UnsupportedOperationException
- if the operation is not supported by this ViewerStateList<SourceAndConverter<?>> getSources()
List
reflects changes to
the viewer state. It is unmodifiable and not thread-safe.SourceAndConverter<?> getCurrentSource()
null
if there is no current
source)boolean isCurrentSource(SourceAndConverter<?> source)
true
if source
is the current source. Equivalent
to (getCurrentSource() == source)
.source
- the source. Passing null
checks whether no source is current.true
if source
is the current sourceboolean setCurrentSource(SourceAndConverter<?> source)
source
the current source (optional operation). Returns
true
, if current source changes as a result of the call. Returns
false
, if source
is already the current source.source
- the source to make current. Passing null
clears the current
source.true
, if current source changed as a result of the callIllegalArgumentException
- if source
is not contained in the state (and not
null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateSet<SourceAndConverter<?>> getActiveSources()
Set
reflects changes
to the viewer state. It is unmodifiable and not thread-safe.boolean isSourceActive(SourceAndConverter<?> source)
source
is active.true
, if source
is activeNullPointerException
- if source == null
IllegalArgumentException
- if source
is not contained in the state (and not
null
).boolean setSourceActive(SourceAndConverter<?> source, boolean active)
source
active or inactive (optional operation).
Returns true
, if source activity changes as a result of the call.
Returns false
, if source
is already in the desired
active
state.
true
, if source activity changed as a result of the callNullPointerException
- if source == null
IllegalArgumentException
- if source
is not contained in the state (and not
null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean setSourcesActive(Collection<? extends SourceAndConverter<?>> collection, boolean active)
collection
active or inactive (optional
operation).
Returns true
, if source activity changes as a result of the call.
Returns false
, if all sources were already in the desired
active
state.
true
, if source activity changed as a result of the callNullPointerException
- if collection == null
or any element of collection
is
null
.IllegalArgumentException
- if any element of collection
is not contained in the state.UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean isSourceVisible(SourceAndConverter<?> source)
source
is visible.
Whether a source is visible depends on the display mode
:
DisplayMode.SINGLE
only the current source is visible.DisplayMode.GROUP
the sources in the current group are visible.DisplayMode.FUSED
all active sources are visible.DisplayMode.FUSEDROUP
the sources in all active groups are visible.true
, if source
is visibleNullPointerException
- if source == null
IllegalArgumentException
- if source
is not contained in the state (and not
null
).boolean isSourceVisibleAndPresent(SourceAndConverter<?> source)
source
is both visible and provides image
data for the current timepoint.
Whether a source is visible depends on the display mode
:
DisplayMode.SINGLE
only the current source is visible.DisplayMode.GROUP
the sources in the current group are visible.DisplayMode.FUSED
all active sources are visible.DisplayMode.FUSEDROUP
the sources in all active groups are visible.present
, i.e., provide image data for the current timepoint
.true
, if source
is both visible and presentNullPointerException
- if source == null
IllegalArgumentException
- if source
is not contained in the state (and not
null
).Set<SourceAndConverter<?>> getVisibleSources()
The returned Set
is a copy. Changes to the set will not be
reflected in the viewer state, and vice versa.
Whether a source is visible depends on the display mode
:
DisplayMode.SINGLE
only the current source is visible.DisplayMode.GROUP
the sources in the current group are visible.DisplayMode.FUSED
all active sources are visible.DisplayMode.FUSEDROUP
the sources in all active groups are visible.Set<SourceAndConverter<?>> getVisibleAndPresentSources()
The returned Set
is a copy. Changes to the set will not be
reflected in the viewer state, and vice versa.
Whether a source is visible depends on the display mode
:
DisplayMode.SINGLE
only the current source is visible.DisplayMode.GROUP
the sources in the current group are visible.DisplayMode.FUSED
all active sources are visible.DisplayMode.FUSEDROUP
the sources in all active groups are visible.present
, i.e., provide image data for the current timepoint
.boolean containsSource(SourceAndConverter<?> source)
source
.true
, if source
is in the list of sources.NullPointerException
- if source == null
boolean addSource(SourceAndConverter<?> source)
source
to the state (optional operation). Returns
true
, if the source is added. Returns false
, if the
source is already present.
If source
is added and no other source was current, then
source
is made current
true
, if list of sources changed as a result of the call.NullPointerException
- if source == null
UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean addSources(Collection<? extends SourceAndConverter<?>> collection)
collection
to the state (optional operation).
Returns true
, if at least one source was added. Returns
false
, if all sources were already present.
If any sources are added and no other source was current, then the first added sources will be made current.
true
, if list of sources changed as a result of the call.NullPointerException
- if collection == null
or any element of collection
is
null
.UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean removeSource(SourceAndConverter<?> source)
source
from the state (optional operation).
Returns true
, if source
was removed from the state.
Returns false
, if source
was not contained in state.
The source
is also removed from any groups that contained it. If
source
was current, then the first source in the list of sources
is made current (if it exists).
true
, if list of sources changed as a result of the callNullPointerException
- if source == null
UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean removeSources(Collection<? extends SourceAndConverter<?>> collection)
collection
from the state (optional
operation). Returns true
, if at least one source was removed.
Returns false
, if none of the sources was present.
Removed sources are also removed from any groups containing them. If the current source was removed, then the first source in the remaining list of sources is made current (if it exists).
true
, if list of sources changed as a result of the call.NullPointerException
- if collection == null
or any element of collection
is
null
.UnsupportedOperationException
- if the operation is not supported by this ViewerStatevoid clearSources()
UnsupportedOperationException
- if the operation is not supported by this ViewerStateComparator<SourceAndConverter<?>> sourceOrder()
Comparator
that compares sources according to the order
in which they occur in the sources list. (Sources that do not occur in
the list are ordered before any source in the list).List<SourceGroup> getGroups()
List
reflects changes to the
viewer state. It is unmodifiable and not thread-safe.SourceGroup getCurrentGroup()
null
if there is no current
group)boolean isCurrentGroup(SourceGroup group)
true
if group
is the current group. Equivalent to
(getCurrentGroup() == group)
.true
if group
is the current groupboolean setCurrentGroup(SourceGroup group)
group
the current group (optional operation). Returns
true
, if current group changes as a result of the call. Returns
false
, if group
is already the current group.group
- the group to make currenttrue
, if current group changed as a result of the call.IllegalArgumentException
- if group
is not contained in the state (and not
null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateSet<SourceGroup> getActiveGroups()
Set
reflects changes
to the viewer state. It is unmodifiable and not thread-safe.boolean isGroupActive(SourceGroup group)
group
is active.true
, if group
is activeNullPointerException
- if group == null
IllegalArgumentException
- if group
is not contained in the state (and not
null
).boolean setGroupActive(SourceGroup group, boolean active)
group
active or inactive (optional operation).
Returns true
, if group activity changes as a result of the call.
Returns false
, if group
is already in the desired
active
state.
true
, if group activity changed as a result of the callNullPointerException
- if group == null
IllegalArgumentException
- if group
is not contained in the state (and not
null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean setGroupsActive(Collection<? extends SourceGroup> collection, boolean active)
collection
active or inactive (optional
operation).
Returns true
, if group activity changes as a result of the call.
Returns false
, if all groups were already in the desired
active
state.
true
, if group activity changed as a result of the callNullPointerException
- if collection == null
or any element of collection
is
null
.IllegalArgumentException
- if any element of collection
is not contained in the state.UnsupportedOperationException
- if the operation is not supported by this ViewerStateString getGroupName(SourceGroup group)
group
.null
NullPointerException
- if group == null
IllegalArgumentException
- if group
is not contained in the state (and not
null
).void setGroupName(SourceGroup group, String name)
name
of a group
(optional operation).NullPointerException
- if group == null
IllegalArgumentException
- if group
is not contained in the state (and not
null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean containsGroup(SourceGroup group)
group
.true
, if group
is in the list of groups.NullPointerException
- if group == null
boolean addGroup(SourceGroup group)
group
to the state (optional operation). Returns
true
, if the group is added. Returns false
, if the group
is already present.
If group
is added and no other group was current, then
group
is made current
true
, if list of groups changed as a result of the call.NullPointerException
- if group == null
UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean addGroups(Collection<? extends SourceGroup> collection)
collection
to the state (optional operation).
Returns true
, if at least one group was added. Returns
false
, if all groups were already present.
If any groups are added and no other group was current, then the first added groups will be made current.
true
, if list of groups changed as a result of the call.NullPointerException
- if collection == null
or any element of collection
is
null
.UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean removeGroup(SourceGroup group)
group
from the state (optional operation).
Returns true
, if group
was removed from the state.
Returns false
, if group
was not contained in state.
If group
was current, then the first group in the list of groups
is made current (if it exists).
true
, if list of groups changed as a result of the callNullPointerException
- if group == null
UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean removeGroups(Collection<? extends SourceGroup> collection)
collection
from the state (optional
operation). Returns true
, if at least one group was removed.
Returns false
, if none of the groups was present.
If the current group was removed, then the first group in the remaining list of groups is made current (if it exists).
true
, if list of groups changed as a result of the call.NullPointerException
- if collection == null
or any element of collection
is
null
.UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean addSourceToGroup(SourceAndConverter<?> source, SourceGroup group)
source
to group
(optional operation).
Returns true
, if source
was added to group
.
Returns false
, if source
was already contained in
group
. or either of source
and group
is not valid
(not in the BDV sources/groups list).
true
, if set of sources in group
changed as a
result of the callNullPointerException
- if source == null
or group == null
IllegalArgumentException
- if either of source
and group
is not contained in the
state (and not null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean addSourcesToGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)
collection
to group
(optional
operation).
Returns true
, if at least one source was added to group
.
Returns false
, if all sources were already contained in
group
.
true
, if set of sources in group
changed as a
result of the callNullPointerException
- if group == null
or collection == null
or any element
of collection
is null
.IllegalArgumentException
- if group
or any element of collection
is is not
contained in the state (and not null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean removeSourceFromGroup(SourceAndConverter<?> source, SourceGroup group)
source
from group
(optional operation).
Returns true
, if source
was removed from group
.
Returns false
, if source
was not contained in
group
,
true
, if set of sources in group
changed as a
result of the callNullPointerException
- if source == null
or group == null
IllegalArgumentException
- if either of source
and group
is not contained in the
state (and not null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateboolean removeSourcesFromGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)
collection
from group
(optional
operation).
Returns true
, if at least one source was removed from
group
. Returns false
, if none of the sources were
contained in group
.
true
, if set of sources in group
changed as a
result of the callNullPointerException
- if group == null
or collection == null
or any element
of collection
is null
.IllegalArgumentException
- if group
or any element of collection
is is not
contained in the state (and not null
).UnsupportedOperationException
- if the operation is not supported by this ViewerStateSet<SourceAndConverter<?>> getSourcesInGroup(SourceGroup group)
group
. The returned Set
reflects
changes to the viewer state. It is unmodifiable and not thread-safe.group
NullPointerException
- if group == null
IllegalArgumentException
- if group
is not contained in the state (and not
null
).void clearGroups()
UnsupportedOperationException
- if the operation is not supported by this ViewerStateComparator<SourceGroup> groupOrder()
Comparator
that compares groups according to the order
in which they occur in the groups list. (Groups that do not occur in the
list are ordered before any group in the list).Copyright © 2015–2021 Fiji. All rights reserved.