Class BvvMultiSource

java.lang.Object
sc.fiji.snt.viewer.BvvMultiSource

public class BvvMultiSource extends Object
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 T in 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

    Constructors
    Constructor
    Description
    BvvMultiSource(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 Type
    Method
    Description
    void
    applyTransform(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<?>
     
    void
    getLeaderTransform(net.imglib2.realtransform.AffineTransform3D result)
    Returns a copy of the most recently cached leader fixed transform.
    List<bvv.vistools.BvvStackSource<?>>
     
    boolean
     
    void
    Removes all sources in the group from the viewer.
    void
    setActive(boolean active)
    Sets the active/visible state for all sources in the group.
    void
    setColor(net.imglib2.type.numeric.ARGBType color)
    Sets the color for all sources in the group.
    void
    setDisplayRange(double min, double max)
    Sets the display range for all sources in the group.
    void
    setLiveSync(boolean live)
    Sets whether transforms are propagated to followers on every render frame (true) or only on explicit syncTransforms() calls (false).
    int
     
    void
    Forces a repaint.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 group
      followers - 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 explicit syncTransforms() calls (false).
      Parameters:
      live - true for live sync, false for manual trigger
    • isLiveSync

      public boolean isLiveSync()
      Returns:
      true if 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 value
      max - 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 - true to show, false to 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

      public List<bvv.vistools.BvvStackSource<?>> getFollowers()
      Returns:
      unmodifiable view of the follower sources
    • getSources

      public List<bvv.vistools.BvvStackSource<?>> getSources()
      Returns:
      all sources (leader + followers) as an unmodifiable list
    • size

      public int size()
      Returns:
      number of sources in the group (leader + followers)