df2dicom Module
df2dicom Module
This module contains functions used to transform a pandas DataFrame into DICOM and PNG files. It can build a valid DICOM file by obtaining the pixels and DICOM attributes from the DataFrame.
df2dicom(df, outdir, do_image_deidentification=False, test=False, output_file_formats=None)
Build DICOM and/or PNG files from a pandas DataFrame obtained with dicom2df.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
The pandas DataFrame obtained with |
required |
outdir |
str
|
Path of the directory that will contain your files at the end of the process. |
required |
do_image_deidentification |
bool
|
Whether or not this process will trigger the OCR deidentification for pixels. |
False
|
test |
bool
|
This option should not be left to False anytime. |
False
|
output_file_formats |
list
|
A list of formats. Currently supported formats are ["dcm", "png"]. Both
can be used alone if you need a single output format. If you select "png", the process
will produce a PNG for each line of |
None
|
Example
In the following example, we have a directory containing a single DICOM file.
Here is an overview of the resulting files in the output directory:
Example
It is also possible to obtain only DICOM files:
only_dcm_files.py | |
---|---|
Output directory:
it is also possible to obtain DICOM and PNG files:
only_dcm_files.py | |
---|---|
Output directory: