Package: nbiatoolkit
NBIA ToolkitA 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.Features[!TIP]
For a thorough description of the package and its available features, please refer to the Documentation atNBIA-Toolkit Read The DocsProgrammatic accessto the National Biomedical Imaging Archive (NBIA) and The Cancer Imaging Archive (TCIA) databasesUse NBIA Guest account to access public data OR authenticate using OAuth with user credentials for limited access data (requires approved data access).CustomOAuth2class forNBIA,TCIA, including special handling for dedicated server for theNLSTcollection.Query NBIA databasefor metadata oncollections,patients,studies,series, andimagesDownload images from NBIAValidate doownloads with MD5 checksumsfor downloaded imagesAuto-sortDICOM files using a user-defined pattern of DICOM tags with specializedDICOMSorter classInstallation[!WARNING]nbiatoolkitis currently under development and is not guaranteed to be stable.It is made available via PyPI and can be installed using pip:pipinstallnbiatoolkitPython UsageUsing a context manager, you can easily access the NBIA database and query for metadata on collections, patients, studies, and series.fromnbiatoolkitimportNBIAClientwithNBIAClient()asclient:# Get a list of collectionscollections=client.getCollections()print(collections)# Get a list of patients in a collectionpatients=client.getPatients(Collection="TCGA-KIRC")print(patients)# Get a list of studies for a patientstudies=client.getStudies(PatientID="TCGA-BP-4989")print(studies)# Get a list of series for a studyseries=client.getSeries(StudyInstanceUID=studies[0]["StudyInstanceUID"])print(series[0:5])CLI UsageFor quick access to the NBIA, the toolkit also provides a command line interface (CLI)>NBIAToolkit--version___________________________/|//__)/_/|/___/_______///__(_)/_/|//__|////||///__\/__\////_//__///|//_/////___|////_///_///,<///_/_/|_/_____/___/_/|_/_/\____/\____/_/_/|_/_/\__/Version:0.32.1

AvailableCLItools:getCollections[-h][-uUSERNAME][-pwPASSWORD][-pPREFIX][-oOUTPUTFILE][--version]getBodyPartCounts[-h][-uUSERNAME][-pwPASSWORD][-cCOLLECTION][-oOUTPUTFILE][--version]getPatients[-h][-uUSERNAME][-pwPASSWORD]-cCOLLECTION[-oOUTPUTFILE][--version]getNewPatients[-h][-uUSERNAME][-pwPASSWORD]-cCOLLECTION-dDATE[-oOUTPUTFILE][--version]getStudies[-h][-uUSERNAME][-pwPASSWORD]-cCOLLECTION[-pPATIENTID][-sSTUDYINSTANCEUID][-oOUTPUTFILE][--version]getSeries[-h][-uUSERNAME][-pwPASSWORD][-cCOLLECTION][-pPATIENTID][-mMODALITY][-studySTUDYINSTANCEUID][--seriesInstanceUIDSERIESINSTANCEUID][--bodyPartExaminedBODYPARTEXAMINED][--manufacturerModelNameMANUFACTURERMODELNAME][--manufacturerMANUFACTURER][-oOUTPUTFILE][--version]getNewSeries[-h][-uUSERNAME][-pwPASSWORD]-dDATE[-oOUTPUTFILE][--version]ContributingInterested 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.Licensenbiatoolkitwas created by Jermiah Joseph. It is licensed under the terms of the MIT license.User Agreements and Disclaimers[!IMPORTANT]
The NBIA-toolkit is NOT a product of the National Cancer Institute (NCI) and is not endorsed by the NCI.
Users of the NBIA-toolkit are required to abide by the NBIA REST API Terms of Service and theNBIA Data Usage Policies and RestrictionsThe NBIA-toolkit is provided as an open-source tool based on theNBIA REST APIand is provided "AS IS" without warranty of any kind.
In no event shall the authors or contributors be liable for any claim, damages or other liability, arising from, out of or in connection with the NBIA-toolkit or the use or other dealings in the NBIA-toolkit.