dicom2df Module
dicom2df Module
This module contains functions used to transform DICOM files into a single pandas DataFrame. It opens each file with pydicom, and flats the DICOM nested structure before saving it to the dataFrame.
dicom2df(search_dir, with_private=False, with_pixels=False, with_seqs=True)
Create a pandas DataFrame based on a directory of DICOM files
This function creates
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_dir |
str
|
Path to the directory containing the DICOM files. |
required |
with_private |
bool
|
Whether to include Private DICOM tags in the dataframe or not. |
False
|
with_pixels |
bool
|
Whether to include pixel bytes (PixelData attribute) in the produced the dataFrame or not. Default to false as it has an important impact on performance. |
False
|
with_seqs |
bool
|
Whether to include DICOM sequences of attributes in the produced dataFrame or not. |
True
|
Returns:
Type | Description |
---|---|
DataFrame
|
A dataframe with information of all DICOM files present in |
Example
In the following example, we have a directory containing a single DICOM file.
dicom2df_single_file.py | |
---|---|
In the output of the command, we can see the number of files that have been read correctly and then the dataframe containing all DICOM files information.