
Label Studio 乳腺癌钼靶分类标注模板基于 BI-RADS 的四视图网格标注方案【免费下载链接】label-studioLabel Studio is a multi-type data labeling and annotation tool with standardized output format项目地址: https://gitcode.com/GitHub_Trending/la/label-studio本文以 Label Studio 社区贡献模板 breast_cancer_mammogram_classification.md 为骨架完整讲解如何基于 BI-RADS乳腺影像报告和数据系统构建乳腺癌钼靶Mammogram分类标注界面。你将掌握四视图L-CC / L-MLO / R-CC / R-MLO网格布局的 XML 配置方法、左右乳腺独立的 BI-RADS 分级与乳腺密度A–D评估、常见征象多选记录以及任务数据的组织方式可直接用于放射影像标注项目的落地。模板概述为放射科医生设计的 BI-RADS 分类工作流该模板由社区贡献者redeipirati等提供仓库中对应实现位于 label_studio/annotation_templates/community-contributions/breast-cancer-mammogram-classification/config.xml模板元数据与示例数据见同目录下的 config.yml。其核心设计目标是让标注人员通常是放射科医生或受训标注员在单一界面内同时完成双侧乳腺Left / Right× 两个标准投照体位CC 头尾位、MLO 内外斜位共四张钼靶影像的查看、比对与分类记录。界面遵循 BI-RADS 标准的临床工作流覆盖三类核心信息信息维度采用标准字段示例BI-RADS 分类0–6 七级分类birads_left/birads_right乳腺密度A–D 四级分类density_left/density_right常见征象多选Mass 等 5 类findings_left/findings_right此外还提供自由文本备注区notes用于记录技术问题、与既往检查的对比等补充观察。完整标注配置以下为模板的完整 Labeling Configuration与仓库 config.xml 一致View Style .mammogram-container { padding: var(--spacing-600); box-shadow: 0 2px 8px rgba(var(--color-neutral-shadow-raw) / 0.15); border-radius: var(--corner-radius-medium); margin-bottom: var(--spacing-800); } .mammogram-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: left-cc right-cc left-mlo right-mlo; gap: var(--spacing-600); margin: var(--spacing-600) 0; max-width: 1000px; margin-left: auto; margin-right: auto; } .mammogram-view { text-align: center; border: 2px solid var(--color-neutral-border); border-radius: var(--corner-radius-medium); padding: var(--spacing-500); background: var(--color-neutral-background); transition: border-color 0.3s ease; min-height: 480px; display: flex; flex-direction: column; } .mammogram-view:hover { border-color: var(--color-primary-border-subtle); } .left-cc { grid-area: left-cc; } .right-cc { grid-area: right-cc; } .left-mlo { grid-area: left-mlo; } .right-mlo { grid-area: right-mlo; } .mammogram-image { width: 100%; height: 400px; object-fit: contain; border-radius: var(--corner-radius-small); background: var(--color-neutral-background); } .view-header { font-size: var(--font-size-16); font-weight: var(--font-weight-semibold); color: var(--color-neutral-content); margin-bottom: var(--spacing-300); padding: var(--spacing-200) var(--spacing-300); background: var(--color-neutral-surface); border: 1px solid var(--color-neutral-border-subtle); border-radius: var(--corner-radius-small); text-align: center; } .instructions { background: var(--color-primary-background); padding: var(--spacing-500); border-radius: var(--corner-radius-medium); border-left: 4px solid var(--color-primary-border); margin-bottom: var(--spacing-600); line-height: var(--line-height-body-medium); } .instructions-header { font-size: var(--font-size-16); margin-bottom: var(--spacing-400); line-height: var(--line-height-body-medium); color: var(--color-neutral-content); } .birads-legend { background: var(--color-warning-background); color: var(--color-warning-content); padding: var(--spacing-400); border-radius: var(--corner-radius-small); border: 1px solid var(--color-warning-border-subtler); margin-top: var(--spacing-400); font-size: var(--font-size-14); line-height: var(--line-height-body-small); } .classification-section { background: var(--color-neutral-background); color: var(--color-neutral-content); padding: var(--spacing-600); border-radius: var(--corner-radius-medium); box-shadow: 0 2px 4px rgba(var(--color-neutral-shadow-raw) / 0.1); margin: var(--spacing-500) 0; border: 1px solid var(--color-neutral-border-subtle); } /Style !-- Header for context -- Header valueBreast Cancer Mammogram Classification styletext-align: center; font-size: var(--font-size-24); color: var(--color-neutral-content); margin-bottom: var(--spacing-500); / !-- Instructions -- View classNameinstructions Header valuePlease review the standard mammographic views (CC and MLO) of both breasts. Compare corresponding views (e.g., L-CC with R-CC). Label each breast individually, and report any findings. stylefont-size: 16px; margin-bottom: 10px; height:auto; / View classNamebirads-legend Text namebirads_legend valueBI-RADS: 0 Incomplete, 1 Negative, 2 Benign, 3 Probably Benign, 4 Suspicious, 5 Highly Suggestive of Malignancy, 6 Known Cancer / /View /View !-- Mammogram Views Grid -- View classNamemammogram-container View classNamemammogram-grid !-- Left CC -- View classNamemammogram-view left-cc Header valueLeft CC classNameview-header / Image nameleft_cc value$img1 classNamemammogram-image / /View !-- Right CC -- View classNamemammogram-view right-cc Header valueRight CC classNameview-header / Image nameright_cc value$img3 classNamemammogram-image / /View !-- Left MLO -- View classNamemammogram-view left-mlo Header valueLeft MLO classNameview-header / Image nameleft_mlo value$img2 classNamemammogram-image / /View !-- Right MLO -- View classNamemammogram-view right-mlo Header valueRight MLO classNameview-header / Image nameright_mlo value$img4 classNamemammogram-image / /View /View /View !-- Left Breast Classification -- View classNameclassification-section Header valueLeft Breast: BI-RADS Classification stylefont-size: var(--font-size-20); color: var(--color-neutral-content); margin-bottom: var(--spacing-400); / Choices namebirads_left toNameleft_cc,right_cc,left_mlo,right_mlo choicesingle requiredtrue Choice value0 - Incomplete / Choice value1 - Negative / Choice value2 - Benign / Choice value3 - Probably Benign / Choice value4 - Suspicious Abnormality / Choice value5 - Highly Suggestive of Malignancy / Choice value6 - Known Biopsy-Proven Malignancy / /Choices Header valueLeft Breast: Density stylefont-size: var(--font-size-16); color: var(--color-neutral-content-subtle); margin: var(--spacing-500) 0 var(--spacing-200) 0; / Choices namedensity_left toNameleft_cc,right_cc,left_mlo,right_mlo choicesingle Choice valueA - Almost entirely fatty / Choice valueB - Scattered fibroglandular densities / Choice valueC - Heterogeneously dense / Choice valueD - Extremely dense / /Choices Header valueLeft Breast: Findings (Optional) stylefont-size: var(--font-size-16); color: var(--color-neutral-content-subtle); margin: var(--spacing-500) 0 var(--spacing-200) 0; / Choices namefindings_left toNameleft_cc,right_cc,left_mlo,right_mlo choicemultiple Choice valueMass / Choice valueCalcifications / Choice valueArchitectural Distortion / Choice valueAsymmetry / Choice valueSkin/Nipple Retraction / /Choices /View !-- Right Breast Classification -- View classNameclassification-section Header valueRight Breast: BI-RADS Classification stylefont-size: var(--font-size-20); color: var(--color-neutral-content); margin-bottom: var(--spacing-400); / Choices namebirads_right toNameleft_cc,right_cc,left_mlo,right_mlo choicesingle requiredtrue Choice value0 - Incomplete / Choice value1 - Negative / Choice value2 - Benign / Choice value3 - Probably Benign / Choice value4 - Suspicious Abnormality / Choice value5 - Highly Suggestive of Malignancy / Choice value6 - Known Biopsy-Proven Malignancy / /Choices Header valueRight Breast: Density stylefont-size: var(--font-size-16); color: var(--color-neutral-content-subtle); margin: var(--spacing-500) 0 var(--spacing-200) 0; / Choices namedensity_right toNameleft_cc,right_cc,left_mlo,right_mlo choicesingle Choice valueA - Almost entirely fatty / Choice valueB - Scattered fibroglandular densities / Choice valueC - Heterogeneously dense / Choice valueD - Extremely dense / /Choices Header valueRight Breast: Findings (Optional) stylefont-size: var(--font-size-16); color: var(--color-neutral-content-subtle); margin: var(--spacing-500) 0 var(--spacing-200) 0; / Choices namefindings_right toNameleft_cc,right_cc,left_mlo,right_mlo choicemultiple Choice valueMass / Choice valueCalcifications / Choice valueArchitectural Distortion / Choice valueAsymmetry / Choice valueSkin/Nipple Retraction / /Choices /View !-- Additional Observations -- View classNameclassification-section Header valueAdditional Observations / Notes (Optional) stylefont-size: var(--font-size-20); color: var(--color-neutral-content); margin-bottom: var(--spacing-400); / TextArea namenotes toNameleft_cc,right_cc,left_mlo,right_mlo rows5 placeholderDescribe any notable findings, technical issues, or comparison to prior exams. stylewidth: 100%; padding: var(--spacing-300); border: 2px solid var(--color-neutral-border); border-radius: var(--corner-radius-small); font-size: var(--font-size-14); background: var(--color-neutral-background); color: var(--color-neutral-content); / /View /View提示所有标注配置Labeling Configuration都必须包裹在View标签内详见 View 标签文档。配置拆解从样式系统到功能区块1. 使用Style建立诊断工作台式视觉布局模板在Style标签内定义了完整 CSS全部基于 Label Studio 的设计令牌Design Tokens如var(--spacing-600)、var(--color-neutral-border)、var(--corner-radius-medium)因此能自动适配浅色/深色主题无需硬编码颜色值。关键的布局思路.mammogram-grid使用 CSS Grid 定义 2×2 网格grid-template-areas明确映射为left-cc right-cc/left-mlo right-mlo与放射影像阅片习惯一致——上方为 CC头尾位下方为 MLO内外斜位左侧为左乳、右侧为右乳便于左右对应视图直接对比.mammogram-view为每个视图提供卡片容器设置min-height: 480px与 flex 纵向排列保证四张影像高度对齐:hover时边框高亮transition: border-color 0.3s ease帮助标注员定位当前查看的视图.mammogram-image使用object-fit: contain影像等比缩放完整显示避免裁剪造成阅片信息丢失.birads-legend采用警示色背景将 BI-RADS 分级速查表常驻显示在操作区顶部减少标注员记忆负担.classification-section将左右乳腺分类区块卡片化每个区块带边框、圆角与轻阴影视觉上区分影像区与评估区。2. 四视图影像网格Image与任务数据绑定View classNamemammogram-grid View classNamemammogram-view left-cc Header valueLeft CC classNameview-header / Image nameleft_cc value$img1 classNamemammogram-image / /View !-- ... 其余三个视图同理 ... -- /View四个Image标签分别命名为left_cc、left_mlo、right_cc、right_mlo通过value$img1至value$img4从任务数据中读取图片 URLImage 标签文档。结合仓库 config.yml 中附带的示例数据映射字段对应关系为任务数据字段对应视图Image 标签 nameimg1Left CC左乳头尾位left_ccimg2Left MLO左乳内外斜位left_mloimg3Right CC右乳头尾位right_ccimg4Right MLO右乳内外斜位right_mlo值得注意的是toName统一指向这四个 Image 标签名称逗号分隔因此所有分类字段在语义上都归属于这组影像对象。3. 左右乳腺独立的 BI-RADS 分级必填Choices namebirads_left toNameleft_cc,right_cc,left_mlo,right_mlo choicesingle requiredtrue Choice value0 - Incomplete / Choice value1 - Negative / Choice value2 - Benign / Choice value3 - Probably Benign / Choice value4 - Suspicious Abnormality / Choice value5 - Highly Suggestive of Malignancy / Choice value6 - Known Biopsy-Proven Malignancy / /Choices左右乳腺各有一个独立的Choices单选框组birads_left/birads_right完整覆盖 BI-RADS 0–6 七个分类级别Choices 标签文档级别含义0Incomplete评估不完整需补充影像/检查1Negative阴性2Benign良性3Probably Benign可能良性建议短期随访4Suspicious Abnormality可疑异常建议活检5Highly Suggestive of Malignancy高度提示恶性6Known Biopsy-Proven Malignancy已知活检证实恶性choicesingle表示单选requiredtrue强制标注员对每个乳腺都必须给出分级确保输出数据的完整性。4. 乳腺密度评估A–D 四级Choices namedensity_left toNameleft_cc,right_cc,left_mlo,right_mlo choicesingle Choice valueA - Almost entirely fatty / Choice valueB - Scattered fibroglandular densities / Choice valueC - Heterogeneously dense / Choice valueD - Extremely dense / /Choices密度评估同样左右乳腺独立density_left/density_right采用 BI-RADS 第五版的 A–D 四级标准A几乎全部为脂肪、B散在纤维腺体密度、C不均匀致密、D极度致密。该字段未设置required属于可选评估项。5. 常见征象多选记录可选Choices namefindings_left toNameleft_cc,right_cc,left_mlo,right_mlo choicemultiple Choice valueMass / Choice valueCalcifications / Choice valueArchitectural Distortion / Choice valueAsymmetry / Choice valueSkin/Nipple Retraction / /Choiceschoicemultiple开启多选覆盖乳腺影像报告中 5 类常见征象肿块Mass、钙化Calcifications、结构扭曲Architectural Distortion、不对称Asymmetry、皮肤/乳头回缩Skin/Nipple Retraction。左右乳腺分别记录findings_left/findings_right。6. 自由文本备注区TextArea namenotes toNameleft_cc,right_cc,left_mlo,right_mlo rows5 placeholderDescribe any notable findings, technical issues, or comparison to prior exams. ... /TextArea标签TextArea 标签文档提供 5 行自由文本输入用于记录其他发现、影像技术质量问题如伪影、体位不标准或与既往检查prior exams的对比placeholder 已给出引导性提示。任务数据准备与示例在 Label Studio 中创建项目后可通过Settings → Labeling Interface粘贴上述配置。任务数据JSON/CSV需要包含四个图片字段参考 config.yml 中的示例数据注释结构如下{ data: { img1: https://example.com/assets/l-cc.png, img2: https://example.com/assets/r-cc.png, img3: https://example.com/assets/l-mlo.png, img4: https://example.com/assets/r-mlo.png } }导入时需保证img1–img4四个字段齐全否则对应视图将无法显示。图片既可以是可公开访问的 URL也可以使用本地存储Local Storage或 S3、GCS 等云存储源。标注输出格式提交后Label Studio 会为每个任务生成标准化的 JSON 标注结果。以左侧乳腺为例BI-RADS 分类、密度与征象会分别产出choices类型的 result 记录[ { from_name: birads_left, to_name: left_cc,right_cc,left_mlo,right_mlo, type: choices, value: { choices: [4 - Suspicious Abnormality] } }, { from_name: density_left, to_name: left_cc,right_cc,left_mlo,right_mlo, type: choices, value: { choices: [C - Heterogeneously dense] } }, { from_name: findings_left, to_name: left_cc,right_cc,left_mlo,right_mlo, type: choices, value: { choices: [Mass, Calcifications] } } ]备注文本则产出textarea类型的 result{ from_name: notes, to_name: left_cc,right_cc,left_mlo,right_mlo, type: textarea, value: { text: [多学科会诊后建议补充放大摄影。] } }这种标准化输出正是 Label Studio 的定位所在——标注结果可直接转换为后续机器学习训练所需的统一格式详细格式说明可参考 Task 格式文档 与 Result 格式说明。使用步骤与扩展建议创建项目在 Label Studio 中新建项目进入Settings → Labeling Interface粘贴配置将上文完整配置复制到 Labeling Interface 编辑器中可用Code模式Label Studio 会自动校验 XML 合法性准备数据按img1–img4字段组织任务数据并导入分配任务将任务分配给标注员或标注团队标注员按界面提示依次完成左右乳腺的分级、密度与征象标注导出结果通过Export功能导出 JSON/CSV 等格式的标注结果。在此基础上你可以按需扩展模板为 0–6 各分级添加热键Choice value... hotkey1/提升标注效率参考 Shortcut 标签文档使用visibleWhen条件显示逻辑例如当 BI-RADS ≥ 4 时才显示征象多选框若需在影像上绘制病灶区域可引入 Rectangle 标签 或 KeyPoint 标签 与分类字段配合。延伸阅读本模板的仓库实现config.xml 与 config.yml模板中使用的标签文档View、Image、Choices、TextArea、Header、Style社区贡献模板总览community-contributions其他医学影像相关模板可参考 label_studio/annotation_templates 目录下的 computer-vision 等分类更多模板的 HTML 渲染示例见 docs/source/templates【免费下载链接】label-studioLabel Studio is a multi-type data labeling and annotation tool with standardized output format项目地址: https://gitcode.com/GitHub_Trending/la/label-studio创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考