import React from 'react'; import { useTranslation } from 'react-i18next'; import { DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuPortal, DropdownMenuSubContent, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator, Icons, } from '@ohif/ui-next'; import { SegmentationRepresentations } from '@cornerstonejs/tools/enums'; interface ExportSegmentationSubMenuItemProps { segmentationId: string; segmentationRepresentationType: string; allowExport: boolean; actions: { storeSegmentation: (segmentationId: string, modality?: string) => Promise; onSegmentationDownloadRTSS: (segmentationId: string) => void; onSegmentationDownload: (segmentationId: string) => void; downloadCSVSegmentationReport: (segmentationId: string) => void; }; } export const ExportSegmentationSubMenuItem: React.FC = ({ segmentationId, segmentationRepresentationType, allowExport, actions, }) => { const { t } = useTranslation('SegmentationPanel'); return ( {t('Download & Export')} {t('Download')} {segmentationRepresentationType === SegmentationRepresentations.Labelmap && ( { e.preventDefault(); actions.downloadCSVSegmentationReport(segmentationId); }} disabled={!allowExport} > {t('CSV Report')} )} {segmentationRepresentationType === SegmentationRepresentations.Labelmap && ( { e.preventDefault(); actions.onSegmentationDownload(segmentationId); }} disabled={!allowExport} > {t('DICOM SEG')} )} { e.preventDefault(); actions.onSegmentationDownloadRTSS(segmentationId); }} disabled={!allowExport} > {t('DICOM RTSS')} {t('Export')} {segmentationRepresentationType === SegmentationRepresentations.Labelmap && ( { e.preventDefault(); actions.storeSegmentation(segmentationId, 'SEG'); }} disabled={!allowExport} > {t('DICOM SEG')} )} { e.preventDefault(); actions.storeSegmentation(segmentationId, 'RTSTRUCT'); }} disabled={!allowExport} > {t('DICOM RTSS')} ); };