dbdicom.database#
- dbdicom.database(path: str | None = None, **kwargs) Database [source]#
create a new database in memory or open an existing one on disk.
- Parameters:
path (str, optional) – path to an existing database. In case none is provided, this will create a new empty database.
kwargs – any valid DICOM (tag, value) pair can be provided as keyword argument. These attributes will be assigned to the database and inherited by all DICOM objects later saved in the database.
- Returns:
Instance of the Database class.
- Return type:
Database
Note
If no path is provided, a new database is created in memory. Any changes or additions to that database will only exist in memory until the new database is saved with .save().
Example
Create a new database in memory and print the contents:
>>> database = db.database() >>> database.print() ---------- DATABASE -------------- Location: In memory ----------------------------------
Open an existing DICOM database and check the contents (in this example we are using an edited version of a RIDER dataset case):
>>> database = db.database('path\to\RIDER\case') >>> database.print() ---------- DATABASE -------------- Location: path o\DICOM\database Study BRAIN^RESEARCH [19040321] Series 014 [sag 3d gre +c] Nr of instances: 176 Study BRAIN^RESEARCH [19040321] Series 017 [sag 3d flair +c] Nr of instances: 210 Study BRAIN^RESEARCH [19040321] Series 005 [ax tensor] Nr of instances: 468 Series 006 [ax 5 flip] Nr of instances: 16 Series 007 [ax 10 flip] Nr of instances: 16 Series 008 [ax 15 flip] Nr of instances: 16 Series 009 [ax 20 flip] Nr of instances: 16 Series 010 [ax 25 flip] Nr of instances: 16 Series 011 [ax 30 flip] Nr of instances: 16 Series 012 [perfusion] Nr of instances: 1040 Study BRAIN^RESEARCH [19040323] Series 017 [sag 3d flair +c] Nr of instances: 160 Series 018 [sag 3d flair +c_Copy] Nr of instances: 160 Series 019 [MergedSeries] Nr of instances: 320 Study BRAIN^RESEARCH [19040323] Series 005 [ax tensor] Nr of instances: 468 Series 006 [ax 5 flip] Nr of instances: 16 Series 007 [ax 10 flip] Nr of instances: 16 Series 008 [ax 15 flip] Nr of instances: 16 Series 009 [ax 20 flip] Nr of instances: 16 Series 010 [ax 25 flip] Nr of instances: 16 Series 011 [ax 30 flip] Nr of instances: 16 Series 012 [perfusion] Nr of instances: 1040 Study BRAIN^RESEARCH [19040323] Series 015 [sag 3d gre +c] Nr of instances: 176 ----------------------------------