Generated banner for Dicom Series To Volume
Generated logo for Dicom Series To Volume

Dicom Series To Volume

NVIDIAOfficialCreated by NVIDIA MedTech Team

  • Skill
  • Workflow
  • Science and research
  • Apache-2.0
  • Medium risk
  • Has scripts

From the author

Used for converting one CT DICOM series folder to a HU NIfTI volume with affine evidence. Not for multi-frame DICOM or clinical use.
— the description by NVIDIA MedTech Team

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The dicom-series-to-volume skill provides a programmatic interface to convert CT DICOM series into NIfTI format. It processes DICOM slices by sorting them based on patient position, applying rescale slope and intercept values to calculate Hounsfield Units, and constructing an affine matrix from header metadata. The output includes the NIfTI volume and a JSON summary containing technical details such as slice count, shape, spacing, and affine information. This tool is intended for research and development workflows and explicitly excludes clinical use, multi-frame DICOM, and compressed transfer syntaxes.

What it does

  • Converts a single CT DICOM series folder into a NIfTI volume.
  • Applies RescaleSlope and RescaleIntercept to generate Hounsfield Unit values.
  • Constructs an affine matrix based on DICOM orientation and spacing tags.
  • Generates a JSON summary file containing metadata about the conversion process.
  • Supports integration with external verifiers for trusted execution.
  • Validates input series before processing to ensure compatibility.

When to use it

  • When preparing CT scan data for research-based image analysis or machine learning pipelines.
  • When you need to extract NIfTI volumes from DICOM series while preserving affine evidence.
  • When building automated research workflows that require consistent metadata output.
  • When working in non-clinical environments where custom conversion scripts are acceptable.

Advantages

  • Provides structured metadata output alongside the NIfTI volume.
  • Integrates with validation gates to ensure output quality.
  • Maintains affine consistency using updated library dependencies.
  • Automates the sorting and scaling logic required for CT data.

Usage examples

“Convert the CT DICOM series located in /data/scan_01 to a NIfTI file named output.nii.gz.”
The agent executes the conversion script, resulting in a NIfTI volume and a JSON summary file in the specified path.
“Run a trusted conversion of the DICOM series in /data/scan_01 using the built-in verifier.”
The agent runs the trusted evaluation command, producing a validated output directory containing the NIfTI volume and verification logs.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/nvidia/dicom-series-to-volume/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip dicom-series-to-volume.zip -d .agents/skills

Documentation by NVIDIA MedTech Team

dicom_series_to_volume

Purpose

  • Used for converting one CT DICOM series folder to a HU NIfTI volume with affine evidence. Not for multi-frame DICOM or clinical use.

  • Use the wrapper exactly as documented; do not replace the upstream entrypoint with a handwritten implementation.

  • Manifest I/O: inputs are dicom_dir; outputs are nifti_volume and result_json.

Instructions

  • Read skill_manifest.yaml before changing arguments, side effects, or validation gates.

  • Run scripts/series_to_volume.py through the documented command below; keep outputs under a caller-provided run directory.

  • If a host agent exposes run_script, use run_script("scripts/series_to_volume.py", args=[...]); otherwise run the Bash/Python command shown below.

  • Check the emitted JSON and the paired dicom_volume_quality_v1 verifier before treating the run as evidence.

Available Scripts

ScriptPurposeArguments
scripts/series_to_volume.pyPrimary entrypoint declared by skill_manifest.yaml.PATH_TO_DICOM_DIR [--output OUT.nii.gz]

Prerequisites

  • Runtime requirements: Python packages listed in runtime.side_effects.pip_packages.

  • NiBabel 5.4 or newer is required so extreme-oblique axes remain labeled consistently across reorientation.

  • Run commands from the repository root unless an existing section below says otherwise.

Limitations

  • Single-series only; multi-series input is rejected at preflight.

  • Multi-frame DICOM (NumberOfFrames > 1 per file) not supported.

  • Compressed transfer syntaxes (JPEG / JPEG2000 / RLE) not supported.

  • No voxel reorientation. The affine is derived from DICOM headers and represented in NIfTI/RAS coordinates; a downstream gate (e.g. expected_axcodes) is expected to assert orientation before this volume is fed to a segmentation model.

  • Not for clinical deployment, autonomous diagnosis, regulatory submission, production inference (use a vetted converter such as dcm2niix for that).

