Exploration Document

Access detailed guides, API documentation, and implementation resources for the Cancer Imaging Biobank.

Data Structure
7. Downloading CAIB Data
1. Overview & Scope
2. Data Model
3. Data Dictionary
4. File Types & Formats
5. Annotation & Label Taxonomy
6. Navigating, Search, Filter, Requesting download access & Cart Interface
8. API / Programmatic Access
9. Data Quality Notes & Known Limitations
10. Citation & Attribution

Data Structure

Patient_Information

├── Baseline_Information

│ ├── Demography

│ ├── Family_History

│ ├── Habit

│ └── Comorbidity

│

├── Pathology_Information/

│ ├── Path_Study_Level_Information

│ └── Slide_Level_Information

│

└── Radiology_Information

├── Radiology_Level_Information

└── Image/ (includes pixel-level annotation)



1. Nomenclature

┌──────────────────────────────────────────────────────────────────────────────┐

│ SLIDE NAME (Decoded)                            │

├──────────────────────────────────────────────────────────────────────────────┤

│ Raw Slide ID : CAIB-T00004390OC01R02P0202HE                 │

│ Patient_ID  : CAIB-T00004390OC     (CAIB → Project/Site)        │

│ Path_ID   : CAIB-T00004390OC01R02   (CAIB → Procedure+PathSerial)    │

├──────────────────────────────────────────────────────────────────────────────┤

│ [CAIB] - [T00004390] [OC] [01] [R02] [P] [02] [02] [HE]            │

│  │    │     │  │   │  │  │  │  └── Stain         │

│  │    │     │  │   │  │  │  └────── BlockNo (02)      │

│  │    │     │  │   │  │  └────────── SlideNo (02)      │

│  │    │     │  │   │  └────────────── TissueClass (P)     │

│  │    │     │  │   │             P = Primary    │

│  │    │     │  │   │             R = Regional    │

│  │    │     │  │   │             N = Non-primary  │

│  │    │     │  │   │               node      │

│  │    │     │  │   │             D = Distant    │

│  │    │     │  │   │               metastasis   │

│  │    │     │  │   │             S = Secondary   │

│  │    │     │  │   │               primary    │

│  │    │     │  │   │             O = Others     │

│  │    │     │  │   └────────────────── Procedure+PathSerial   │

│  │    │     │  │             R = Resection      │

│  │    │     │  │             B = Biopsy        │

│  │    │     │  │             02 = Path serial (00–99) │

│  │    │     │  └──────────────────────── Presentation (01)     │

│  │    │     └───────────────────────────── Project/Site       │

│  │    │                    OC = Oral Cancer     │

│  │    │                    LC = Lung Cancer     │

│  │    └────────────────────────────────────── Patient serial       │

│  │      ├─ Org code: T → TMC                      │

│  │      ├─ Org code: A → AIIMS                     │

│  │      ├─ Org code: P → PGIMER                     │

│  │      └─ Org code: R → Rajiv Gandhi                  │

│  └──────────────────────────────────────────────── Program/Consortium: CAIB │

├──────────────────────────────────────────────────────────────────────────────┤

│ Note: "P0202" means TissueClass + SlideNo + BlockNo              │

└──────────────────────────────────────────────────────────────────────────────┘


Pathology data format

The whole slide images in this data base are coming from multiple hospital and scanners. All the slides are scanned at 40X resolution but depending on the scanner the micrometer per pixels can vary from 0.2 - 0.25 micrometer per pixel (mpp). The image are being displayed using vendor neutral image viewer.

7. Downloading CAIB Data

This document describes how approved users can download CAIB imaging data from the CAIB Exploration Portal. The workflow is the same for whole-slide images (WSIs) and radiology imaging datasets.


After your data-access request has been approved, download the file named download_links.txt from the CAIB Exploration Portal. This file contains one row for each selected dataset file, with two tab-separated columns:

  1. Temporary download URL
  2. File size


Important: Download URLs are valid for 7 days. If they expire, generate and download a new download_links.txt file from the portal.


For downloading single file copy URL from download_links.txt and paste directly to browser.


Data-access notice: download_links.txt contains temporary links to CAIB data. Store and share this file only in accordance with the applicable CAIB data-access and data-use policies.



Download on Linux

Ensure that you have:

  1. curl installed
  2. Sufficient free disk space for the selected dataset files


Download a file for testing

curl -L -C - -O "<DOWNLOAD_URL from download_links.txt for a file>" 


Step 1: Create a download folder

