1
---
2
name: imaging-data-commons
3
description: Queries and downloads public cancer imaging data from NCI Imaging Data Commons. Supports IDC collection discovery, DICOM access, radiology (CT, MR, PET) and pathology AI datasets, metadata SQL, visualization, licensing, and citations. Uses public metadata and download routes without authentication; optional BigQuery and Google Healthcare routes require Google credentials.
4
compatibility: Requires network access for hosted APIs, index fetching, citations, and downloads. Local Python workflows target idc-index 0.12.5; BigQuery and Google Healthcare require Google credentials.
5
license: This skill is provided under the MIT License. IDC data itself has individual licensing (mostly CC-BY, some CC-NC) that must be respected when using the data.
6
metadata:
7
version: "1.8"
8
last-reviewed: "2026-09-30"
9
source-skill-version: "1.8.1"
10
skill-author: Andrey Fedorov, @fedorov
11
idc-index: "0.12.5"
12
idc-data-version: "v24"
13
repository: https://github.com/ImagingDataCommons/imaging-data-commons-skill
14
---
15
16
# Imaging Data Commons
17
18
## Overview
19
20
Query and download public cancer imaging data from the National Cancer Institute Imaging Data Commons (IDC). No authentication required for data access.
21
22
**Expected network access:** IDC metadata is reachable three ways — a bundled local DuckDB index (offline after installation; additional indices are fetched from GitHub and clinical tables from S3), or the hosted IDC service over MCP or REST (`api.imaging.datacommons.cancer.gov`, no authentication). File downloads use public GCS (`storage.googleapis.com`) and AWS S3 (`s3.amazonaws.com`) — no authentication required. DICOMweb access uses either the public IDC proxy (`proxy.imaging.datacommons.cancer.gov`, no auth) or the Google Cloud Healthcare API (`healthcare.googleapis.com`, requires GCP authentication). Optional BigQuery queries (`bigquery.googleapis.com`) also require GCP authentication. Citation resolution contacts DOI services. Public IDC routes require no credentials; optional Google clients use Application Default Credentials.
23
24
**Reviewed 2026-09-30:** idc-index 0.12.5, idc-index-data 24.2.2, IDC v24; hosted API 3.0.0b3. Recheck at use time.
25
26
**Choose the access path first.** There is no single default: the cheapest correct path depends
27
on the session and the task.
28
29
1. **Session already has the IDC MCP server?** Route discovery and metadata there — see *IDC
30
MCP Server*.
31
2. **Otherwise, is `idc-index` installed and current?** Run `python scripts/check_version.py`. If it passes,
32
use `idc-index` for everything.
33
3. **Not installed, and the task is read-only metadata** — counts, attribute values, collection
34
lookups, SQL under 10 000 rows, licenses, citations, viewer URLs? **Use the REST API over
35
`curl`; do not install anything.** Installing costs ~77 MB of packaged index data plus
36
pandas, pyarrow, and duckdb, which a metadata question does not need. See *Data Access
37
Options*.
38
4. **Not installed, and the task needs more than metadata** — downloading files, pandas or
39
plotting, pydicom/SimpleITK, pathology tiling, results past 10 000 rows, or a version-pinned
40
script the user re-runs? Install `idc-index`: `check_version.py` exits non-zero and prints
41
the exact install command for the running interpreter. Prefer a virtual environment, then
42
restart Python.
43
44
`idc-index` ([GitHub](https://github.com/imagingdatacommons/idc-index)) is still the most
45
capable Python path, with query and download helpers in one client. `check_version.py` never installs anything itself — it also flags a newer
46
`idc-index` or skill release when one exists.
47
48
**Setup for the `idc-index` path:** use the intended interpreter for `scripts/check_version.py`
49
and confirm its `meets pinned minimum` message before continuing. A launch failure is not a pass.
50
51
```python
52
from idc_index import IDCClient
53
client = IDCClient()
54
55
# Verify IDC data version (should be "v24")
56
print(f"IDC data version: {client.get_idc_version()}")
57
```
58
59
Download and image-processing examples are illustrative unless noted; see the reference review notes for verification scope.
60
61
**Core workflow:** query metadata with `client.sql_query()` → download with
62
`client.download_from_selection()` → visualize with `client.get_viewer_URL()`. Python examples
63
below assume this `client`; *Data Access Options* has the REST equivalents. For current data
64
scale, run the summary query in `references/sql_patterns.md` or `GET /v3/stats`.
65
66
## IDC MCP Server
67
68
IDC operates a hosted MCP server at `https://api.imaging.datacommons.cancer.gov/mcp`
69
(streamable HTTP, no authentication). Where it is available it complements — it does not
70
replace — the `idc-index` workflow below.
71
72
**Identify it** by the MCP resource `idc://guide`, or by three or more of the tool names
73
`build_cohort`, `get_cohort_urls`, `list_analysis_results`, and `get_idc_version`. Generic
74
names such as `run_sql` are not evidence on their own. If identification is ambiguous, use
75
`idc-index`.
76
77
**If this session has the server**, treat it as authoritative for discovery and metadata —
78
IDC version, counts, attribute values, cohort building, metadata SQL — and follow the
79
server's own instructions rather than re-deriving them from this file. Its data version is
80
whatever the server reports: call `get_idc_version` instead of relying on the version pinned
81
in this file.
82
83
Return here for what the server does not do: downloading files, local pandas/notebook
84
analysis, DICOMweb, BigQuery, digital pathology tiling, and reproducible scripts. Hand off by
85
passing SeriesInstanceUIDs from the server to `client.download_from_selection(...)`, and run
86
`scripts/check_version.py` at that point.
87
88
**If it is not available**, the identical service is reachable with no configuration as a REST
89
API at `https://api.imaging.datacommons.cancer.gov/v3` — use it for read-only metadata rather
90
than installing `idc-index`, per the routing gate in *Overview*. Suggest connecting the MCP
91
server at most once, only for repeated interactive discovery, and never change the user's
92
configuration yourself.
93
94
See `references/mcp_guide.md` for the tool inventory, handoff patterns, and per-host notes.
95
96
## When to Use This Skill
97
98
- Finding publicly available radiology (CT, MR, PET) or pathology (slide microscopy) images
99
- Selecting image subsets by cancer type, modality, anatomical site, or other metadata
100
- Downloading DICOM data from IDC
101
- Checking data licenses before use in research or commercial applications
102
- Visualizing medical images in a browser without local DICOM viewer software
103
104
## Quick Navigation
105
106
Inline below: the MCP/REST routing rules, the IDC data model, the index tables and how they
107
join, the core API patterns (query, download, visualize, license, cite), best practices, and
108
troubleshooting.
109
110
**Reference Guides (load on demand):**
111
112
| Guide | When to Load |
113
|-------|--------------|
114
| `index_tables_guide.md` | Complex JOINs, schema discovery, DataFrame access |
115
| `use_cases.md` | End-to-end workflows: training datasets, batch downloads, DICOM reading with pydicom/SimpleITK, pipeline integration |
116
| `sql_patterns.md` | Quick SQL patterns for filter discovery, annotations, size estimation |
117
| `clinical_data_guide.md` | Clinical/tabular data, imaging+clinical joins, value mapping |
118
| `licensing_and_citation.md` | Commercial-use questions, mixed-license cohorts, citation formats |
119
| `cloud_storage_guide.md` | Direct S3/GCS access, versioning, UUID mapping |
120
| `dicomweb_guide.md` | DICOMweb endpoints, PACS integration |
121
| `digital_pathology_guide.md` | Slide microscopy (SM), annotations (ANN), pathology workflows |
122
| `bigquery_guide.md` | Full DICOM metadata, private elements (requires GCP) |
123
| `cli_guide.md` | Command-line tools (`idc download`, manifest files) |
124
| `parquet_access_guide.md` | Direct Parquet queries via GCS (no idc-index install needed) |
125
| `mcp_guide.md` | Hosted IDC MCP server: tool inventory, identification, handoff to `idc-index` |
126
| `rest_api_guide.md` | Hosted IDC REST API: endpoints, filter syntax, SQL over HTTP, manifests |
127
128
## IDC Data Model
129
130
IDC adds two grouping levels above the standard DICOM hierarchy (Patient → Study → Series → Instance):
131
132
- **collection_id**: Groups patients by disease, modality, or research focus (e.g., `tcga_luad`, `nlst`). Treat `(collection_id, PatientID)` as the patient key; do not assume PatientID is globally unique.
133
- **analysis_result_id**: Identifies derived objects (segmentations, annotations, radiomics features) across one or more original collections. Use it to find AI-generated or expert annotations, while `collection_id` finds original imaging data (which may itself include deposited annotations).
134
135
**Key identifiers for queries:**
136
| Identifier | Scope | Use for |
137
|------------|-------|---------|
138
| `collection_id` | Dataset grouping | Filtering by project/study |
139
| `PatientID` | Patient | Grouping images by patient |
140
| `StudyInstanceUID` | DICOM study | Grouping of related series, visualization |
141
| `SeriesInstanceUID` | DICOM series | Grouping of related series, visualization |
142
143
## Index Tables
144
145
The `idc-index` package provides multiple metadata index tables, accessible via SQL or as pandas DataFrames. The REST API exposes the same tables through `GET /tables` and `POST /sql`.
146
147
**Important:** `client.indices_overview` is the authoritative source for current table descriptions, available columns, and their types — query it when writing SQL or exploring data structure. It also answers "which table contains column X"; see `references/index_tables_guide.md` for that search pattern and full schema discovery.
148
149
### Available Tables
150
151
Always call `client.fetch_index("table_name")` before querying any index table — it is safe and idempotent for all tables, including those loaded automatically at startup.
152
153
| Family | Tables | Granularity |
154
|--------|--------|-------------|
155
| Core | `index` (primary metadata for all current data), `collections_index`, `analysis_results_index` | series / collection / analysis result |
156
| Modality acquisition parameters | `ct_index`, `mr_index`, `pt_index`, `contrast_index` | 1 row = 1 series of that modality |
157
| Derived objects | `seg_index`, `rtstruct_index`, `ann_index`, `ann_group_index` | 1 row = 1 series (or annotation group) |
158
| Microscopy | `sm_index`, `sm_instance_index` | 1 row = 1 SM series / instance |
159
| Geometry, clinical, history | `volume_geometry_index`, `clinical_index`, `version_metadata_index`, `prior_versions_index` | see guide |
160
161
`references/index_tables_guide.md` has the full inventory with each table's columns and
162
contents — load it when you need to know what a specialized table actually holds.
163
164
**`prior_versions_index` contains historical series versions**, including revised versions
165
whose DICOM SeriesInstanceUID still occurs in `index`. Pin `crdc_series_uuid` for historical
166
content. For "what's new" in the current release use
167
`series_init_idc_version` / `series_revised_idc_version` in the main `index` table, which are
168
not equivalent to this table's `min_idc_version` / `max_idc_version`.
169
170
### Joining Tables
171
172
**`SeriesInstanceUID` is the universal join key** for all series-level specialized tables: `sm_index`, `sm_instance_index`, `seg_index`, `ann_index`, `ann_group_index`, `contrast_index`, `volume_geometry_index`, `rtstruct_index`, `ct_index`, `mr_index`, `pt_index`. Always join these to `index` on `SeriesInstanceUID`. The exceptions below use different column names.
173
174
| Join Column | Tables | Use Case |
175
|-------------|--------|----------|
176
| `collection_id` | index, prior_versions_index, collections_index, clinical_index | Link series to collection metadata or clinical data |
177
| `analysis_result_id` | index, analysis_results_index | Link series to analysis result metadata (annotations, segmentations) |
178
| `source_DOI` | index, analysis_results_index | Link by publication DOI |
179
| `segmented_SeriesInstanceUID` | seg_index → index | Link segmentation to its source image series (`seg_index.segmented_SeriesInstanceUID = index.SeriesInstanceUID`) |
180
| `referenced_SeriesInstanceUID` | ann_index → index, rtstruct_index → index | Link annotation or RTSTRUCT to its source image series |
181
182
**Note:** `subjects`, `updated`, and `description` appear in multiple tables but have different meanings (counts vs identifiers, different update contexts). A UID-only join to `prior_versions_index` can match several historical revisions; use CRDC UUIDs to distinguish them.
183
184
For detailed join examples, schema discovery patterns, key columns reference, and DataFrame access, see `references/index_tables_guide.md`.
185
186
### Clinical Data Access
187
188
Clinical (non-imaging) attributes — staging, demographics, therapy — live in per-collection
189
tables. `client.fetch_index("clinical_index")` loads the dictionary mapping columns to
190
collections; `client.get_clinical_table(name)` returns one table as a DataFrame.
191
192
See `references/clinical_data_guide.md` for the discovery workflow, coded-value mapping, and
193
joining clinical data with imaging.
194
195
## Data Access Options
196
197
| Method | Auth | Best For | Reference |
198
|--------|------|----------|-----------|
199
| `idc-index` | No | Downloads, pandas analysis, unbounded queries — the most capable path | This document |
200
| IDC MCP server | No | Discovery, cohort building, metadata when the session already has it | `mcp_guide.md` |
201
| IDC REST API | No | Metadata with no install, from any language or shell — the default when `idc-index` is absent | `rest_api_guide.md` |
202
| Direct Parquet (GCS) | No | Version-pinned queries, or results past the REST row cap | `parquet_access_guide.md` |
203
| Cloud storage (S3/GCS) | No | Direct file access, bulk transfer, custom pipelines | `cloud_storage_guide.md` |
204
| DICOMweb via IDC proxy | No | Tool and PACS integration; daily quota, so testing and moderate use | `dicomweb_guide.md` |
205
| DICOMweb via Google Healthcare | Yes (GCP) | The same DICOMweb API at production volume, without the proxy quota | `dicomweb_guide.md` |
206
| SlicerIDCBrowser | No | 3D visualization and analysis in 3D Slicer | https://github.com/ImagingDataCommons/SlicerIDCBrowser |
207
| BigQuery | Yes (GCP) | Full DICOM metadata, private elements, SR measurements — last resort | `bigquery_guide.md` |
208
209
**The IDC Portal (https://portal.imaging.datacommons.cancer.gov/) is interactive only** —
210
browser-based exploration, manual cohort selection, and download. Unlike every option above it
211
has no programmatic interface, so point a user there to browse or click through data
212
themselves; never use it as a step in a script or workflow.
213
214
**REST API — the no-install metadata path**
215
216
`https://api.imaging.datacommons.cancer.gov/v3`, no authentication: discovery, cohort counts and
217
manifests, read-only SQL, clinical tables, viewer URLs, licenses, citations. It is the same
218
service as the MCP server over plain HTTP, so it needs no configuration. It never moves image
219
bytes — switch to `idc-index` to download, to get a DataFrame, or for results past 10 000 rows.
220
221
```bash
222
B=https://api.imaging.datacommons.cancer.gov/v3
223
curl -s $B/version # idc_version, idc_index_data_version, api_version
224
curl -s $B/stats # collections, patients, studies, series, instances, size_TB
225
curl -s "$B/attributes/Modality/values?limit=5" # real filter values, with counts
226
curl -s $B/sql -H 'content-type: application/json' \
227
-d '{"sql":"SELECT collection_id, COUNT(*) n FROM index GROUP BY 1 ORDER BY n DESC LIMIT 3"}'
228
curl -s $B/cohort/counts -H 'content-type: application/json' \
229
-d '{"filters":{"terms":{"collection_id":["rider_pilot"]}}}'
230
```
231
232
**The filter object always goes under `filters`** — on `cohort/counts`, `cohort/manifest`,
233
`cohort/manifest.txt`, `licenses`, and `citations` alike. A bare filter or an unrecognized key is
234
a 422 naming the fix; an unfiltered series-enumerating request is a 400, not the whole archive.
235
Filtered JSON responses echo `filters_applied` and `warnings` (inside `counts` for manifests) — read them, because they name
236
any predicate the server dropped. A zero count with empty `warnings` therefore means the filter
237
matched nothing, not that a value was miscased; miscasing produces a warning that says so.
238
239
`POST /sql` takes one read-only `SELECT`/`WITH` over the tables `idc-index` exposes plus
240
`clinical.<table>`; `max_rows` defaults to 5 000, caps at 10 000, and `truncated` flags clipping.
241
`GET /attributes` lists the 19 filterable attributes — clinical values, segmented anatomy, and
242
acquisition parameters are not among them and need SQL. Request limits still apply. **Use
243
v3 only:** V1 and V2 are superseded and scheduled for shutdown, so port any `/v1/`- or
244
`Modality_btw`-style example a user brings rather than extending it.
245
246
Both sides build on `idc-index-data`, so compare the API's `idc_index_data_version` against local
247
`idc_index_data.__version__` before mixing them: the **major is the IDC data release** (`24.x.y`
248
serves `v24`); minor/patch index builds may correct metadata. If the API is a whole
249
release ahead, `idc-index` **cannot download the extra series** — mixed selections can omit
250
unrecognized UIDs, while wholly unmatched selections raise — so either upgrade it (run `scripts/check_version.py` for the right command)
251
or transfer directly from the bucket with `s5cmd --no-sign-request`.
252
253
See `references/rest_api_guide.md` for the endpoint reference, filter grounding, limits, and the
254
manifest-based download flow.
255
256
**Cloud storage organization**
257
258
All DICOM files live in public buckets mirrored between AWS S3 and GCS, organized by CRDC UUIDs
259
(not DICOM UIDs) to support versioning, as `<crdc_series_uuid>/<crdc_instance_uuid>.dcm`. Access
260
is free (no egress fees) via AWS CLI, gsutil, or s5cmd with anonymous access; use the
261
`series_aws_url` column for S3 URLs. Bucket names do not establish a license; query `license_short_name` for each selected series. See `references/cloud_storage_guide.md` for the full
262
bucket list and UUID mapping.
263
264
**DICOMweb access**
265
266
IDC data is available via DICOMweb (Google Cloud Healthcare API) for PACS integration and
267
DICOMweb-compatible tools: a public proxy (no auth, daily quota) for testing and moderate
268
queries, or Google Healthcare (GCP auth) for production volumes. See
269
`references/dicomweb_guide.md`.
270
271
**Direct Parquet access**
272
273
The idc-index metadata tables are also published as Parquet on a public GCS bucket
274
(`idc-index-data-artifacts`), queryable with DuckDB or pandas. This needs DuckDB installed
275
For ad-hoc metadata prefer REST `/sql`; choose Parquet for pinned versions or large results.
276
A separate public S3 export also includes clinical tables and full BigQuery metadata. See
277
`references/parquet_access_guide.md`.
278
279
## Core Capabilities
280
281
The patterns below are the ones that go wrong when recalled from memory rather than checked.
282
Worked examples for each area live in the reference guides named inline.
283
284
### 1. Discovery — enumerate values before filtering on them
285
286
Filtering on a guessed `Modality` or `BodyPartExamined` string is the most common cause of an
287
empty result set. Enumerate first:
288
289
```python
290
modalities = client.sql_query("""
291
SELECT DISTINCT Modality, COUNT(*) as series_count
292
FROM index
293
GROUP BY Modality
294
ORDER BY series_count DESC
295
""")
296
print(modalities)
297
```
298
299
The same pattern works for any filter column, optionally narrowed by another —
300
`BodyPartExamined` within a `Modality`, `Manufacturer`, `collection_id`. On the REST path this
301
grounding is a single call — `GET /attributes/{attr}/values` returns values with counts — and the
302
cohort endpoints report a miscased value in `warnings` rather than as an empty result.
303
304
Two indices carry curated collection-level metadata the primary `index` does not, both
305
requiring `client.fetch_index(...)` first: `collections_index` (cancer types, tumor locations,
306
species, subject counts) and `analysis_results_index` (derived datasets — AI segmentations,
307
expert annotations, radiomics — with their source collections and modalities).
308
309
**Cancer type lives in `collections_index.cancer_types`, not in `index`** — filtering by
310
cancer type requires a join:
311
312
```python
313
client.fetch_index("collections_index")
314
results = client.sql_query("""
315
SELECT i.collection_id, i.PatientID, i.SeriesInstanceUID, i.Modality
316
FROM index i
317
JOIN collections_index c ON i.collection_id = c.collection_id
318
WHERE c.cancer_types LIKE '%Breast%'
319
AND i.Modality = 'MR'
320
LIMIT 20
321
""")
322
```
323
324
`client.sql_query()` returns a pandas DataFrame. Confirm column names with
325
`client.get_index_schema('index')` or `client.indices_overview` before writing a query rather
326
than assuming them.
327
328
See `references/sql_patterns.md` for filter-value discovery, annotation and segmentation
329
queries, size estimation, clinical linking, and version tracking ("what's new in vX" — use
330
`series_init_idc_version` / `series_revised_idc_version` in `index`; historical objects use
331
`prior_versions_index`).
332
333
### 2. Downloading DICOM files
334
335
**The two download methods take their first two arguments in opposite order.** This is the
336
most common source of broken IDC code — check it rather than recalling it:
337
338
| Method | First arg | Second arg | Use when |
339
|--------|-----------|------------|----------|
340
| `download_from_selection` | `downloadDir` (required) | filter kwargs (optional) | Filtering by collection, patient, study, or series |
341
| `download_dicom_series` | `seriesInstanceUID` (required) | `downloadDir` (required) | Downloading specific series by UID only |
342
343
**`download_from_selection` takes filter keyword arguments, NOT a DataFrame.** The name
344
"from_selection" refers to filtering the IDC index by criteria — not to accepting a pandas
345
DataFrame. To download query results, extract the UIDs into a list first:
346
347
```python
348
# Step 1: Query for series UIDs
349
series_df = client.sql_query("""
350
SELECT SeriesInstanceUID
351
FROM index
352
WHERE Modality = 'CT'
353
AND BodyPartExamined = 'CHEST'
354
AND collection_id = 'nlst'
355
LIMIT 5
356
""")
357
358
# Step 2: Extract UIDs as a list from the DataFrame
359
uids = list(series_df['SeriesInstanceUID'].values)
360
361
# Step 3: Pass the list to download_from_selection (NOT the DataFrame itself)
362
client.download_from_selection(
363
downloadDir="./data/lung_ct",
364
seriesInstanceUID=uids # list of strings, not a DataFrame
365
)
366
367
# Alternative: download_dicom_series has seriesInstanceUID as FIRST arg (different order!)
368
client.download_dicom_series(
369
seriesInstanceUID=uids, # FIRST arg here
370
downloadDir="./data/lung_ct"
371
)
372
373
# Whole collection: downloadDir is still the FIRST positional argument
374
client.download_from_selection(downloadDir="./data/rider", collection_id="rider_pilot")
375
```
376
377
Both default to AWS; use `source_bucket_location="gcs"` for Google. In 0.12.5 the most-specific
378
selector wins, so use SQL first for intersecting criteria and verify every requested UID exists.
379
380
**Downloaded files are named `<crdc_instance_uuid>.dcm`, not by SOPInstanceUID.** The DICOM
381
UIDs are preserved inside the file metadata, not in the filename. Read DICOM headers for the
382
series UID; `crdc_instance_uuid` is not a column of the series-level `index`.
383
384
`idc download <collection|series-uid|manifest> --download-dir ./data` does the same from a
385
shell. See `references/cli_guide.md` for the `dirTemplate` hierarchy options (Python default:
386
`%collection_id/%PatientID/%StudyInstanceUID/%Modality_%SeriesInstanceUID`; `dirTemplate=""`
387
flattens), manifest downloads with resume, and dry-run size estimation.
388
389
### 3. Visualizing IDC images
390
391
```python
392
viewer_url = client.get_viewer_URL(seriesInstanceUID=uid) # one series
393
viewer_url = client.get_viewer_URL(studyInstanceUID=study_uid) # all series in a study
394
```
395
396
Returns a browser URL — nothing is downloaded. The method selects OHIF v3 for radiology or
397
SLIM for slide microscopy automatically. Viewing by study is useful when a single DICOM Study
398
holds several Series (T1, T2, and DWI from one MRI session).
399
400
### 4. Licenses and citations — obligations, not optional steps
401
402
IDC data carries license terms and attribution requirements that follow it into any downstream
403
publication or product, and neither is inferable from the pixel data. **Check the license
404
before use, and generate citations for whatever you download.**
405
406
```python
407
# License breakdown for a selection
408
licenses = client.sql_query("""
409
SELECT DISTINCT collection_id, license_short_name,
410
COUNT(DISTINCT SeriesInstanceUID) as series_count
411
FROM index GROUP BY collection_id, license_short_name
412
""")
413
414
# Citations for the same selection you downloaded (APA by default)
415
for citation in client.citations_from_selection(collection_id="rider_pilot"):
416
print(citation)
417
```
418
419
In the reviewed v24 snapshot, about 97% of IDC data by size is CC BY (commercial use allowed with attribution) and about 3% is
420
CC BY-NC (non-commercial only). **Licenses attach to series, not collections** — 39 of 176
421
collections carry more than one — so check the selection you actually intend to use, and note
422
that each component retains its license obligations.
423
424
Both tasks are available from all three access paths, so stay on whichever one the session is
425
already using: `idc-index` as above, `POST /v3/licenses` and `POST /v3/citations` over REST,
426
or the `get_licenses` and `get_citations` MCP tools. See
427
`references/licensing_and_citation.md` for the full license inventory, all three routes, the
428
citation formats (APA, BibTeX, CSL JSON, RDF Turtle), and what to include when publishing.
429
430
### 5. Reaching past the index
431
432
Pick the access path with the routing gate in *Overview*; *Data Access Options* above is the
433
full routing table.
434
435
Before reaching for BigQuery (which needs a Google Cloud project and access), check whether a
436
specialized index table already has the column you want: search `client.indices_overview`,
437
then `client.fetch_index(...)` and query locally for free. Full instance metadata, per-segment
438
rows, and SR measurement tables require BigQuery or its public Parquet exports; these are
439
outside the compact idc-index tables.
440
441
## Best Practices
442
443
- **Check schema before writing queries** — Use `client.get_index_schema('index')` (reads cached metadata, no SQL executed) or `client.indices_overview` to see all available columns and their descriptions. The version-tracking columns `series_init_idc_version` and `series_revised_idc_version` in the main `index` table directly answer "what's new / when was this added" questions without touching `prior_versions_index`.
444
- **Use the index for IDC data content questions** - Query the IDC index directly, via `client.sql_query()` locally or `POST /v3/sql` over HTTP. Web sources (release notes, blog posts, documentation pages) are frequently out of date and will produce incorrect answers. The index is the authoritative source; use it even when web search is available.
445
- **Verify the IDC data version at the start of a session** - `client.get_idc_version()`, `GET /v3/version`, or the MCP `get_idc_version` tool, depending on the path in use (currently v24). For a stale local index, run `scripts/check_version.py` and use the upgrade command it prints
446
- **Check licenses and generate citations** - Query `license_short_name` and respect CC BY vs CC BY-NC terms; use `citations_from_selection()` to produce citations from `source_DOI` for publications
447
- **Explore small, then commit** - Use `LIMIT` (or a low `max_rows`) while exploring, and check collection size before downloading — some collections are terabytes. See `references/cli_guide.md`
448
- **Keep downloads reproducible** - Organize with `dirTemplate` (e.g. `%collection_id/%PatientID/%Modality`) and save the Series UIDs or manifest behind any dataset you build
449
450
## Troubleshooting
451
452
**Issue: `ModuleNotFoundError: No module named 'idc_index'`**
453
- **Cause:** idc-index package not installed
454
- **Solution:** If the task is read-only metadata, do not install it — use the REST API instead (*Data Access Options*). Otherwise run `scripts/check_version.py` and use the install command it prints, which targets the running interpreter and pins the vetted version. For data analysis also add pandas, numpy, and pydicom (tested with pandas>=1.5, numpy>=1.23, pydicom>=2.3)
455
456
**Issue: Download fails with connection timeout**
457
- **Cause:** Network instability or large download size
458
- **Solution:** Download in smaller batches (10-20 series); see `references/cli_guide.md` for
459
`--use-s5cmd-sync` resume and retry guidance
460
461
**Issue: `BigQuery quota exceeded` or billing errors**
462
- **Cause:** Project quotas, sandbox limits, or billing configuration prevent the query
463
- **Solution:** Use idc-index mini-index for simple queries (no billing required), or see `references/bigquery_guide.md` for cost optimization tips
464
465
**Issue: Series UID not found or no data returned**
466
- **Cause:** Typo in UID, data not in the current IDC version, or wrong field name
467
- **Solution:** Test with `LIMIT 5` first, check field names against `client.indices_overview`,
468
and confirm the series is in the current version (some old data is deprecated)
469
470
**Issue: Column not found in `index` table (e.g., `SliceThickness`, `PixelSpacing`, `KVP`, `EchoTime`, `InjectedDose`)**
471
- **Cause:** The `index` table contains series-level metadata only; modality-specific acquisition and reconstruction parameters live in dedicated tables (`ct_index`, `mr_index`, `pt_index`)
472
- **Solution:** Search `client.indices_overview` for the column to find its table — the loop is under *Finding which table contains a column* in `references/index_tables_guide.md` — then fetch and join on `SeriesInstanceUID`:
473
```python
474
client.fetch_index("ct_index")
475
result = client.sql_query("""
476
SELECT i.SeriesInstanceUID, i.Modality, c.SliceThickness, c.KVP, c.PixelSpacing_row_mm
477
FROM index i
478
JOIN ct_index c USING (SeriesInstanceUID)
479
WHERE i.collection_id = 'your_collection'
480
""")
481
```
482
483
**Issue: Downloaded DICOM files won't open**
484
- **Cause:** Corrupted download, or an object type the viewer does not handle — SEG, RTSTRUCT,
485
SR, and slide microscopy all need specialized tools
486
- **Solution:** Inspect `Modality`, `SOPClassUID`, and transfer syntax with normal `pydicom.dcmread`;
487
[forced parsing is not validation](https://pydicom.github.io/pydicom/stable/reference/generated/pydicom.filereader.dcmread.html).
488
Check download integrity and decoder/viewer support before re-downloading; reserve `force=True` for diagnosed non-Part-10 inputs.
489
490
## Resources
491
492
Reference guides and their decision triggers are listed in *Quick Navigation* above.
493
494
- **IDC Portal**: https://portal.imaging.datacommons.cancer.gov/explore/
495
- **Documentation**: https://learn.canceridc.dev/ — **Tutorials**: https://github.com/ImagingDataCommons/IDC-Tutorials
496
- **User Forum**: https://discourse.canceridc.dev/ — **idc-index**: https://github.com/ImagingDataCommons/idc-index
497
- **[indices_reference](https://idc-index.readthedocs.io/en/latest/indices_reference.html)** — external index-table docs (may be ahead of the installed version)
498
- **Citation**: Fedorov, A., et al. "National Cancer Institute Imaging Data Commons: Toward Transparency, Reproducibility, and Scalability in Imaging Artificial Intelligence." RadioGraphics 43.12 (2023). https://doi.org/10.1148/rg.230180
499
- **Skill updates**: [releases page](https://github.com/ImagingDataCommons/imaging-data-commons-skill/releases); watch the repository (Watch → Custom → Releases)
500