DuckDB integration with medical imaging data (DICOM - Digital Imaging and Communication in Medicine).
Maintainer(s):
nmontesg
Installing and Loading
INSTALL dicom FROM community;
LOAD dicom;
Example
INSTALL dicom FROM community;
LOAD dicom;
FROM read_dicom('path/to/dicom_file.dcm');
About dicom
The dicom extension for DuckDB provides functionality to import medical imaging data (DICOM, Digital Imaging and Communication in Medicine) directly into DuckDB. It uses the powerful DCMTK C++ library to read DICOM files and convert them into JSON format.
For full documentation and examples, see the project documentation.
Key functionality:
read_dicom()- Table function to import DICOM files directly into DuckDB, including support for local and remote files.DICOM_TAG- Custom type to work with DICOM tags, including conversion to and fromVARCHAR.tag_group(),tag_element(),tag_name()- Scalar functions to work with DICOM tags.dicomsecret type - Store credentials to establish connection with remote DICOM modalities, such as PACS systems.query_dicom()andretrieve_dicom()- Table functions to query and retrieve DICOM datasets from a remote modalities directly into DuckDB using C-FIND and C-MOVE commands.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| query_dicom | table | Query remote DICOM nodes using C-FIND commands | NULL | [FROM query_dicom(host='localhost', port=4242, match_keys={'Modality': 'MR'}, retrieve_keys=['StudyInstanceUID']);, FROM query_dicom(secret='my_dicom_conn_secret', qr_level='series', match_keys={'SeriesDate': '20070101'});] |
| read_dicom | table | Load DICOM files into DuckDB. The contents of each file are loaded into a row in JSON format. | NULL | [SELECT * FROM read_dicom('/path/to/dicom_files/');, SELECT * FROM read_dicom('/path/to/dicom_files/', load_pixel_data = true);] |
| retrieve_dicom | table | Retrieve DICOM data from remote modalities using C-MOVE commands | NULL | [FROM retrieve_dicom('1.3.54.24.5…', host='localhost', port=4242, incoming_port=11112, qr_level='study');, FROM retrieve_dicom(['1.95.3…', '1.56.7…'], secret='my_dicom_conn_secret', qr_level='series');] |
| tag_element | scalar | Extracts the element of a DICOM tag, as a VARCHAR containing the element in hexadecimal representation. | NULL | [SELECT tag_element('0008,01DA')] |
| tag_group | scalar | Extracts the group of a DICOM tag, as a VARCHAR containing the group in hexadecimal representation. | NULL | [SELECT tag_group('0008,01DA')] |
| tag_name | scalar | Extracts the name of the DICOM tag. If it can't be found, a VARCHAR with format GGGG,EEEE is returned. | NULL | [SELECT tag_name('0008,0008')] |
Overloaded Functions
This extension does not add any function overloads.
Added Types
| type_name | type_size | logical_type | type_category | internal |
|---|---|---|---|---|
| DICOM_TAG | 0 | STRUCT | COMPOSITE | true |
Added Settings
This extension does not add any settings.