Open a terminal and run:

 mkdir -p dataset_download
 cd dataset_download


Step 2: Save download_links.txt in the download folder

Download download_links.txt from the CAIB Exploration Portal and save it in the dataset_download folder created above.


Step 3: Download the bulk files

Inside the dataset_download folder, save the code below into a file named download.sh:

#!/bin/bash
















while read -r line; do
  url=$(echo "$line" | sed -n 's/^url: \(.*\) size: .*/\1/p')
  [ -z "$url" ] && continue
  filename=$(basename "$url" | cut -d'?' -f1)
  
  # 1. Skip completely if the final file already exists
  if [ -f "$filename" ]; then
    echo "Already downloaded: $filename"
    continue
  fi
  
  echo "Downloading $filename ..."
  
  # 2. Download to a .part file, then rename when successful
  curl -L -C - -o "${filename}.part" "$url" && mv "${filename}.part" "$filename"
















done < download_links.txt

Open your terminal inside the dataset_download folder and run the following commands:

 chmod +x download.sh
./download.sh


If the process is interrupted, run the same command again.

./download.sh



Troubleshooting

  1. Authorization, access-denied, or expiry error: The temporary URL has expired. Generate and download a new download_links.txt file from the CAIB Exploration Portal, then rerun the command.
  2. curl: command not found: Install curl using your Linux distribution’s package manager. For Ubuntu or Debian-based systems:
sudo apt install curl
  1. Insufficient disk space: Free sufficient storage space before restarting the download.
  2. Network interruption: Run the same command again. Completed files will be skipped and partial downloads will resume where supported.
Data-access notice:download_links.txt contains temporary links to CAIB data. Store and share this file only in accordance with the applicable CAIB data-access and data-use requirements.


Download on Windows

Ensure that you have:

  1. Windows PowerShell
  2. curl.exe available (included with most current Windows installations)
  3. Sufficient free disk space for the selected dataset files


Download a file for testing

curl.exe -L -C - -O "<DOWNLOAD_URL from download_links.txt for a file>" 


Step 1: Create a download folder

Open PowerShell and run:

New-Item -ItemType Directory -Force -Path "$HOME\dataset_download" | Out-Null
Set-Location "$HOME\dataset_download"


Step 2: Save download_links.txt in the download folder

Download download_links.txt from the CAIB Exploration Portal and save it in the dataset_download folder created above.


Step 3: Download the dataset files

