fix(segmentation): Add segment jump for new segments and make panels scrollable (#4928)

This commit is contained in:
Alireza authored and GitHub committed 2025-04-07 16:45:29 -04:00
1 parent a8ac297e16
commit 3653de7487
23 files changed
+491 -368

No files matched your search

@@ -3,6 +3,7 @@ import { useActiveViewportSegmentationRepresentations } from '@ohif/extension-co
import { handleROIThresholding } from '../../utils/handleROIThresholding';
import { debounce } from '@ohif/core/src/utils';
import { useSystem } from '@ohif/core/src';
import { Button } from '@ohif/ui-next';
export default function PanelRoiThresholdSegmentation() {
const { commandsManager, servicesManager } = useSystem();
@@ -11,6 +12,7 @@ export default function PanelRoiThresholdSegmentation() {
useActiveViewportSegmentationRepresentations({ servicesManager });
const segmentationIds = segmentationsInfo?.map(info => info.segmentation.segmentationId) || [];
const segmentations = segmentationsInfo?.map(info => info.segmentation) || [];
useEffect(() => {
const initialRun = async () => {
@@ -54,17 +56,37 @@ export default function PanelRoiThresholdSegmentation() {
const stats = segmentationService.getSegmentationGroupStats(segmentationIds);
const tmtvValue = stats?.tmtv;
const handleExportCSV = () => {
if (!segmentations.length) {
return;
}
commandsManager.runCommand('exportTMTVReportCSV', {
segmentations,
tmtv: tmtvValue,
config: {},
});
};
return (
<div className="mt-2 mb-10 flex flex-col">
<div className="mb-1 flex flex-col">
<div className="invisible-scrollbar overflow-y-auto overflow-x-hidden">
{tmtvValue !== null && tmtvValue !== undefined ? (
<div className="bg-secondary-dark flex items-baseline justify-between px-2 py-1">
<span className="text-base font-bold uppercase tracking-widest text-white">
{'TMTV:'}
</span>
<div className="text-white">{`${tmtvValue?.toFixed(3)} mL`}</div>
<div className="bg-secondary-dark flex items-baseline justify-between px-2 py-1">
<div className="py-1">
<span className="text-muted-foreground text-base font-bold uppercase">{'TMTV: '}</span>
<span className="text-foreground">{tmtvValue ? `${tmtvValue.toFixed(3)} mL` : ''}</span>
</div>
) : null}
<div className="flex items-center">
<Button
size="sm"
variant="ghost"
className="text-blue-500"
onClick={handleExportCSV}
>
<span className="pl-1">CSV</span>
</Button>
</div>
</div>
</div>
</div>
);