'use client'; import React, { useState } from 'react'; import { DataRow } from '../../../../ui-next/src/components/DataRow'; import { Button } from '../../../../ui-next/src/components/Button'; import { Select, SelectValue, SelectTrigger, SelectContent, SelectItem, } from '../../../../ui-next/src/components/Select'; import { Icons } from '../../../../ui-next/src/components/Icons'; import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuLabel, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuPortal, } from '../../../../ui-next/src/components/DropdownMenu'; import { Accordion, AccordionItem, AccordionTrigger, AccordionContent, } from '../../../../ui-next/src/components/Accordion'; import { Slider } from '../../../../ui-next/src/components/Slider'; import { Switch } from '../../../../ui-next/src/components/Switch'; import { Label } from '../../../../ui-next/src/components/Label'; import { Input } from '../../../../ui-next/src/components/Input'; import { Tabs, TabsList, TabsTrigger } from '../../../../ui-next/src/components/Tabs'; import { actionOptionsMap, dataList } from '../../../../ui-next/assets/data'; import { TooltipProvider } from '../../../../ui-next/src/components/Tooltip'; import { HoverCard, HoverCardTrigger, HoverCardContent, } from '../../../../ui-next/src/components/HoverCard'; interface DataItem { id: number; title: string; description: string; optionalField?: string; colorHex?: string; details?: { primary: string[]; secondary: string[] }; series?: string; statistics?: { centroidX: string; centroidY: string; centroidZ: string; frameDuration: string; kurtosis: string; max: string; maxSlice: string; mean: string; median: string; min: string; regions: string; skewness: string; sphereDiameter: string; standardDeviation: string; suvPeak: string; total: string; glycolysis: string; volume: string; voxelCount: string; }; } interface ListGroup { type: string; items: DataItem[]; } export default function SegmentationPanel() { const [selectedRowId, setSelectedRowId] = useState(null); const [selectedTab, setSelectedTab] = useState('Fill & Outline'); const handleAction = (id: string, action: string) => { console.log(`Action "${action}" triggered for item with id: ${id}`); // Implement actual action logic here }; // Handle row selection const handleRowSelect = (id: string) => { setSelectedRowId(prevSelectedId => (prevSelectedId === id ? null : id)); }; const organSegmentationGroup = dataList.find( (listGroup: any) => listGroup.type === 'Organ Segmentation' ) as unknown as ListGroup; if (!organSegmentationGroup) { return
Organ Segmentation data not found.
; } // Create a state to track which item's statistics to show // Function to render statistics panel const renderStatisticsPanel = (item: DataItem) => { if (!item.statistics) { return null; } const stats = item.statistics; return (

{item.title}

Centroid X
{stats.centroidX.value}{' '} {stats.centroidX.unit}
Centroid Y
{stats.centroidY.value}{' '} {stats.centroidY.unit}
Centroid Z
{stats.centroidZ.value}{' '} {stats.centroidZ.unit}
Frame Duration
{stats.frameDuration.value}{' '} {stats.frameDuration.unit}
Kurtosis
{stats.kurtosis.value}{' '} {stats.kurtosis.unit}
Max
{stats.max.value}{' '} {stats.max.unit}
Max Slice
{stats.maxSlice.value}{' '} {stats.maxSlice.unit}
Mean
{stats.mean.value}{' '} {stats.mean.unit}
Median
{stats.median.value}{' '} {stats.median.unit}
Min
{stats.min.value}{' '} {stats.min.unit}
Regions
{stats.regions.value}{' '} {stats.regions.unit}
Skewness
{stats.skewness.value}{' '} {stats.skewness.unit}
Sphere Diameter
{stats.sphereDiameter.value}{' '} {stats.sphereDiameter.unit}
Standard Deviation
{stats.standardDeviation.value}{' '} {stats.standardDeviation.unit}
SUV Peak
{stats.suvPeak.value}{' '} {stats.suvPeak.unit}
Total
{stats.total.value}{' '} {stats.total.unit}
Glycolysis
{stats.glycolysis.value}{' '} {stats.glycolysis.unit}
Volume
{stats.volume.value}{' '} {stats.volume.unit}
Voxel Count
{stats.voxelCount.value}{' '} {stats.voxelCount.unit}
); }; return (
{/* Segmentation Tools */} Segmentation Tools
{/* Segmentation List */} Segmentation List
{/* Header Controls */}
Create New Segmentation Manage Current Segmentation Remove from Viewport Rename Export & Download Export DICOM SEG Download DICOM SEG Download DICOM RTSTRUCT Delete
{/* Appearance Settings */}
Appearance Settings
{/* Display Label with Selected Tab */}
Show: {selectedTab}
{/* Tabs Controls */}
{/* Opacity Slider */}
{/* Border Slider */}
{/* Sync Changes Switch */}
{/* Display Inactive Segmentations Switch */}
{/* Additional Opacity Slider */}
{/* Action Buttons */}
{/* Data Rows */}
{organSegmentationGroup.items.map((item, index) => { const compositeId = `${organSegmentationGroup.type}-${item.id}-panel`; // Ensure unique composite ID return (
handleAction(compositeId, action)} isSelected={selectedRowId === compositeId} onSelect={() => handleRowSelect(compositeId)} isVisible={true} isLocked={false} onToggleVisibility={() => console.debug('Toggle visibility')} onToggleLocked={() => console.debug('Toggle locked')} onRename={() => console.debug('Rename')} onDelete={() => console.debug('Delete')} onColor={() => console.debug('Color')} disableEditing={false} />
{renderStatisticsPanel(item)}
); })}
); }