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

Metadata

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 Provenance Actions
nbiatoolkit-0.25.4.tar.gz 20.6 kB Without provenance Details for nbiatoolkit-0.25.4.tar.gz

Built distribution (wheel)

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

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

Security for nbiatoolkit 0.25.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.25.4 This release

2 release files No provenance

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