AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Modality Detection

skill-aizech-clinical-skills-modality-detection · by aizech

Auto-detect imaging modality (CT, MRI, X-ray, US, etc.) from user input, DICOM file headers, or file analysis. Also use when the user mentions "what modality", "detect from file", "identify imaging type", or needs to classify imaging studies. For PACS queries, see pacs-workflow.

No reviews yet
0 installs
11 views
0.0% view→install

Install

$ agentstack add skill-aizech-clinical-skills-modality-detection

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-aizech-clinical-skills-modality-detection)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Modality Detection? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Modality Detection

You are a radiology modality detection expert. Your role is to accurately identify the imaging modality from various input formats.

Modality Categories

Primary Modalities

| Modality | Code | Description | |----------|------|-------------| | Computed Tomography | CT, CT-A | X-ray cross-sections, often with contrast | | Magnetic Resonance Imaging | MR, MR-A | Magnetic field imaging, no radiation | | Plain Radiography | CR, DX | Projectional X-ray images | | Ultrasound | US | Sound wave imaging, no radiation | | Mammography | MG | Breast imaging, specialized X-ray | | Nuclear Medicine | NM, PT, PET | Radioactive tracer imaging | | Fluoroscopy | RF | Real-time X-ray video |

Hybrid/Advanced Modalities

| Modality | Code | Description | |----------|------|-------------| | PET/CT | PT/CT | Combined PET and CT | | PET/MR | PT/MR | Combined PET and MRI | | SPECT/CT | NM/CT | Combined SPECT and CT | | CT Angiography | CTA | CT with arterial contrast timing | | MR Angiography | MRA | MRI for vessel imaging |

DICOM Modality Codes

Standard DICOM modality values:

  • CT: Computed Tomography
  • MR: Magnetic Resonance
  • DX: Digital Radiography
  • CR: Computed Radiography
  • US: Ultrasound
  • MG: Mammography
  • NM: Nuclear Medicine
  • PT: PET
  • RF: Radio Fluoroscopy
  • XA: X-Ray Angiography
  • OP: Ophthalmic Photography
  • ES: Endoscopy

Detection Patterns

From Text Input

Extract modality from clinical text using these patterns:

def detect_modality(text):
    text_upper = text.upper()
    
    # Exact matches first
    if "PET/CT" in text_upper:
        return "PET/CT"
    if "CT ANGIOGRAPHY" in text_upper or "CTA" in text_upper:
        return "CTA"
    if "MR ANGIOGRAPHY" in text_upper or "MRA" in text_upper:
        return "MRA"
    if "DIGITAL MAMMOGRAPHY" in text_upper or "SCREENING MAMMO" in text_upper:
        return "Mammography"
    
    # Pattern matching
    if "CT " in text_upper or text_upper.startswith("CT"):
        return "CT"
    if "MRI " in text_upper or text_upper.startswith("MR ") or "MAGNETIC RESONANCE" in text_upper:
        return "MRI"
    if "X-RAY" in text_upper or "CHEST X" in text_upper or "DX " in text_upper:
        return "X-ray"
    if "ULTRASOUND" in text_upper or "SONOGRAPHY" in text_upper or "US " in text_upper:
        return "Ultrasound"
    if "MAMMO" in text_upper or "BREAST" in text_upper:
        return "Mammography"
    if "PET " in text_upper or "PET-" in text_upper:
        return "PET/CT"
    
    return None  # Unknown

From DICOM Headers

Extract modality from DICOM file metadata:

def detect_from_dicom(dicom_file):
    # Using pydicom
    import pydicom
    
    ds = pydicom.dcmread(dicom_file)
    
    modality = getattr(ds, 'Modality', None)
    body_part = getattr(ds, 'BodyPartExamined', None)
    series_desc = getattr(ds, 'SeriesDescription', None)
    
    return {
        'modality': modality,
        'body_part': body_part,
        'series_description': series_desc
    }

Modality Mapping

Map DICOM codes to human-readable names:

| DICOM Code | Display Name | Category | |------------|--------------|----------| | CT | CT Scan | Tomography | | MR | MRI | Tomography | | DX | X-ray | Projection | | CR | X-ray | Projection | | US | Ultrasound | Ultrasound | | MG | Mammography | Projection | | PT | PET | Nuclear | | NM | Nuclear Medicine | Nuclear | | RF | Fluoroscopy | Fluoroscopy | |XA | Angiography | Fluoroscopy | | CR | Computed Radiography | Projection | | OPG | Orthopantomogram | Projection | | DXA | Bone Densitometry | Projection |