Troubleshooting

ErrorCauseFix
Missing dependency or import errorRuntime package drift from skill_manifest.yaml.Install the packages declared in the manifest or use the documented setup command.
Empty or schema-invalid outputWrong input path, unsupported modality, or upstream failure.Re-run with a known fixture and inspect the wrapper JSON plus stderr.
Validation gate failureOutput violated a declared engineering invariant.Keep the failed evidence pack and use the gate message to repair inputs or wrapper code.

Reads one DICOM series, sorts slices by ImagePositionPatient, applies RescaleSlope and RescaleIntercept, builds an affine from orientation and spacing tags, and writes a .nii.gz plus JSON summary.

python scripts/series_to_volume.py PATH_TO_DICOM_DIR --output PATH_TO_OUT.nii.gz

For a trusted run with the paired verifier:

python -m eval_engine.run_trusted skills/dicom-series-to-volume \
  --fixture PATH_TO_DICOM_DIR \
  --out runs/dicom_series_to_volume_trusted

Key output fields: n_slices, series_instance_uid, output.path, output.shape, output.spacing, output.axcodes, output.affine, hu_range, and runtime.conversion_seconds.

Scope limits: single-series CT only; no multi-frame DICOM, compressed transfer syntax handling, RT structure sets, auto-reorientation, or clinical use.

Files

skill_manifest.yaml

# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

id: medagent.dicom_series_to_volume
version: 0.1.0
upstream_refs:
  - kind: pypi_package
    name: pydicom
    version_constraint: ">=2.4.5,<4,!=3.0.0,!=3.0.1"
  - kind: pypi_package
    name: nibabel
    version_constraint: ">=5.4,<6"
license: Apache-2.0
intended_use:
  summary: Engineering-time conversion of a single-series DICOM directory (CT) to a
    NIfTI volume in HU, with affine and axcodes computed from the DICOM headers.
  scope: development
  not_for:
    - clinical deployment
    - autonomous diagnosis
    - regulatory submission
    - production inference (use a vetted converter such as dcm2niix for that)
inputs:
  - name: dicom_dir
    type: directory_path
    formats: [dicom_series]
outputs:
  - name: nifti_volume
    type: file_path
    formats: [nifti]
  - name: result_json
    type: json
    schema: validators/output_schema.json
runtime:
  language: python
  python: ">=3.10"
  entrypoint: scripts/series_to_volume.py
  # Land the NIfTI in the evidence pack; the script falls back to writing
  # next to the input directory when --output is omitted, so direct script
  # users keep working.
  args:
    - "${python}"
    - "${script}"
    - "${fixture}"
    - "--output"
    - "${out}/volume.nii.gz"
  dependencies:
    pydicom: ">=2.4.5,<4,!=3.0.0,!=3.0.1"
    nibabel: ">=5.4,<6"
    numpy: ">=1.25,<3"
    typer: ">=0.9"
  side_effects:
    pip_packages:
      - pydicom>=2.4.5,<4,!=3.0.0,!=3.0.1
      - nibabel>=5.4,<6
      - numpy>=1.25,<3
      - typer>=0.9
    local_writes:
      - {path: "${out}/volume.nii.gz", approx_mb_max: 500}
    home_writes: []
    network_endpoints: []
    requires_docker: false
    requires_gpu: none
    env_required: []

cost:
  # Per-invocation agent-overhead token cost measured by NeMo Agent Toolkit
  # (NAT) profiler — the cost an LLM-driven agent pays to call this skill
  # once. The skill itself emits zero tokens. See tools/nat_audit/README.md
  # for methodology (pinned model, agent type, tool registry size).
  token_estimate:
    common:
      model: meta/llama-3.3-70b-instruct
      agent_type: tool_calling_agent
      measured_at: 2026-05-16
      methodology: tools/nat_audit/README.md
    isolated_tool_call:
      prompt_tokens: 2241
      completion_tokens: 68
      total_tokens: 2309
      llm_calls: 2
      n_tools_in_workflow: 9
    end_to_end_workflow:
      prompt_tokens: 8414
      completion_tokens: 141
      total_tokens: 8555
      llm_calls: 4
      n_tools_in_workflow: 11
      scenario: realistic_user_workflow

