-
- All Known Implementing Classes:
BasicViewerState,SynchronizedViewerState
public interface ViewerStateReading and writing the BigDataViewer state:- interpolation and display mode
- contained sources and source groups
- activeness / currentness of sources and groups
- current timepoint and transformation
- Author:
- Tobias Pietzsch
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanaddGroup(SourceGroup group)Addgroupto the state (optional operation).booleanaddGroups(Collection<? extends SourceGroup> collection)Add all groups incollectionto the state (optional operation).booleanaddSource(SourceAndConverter<?> source)Addsourceto the state (optional operation).booleanaddSources(Collection<? extends SourceAndConverter<?>> collection)Add all sources incollectionto the state (optional operation).booleanaddSourcesToGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)Add all sources incollectiontogroup(optional operation).booleanaddSourceToGroup(SourceAndConverter<?> source, SourceGroup group)Addsourcetogroup(optional operation).org.scijava.listeners.Listeners<ViewerStateChangeListener>changeListeners()ViewerStateChangeListeners can be added/removed here, and will be notified about changes to this ViewerState.voidclearGroups()Remove all groups from the state (optional operation).voidclearSources()Remove all sources from the state (optional operation).booleancontainsGroup(SourceGroup group)Check whether the state contains thegroup.booleancontainsSource(SourceAndConverter<?> source)Check whether the state contains thesource.AccumulateProjectorFactory<net.imglib2.type.numeric.ARGBType>getAccumulateProjectorFactory()Get the currentAccumulateProjectorFactory.Set<SourceGroup>getActiveGroups()Get the set of active groups.Set<SourceAndConverter<?>>getActiveSources()Get the set of active sources.SourceGroupgetCurrentGroup()Get the current group.SourceAndConverter<?>getCurrentSource()Get the current source.intgetCurrentTimepoint()Get the current timepoint.DisplayModegetDisplayMode()Get the currentDisplayMode.StringgetGroupName(SourceGroup group)Get the name of agroup.List<SourceGroup>getGroups()Get the list of groups.InterpolationgetInterpolation()Get the interpolation method.intgetNumTimepoints()Get the number of timepoints.List<SourceAndConverter<?>>getSources()Get the list of sources.Set<SourceAndConverter<?>>getSourcesInGroup(SourceGroup group)Get the set sources ingroup.default net.imglib2.realtransform.AffineTransform3DgetViewerTransform()Get the viewer transform.voidgetViewerTransform(net.imglib2.realtransform.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 aComparatorthat compares groups according to the order in which they occur in the groups list.booleanisCurrentGroup(SourceGroup group)Returnstrueifgroupis the current group.booleanisCurrentSource(SourceAndConverter<?> source)Returnstrueifsourceis the current source.booleanisGroupActive(SourceGroup group)Check whether the givengroupis active.booleanisSourceActive(SourceAndConverter<?> source)Check whether the givensourceis active.booleanisSourceVisible(SourceAndConverter<?> source)Check whether the givensourceis visible.booleanisSourceVisibleAndPresent(SourceAndConverter<?> source)Check whether the givensourceis both visible and provides image data for the current timepoint.booleanremoveGroup(SourceGroup group)Removegroupfrom the state (optional operation).booleanremoveGroups(Collection<? extends SourceGroup> collection)Remove all groups incollectionfrom the state (optional operation).booleanremoveSource(SourceAndConverter<?> source)Removesourcefrom the state (optional operation).booleanremoveSourceFromGroup(SourceAndConverter<?> source, SourceGroup group)Removesourcefromgroup(optional operation).booleanremoveSources(Collection<? extends SourceAndConverter<?>> collection)Remove all sources incollectionfrom the state (optional operation).booleanremoveSourcesFromGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)Remove all sources incollectionfromgroup(optional operation).voidsetAccumulateProjectorFactory(AccumulateProjectorFactory<net.imglib2.type.numeric.ARGBType> factory)Set theAccumulateProjectorFactory.booleansetCurrentGroup(SourceGroup group)Makegroupthe current group (optional operation).booleansetCurrentSource(SourceAndConverter<?> source)Makesourcethe current source (optional operation).voidsetCurrentTimepoint(int t)Set the current timepoint (optional operation).voidsetDisplayMode(DisplayMode mode)Set theDisplayMode(optional operation).booleansetGroupActive(SourceGroup group, boolean active)Setgroupactive or inactive (optional operation).voidsetGroupName(SourceGroup group, String name)Set thenameof agroup(optional operation).booleansetGroupsActive(Collection<? extends SourceGroup> collection, boolean active)Set all groups incollectionactive or inactive (optional operation).voidsetInterpolation(Interpolation interpolation)Set the interpolation method (optional operation).voidsetNumTimepoints(int n)Set the number of timepoints (optional operation).booleansetSourceActive(SourceAndConverter<?> source, boolean active)Setsourceactive or inactive (optional operation).booleansetSourcesActive(Collection<? extends SourceAndConverter<?>> collection, boolean active)Set all sources incollectionactive or inactive (optional operation).voidsetViewerTransform(net.imglib2.realtransform.AffineTransform3D transform)Set the viewer transform (optional operation).ViewerStatesnapshot()Get a snapshot of this ViewerState.Comparator<SourceAndConverter<?>>sourceOrder()Returns aComparatorthat compares sources according to the order in which they occur in the sources list.
-
-
-
Method Detail
-
snapshot
ViewerState snapshot()
Get a snapshot of this ViewerState.- Returns:
- unmodifiable copy of the current state
-
changeListeners
org.scijava.listeners.Listeners<ViewerStateChangeListener> changeListeners()
ViewerStateChangeListeners can be added/removed here, and will be notified about changes to this ViewerState.
-
getInterpolation
Interpolation getInterpolation()
Get the interpolation method.- Returns:
- interpolation method
-
setInterpolation
void setInterpolation(Interpolation interpolation)
Set the interpolation method (optional operation).- Throws:
UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getDisplayMode
DisplayMode getDisplayMode()
Get the currentDisplayMode.- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
- Returns:
- the current display mode
- In
-
setDisplayMode
void setDisplayMode(DisplayMode mode)
Set theDisplayMode(optional operation).- Throws:
UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getAccumulateProjectorFactory
AccumulateProjectorFactory<net.imglib2.type.numeric.ARGBType> getAccumulateProjectorFactory()
Get the currentAccumulateProjectorFactory.This factory provides AccumulateProjectors for blending rendered overlapping sources into the final screen image.
- Returns:
- current AccumulateProjector factory
-
setAccumulateProjectorFactory
void setAccumulateProjectorFactory(AccumulateProjectorFactory<net.imglib2.type.numeric.ARGBType> factory)
Set theAccumulateProjectorFactory.This factory provides AccumulateProjectors for blending rendered overlapping sources into the final screen image. This can be used for switching between "sum" and "average" blending mode for example.
- Parameters:
factory- AccumulateProjector factory to set
-
getNumTimepoints
int getNumTimepoints()
Get the number of timepoints.- Returns:
- the number of timepoints
-
setNumTimepoints
void setNumTimepoints(int n)
Set the number of timepoints (optional operation).If
getCurrentTimepoint()current timepoint} is>= n, it will be adjusted ton-1.- Throws:
IllegalArgumentException- ifn < 1.UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getCurrentTimepoint
int getCurrentTimepoint()
Get the current timepoint.- Returns:
- current timepoint (index)
-
setCurrentTimepoint
void setCurrentTimepoint(int t)
Set the current timepoint (optional operation).- Throws:
IllegalArgumentException- ift >= getNumTimepoints()ort < 0.UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getViewerTransform
void getViewerTransform(net.imglib2.realtransform.AffineTransform3D transform)
Get the viewer transform.- Parameters:
transform- is set to the viewer transform
-
getViewerTransform
default net.imglib2.realtransform.AffineTransform3D getViewerTransform()
Get the viewer transform.- Returns:
- a copy of the current viewer transform
-
setViewerTransform
void setViewerTransform(net.imglib2.realtransform.AffineTransform3D transform)
Set the viewer transform (optional operation).- Throws:
UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getSources
List<SourceAndConverter<?>> getSources()
Get the list of sources. The returnedListreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Returns:
- the list of sources
-
getCurrentSource
SourceAndConverter<?> getCurrentSource()
Get the current source. (May returnnullif there is no current source)- Returns:
- the current source
-
isCurrentSource
boolean isCurrentSource(SourceAndConverter<?> source)
Returnstrueifsourceis the current source. Equivalent to(getCurrentSource() == source).- Parameters:
source- the source. Passingnullchecks whether no source is current.- Returns:
trueifsourceis the current source
-
setCurrentSource
boolean setCurrentSource(SourceAndConverter<?> source)
Makesourcethe current source (optional operation). Returnstrue, if current source changes as a result of the call. Returnsfalse, ifsourceis already the current source.- Parameters:
source- the source to make current. Passingnullclears the current source.- Returns:
true, if current source changed as a result of the call- Throws:
IllegalArgumentException- ifsourceis not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getActiveSources
Set<SourceAndConverter<?>> getActiveSources()
Get the set of active sources. The returnedSetreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Returns:
- the set of active sources
-
isSourceActive
boolean isSourceActive(SourceAndConverter<?> source)
Check whether the givensourceis active.- Returns:
true, ifsourceis active- Throws:
NullPointerException- ifsource == nullIllegalArgumentException- ifsourceis not contained in the state (and notnull).
-
setSourceActive
boolean setSourceActive(SourceAndConverter<?> source, boolean active)
Setsourceactive or inactive (optional operation).Returns
true, if source activity changes as a result of the call. Returnsfalse, ifsourceis already in the desiredactivestate.- Returns:
true, if source activity changed as a result of the call- Throws:
NullPointerException- ifsource == nullIllegalArgumentException- ifsourceis not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
setSourcesActive
boolean setSourcesActive(Collection<? extends SourceAndConverter<?>> collection, boolean active)
Set all sources incollectionactive or inactive (optional operation).Returns
true, if source activity changes as a result of the call. Returnsfalse, if all sources were already in the desiredactivestate.- Returns:
true, if source activity changed as a result of the call- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.IllegalArgumentException- if any element ofcollectionis not contained in the state.UnsupportedOperationException- if the operation is not supported by this ViewerState
-
isSourceVisible
boolean isSourceVisible(SourceAndConverter<?> source)
Check whether the givensourceis visible.Whether a source is visible depends on the
display mode:- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
- Returns:
true, ifsourceis visible- Throws:
NullPointerException- ifsource == nullIllegalArgumentException- ifsourceis not contained in the state (and notnull).
- In
-
isSourceVisibleAndPresent
boolean isSourceVisibleAndPresent(SourceAndConverter<?> source)
Check whether the givensourceis both visible and provides image data for the current timepoint.Whether a source is visible depends on the
display mode:- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
present, i.e., provide image data for thecurrent timepoint.- Returns:
true, ifsourceis both visible and present- Throws:
NullPointerException- ifsource == nullIllegalArgumentException- ifsourceis not contained in the state (and notnull).
- In
-
getVisibleSources
Set<SourceAndConverter<?>> getVisibleSources()
Get the set of visible sources.The returned
Setis 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:- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
- Returns:
- the set of visible sources
- In
-
getVisibleAndPresentSources
Set<SourceAndConverter<?>> getVisibleAndPresentSources()
Get the set of visible sources that also provide image data for the current timepoint.The returned
Setis 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:- In
DisplayMode.SINGLEonly the current source is visible. - In
DisplayMode.GROUPthe sources in the current group are visible. - In
DisplayMode.FUSEDall active sources are visible. - In
DisplayMode.FUSEDROUPthe sources in all active groups are visible.
present, i.e., provide image data for thecurrent timepoint.- Returns:
- the set of sources that are both visible and present
- In
-
containsSource
boolean containsSource(SourceAndConverter<?> source)
Check whether the state contains thesource.- Returns:
true, ifsourceis in the list of sources.- Throws:
NullPointerException- ifsource == null
-
addSource
boolean addSource(SourceAndConverter<?> source)
Addsourceto the state (optional operation). Returnstrue, if the source is added. Returnsfalse, if the source is already present.If
sourceis added and no other source was current, thensourceis made current- Returns:
true, if list of sources changed as a result of the call.- Throws:
NullPointerException- ifsource == nullUnsupportedOperationException- if the operation is not supported by this ViewerState
-
addSources
boolean addSources(Collection<? extends SourceAndConverter<?>> collection)
Add all sources incollectionto the state (optional operation). Returnstrue, if at least one source was added. Returnsfalse, 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.
- Returns:
true, if list of sources changed as a result of the call.- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.UnsupportedOperationException- if the operation is not supported by this ViewerState
-
removeSource
boolean removeSource(SourceAndConverter<?> source)
Removesourcefrom the state (optional operation).Returns
true, ifsourcewas removed from the state. Returnsfalse, ifsourcewas not contained in state.The
sourceis also removed from any groups that contained it. Ifsourcewas current, then the first source in the list of sources is made current (if it exists).- Returns:
true, if list of sources changed as a result of the call- Throws:
NullPointerException- ifsource == nullUnsupportedOperationException- if the operation is not supported by this ViewerState
-
removeSources
boolean removeSources(Collection<? extends SourceAndConverter<?>> collection)
Remove all sources incollectionfrom the state (optional operation). Returnstrue, if at least one source was removed. Returnsfalse, 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).
- Returns:
true, if list of sources changed as a result of the call.- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.UnsupportedOperationException- if the operation is not supported by this ViewerState
-
clearSources
void clearSources()
Remove all sources from the state (optional operation).- Throws:
UnsupportedOperationException- if the operation is not supported by this ViewerState
-
sourceOrder
Comparator<SourceAndConverter<?>> sourceOrder()
Returns aComparatorthat 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).
-
getGroups
List<SourceGroup> getGroups()
Get the list of groups. The returnedListreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Returns:
- the list of groups
-
getCurrentGroup
SourceGroup getCurrentGroup()
Get the current group. (May returnnullif there is no current group)- Returns:
- the current group
-
isCurrentGroup
boolean isCurrentGroup(SourceGroup group)
Returnstrueifgroupis the current group. Equivalent to(getCurrentGroup() == group).- Returns:
trueifgroupis the current group
-
setCurrentGroup
boolean setCurrentGroup(SourceGroup group)
Makegroupthe current group (optional operation). Returnstrue, if current group changes as a result of the call. Returnsfalse, ifgroupis already the current group.- Parameters:
group- the group to make current- Returns:
true, if current group changed as a result of the call.- Throws:
IllegalArgumentException- ifgroupis not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getActiveGroups
Set<SourceGroup> getActiveGroups()
Get the set of active groups. The returnedSetreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Returns:
- the set of active groups
-
isGroupActive
boolean isGroupActive(SourceGroup group)
Check whether the givengroupis active.- Returns:
true, ifgroupis active- Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
setGroupActive
boolean setGroupActive(SourceGroup group, boolean active)
Setgroupactive or inactive (optional operation).Returns
true, if group activity changes as a result of the call. Returnsfalse, ifgroupis already in the desiredactivestate.- Returns:
true, if group activity changed as a result of the call- Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
setGroupsActive
boolean setGroupsActive(Collection<? extends SourceGroup> collection, boolean active)
Set all groups incollectionactive or inactive (optional operation).Returns
true, if group activity changes as a result of the call. Returnsfalse, if all groups were already in the desiredactivestate.- Returns:
true, if group activity changed as a result of the call- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.IllegalArgumentException- if any element ofcollectionis not contained in the state.UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getGroupName
String getGroupName(SourceGroup group)
Get the name of agroup.- Returns:
- name of the group, may be
null - Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
setGroupName
void setGroupName(SourceGroup group, String name)
Set thenameof agroup(optional operation).- Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
containsGroup
boolean containsGroup(SourceGroup group)
Check whether the state contains thegroup.- Returns:
true, ifgroupis in the list of groups.- Throws:
NullPointerException- ifgroup == null
-
addGroup
boolean addGroup(SourceGroup group)
Addgroupto the state (optional operation). Returnstrue, if the group is added. Returnsfalse, if the group is already present.If
groupis added and no other group was current, thengroupis made current- Returns:
true, if list of groups changed as a result of the call.- Throws:
NullPointerException- ifgroup == nullUnsupportedOperationException- if the operation is not supported by this ViewerState
-
addGroups
boolean addGroups(Collection<? extends SourceGroup> collection)
Add all groups incollectionto the state (optional operation). Returnstrue, if at least one group was added. Returnsfalse, 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.
- Returns:
true, if list of groups changed as a result of the call.- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.UnsupportedOperationException- if the operation is not supported by this ViewerState
-
removeGroup
boolean removeGroup(SourceGroup group)
Removegroupfrom the state (optional operation).Returns
true, ifgroupwas removed from the state. Returnsfalse, ifgroupwas not contained in state.If
groupwas current, then the first group in the list of groups is made current (if it exists).- Returns:
true, if list of groups changed as a result of the call- Throws:
NullPointerException- ifgroup == nullUnsupportedOperationException- if the operation is not supported by this ViewerState
-
removeGroups
boolean removeGroups(Collection<? extends SourceGroup> collection)
Remove all groups incollectionfrom the state (optional operation). Returnstrue, if at least one group was removed. Returnsfalse, 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).
- Returns:
true, if list of groups changed as a result of the call.- Throws:
NullPointerException- ifcollection == nullor any element ofcollectionisnull.UnsupportedOperationException- if the operation is not supported by this ViewerState
-
addSourceToGroup
boolean addSourceToGroup(SourceAndConverter<?> source, SourceGroup group)
Addsourcetogroup(optional operation).Returns
true, ifsourcewas added togroup. Returnsfalse, ifsourcewas already contained ingroup. or either ofsourceandgroupis not valid (not in the BDV sources/groups list).- Returns:
true, if set of sources ingroupchanged as a result of the call- Throws:
NullPointerException- ifsource == nullorgroup == nullIllegalArgumentException- if either ofsourceandgroupis not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
addSourcesToGroup
boolean addSourcesToGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)
Add all sources incollectiontogroup(optional operation).Returns
true, if at least one source was added togroup. Returnsfalse, if all sources were already contained ingroup.- Returns:
true, if set of sources ingroupchanged as a result of the call- Throws:
NullPointerException- ifgroup == nullorcollection == nullor any element ofcollectionisnull.IllegalArgumentException- ifgroupor any element ofcollectionis is not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
removeSourceFromGroup
boolean removeSourceFromGroup(SourceAndConverter<?> source, SourceGroup group)
Removesourcefromgroup(optional operation).Returns
true, ifsourcewas removed fromgroup. Returnsfalse, ifsourcewas not contained ingroup,- Returns:
true, if set of sources ingroupchanged as a result of the call- Throws:
NullPointerException- ifsource == nullorgroup == nullIllegalArgumentException- if either ofsourceandgroupis not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
removeSourcesFromGroup
boolean removeSourcesFromGroup(Collection<? extends SourceAndConverter<?>> collection, SourceGroup group)
Remove all sources incollectionfromgroup(optional operation).Returns
true, if at least one source was removed fromgroup. Returnsfalse, if none of the sources were contained ingroup.- Returns:
true, if set of sources ingroupchanged as a result of the call- Throws:
NullPointerException- ifgroup == nullorcollection == nullor any element ofcollectionisnull.IllegalArgumentException- ifgroupor any element ofcollectionis is not contained in the state (and notnull).UnsupportedOperationException- if the operation is not supported by this ViewerState
-
getSourcesInGroup
Set<SourceAndConverter<?>> getSourcesInGroup(SourceGroup group)
Get the set sources ingroup. The returnedSetreflects changes to the viewer state. It is unmodifiable and not thread-safe.- Returns:
- the set of sources in
group - Throws:
NullPointerException- ifgroup == nullIllegalArgumentException- ifgroupis not contained in the state (and notnull).
-
clearGroups
void clearGroups()
Remove all groups from the state (optional operation).- Throws:
UnsupportedOperationException- if the operation is not supported by this ViewerState
-
groupOrder
Comparator<SourceGroup> groupOrder()
Returns aComparatorthat 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).
-
-