Package sc.fiji.snt.viewer
Class Keyframe
java.lang.Object
sc.fiji.snt.viewer.Keyframe
A snapshot of a
Bvv or Bdv viewer state at a particular moment, used as a keyframe
for movie recording. Captures the viewer transform, camera/slab parameters (dCam,
nearClip, farClip), the current timepoint, and which "actors" (volume channels,
paths, annotations) are visible.
Keyframes are serialized/deserialized via toString() and fromString(String) so
they can be dumped to the console with the K hotkey and pasted into scripts. Camera/slab
parameters are only meaningful in BVV: BDV ignores them on playback.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDisplay settings of a single source. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intintEasing type for the transition into this keyframe (0-5).final doubleCamera depth parameter (perspective).final Map<Integer, Keyframe.SourceDisplay> Per-source display settings (levels and LUT color), keyed by 0-based source index.final doubleFar clipping distance (slab back).intNumber of frames for the transition from the previous keyframe into this one.intViewer (canvas) size in pixels at capture, or-1if unspecified.final doubleNear clipping distance (slab front).intTimepoint (1-based) displayed at this keyframe.final net.imglib2.realtransform.AffineTransform3DViewer transform (camera position + zoom + rotation).Names of visible actors (e.g.intViewer (canvas) size in pixels at capture, or-1if unspecified. -
Constructor Summary
ConstructorsConstructorDescriptionConvenience constructor that deserializes a keyframe from a string.Keyframe(net.imglib2.realtransform.AffineTransform3D transform, double dCam, double nearClip, double farClip, Set<String> visibleActors, int accelType) Keyframe(net.imglib2.realtransform.AffineTransform3D transform, double dCam, double nearClip, double farClip, Set<String> visibleActors, int accelType, int frames) -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleaccel(double t, int type) Easing function for keyframe transitions, adapted from BDV movie recorder.Sets the easing type by name (chainable, for scripts).frames(int frames) Sets the transition length (chainable, for scripts).static KeyframefromString(String s) Deserializes a keyframe from the string produced bytoString().Returns the current easing type as a human-readable name.voidSets the easing type by name.toString()Serializes this keyframe to a single-line string:transform=d0,d1,...,d11|cam=dCam,near,far|visible=a;b;c|accel=name|frames=N|t=N|size=WxH|display=i:min,max,#RRGGBB;...(the timepoint, size and display entries are omitted if unspecified).toString(boolean includeTiming) Serializes this keyframe, optionally leaving out the timing entries (accelandframes), e.g., when they are set separately throughframes(int)andaccel(String).net.imglib2.realtransform.AffineTransform3DtransformFor(int canvasWidth, int canvasHeight) Returns a copy of the viewer transform adjusted to a canvas of the given size.
-
Field Details
-
transform
public final net.imglib2.realtransform.AffineTransform3D transformViewer transform (camera position + zoom + rotation). -
dCam
public final double dCamCamera depth parameter (perspective). -
nearClip
public final double nearClipNear clipping distance (slab front). -
farClip
public final double farClipFar clipping distance (slab back). -
visibleActors
Names of visible actors (e.g. "vol:Sample#1", "paths", "annotations"). -
timepoint
public int timepointTimepoint (1-based) displayed at this keyframe. Interpolated linearly (and rounded) between keyframes. A value<= 0means "unspecified": the viewer's timepoint is left untouched. -
width
public int widthViewer (canvas) size in pixels at capture, or-1if unspecified. The viewer transform is in screen pixels, so it depends on the canvas size: seetransformFor(int, int). -
height
public int heightViewer (canvas) size in pixels at capture, or-1if unspecified. The viewer transform is in screen pixels, so it depends on the canvas size: seetransformFor(int, int). -
display
Per-source display settings (levels and LUT color), keyed by 0-based source index. Interpolated between keyframes for sources present in both; sources absent from the map are left untouched. -
accelType
public int accelTypeEasing type for the transition into this keyframe (0-5). Can be set by name viasetAccel(String).- See Also:
-
ACCEL_SYMMETRIC
public static final int ACCEL_SYMMETRIC- See Also:
-
ACCEL_SLOW_START
public static final int ACCEL_SLOW_START- See Also:
-
ACCEL_SLOW_END
public static final int ACCEL_SLOW_END- See Also:
-
ACCEL_SOFT_SYMMETRIC
public static final int ACCEL_SOFT_SYMMETRIC- See Also:
-
ACCEL_SOFT_SLOW_START
public static final int ACCEL_SOFT_SLOW_START- See Also:
-
ACCEL_SOFT_SLOW_END
public static final int ACCEL_SOFT_SLOW_END- See Also:
-
frames
public int framesNumber of frames for the transition from the previous keyframe into this one. Ignored for the first keyframe in a sequence. Defaults to 60 (~2 s at 30 fps).
-
-
Constructor Details
-
Keyframe
Convenience constructor that deserializes a keyframe from a string. Equivalent tofromString(String)but usable asnew Keyframe("transform=...|cam=...|...")in scripts.- Parameters:
serialized- the string produced bytoString()- Throws:
IllegalArgumentException- if parsing fails
-
Keyframe
-
Keyframe
-
-
Method Details
-
setAccel
Sets the easing type by name. Accepted values (case-insensitive, spaces or underscores): "symmetric", "slow_start" / "slow start", "slow_end", "soft_symmetric", "soft_slow_start", "soft_slow_end".- Parameters:
name- the easing name- Throws:
IllegalArgumentException- if the name is not recognized
-
getAccelName
Returns the current easing type as a human-readable name.- Returns:
- the easing name, e.g. "slow start"
-
transformFor
public net.imglib2.realtransform.AffineTransform3D transformFor(int canvasWidth, int canvasHeight) Returns a copy of the viewer transform adjusted to a canvas of the given size. Mirrors what the viewer does when resized (the scene center stays at the canvas center): the translation is shifted by half the size difference. The transform is returned unchanged if this keyframe has no recorded size.- Parameters:
canvasWidth- the current canvas width in pixelscanvasHeight- the current canvas height in pixels- Returns:
- a new transform
-
frames
Sets the transition length (chainable, for scripts).- Parameters:
frames- number of frames of the transition into this keyframe- Returns:
- this keyframe
-
accel
Sets the easing type by name (chainable, for scripts).- Parameters:
name- the easing name, seesetAccel(String)- Returns:
- this keyframe
-
toString
Serializes this keyframe to a single-line string:transform=d0,d1,...,d11|cam=dCam,near,far|visible=a;b;c|accel=name|frames=N|t=N|size=WxH|display=i:min,max,#RRGGBB;...(the timepoint, size and display entries are omitted if unspecified). -
toString
Serializes this keyframe, optionally leaving out the timing entries (accelandframes), e.g., when they are set separately throughframes(int)andaccel(String).- Parameters:
includeTiming- whether to include theaccelandframesentries- Returns:
- the serialized keyframe
-
fromString
Deserializes a keyframe from the string produced bytoString().- Parameters:
s- the serialised keyframe string- Returns:
- a new Keyframe, or
nullif parsing fails
-
accel
public static double accel(double t, int type) Easing function for keyframe transitions, adapted from BDV movie recorder.- Parameters:
t- progress value in [0, 1]type- easing type: 0 = symmetric, 1 = slow start, 2 = slow end, 3 = soft symmetric, 4 = soft slow start, 5 = soft slow end- Returns:
- eased progress value in [0, 1]
- See Also:
-