Inside the dataset_download folder, save the code below into a file named download.ps1`:

Get-Content "download_links.txt" | ForEach-Object {
    if ($_ -match '^url:\s*(.+?)\s+size:') {
        $url = $matches[1]
        $filename = ($url.Split('?')[0] -split '/')[ -1 ]
        Write-Host "Downloading $filename ..."
































        curl.exe -L -C - -o $filename $url
    }
}


In the PowerShell go to dataset_download folder and run the following commands:

.\download.ps1


If the process is interrupted, run the same command again.

.\download.ps1



Resuming or repeating a download

If the process is interrupted, run the same command again.

  1. Successfully completed files will be skipped.
  2. Partially downloaded .part files will resume where possible, provided that the download server supports resumable downloads.
  3. If resuming is not supported, delete the affected .part file and rerun the command to restart that file.


Troubleshooting

  1. Authorization, access-denied, or expiry error: The temporary URL has expired. Generate and download a new download_links.txt file from the CAIB Exploration Portal, then rerun the command.
  2. curl.exe is not recognized: Use the Python download method, or ask your local IT support to install or enable curl.
  3. Insufficient disk space: Free sufficient storage space before restarting the download.
  4. Network interruption: Run the same command again. Completed files will be skipped and partial downloads will resume where supported.

Download using Python script

Ensure that you have:

  1. Python 3 installed
  2. Sufficient free disk space for the selected dataset files
  3. A stable internet connection
  4. The required Python packages installed. Open your terminal or PowerShell and run:
pip install requests tqdm


Step 1: Create a download folder

  1. Create a folder named dataset_download at a suitable location on your computer.
  2. Save both of the following files in this folder:
  3. download_links.txt, downloaded from the CAIB Exploration Portal.
  4. The Python script created in Step 2.
  5. Note: download_links.txt contains one download per line, formatted with the temporary download URL and file size.


Step 2: Create the Python download script

Open a text editor, copy the following code, and save it as download_caib.py:


import os
import requests
import re
from tqdm import tqdm
















# Open and read the links file
try:
    with open('download_links.txt', 'r') as file:
        lines = file.readlines()
except FileNotFoundError:
    print("Error: download_links.txt not found. Ensure it is in the same folder as this script.")
    exit()
















for line in lines:
    line = line.strip()
    if not line:
        continue
    
    # Extract URL using regular expression
    match = re.search(r'url:\s*(.+?)\s+size:', line)
    if not match:
        print(f"Skipping invalid row: {line}")
        continue
        
    url = match.group(1)
    # Extract filename from the URL, ignoring query parameters
    filename = url.split('?')[0].split('/')[-1]
















    # Setup resume byte position if the file already exists locally
    resume_byte_pos = os.path.getsize(filename) if os.path.exists(filename) else 0
    headers = {"Range": f"bytes={resume_byte_pos}-"} if resume_byte_pos else {}
















    try:
        with requests.get(url, headers=headers, stream=True) as r:
            # Handle standard HTTP responses
            if r.status_code not in (200, 206):
                if r.status_code == 416:
                    # HTTP 416 means Requested Range Not Satisfiable (file is completely downloaded)
                    print(f"Already downloaded: {filename}")
                else:
                    print(f"Error accessing {filename}: HTTP {r.status_code}")
                continue
















            total_size = int(r.headers.get("Content-Length", 0)) + resume_byte_pos
















            # Double-check if the existing file is already exactly the target size
            if resume_byte_pos == total_size and total_size > 0:
                print(f"Already downloaded: {filename}")
                continue
















            print(f"Starting download: {filename} ({total_size / (1024**2):.2f} MB)")
            
            # 'ab' appends to existing file (resume), 'wb' writes a new file
            mode = "ab" if resume_byte_pos else "wb"
            
            with open(filename, mode) as f, tqdm(
                total=total_size,
                unit='B',
                unit_scale=True,
                unit_divisor=1024,
                initial=resume_byte_pos,
                desc=filename
            ) as bar:
                for chunk in r.iter_content(1024*1024):
                    if chunk:
                        f.write(chunk)
                        bar.update(len(chunk))
                        
    except Exception as e:
        print(f"Network error or interruption for {filename}: {e}")


Step 3: Run the download script Open a terminal or PowerShell window in the dataset_download folder.

python download_caib.py

(If this does not work, try python3 download_caib.py)

The script downloads files directly into the dataset_download folder.


Resuming or repeating a download If the process is interrupted, run the same command again.

  1. Successfully completed files will be skipped automatically.
  2. Partially downloaded files will resume exactly where they left off, provided that the download server supports resumable downloads.
  3. If resuming is not supported, the script restarts that file automatically.


Troubleshooting

  1. Authorization, access-denied, or expiry error: The temporary URL has expired. Generate and download a new download_links.txt file from the CAIB Exploration Portal, then rerun the script.
  2. python command not found: Install Python 3, then reopen the terminal or PowerShell window and run the command again.
  3. ModuleNotFoundError: Ensure you have installed the required dependencies by running pip install requests tqdm.
  4. Insufficient disk space: Free sufficient storage space before restarting the download.
  5. Network interruption: Run the same command again. Completed files will be skipped and partial downloads will resume where supported.
  6. download_links.txt was not found: Ensure that download_links.txt and download_caib.py are saved in the exact same dataset_download folder.


1. Overview & Scope

The purpose of this document is to help users utilize the data provided in the CAIB to the best possible extent. This is a technical documentation and not an FAQ/Help page. It focusses on medical and technical details related to the data being stored in CAIB database.


Intended audience

The intended audience is medical personnel, scientists, bioinformaticians and other technical individuals who would be involved in either downloading, managing, using or analyzing the data they download from CAIB.

How to read this doc (conventions, versioning of the doc itself)


2. Data Model

The following is a high level Summary of the Data Model. Details follow in individual subsections.

Project/Cancer Type

├── Organization

│ ├── Patient

│ │ ├── Baseline_Information

│ │ │ ├── Demography

│ │ │ ├── Family History

│ │ │ ├── Habits

│ │ │ ├── Comorbidities

│ │ │

│ │ ├── Clinical Course

│ │ │ ├── Summary Clinical Course

│ │ │ ├── Primary Tumor Presentation

│ │ │ ├── Treatment Details

│ │ │ └── Progression/Outcome Details

│ │ │

│ │ ├── Pathology

│ │ │ ├── Pathology Study Level Information

│ │ │ ├── Slide Level_Information

│ │ │ │ ├── WSI

│ │ │ │ │ ├── Pixel Annotations

│ │ │

│ │ ├── Radiology

│ │ │ ├── Radiology Study Level Information

│ │ │ ├── DICOM Image

│ │ │ │ ├── Pixel Annotations



Project/Cancer Type

Organization → Patient → Cancer Type → Episode/Timeline → Study (Pathology/Radiology) → Image/Report → Annotation/Label

Organization


Patient


3. Data Dictionary

Clinical/treatment/outcome field definitions (staging systems used — AJCC version, ICD-O-3 codes, etc.)

Controlled vocabularies and coding standards used (SNOMED/ICD-O/LOINC if applicable)

ID Structure & Information

 [CAIB] - [T] [00004390] [OC] [01] [R] [02] [P] [02] [02] [HE]

┌──────────────────────────────────────────────────────────────────────────────┐

│ SLIDE NAME (Decoded)                            │

├──────────────────────────────────────────────────────────────────────────────┤

│ Raw Slide ID : CAIB-T00004390OC01R02P0202HE                 │

│ Patient_ID  : CAIB-T00004390OC     (CAIB → Project/Site)        │

│ Path_ID   : CAIB-T00004390OC01R02   (CAIB → Procedure+PathSerial)    │

├──────────────────────────────────────────────────────────────────────────────┤

│ [CAIB] - [T] [00004390] [OC] [01] [R] [02] [P] [02] [02] [HE]            │

│  │    │     │     │  │ │ │ │ │ │ │ └── Stain         │

│  │    │     │     │  │ │ │ │ │ │ └── BlockNo (00-99)      │

│  │    │     │     │  │ │ │ │ │ └──SlideNo (00-99)      │

│  │    │     │     │  │ │ │ │ └──TissueClass (P)     │

│  │    │     │     │  │ │ │ │ └──P = Primary    │

│  │    │     │     │  │ │ │ │ └──R = Regional    │

│  │    │     │     │  │ │ │ │ └──N = Non-Regional Node │

│  │    │     │     │  │ │ │ │ └──D = Distant metastasis   │

│  │    │     │     │  │ │ │ │ └──S = Second Primary   │

│  │    │     │     │  │ │ │ │ └──O = Others (mostly referring to non-neoplastic pathologies)    │

│  │    │     │     │  │ │ │ └──Serial number(00–99)  │

│  │    │     │     │  │ │ └──Type of Specimen

│  │    │     │     │  │ │ └──R = Resection

│  │    │     │     │  │ │ └──B = Biopsy

│  │    │     │     │  │ └──Presentation

│  │    │     │     │  │ └──01 = First Presentation │

│  │    │     │     │  │ └──02 = Second Presentation │

│  │    │     │     │  │ └──........

│  │    │     │     │  │ └── n = nth Presentation │

│  │    │     │     │  └── Project/Cancer Type│

│  │    │     │     │  └── OC = Oral Cancer     │

│  │    │     │     │  └── LC = Lung Cancer     │

│  │    │     │     └── Patient serial       │

│  │    │     └── Org code:

│           └── T → TMC                      │

│           └── Org code: A → AIIMS                     │

│     └── Org code: P → PGIMER                     │

│         └── Org code: R → Rajiv Gandhi                  │

└── Program/Consortium: CAIB │



4. File Types & Formats

Radiology: DICOM series structure, modalities covered, which DICOM tags are preserved vs. anonymized

Report data: structured vs. free-text-post-anonymization, output format (JSON/CSV/XML)

Annotations/segmentation masks: format (GeoJSON, QuPath XML, binary mask PNG/TIFF, COCO-style, etc.), coordinate reference system relative to WSI/DICOM

Pathology WSI:

Pathology WSI: format (SVS/TIFF/DICOM-WSI), pyramid levels, scanner metadata retained/stripped

5. Annotation & Label Taxonomy


Annotation tool/protocol used, number of annotators, adjudication/verification process

Confidence/quality flags attached to labels, if any

Per-cancer-type label schema

 (e.g., H&N: tumor/normal/dysplasia; lymph node: metastasis/ENE/pN)

6. Navigating, Search, Filter, Requesting download access & Cart Interface

Filter logic on the exploration portal (what's indexed/searchable)

Cart → request → fulfillment workflow, technically (what happens at each stage)

Approval Workflow


8. API / Programmatic Access

The approved data files can be downloaded programmatically

asddsf


9. Data Quality Notes & Known Limitations

Data Completeness

Known Limitations


10. Citation & Attribution

Please cite CAIB in all your work using the following citation.

Data Structure

1. Nomenclature

Pathology data format