Package sc.fiji.snt.viewer
Class BvvMultiSource
java.lang.Object
sc.fiji.snt.viewer.BvvMultiSource
A group of
BvvSource objects that are treated as a logical unit:
display properties (color, range, active state) and manual transforms applied
to the leader source are propagated to all follower sources.
This is particularly useful for:
- Multichannel images where each channel is a separate BVV source but
should move together during manual registration (press
Tin BVV to enter manual transform mode). - Multi-image workflows where multiple volumes must be grouped and manipulated as one.
Transform synchronization is achieved by making all follower
TransformedSources share the leader's fixedTransform and
incrementalTransform field objects via reflection. This means any
transform applied to the leader, including live T-mode (press T)
dragging: It is immediately visible on all followers with no listener overhead.
If reflection fails, a renderTransformListeners fallback is used.
-
Constructor Summary
ConstructorsConstructorDescriptionBvvMultiSource(bvv.vistools.BvvStackSource<?> single) Convenience constructor for a single source (no followers).BvvMultiSource(bvv.vistools.BvvStackSource<?> leader, List<bvv.vistools.BvvStackSource<?>> followers) Creates a group with a designated leader and zero or more followers. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTransform(net.imglib2.realtransform.AffineTransform3D transform) Applies the given transform as the fixed transform to the leader and all followers.List<bvv.vistools.BvvStackSource<?>> bvv.vistools.BvvStackSource<?> voidgetLeaderTransform(net.imglib2.realtransform.AffineTransform3D result) Returns a copy of the most recently cached leader fixed transform.List<bvv.vistools.BvvStackSource<?>> booleanvoidRemoves all sources in the group from the viewer.voidsetActive(boolean active) Sets the active/visible state for all sources in the group.voidsetColor(net.imglib2.type.numeric.ARGBType color) Sets the color for all sources in the group.voidsetDisplayRange(double min, double max) Sets the display range for all sources in the group.voidsetLiveSync(boolean live) Sets whether transforms are propagated to followers on every render frame (true) or only on explicitsyncTransforms()calls (false).intsize()voidForces a repaint.
-
Constructor Details
-
BvvMultiSource
public BvvMultiSource(bvv.vistools.BvvStackSource<?> leader, List<bvv.vistools.BvvStackSource<?>> followers) Creates a group with a designated leader and zero or more followers.- Parameters:
leader- the primary source; its transform drives the groupfollowers- additional sources that mirror the leader's transform
-
BvvMultiSource
public BvvMultiSource(bvv.vistools.BvvStackSource<?> single) Convenience constructor for a single source (no followers). Useful for keeping a consistent API when only one source exists.
-
-
Method Details
-
syncTransforms
public void syncTransforms()Forces a repaint. With field-sharing active, followers already hold the same transform objects as the leader: this call just flushes the display. Called internally after transform commits in the fallback path. -
applyTransform
public void applyTransform(net.imglib2.realtransform.AffineTransform3D transform) Applies the given transform as the fixed transform to the leader and all followers. This is the primary entry point for loading a saved transform.- Parameters:
transform- the transform to apply
-
getLeaderTransform
public void getLeaderTransform(net.imglib2.realtransform.AffineTransform3D result) Returns a copy of the most recently cached leader fixed transform.- Parameters:
result- set to the cached transform
-
setLiveSync
public void setLiveSync(boolean live) Sets whether transforms are propagated to followers on every render frame (true) or only on explicitsyncTransforms()calls (false).- Parameters:
live-truefor live sync,falsefor manual trigger
-
isLiveSync
public boolean isLiveSync()- Returns:
trueif live transform sync is enabled
-
setDisplayRange
public void setDisplayRange(double min, double max) Sets the display range for all sources in the group.- Parameters:
min- minimum display valuemax- maximum display value
-
setColor
public void setColor(net.imglib2.type.numeric.ARGBType color) Sets the color for all sources in the group.- Parameters:
color- the ARGB color
-
setActive
public void setActive(boolean active) Sets the active/visible state for all sources in the group.- Parameters:
active-trueto show,falseto hide
-
removeFromBvv
public void removeFromBvv()Removes all sources in the group from the viewer. -
getLeader
public bvv.vistools.BvvStackSource<?> getLeader()- Returns:
- the leader source
-
getFollowers
- Returns:
- unmodifiable view of the follower sources
-
getSources
- Returns:
- all sources (leader + followers) as an unmodifiable list
-
size
public int size()- Returns:
- number of sources in the group (leader + followers)
-