Queries and downloads public cancer imaging data from the NCI Imaging Data Commons using the idc-index Python package. Supports filtering by metadata, in-browser visualization, and license checking for CT, MR, PET, and digital pathology DICOM datasets.
Use the idc-index Python package to query and download public cancer imaging data from the National Cancer Institute Imaging Data Commons (IDC). No authentication required for data access.
Current IDC Data Version: v25 (idc-index 0.13.4, released 2026-10-20; always verify with IDCClient().get_idc_version())
Primary tool: idc-index (GitHub)
Run it install-free. uv run --with "idc-index>=0.13.4" python your_script.py (or ... python -c "...") resolves
idc-index into uv's cache for that run: no pip install, nothing added to another
environment, and always at least the version below. Every IDC data release ships as a new
idc-index version, so an old install silently queries stale data; releases up to 0.12.4
also pin pandas<=2.2.4, which conflicts with pandas 3 (0.12.5 relaxed this to pandas<4).
If you run in an existing environment instead, check the installed version first:
from importlib.metadata import version as _v
from packaging.version import Version
REQUIRED_VERSION = "0.13.4" # keep in sync with the compatibility field of this file
installed = _v("idc-index")
# Compare as versions, not strings ("0.9.0" < "0.11.0" is False as a string).
if Version(installed) < Version(REQUIRED_VERSION):
print(f"idc-index {installed} is older than {REQUIRED_VERSION}; upgrade with:")
print(' run with: uv run --with "idc-index>=0.13.4" python your_script.py')
else:
print(f"idc-index {installed} meets requirement ({REQUIRED_VERSION})")
Verify IDC data version and check current data scale:
from idc_index import IDCClient
client = IDCClient()
# Verify IDC data version ("v25" as of 2026-10)
print(f"IDC data version: {client.get_idc_version()}")
# Get collection count and total series
stats = client.sql_query("""
SELECT
COUNT(DISTINCT collection_id) as collections,
COUNT(DISTINCT analysis_result_id) as analysis_results,
COUNT(DISTINCT PatientID) as patients,
COUNT(DISTINCT StudyInstanceUID) as studies,
COUNT(DISTINCT SeriesInstanceUID) as series,
SUM(instanceCount) as instances,
SUM(series_size_MB)/1000000 as size_TB
FROM index
""")
print(stats)
Core workflow:
client.sql_query()client.download_from_selection()client.get_viewer_URL(seriesInstanceUID=...)scripts/query_imaging_data_commons.py — CLI wrapper over the idc-index package (JSON to stdout), run install-free:
uv run --with "idc-index>=0.13.4" python scripts/query_imaging_data_commons.py version # IDC data version
uv run --with "idc-index>=0.13.4" python scripts/query_imaging_data_commons.py collections --limit 50
uv run --with "idc-index>=0.13.4" python scripts/query_imaging_data_commons.py sql "SELECT * FROM index LIMIT 5"
| Scenario | Use Instead |
|---|---|
| Reading, anonymizing, or converting DICOM files you already have | alterlab-pydicom |
| Whole-slide image tiling and tissue detection on local slides | alterlab-histolab |
| Somatic mutations / copy number for TCGA or other cancer cohorts | alterlab-cbioportal |
| Cancer mutation signatures and census genes | alterlab-cosmic |
| Clinical significance / pathogenicity classification of a variant | alterlab-clinvar |
| Population statistics: incidence or mortality rates by state, county or country | alterlab-datacommons |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-pydicom) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Core Sections (inline):
Reference Guides (load on demand):
| Guide | When to Load |
|---|---|
core_api_examples.md | Runnable code for Core Capabilities §1-§9 (discovery, SQL, download, visualize, license, batch, BigQuery, pipelines) |
index_tables_guide.md | Complex JOINs, schema discovery, DataFrame access |
use_cases.md | End-to-end workflow examples (training datasets, batch downloads) |
sql_patterns.md | Quick SQL patterns for filter discovery, annotations, size estimation |
clinical_data_guide.md | Clinical/tabular data, imaging+clinical joins, value mapping |
cloud_storage_guide.md | Direct S3/GCS access, versioning, UUID mapping |
dicomweb_guide.md | DICOMweb endpoints, PACS integration |
digital_pathology_guide.md | Slide microscopy (SM), annotations (ANN), pathology workflows |
bigquery_guide.md | Full DICOM metadata, private elements (requires GCP) |
cli_guide.md | Command-line tools (idc download, manifest files) |
IDC adds two grouping levels above the standard DICOM hierarchy (Patient → Study → Series → Instance):
tcga_luad, nlst). A patient belongs to exactly one collection.Use collection_id to find original imaging data, may include annotations deposited along with the images; use analysis_result_id to find AI-generated or expert annotations.
Key identifiers for queries:
| Identifier | Scope | Use for |
|---|---|---|
collection_id | Dataset grouping | Filtering by project/study |
PatientID | Patient | Grouping images by patient |
StudyInstanceUID | DICOM study | Grouping of related series, visualization |
SeriesInstanceUID | DICOM series | Grouping of related series, visualization |
The idc-index package provides multiple metadata index tables, accessible via SQL or as pandas DataFrames.
Complete index table documentation: Use https://idc-index.readthedocs.io/en/latest/indices_reference.html for quick check of available tables and columns without executing any code.
Important: Use client.indices_overview to get current table descriptions and column schemas. This is the authoritative source for available columns and their types — always query it when writing SQL or exploring data structure.
| Table | Row Granularity | Loaded | Description |
|---|---|---|---|
index | 1 row = 1 DICOM series | Auto | Primary metadata for all current IDC data |
prior_versions_index | 1 row = 1 DICOM series | Auto | Series from previous IDC releases; for downloading deprecated data |
collections_index | 1 row = 1 collection | fetch_index() | Collection-level metadata and descriptions |
analysis_results_index | 1 row = 1 analysis result collection | fetch_index() | Metadata about derived datasets (annotations, segmentations) |
clinical_index | 1 row = 1 clinical data column | fetch_index() | Dictionary mapping clinical table columns to collections |
sm_index | 1 row = 1 slide microscopy series | fetch_index() | Slide Microscopy (pathology) series metadata |
sm_instance_index | 1 row = 1 slide microscopy instance | fetch_index() | Instance-level (SOPInstanceUID) metadata for slide microscopy |
seg_index | 1 row = 1 DICOM Segmentation series | fetch_index() | Segmentation metadata: algorithm, segment count, reference to source image series |
ann_index | 1 row = 1 DICOM ANN series | fetch_index() | Microscopy Bulk Simple Annotations series metadata; references annotated image series |
ann_group_index | 1 row = 1 annotation group | fetch_index() | Detailed annotation group metadata: graphic type, annotation count, property codes, algorithm |
contrast_index | 1 row = 1 series with contrast info | fetch_index() | Contrast agent metadata: agent name, ingredient, administration route (CT, MR, PT, XA, RF) |
ct_index / mr_index / pt_index | 1 row = 1 CT / MR / PET image series | fetch_index() | Modality-specific acquisition parameters (e.g. KVP, ConvolutionKernel; MagneticFieldStrength, EchoTime; Radiopharmaceutical, Units) |
volume_geometry_index | 1 row = 1 single-frame CT/MR/PT series | fetch_index() | Boolean checks for a regularly spaced 3D volume (regularly_spaced_3d_volume, orientation, spacing) — filter before building volumes |
rtstruct_index | 1 row = 1 RTSTRUCT series | fetch_index() | ROI names/counts, generation algorithms, referenced_SeriesInstanceUID |
version_metadata_index | 1 row = 1 IDC release | Auto | Release timestamps for each idc_version |
Auto = loaded automatically when IDCClient() is instantiated
fetch_index() = requires client.fetch_index("table_name") to load
Key columns are not explicitly labeled, the following is a subset that can be used in joins.
| Join Column | Tables | Use Case |
|---|---|---|
collection_id | index, prior_versions_index, collections_index, clinical_index | Link series to collection metadata or clinical data |
SeriesInstanceUID | index, prior_versions_index, sm_index, sm_instance_index | Link series across tables; connect to slide microscopy details |
StudyInstanceUID | index, prior_versions_index | Link studies across current and historical data |
PatientID | index, prior_versions_index | Link patients across current and historical data |
analysis_result_id | index, analysis_results_index | Link series to analysis result metadata (annotations, segmentations) |
source_DOI | index, analysis_results_index | Link by publication DOI |
crdc_series_uuid | index, prior_versions_index | Link by CRDC unique identifier |
Modality | index, prior_versions_index | Filter by imaging modality |
SeriesInstanceUID | index, seg_index, ann_index, ann_group_index, contrast_index | Link segmentation/annotation/contrast series to its index metadata |
segmented_SeriesInstanceUID | seg_index → index | Link segmentation to its source image series (join seg_index.segmented_SeriesInstanceUID = index.SeriesInstanceUID) |
referenced_SeriesInstanceUID | ann_index → index | Link annotation to its source image series (join ann_index.referenced_SeriesInstanceUID = index.SeriesInstanceUID) |
Note: Subjects, Updated, and Description appear in multiple tables but have different meanings (counts vs identifiers, different update contexts).
For detailed join examples, schema discovery patterns, key columns reference, and DataFrame access, see references/index_tables_guide.md.
# Fetch clinical index (also downloads clinical data tables)
client.fetch_index("clinical_index")
# Query clinical index to find available tables and their columns
tables = client.sql_query("SELECT DISTINCT table_name, column_label FROM clinical_index")
# Load a specific clinical table as DataFrame
clinical_df = client.get_clinical_table("table_name")
See references/clinical_data_guide.md for detailed workflows including value mapping patterns and joining clinical data with imaging.
| Method | Auth Required | Best For |
|---|---|---|
idc-index | No | Key queries and downloads (recommended) |
| IDC Portal | No | Interactive exploration, manual selection, browser-based download |
| BigQuery | Yes (GCP account) | Complex queries, full DICOM metadata |
| DICOMweb proxy | No | Tool integration via DICOMweb API |
| Cloud storage (S3/GCS) | No | Direct file access, bulk downloads, custom pipelines |
Cloud storage organization
IDC maintains all DICOM files in public cloud storage buckets mirrored between AWS S3 and Google Cloud Storage. Files are organized by CRDC UUIDs (not DICOM UIDs) to support versioning.
| Bucket (AWS / GCS) | License | Content |
|---|---|---|
idc-open-data / idc-open-data | No commercial restriction | >90% of IDC data |
idc-open-data-two / idc-open-idc1 | No commercial restriction | Collections with potential head scans |
idc-open-data-cr / idc-open-cr | Commercial use restricted (CC BY-NC) | ~4% of data |
Files are stored as <crdc_series_uuid>/<crdc_instance_uuid>.dcm. Access is free (no egress fees) via AWS CLI, gsutil, or s5cmd with anonymous access. Use series_aws_url column from the index for S3 URLs; GCS uses the same path structure.
See references/cloud_storage_guide.md for bucket details, access commands, UUID mapping, and versioning.
DICOMweb access
IDC data is available via DICOMweb interface (Google Cloud Healthcare API implementation) for integration with PACS systems and DICOMweb-compatible tools.
| Endpoint | Auth | Use Case |
|---|---|---|
| Public proxy | No | Testing, moderate queries, daily quota |
| Google Healthcare | Yes (GCP) | Production use, higher quotas |
See references/dicomweb_guide.md for endpoint URLs, code examples, supported operations, and implementation details.
Required (for basic access) — no install step; run each script through uv:
uv run --with "idc-index>=0.13.4" python build_dataset.py
# add analysis packages the same way:
uv run --with "idc-index>=0.13.4" --with pydicom --with numpy python analyse.py
Important: every IDC data release ships as a new idc-index version. The >= floor
keeps runs current; pin an exact version (--with "idc-index==0.13.4") only when you need
to reproduce a past data release.
IDC data version v25 is current as of 2026-10-20. Verify your version at the start of a session:
print(client.get_idc_version()) # "v25"
Tested with: idc-index 0.13.4 (IDC data version v25) on 2026-10-23: sql_query on
collection_id = 'nlst' (194,327 CT CHEST series, ~10.5 TB) and download_from_selection of
one series. Reference files were written against 0.12.3 (v24); their SQL is unchanged.
Runnable Python/SQL/CLI recipes for every capability below live in
references/core_api_examples.md (numbered §1-§9 matching the headings here).
Load that file when you need copy-paste code; the summaries here give the
routing and the key decisions. All examples assume
from idc_index import IDCClient; client = IDCClient().
Find available collections and derived datasets:
index (patients/series/size per collection_id).collections_index (after fetch_index) gives curated per-collection metadata
(CancerTypes, TumorLocations, Species, Subjects) without aggregating.analysis_results_index lists derived datasets (AI segmentations, expert
annotations, radiomics) with source collections and modalities.Recipes in core_api_examples.md §1.
Two-step pattern: explore filter values first (SELECT DISTINCT Modality …,
BodyPartExamined …), then query with validated values. Access results as a
pandas DataFrame. To filter by cancer type, JOIN index with collections_index
(cancer type lives in collections_index.CancerTypes, not the primary index).
Use client.indices_overview for the full column list. Recipes in
core_api_examples.md §2.
client.download_from_selection(...) by collection_id or seriesInstanceUID,
with downloadDir and an optional dirTemplate (default
%collection_id/%PatientID/%StudyInstanceUID/%Modality_%SeriesInstanceUID; ""
for a flat layout). Files are named by CRDC instance UUID (<uuid>.dcm), not
DICOM UID. The idc download CLI mirrors this and auto-detects identifiers vs
manifest files. Recipes, CLI options, and manifest format in
core_api_examples.md §3; deeper CLI detail in references/cli_guide.md.
client.get_viewer_URL(seriesInstanceUID=...) (or studyInstanceUID=... for
multi-series exams) returns a browser URL — no download needed. The method picks
OHIF v3 for radiology or SLIM for slide microscopy automatically. Recipe in
core_api_examples.md §4.
Query license_short_name before any use. CC BY 4.0/3.0 (~97%) allows
commercial use with attribution; CC BY-NC 4.0/3.0 (~3%) is non-commercial
only; rare custom licenses exist. For attribution, citations_from_selection()
generates formatted citations from source_DOI (APA default; also BibTeX, JSON,
Turtle via IDCClient.CITATION_FORMAT_*). Recipes in core_api_examples.md §5.
Query with filters → save a manifest CSV → download in batches (e.g. 10 series at
a time) to avoid timeouts. Recipe in core_api_examples.md §6.
Use BigQuery only when you need full DICOM metadata, complex JOINs, or private
DICOM elements (OtherElements). First check whether a specialized index
(seg_index, ann_index/ann_group_index, sm_index, collections_index)
already has the field — local sql_query is free and needs no GCP account.
Dataset bigquery-public-data.idc_current.*, main table dicom_all. See
references/bigquery_guide.md; quick reference in core_api_examples.md §7.
| Task | Tool | Reference |
|---|---|---|
| Programmatic queries & downloads | idc-index | This document |
| Interactive exploration | IDC Portal | https://portal.imaging.datacommons.cancer.gov/ |
| Complex metadata queries | BigQuery | references/bigquery_guide.md |
| 3D visualization & analysis | SlicerIDCBrowser | https://github.com/ImagingDataCommons/SlicerIDCBrowser |
Default choice: Use idc-index for most tasks (no auth, easy API, batch downloads).
After download, read DICOM with pydicom, build 3D volumes by sorting on
ImagePositionPatient[2] and stacking pixel_array, or read a series with
SimpleITK.ImageSeriesReader for processing and NIfTI export. Recipes in
core_api_examples.md §9.
See references/use_cases.md for complete end-to-end workflow examples including:
client.get_idc_version() at the start of a session to confirm you're using the expected data version (currently v25). If it is older, run through uv run --with "idc-index>=0.13.4" pythonlicense_short_name field and respect licensing terms (CC BY vs CC BY-NC)citations_from_selection() to get properly formatted citations from source_DOI values; include these in publicationsLIMIT clause when exploring to avoid long downloads and understand data structure%collection_id/%PatientID/%ModalityIssue: ModuleNotFoundError: No module named 'idc_index'
uv run --with "idc-index>=0.13.4" python script.pyIssue: dependency resolver refuses idc-index next to pandas 3
pandas<=2.2.4uv run --with "idc-index>=0.13.4" route does)Issue: Download fails with connection timeout
dirTemplate to organize downloads by batchIssue: BigQuery quota exceeded or billing errors
references/bigquery_guide.md for cost optimization tipsIssue: Series UID not found or no data returned
LIMIT 5 to test query firstIssue: Downloaded DICOM files won't open
pydicom.dcmread(file, force=True)See references/sql_patterns.md for quick-reference SQL patterns including:
For segmentation and annotation details, also see references/digital_pathology_guide.md.
The following skills complement IDC workflows for downstream analysis and visualization:
alterlab-pydicom - Read, write, and manipulate downloaded DICOM files. Use for extracting pixel data, reading metadata, anonymization, and format conversion. Essential for working with IDC radiology data (CT, MR, PET).See references/digital_pathology_guide.md for DICOM-compatible tools (highdicom, wsidicom, TIA-Toolbox, Slim viewer).
alterlab-matplotlib - Low-level plotting for full customization. Use for creating static figures summarizing IDC query results (bar charts of modalities, histograms of series counts, etc.).alterlab-seaborn - Statistical visualization with pandas integration. Use for quick exploration of IDC metadata distributions, relationships between variables, and categorical comparisons with attractive defaults.alterlab-plotly - Interactive visualization. Use when you need hover info, zoom, and pan for exploring IDC metadata, or for creating web-embeddable dashboards of collection statistics.alterlab-eda - Comprehensive EDA on scientific data files. Use after downloading IDC data to understand file structure, quality, and characteristics before analysis.Always use client.indices_overview for current column schemas. This ensures accuracy with the installed idc-index version:
# Get all column names and types for any table
schema = client.indices_overview["index"]["schema"]
columns = [(c['name'], c['type'], c.get('description', '')) for c in schema['columns']]
See the Quick Navigation section at the top for the full list of reference guides with decision triggers.
This skill version is available in skill metadata. To check for updates:
evals/evals.json (opens in a new tab)references/bigquery_guide.md (opens in a new tab)references/cli_guide.md (opens in a new tab)references/clinical_data_guide.md (opens in a new tab)references/cloud_storage_guide.md (opens in a new tab)references/core_api_examples.md (opens in a new tab)references/dicomweb_guide.md (opens in a new tab)references/digital_pathology_guide.md (opens in a new tab)references/index_tables_guide.md (opens in a new tab)references/sql_patterns.md (opens in a new tab)references/use_cases.md (opens in a new tab)scripts/query_imaging_data_commons.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Not loaded · from alterlab-writing-tools
Claude Code won't load this skill
It ships in alterlab-writing-tools at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
Generated from the plugin's indexed repository (alterlab-ieu/alterlab-academic-skills) — no native marketplace selected
npx claudepluginhub p/alterlab-ieu-alterlab-writing-tools241 skills in this plugin
/alterlab-abm-mesaBuilds agent-based models of social systems with Mesa 3 — the current AgentSet API (model.agents.shuffle_do('step'), auto-assigned unique_id, mandatory super().__init__(rng=...)), cell spaces (mesa.discrete_space OrthogonalMooreGrid / classic mesa.space grids), the DataCollector, batch_run parameter sweeps, and SolaraViz — for emergence, segregation, diffusion, opinion dynamics, and cooperation models. It uses the Mesa 3.x API (the old mesa.time schedulers like RandomActivation are removed) and treats the model as a generative theory to be validated, not just run. Use when the request mentions an agent-based model, Mesa, simulating interacting agents, or emergent macro behavior from micro rules. For discrete-event (queueing/process) simulation prefer alterlab-simpy; for reinforcement learning prefer alterlab-stable-baselines3. Part of the AlterLab Academic Skills suite./alterlab-academic-careerPrepares academic career documents and professional-development materials for faculty and researchers. Use when drafting academic CVs, research statements, teaching philosophies, diversity statements, faculty-position cover letters, tenure dossiers, promotion narratives, academic portfolios, or mentorship statements, and when planning conference-networking strategy, building academic web presence, setting up ORCID profiles, or understanding impact metrics. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job