Skip to main content

NBIA Toolkit

A python package that provides programmatic access to query and download images from the National Biomedical Imaging Archive (NBIA) and The Cancer Imaging Archive (TCIA) databases.

PyTests Documentation Status codecov Python version

PyPI version Downloads PyPI - Downloads GitHub repo size Docker Pulls

GitHub milestone detailsGitHub milestone details

Features

  • Use NBIA Guest account to access public data OR authenticate using OAuth with user credentials for limited access data (requires approved data access).
  • Query NBIA database for metadata on collections, patients, studies, series, and images
  • Download images from NBIA
    • Validate doownloads with MD5 checksums for downloaded images
    • Auto-sort DICOM files using a user-defined pattern of DICOM tags with specialized DICOMSorter class

Installation

It is made available via PyPI and can be installed using pip:


pip install nbiatoolkit

CLI Usage

For quick access to the NBIA, the toolkit also provides a command line interface (CLI)

> NBIAToolkit --version
    _   ______  _______  ______            ____   _ __ 
   / | / / __ )/  _/   |/_  __/___  ____  / / /__(_) /_
  /  |/ / __  |/ // /| | / / / __ \/ __ \/ / //_/ / __/
 / /|  / /_/ // // ___ |/ / / /_/ / /_/ / / ,< / / /_  
/_/ |_/_____/___/_/  |_/_/  \____/\____/_/_/|_/_/\__/  
                                                       

Version: 0.25.3

Available CLI tools: 

getCollections [-h] [-u USERNAME] [-pw PASSWORD] [-p PREFIX]
               [-o OUTPUTFILE] [--version]

getBodyPartCounts [-h] [-u USERNAME] [-pw PASSWORD] [-c COLLECTION]
                  [-o OUTPUTFILE] [--version]

getPatients [-h] [-u USERNAME] [-pw PASSWORD] -c COLLECTION
            [-o OUTPUTFILE] [--version]

getNewPatients [-h] [-u USERNAME] [-pw PASSWORD] -c COLLECTION -d DATE
               [-o OUTPUTFILE] [--version]

getStudies [-h] [-u USERNAME] [-pw PASSWORD] -c COLLECTION
           [-p PATIENTID] [-s STUDYINSTANCEUID] [-o OUTPUTFILE]
           [--version]

getSeries [-h] [-u USERNAME] [-pw PASSWORD] [-c COLLECTION]
          [-p PATIENTID] [-m MODALITY] [-study STUDYINSTANCEUID]
          [--seriesInstanceUID SERIESINSTANCEUID]
          [--bodyPartExamined BODYPARTEXAMINED]
          [--manufacturerModelName MANUFACTURERMODELNAME]
          [--manufacturer MANUFACTURER] [-o OUTPUTFILE] [--version]

getNewSeries [-h] [-u USERNAME] [-pw PASSWORD] -d DATE [-o OUTPUTFILE]
             [--version]

downloadSingleSeries [-h] [-u USERNAME] [-pw PASSWORD] --seriesUID
                     SERIESUID --downloadDir DOWNLOADDIR
                     [--filePattern FILEPATTERN] [--overwrite]

dicomsort [-h] [-u USERNAME] [-pw PASSWORD]
          [--targetPattern TARGETPATTERN] [--truncateUID]
          [--sanitizeFilename] [--overwrite] [--nParallel NPARALLEL]
          sourceDir destinationDir

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

nbiatoolkit was created by Jermiah Joseph. It is licensed under the terms of the MIT license.

User Agreements and Disclaimers

Release files for nbiatoolkit 0.25.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nbiatoolkit 0.25.4
File Size Uploaded
nbiatoolkit-0.25.4.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nbiatoolkit 0.25.4
File Interpreter ABI Platform
nbiatoolkit-0.25.4-py3-none-any.whl Python 3 none any Details

Total release size: 44.1 kB

Release files / nbiatoolkit-0.25.4.tar.gz

Download URL nbiatoolkit-0.25.4.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bd60d09d560a6df938ab5fe5999e287df3a27660124c590084fb703ba4329e80
BLAKE2b-256 checksum
How to use checksums
1437446c8701b461a9a03164c2381831083e56bf28938b3c7518cc87b2bc1f04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / nbiatoolkit-0.25.4-py3-none-any.whl

Download URL nbiatoolkit-0.25.4-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cbaebbdb5a698884299d1dcb65543e1ffe59a9b253dff454b0c61534ab8ba41
BLAKE2b-256 checksum
How to use checksums
8bcec080ec822d240e3b0cb007f4b14989fa92b56ffb923ed0d9479def91a0e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.0.1

2 release files

0.35.0

2 release files

0.34.0

2 release files

0.33.0

2 release files

0.32.1

2 release files

0.32.0

2 release files

0.31.0

2 release files

0.30.1

2 release files

0.30.0

2 release files

0.29.2

2 release files

0.29.1

2 release files

0.29.0

2 release files

This release

0.25.4 This release

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.9

2 release files

0.10.8

2 release files

0.10.7

2 release files

0.10.6

2 release files

0.10.5

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page