Skip to main content

cobra_db

DOI:10.1117/1.JMI.10.6.061404 PyPI version Documentation Status codecov

Consolidated Breast Cancer Analysis DataBase

What is cobra_db?

cobra_db is a python package that allows you to extract DICOM metadata and store it in a MongoDB database. Allowing you to index, transform, and export your medical imaging metadata.

With cobra_db, you will have more visibility of your data enabling you to get more value from your medical imaging studies.

Once the metadata is in the database, you can import other text-based information (csv or json) into a custom collection and then run queries. This allows you to mix and match data extracted from different sources in different formats.

For example, let's say you have 1 million mammography DICOM files and you would like to obtain the path of the files that belong to women scanned at an age of between 40 and 50 years old.

If you had cobra_db, you could run the following query in just a few seconds directly in the mongo shell.

db.ImageMetadata.find(
  // filter the data
  {patient_age:{$gt:40, $lte:50}},
  // project it into a flat structure
  {
    patient_id: "$dicom_tags.PatientID.Value"
    drive_name: "$file_source.drive_name",
    rel_path:"$file_source.rel_path",
  })

This would return the patient id, the drive name and the relative path (to the drive) for all the files that match the selection criteria.

Installation

If you already have a working instance of the database, you only need to install the python package.

$ pip install cobra_db

If you would like to create a database from scratch, go ahead and follow the tutorial.

Usage

If you have an ImageMetadata instance id that you would like to access from python.

from cobra_db import Connector, ImageMetadataDao

# the _id of the ImageMetadata instance that you want to access
im_id = '62de8e38dc2414586e4ddb25'

# prompt user for password
connector = Connector.get_pass(
  host='my_host.server.com',
  port=27017,
  db_name='cobra_db',
  username='my_user'
)
# connect to the ImageMetadata collection
im_dao = ImageMetadataDao(connector)
im = im_dao.get_by_id(im_id)
print(im.date.file_source.rel_path)

# this will return
... rel/path/to/my_file.dcm

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

cobra_db was created by Fernando Cossio, Apostolia Tsirikoglou, Annika Gregoorian, Haiko Schurz, Hui Li, and Fredrik Strand. It is licensed under the terms of the Apache License 2.0 license.

Aknowledgements

This project has been funded by research grants Regional Cancer Centers in Collaboration 21/00060, and Vinnova 2021-0261.

Metadata

Release files for cobra-db 0.4.6

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

Source distribution (sdist)

Source distribution for cobra-db 0.4.6
File Size Uploaded Provenance Actions
cobra_db-0.4.6.tar.gz 36.0 kB Without provenance Details for cobra_db-0.4.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cobra-db 0.4.6
File Interpreter ABI Platform Actions
cobra_db-0.4.6-py3-none-any.whl Python 3 none any Details for cobra_db-0.4.6-py3-none-any.whl

Total release size: 79.0 kB

Release files / cobra_db-0.4.6.tar.gz

Download URL cobra_db-0.4.6.tar.gz
Size 36.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2c854d31dd85ed6391a1f57edadee41a326c84d6cf212aa7e242c8ae74f2c7c9
BLAKE2b-256 checksum
How to use checksums
7595d585a29767cfa6a5ba65feeb08d2974c97003aefb1e47ddb575372e153ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / cobra_db-0.4.6-py3-none-any.whl

Download URL cobra_db-0.4.6-py3-none-any.whl
Size 43.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5eff19960b3ded4b98b7de825504b74ce3fa08b19309395dc1c0b477a719c49a
BLAKE2b-256 checksum
How to use checksums
7b51cd15d738ae5f962c0ba21c345a73066fb5cb2fa386bb3d208a506ace2673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.8

Security for cobra-db 0.4.6

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.

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