Skillpedia
قواعد البيانات51k · #3539

pydicom

ما الذي تفعله

هذه المهارة (pydicom) تعمل مع ملفات الصور الطبية المعروفة بـ DICOM. تتيح قراءة المعلومات الموجودة في هذه الملفات وتعديلها وحفظها، مثل بيانات المريض وتفاصيل الصورة.

متى تستخدمها

  • ✓عندما تحتاج إلى استخراج معلومات محددة من ملف DICOM.
  • ✓عندما تريد تعديل البيانات الوصفية لصورة طبية.
  • ✓عندما تريد التحقق من بنية ملفات DICOM ومحتواها.

رابط المهارة

https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/pydicom/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/pydicom/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“اقرأ ملف DICOM باسم «patient_exam.dcm» وأخبرني بنوع الفحص وأبعاد الصورة.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تعمل المهارة بقراءة ملف DICOM، وتتيح لك الوصول إلى البيانات الموجودة فيه أو تغييرها بطريقة منظمة. يمكنك تحديد المعلومات التي تريد قراءتها أو حفظها.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

pydicom

Use pydicom for DICOM dataset I/O and pixel processing. Version 3.0.2 is the current stable release reviewed here. It fixes CVE-2026-32711, a crafted DICOMDIR path-traversal issue. pydicom 3.0.2 declares Python >=3.10; its bundled DICOM dictionary is 2024c; the current DICOM Standard reviewed here is 2026d. No PACS, DIMSE, DICOMweb endpoint, or authenticated service is exercised by this local-file skill.

Mandatory safety boundary

  • Work only with local data that the user is authorized to access.
  • DICOM metadata, file names, private elements, overlays, structured content, and pixels may contain protected health information (PHI).
  • Never print Dataset, export full metadata/JSON, or log element values by default. Use a documented allowlist and aggregate output.
  • pydicom is a general DICOM framework, not a diagnostic viewer. Pixel output, validation, conversion, and plugin availability are not diagnostic claims.
  • De-identification is profile-, purpose-, recipient-, jurisdiction-, and threat-context-specific. It requires privacy/DICOM expert verification.
  • Never claim that a tag-removal script is DICOM PS3.15, HIPAA, GDPR, or other compliance. Preserve originals and audit derived outputs.
  • Treat deterministic pseudonymization keys and UID maps as re-identification secrets: use least privilege and encrypted/managed secret storage, never commit, sync, log, or share them with derivatives, and define backup, rotation, revocation, and destruction procedures. A leaked key invalidates the intended separation; rotation also changes deterministic mappings.
  • Set explicit input-file, file-count, frame-count, decoded-byte, and output limits before parsing untrusted or unusually large datasets.

Installation

Create or activate an isolated environment, then install the reviewed release (the pixel-stack pins below require Python 3.12+ because of NumPy):

uv pip install "pydicom==3.0.2"

Uncompressed pixel arrays and image rendering:

uv pip install "pydicom==3.0.2" "numpy==2.5.3" "Pillow==12.3.0"

Install only the transfer-syntax plugins required by the deployment:

# JPEG/JPEG-LS, JPEG 2000/HTJ2K, and faster RLE through pylibjpeg
uv pip install "numpy==2.5.3" "pylibjpeg==2.1.0" \
  "pylibjpeg-libjpeg==2.4.0" "pylibjpeg-openjpeg==2.6.0" \
  "pylibjpeg-rle==2.2.0"

# JPEG-LS encoder/decoder
uv pip install "numpy==2.5.3" "pyjpegls==1.5.1"

# Alternative decoder with platform-specific wheels
uv pip install "python-gdcm==3.2.6"

Plugin licenses and wheels differ by package/platform; review them before deployment. Pillow has documented decoding limitations and pydicom cautions that plugin output must be independently checked.

Native codec wheels widen the supply-chain and memory-safety boundary. For a controlled deployment, resolve these exact pins on a trusted build host, lock and verify wheel hashes/provenance, mirror approved artifacts internally, scan them, and install with hash enforcement rather than resolving from the public index at runtime.

Choose the workflow

  1. Need an aggregate overview: run scripts/extract_metadata.py.
  2. Need bounded technical checks: run scripts/dicom_inventory.py.
  3. Need codec deployment preflight: run scripts/transfer_syntax_inspector.py.
  4. Need frame/memory planning: run scripts/pixel_frame_planner.py.
  5. Need one non-diagnostic rendered frame: run scripts/dicom_to_image.py.
  6. Need a pseudonymized derivative: read the de-identification section, create a site-reviewed action profile, then run scripts/anonymize_dicom.py and scripts/deidentification_audit.py.
  7. Need to check a sensitive UID map: run scripts/uid_mapping_validator.py.

Read datasets safely

dcmread() returns a FileDataset, a Dataset subclass with File Format state such as file_meta, preamble, and original encoding.

from pathlib import Path
import pydicom

path = Path("authorized/input.dcm")
ds = pydicom.dcmread(
    path,
    stop_before_pixels=True,
    specific_tags=[
        "SOPClassUID",
        "Modality",
        "Rows",
        "Columns",
        "NumberOfFrames",
    ],
)

technical = {
    "sop_class": ds.get("SOPClassUID"),
    "modality": ds.get("Modality"),
    "rows": ds.get("Rows"),
    "columns": ds.get("Columns"),
}

Use:

  • stop_before_pixels=True for metadata-only work.
  • specific_tags=[...] for a minimum allowlist.

…

الأسئلة الشائعة

ما هي ملفات DICOM؟

DICOM معيار للصور الطبية والمعلومات المرتبطة بها. وهو مستخدم على نطاق واسع في أجهزة مثل الأشعة السينية والأشعة المقطعية والرنين المغناطيسي.

هل يمكنني استخدام pydicom لعرض الصور؟

يركز pydicom على قراءة البيانات الموجودة في الملفات وتعديلها، وليس على عرض الصور مثل البرامج الطبية. لكنه يساعد في تجهيز البيانات للعرض.

هل من الآمن استخدام pydicom مع بيانات المرضى؟

نعم، لكن بحذر. يحذّر pydicom من المعلومات الحساسة (PHI) ويتطلب اتخاذ احتياطات لحماية هذه البيانات، مثل عدم عرض كل شيء افتراضياً وإخفاء الهوية عند الضرورة.

التفاصيل

الوصف الأصلي من المؤلف

Reads, inspects, writes, transforms, and preflights local DICOM datasets and pixel data. Applies to DICOM metadata, transfer syntaxes, compression plugins, frames, private elements, JSON, and bounded de-identification review.

repo: K-Dense-AI/scientific-agent-skills

الشعبية

نجوم GitHub
51k
الترتيب
#3539
الترخيص
MIT
آخر تحديث
15‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة