Multi-Frame Data
Control the selected/focused frame of a multi-frame SharedImageSet
A SharedImageSet can consist of multiple frames, as reported by SharedImageSet.size(). This is how the ImFusion SDK models for example a 2D Ultrasound series or a 3D volume at various timestamps. The following demo shows a 2D Ultrasound series next to a single-frame CT volume. Use the mousewheel on the Ultrasound view or the slider below to scrub through the individual frames:
The currently selected (or focused) frame can be queried and changed:
To react to changes made elsewhere (by another control) subscribe with onSelectionChanged. It returns an unsubscribe function:
React
useFrameSelection subscribes to onSelectionChanged for you and returns the current focus index, a setter, and the total frame count.
This allows you to implement a React component that controls and listens to updates to the currently focused frame:
The Demo above is driven by a FrameSelection component which renders a slider that allows you to scrub through the selected frames and reports the currently focused frame and the total number of frames. It additionally handles the case of multiple SharedImageSets. You can for example query the currently visible data and the FrameSelection component will select any multi-frame images whose number of frames matches the first multi-frame image. The component then provides a single slider to sync the focused frame between these datasets: