import { CheckCircle, AlertCircle, Info } from 'lucide-react'; import { useState } from 'react'; import type { PreprocessingInfo } from '../lib/api'; interface PreprocessingBadgeProps { info: PreprocessingInfo | null; fileType?: 'dicom' | 'image' | null; compact?: boolean; } const STEP_LABELS: Record = { dicom_parsing: 'DICOM Parsing', us_region_extraction: 'US Region Extraction', text_box_removal: 'Text Box Removal', fan_extraction: 'Fan Extraction', annotation_detection: 'Annotation Detection', inpainting: 'Inpainting', denoising: 'Denoising', normalization: 'Normalization', square_padding: 'Square Padding', resize_512: 'Resize to 512×512', rgb_conversion: 'RGB Conversion', }; export function PreprocessingBadge({ info, fileType, compact = false }: PreprocessingBadgeProps) { const [expanded, setExpanded] = useState(false); // Show pending state when file is selected but not yet processed if (!info && fileType) { const isDicom = fileType === 'dicom'; return (
{isDicom ? 'DICOM' : 'PNG/JPEG'} • {isDicom ? 'Full Pipeline' : 'Basic Pipeline'}
{!compact && (

{isDicom ? 'Will apply: Fan extraction, text removal, denoising' : 'Will apply: Square padding only. For best accuracy, use DICOM files.' }

)}
); } if (!info) return null; const isDicom = info.type === 'dicom'; const isFull = info.pipeline === 'full'; return (
{/* Header */} {/* Expanded Details */} {expanded && (

Steps Applied:

{info.steps_applied.map((step) => (
{STEP_LABELS[step] || step}
))}
{/* Missing steps for basic pipeline */} {!isFull && (

Not Applied:

{['fan_extraction', 'annotation_detection', 'inpainting', 'denoising'].map((step) => (
{STEP_LABELS[step] || step}
))}

⚠️ For best accuracy, use DICOM files from the ultrasound machine.

)} {/* Metadata */} {info.metadata.pixel_spacing && (

Pixel Spacing: {info.metadata.pixel_spacing.toFixed(3)} mm/px

)}
)}
); }