import React, { useState } from 'react'; import { Tabs, TabsList, TabsTrigger, Button, PanelSection, Icons, Tooltip, TooltipTrigger, TooltipContent, Numeric, } from '@ohif/ui-next'; import { Enums } from '@cornerstonejs/core'; // Helper function to safely convert any value to uppercase string const toUpperCaseString = value => { if (value === null || value === undefined) { return ''; } return String(value).toUpperCase(); }; const Header = ({ title, tooltip }) => (
{tooltip}
{title}
); const DynamicVolumeControls = ({ isPlaying, onPlayPauseChange, // fps fps, onFpsChange, minFps, maxFps, // Frames currentDimensionGroupNumber, onDimensionGroupChange, numDimensionGroups, onGenerate, onDoubleRangeChange, rangeValues, onDynamicClick, }) => { const [computedView, setComputedView] = useState(false); const [computeViewMode, setComputeViewMode] = useState(Enums.DynamicOperatorType.SUM); // Wrapper for onGenerate to handle potential errors const handleGenerate = () => { try { if (typeof onGenerate === 'function') { onGenerate(computeViewMode); } else { console.error('onGenerate is not a function', onGenerate); } } catch (error) { console.error('Error in onGenerate:', error); } }; return (
Controls
{ const isComputed = value === 'computed'; setComputedView(isComputed); if (!isComputed && typeof onDynamicClick === 'function') { onDynamicClick(); } }} className="my-2 w-full" > 4D Computed
Operation Buttons (SUM, AVERAGE, SUBTRACT): Select the mathematical operation to be applied to the data set.
Range Slider: Choose the numeric range of dimension groups within which the operation will be performed.
Generate Button: Execute the chosen operation on the specified range of data.
} /> { setComputeViewMode(value); }} className="mt-2 w-full" > {' '} {toUpperCaseString(Enums.DynamicOperatorType.SUM)} {toUpperCaseString(Enums.DynamicOperatorType.AVERAGE)} {toUpperCaseString(Enums.DynamicOperatorType.SUBTRACT)}
{})} >
); }; export default DynamicVolumeControls; function DimensionGroupControls({ isPlaying, onPlayPauseChange, fps, minFps, maxFps, onFpsChange, numDimensionGroups, onDimensionGroupChange, currentDimensionGroupNumber, computedView, }) { const getPlayPauseIconName = () => (isPlaying ? 'icon-pause' : 'icon-play'); return (
Play/Pause Button: Begin or pause the animation of the 4D visualization.
Dimension Group Selector: Navigate through individual dimension groups of the 4D data.{' '}
FPS (Frames Per Second) Selector: Adjust the playback speed of the animation.
} />
{})} min={1} max={numDimensionGroups || 1} step={1} >
Frame
{})} min={minFps || 1} max={maxFps || 30} step={1} >
FPS
); }