paired_verifiers:
  - id: medagent.verifiers.dicom_volume_quality_v1
    status: implemented
    consumes: evidence_pack_dir
    purpose: >
      Second-pass volume evidence audit. Confirms the source pack passed and
      the emitted NIfTI artifact matches reported shape, spacing, affine
      orientation, axcodes, and HU range evidence.

limitations:
  - Single-series only; multi-series input is rejected at preflight.
  - Multi-frame DICOM (NumberOfFrames > 1 per file) not supported.
  - Compressed transfer syntaxes (JPEG / JPEG2000 / RLE) not supported.
  - No voxel reorientation. The affine is derived from DICOM headers and
    represented in NIfTI/RAS coordinates; a downstream gate (e.g.
    expected_axcodes) is expected to assert orientation before this
    volume is fed to a segmentation model.
  - Slice-spacing is computed from successive ImagePositionPatient z values;
    inconsistent spacing is reported but not auto-corrected.
validation:
  expected_runtime_seconds:
    # No min: conversion is I/O bound and a fast SSD can finish 32 slices in
    # < 20ms. The sanity gates (n_slices > 1, single_series, axcodes) already
    # protect against the silent-failure shape this would otherwise catch.
    max: 10.0
    inference_path: runtime.conversion_seconds
  sanity_checks:
    - path: modality
      eq: CT
    - path: n_slices
      gt: 1
    - path: single_series
      eq: true
    - path: inconsistent_shape
      eq: false
    - path: output.axcodes
      eq: ["L", "P", "S"]
      # Canonical axial CT preserves the DICOM LPS axis directions through to the
      # NIfTI affine; the converter does NOT auto-reorient to RAS+. A workflow
      # that needs RAS-canonical input is expected to apply nib.as_closest_canonical
      # downstream of this gate.
  expected_cost:
    # I/O-bound numpy + nibabel; should never approach a CT segmentation
    # skill's footprint. rss_mb_peak.max catches accidental loading of a
    # whole multi-series dataset; gpu_*.max=0 enforces this is CPU-only.
    wall_seconds:        {max: 10}
    cpu_seconds:         {max: 10}
    rss_mb_peak:         {max: 500}
    gpu_seconds:         {max: 0}
    gpu_memory_mb_peak:  {max: 0}
  env_pin:
    pydicom: ">=2.4.5,<4,!=3.0.0,!=3.0.1"
    nibabel: ">=5.4,<6"
    numpy: ">=1.25,<3"
  reproducibility:
    mode: repeat
    fixture: fixtures/clean_axial
    fixture_builder: fixtures/generate_fixtures.py
    runs: 2

# Negative fixtures that exist to *prove the gates fire* on bad inputs.
# `make verify-skills` and any audit tooling that runs every fixture
# blindly should consult this list and treat the named expected_overall
# as the success condition (rather than `passed`). The corresponding
# fixture lives under fixtures/ alongside the gate-passing one.
negative_fixtures:
  - path: fixtures/flipped_lr
    expected_overall: failed
    expected_failed_gate: sanity
    failure_reason: >
      The flipped_lr fixture has its DICOM ImageOrientationPatient row-direction
      reversed (RPI vs LPS). The output.axcodes sanity check should fail with
      ['R','P','I'] != ['L','P','S']. If this fixture passes, the orientation
      gate is not actually firing.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Declares allowed tools, Needs Python

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
NVIDIA MedTech Team
Publisher
NVIDIA (Official)
Source
NVIDIA/skills · skills/dicom-series-to-volume · commit fce3cca
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE-APACHE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by NVIDIA MedTech Team or NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download dicom-series-to-volume.zip