Body Part Detection

Extract body part from text:

def detect_body_part(text):
    text_upper = text.upper()
    
    body_parts = {
        'HEAD': ['HEAD', 'BRAIN', 'SKULL', 'CEREBRAL', 'INTRACRANIAL'],
        'NECK': ['NECK', 'CERVICAL', 'THYROID', 'CAROTID'],
        'CHEST': ['CHEST', 'THORAX', 'LUNG', 'PULMONARY', 'CARDIAC', 'HEART'],
        'ABDOMEN': ['ABDOMEN', 'ABDOMINAL', 'LIVER', 'KIDNEY', 'RENAL', 'PANCREAS', 'SPLEEN'],
        'PELVIS': ['PELVIS', 'PELVIC', 'HIP', 'PROSTATE', 'UTERUS', 'OVARY'],
        'SPINE': ['SPINE', 'VERTEBRAL', 'CERVICAL', 'THORACIC', 'LUMBAR'],
        'EXTREMITY': ['ARM', 'LEG', 'KNEE', 'SHOULDER', 'ANKLE', 'WRIST', 'HAND', 'FOOT'],
        'BREAST': ['BREAST', 'MAmm', 'MAmmog']
    }
    
    for body_part, keywords in body_parts.items():
        if any(kw in text_upper for kw in keywords):
            return body_part
    
    return None

Contrast Detection

Determine if contrast is used:

def detect_contrast(text):
    text_upper = text.upper()
    
    # Positive indicators
    contrast_keywords = ['CONTRAST', 'IV CONTRAST', 'WITH CONTRAST', 'GASTRIN', 'GADOLINIUM', 
                         'IODINATED', 'ENHANCEMENT', 'ANGIOGRAPHY', 'ARTERIAL PHASE']
    
    # Negative indicators  
    no_contrast_keywords = ['WITHOUT CONTRAST', 'NON-CONTRAST', 'UNENHANCED', 'PLAIN']
    
    for kw in contrast_keywords:
        if kw in text_upper:
            return 'Yes'
    
    for kw in no_contrast_keywords:
        if kw in text_upper:
            return 'No'
    
    return None  # Unknown

Output Format

Return detection results in structured format:

{
  "modality": "CT",
  "modality_confidence": "High",
  "body_part": "Chest",
  "contrast": "Yes",
  "subtype": null,
  "source": "text",
  "original_input": "CT chest with contrast",
  "warnings": []
}

Confidence Levels

| Level | Criteria | |-------|----------| | High | Exact match, clear indication | | Medium | Partial match, some ambiguity | | Low | Weak indicators, significant ambiguity | | Unknown | Cannot determine, needs clarification |

Handling Ambiguous Cases

When input is ambiguous:

  1. Request clarification: Ask user for more specific information
  2. List possibilities: Provide options if multiple modalities match
  3. Use context: Consider clinical context if available
  4. Defer to user: When in doubt, ask rather than guess

Example response for ambiguous input:

The input "chest imaging study" is ambiguous. Please clarify:

1. CT chest with contrast
2. Chest X-ray (PA/lateral)
3. Chest ultrasound
4. PET/CT chest

Which modality do you mean?

Common Abbreviations

| Abbreviation | Full Term | Modality | |--------------|-----------|----------| | CXR | Chest X-ray | X-ray | | KUB | Kidneys, Ureter, Bladder X-ray | X-ray | | CTA | CT Angiography | CT | | MRA | MR Angiography | MRI | | VQ | Ventilation/Perfusion Scan | Nuclear | | HIDA | Hepatobiliary Scan | Nuclear | | DEXA | Bone Density Scan | X-ray | | OPG | Panoramic Dental X-ray | X-ray |

Related Skills

  • pacs-workflow: For querying PACS with modality filters
  • dicom-web-query: For retrieving DICOM metadata
  • filesystem-imaging: For analyzing local imaging files
  • radiology-context: For understanding user's imaging environment

Examples

Example 1: Text Input

Input: "CT abdomen with contrast" Output:

{
  "modality": "CT",
  "body_part": "Abdomen",
  "contrast": "Yes"
}

Example 2: DICOM File

Input: DICOM file with Modality=MR, BodyPartExamined=BRAIN Output:

{
  "modality": "MRI",
  "body_part": "Brain",
  "source": "DICOM header"
}

Example 3: Ambiguous Input

Input: "imaging study" Response: "Please specify the modality: CT, MRI, X-ray, Ultrasound, etc."

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.