技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
image-data-utilities【数据与研究】Prepare, validate, convert, and display chest X-ray image inputs while preserving DICOM originals and reporting utility metadata.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when a chest X-ray input must be checked, made viewable, or handed between the upload/UI layer and an image-capable tool. It covers the two utility tools:
DicomProcessorTool converts a DICOM pixel array to a temporary PNG and
returns conversion metadata.ImageVisualizerTool validates a JPG/PNG path and returns the path plus
display metadata. Its normal _run path reports a display result; it does
not call the matplotlib rendering method in the current implementation.This skill does not perform model inference. Route interpretation, classification, segmentation, grounding, or report generation to chest-xray-analysis. Route LangGraph construction to agent-orchestration, upload widgets, chat history, and Gradio state to web-interface, and benchmark data preparation to benchmark-evaluation.
original_path is the preserved
source used for archival or a tool that explicitly supports that format;
display_path is a viewable PNG/JPG path for the UI or an image-only tool.scripts/validate_image_input.py for existence, supported suffix, lightweight
file-signature, and optional output-directory checks.DicomProcessorTool; never replace the original with the generated PNG.PatientID and StudyDate as sensitive.
Pass only the metadata needed by the next step, avoid logging it, and do not
claim that conversion anonymizes the source.error key before using image_path.
Utility failures are data-preparation failures, not evidence about the
patient's image.See api-reference.md for exact inputs and outputs, data-formats.md for format and privacy rules, workflows.md for path handoffs, and troubleshooting.md for recovery actions.
ImageVisualizerTool._run when a display
record is required.ImageVisualizerInput documents JPG and PNG. JPEG is commonly represented by
.jpg or .jpeg; do not silently accept an arbitrary suffix merely because a
reader might open it.
DicomProcessorTool._run(dicom_path, window_center, window_width).WindowCenter/WindowWidth when present. If either is still absent,
it uses a min/max scale. If both are present, it clips and scales to uint8.RescaleSlope and RescaleIntercept are both present, apply them before
windowing or min/max scaling (as the tool does).image_path as the display path and retain the original DICOM
path as the source path. The metadata also records original_path and
output_path on success.A caller may supply a positive window width and a clinically appropriate center when the source values are known. Do not invent window settings to compensate for a malformed file; fix or reroute the input instead.
ImageVisualizerTool._run accepts image_path, optional title, optional
description, figsize=(width, height), and cmap="rgb". For a grayscale CXR,
use a grayscale colormap such as "gray" when actual rendering is requested.
The implementation treats "rgb" specially and passes other colormap names to
matplotlib. If a non-rgb colormap is selected for a multi-channel array, its
renderer keeps only the first channel.
The success result is a two-item tuple: output={"image_path": image_path} and
metadata containing whether title/description were supplied, the requested
figsize and cmap, and analysis_status="completed". A missing file returns
an error tuple; do not treat that as a successful visualization.
The interface stores uploaded data in managed temporary storage. It keeps an
original_file_path for the uploaded file and a separate display_file_path.
For a .dcm upload it converts only for display; for a regular image the two
paths can be the same. UI rendering should use display_file_path, while a
message/tool handoff must choose the path according to the receiving tool's
format contract. In particular, do not encode raw DICOM bytes as if they were a
JPEG data URL. If an image API needs base64, encode the PNG display derivative
and use its actual image MIME type, while retaining the original for archival
or explicitly DICOM-aware processing.
The utility result from image_visualizer contains the path to show in the UI;
it is not a model answer. See web-interface for
state and event handling.
processed_dicom_<token>.png; it does not
anonymize or automatically delete that file.