The piramidaldicom2png package is designed to convert one level of a pyramidal DICOM (Digital Imaging and Communications in Medicine) file into a group of PNG (Portable Network Graphics) images. This conversion is particularly useful in medical imaging where DICOM is the standard format. However, for certain applications like machine learning models or web visualization, PNG format might be more suitable due to its wide acceptance and smaller size.
To install the package, use pip:
pip install piramidaldicom2png
Ensure you have the following dependencies installed:
- dcm2mids==0.0.post1.dev87+g0177b14
- gdcm==1.1
- numpy==1.24.4
- pillow==10.3.0
- pydicom==2.4.4
- SimpleITK==2.3.1
You can install these dependencies using pip:
pip install dcm2mids==0.0.post1.dev87+g0177b14 gdcm==1.1 numpy==1.24.4 pillow==10.3.0 pydicom==2.4.4 SimpleITK==2.3.1
or
pip install -r requirements.txt
The CLI allows for easy conversion of DICOM files to PNG. The basic usage is as follows:
piramidaldicom2png -p <path_to_project> -c <chunk> -l <level> [--verbose] [--very-verbose]
- -p, --project: Path to the BIDS/MIDS project to convert.
- -c, --chunk: The chunk of the pyramidal DICOM to convert by chunk naming.
- -l, --level: The level in the pyramidal DICOM to convert by resolution order(lowest to highest resolution).
- -v, --verbose: Set loglevel to INFO.
- -vv, --very-verbose: Set loglevel to DEBUG.
To convert a level in a pyramidal DICOM file to PNG images:
piramidaldicom2png -p /path/to/project -l 2 --verbose
The package also provides a Python API that can be used in scripts or interactive interpreters.
from piramidaldcm2png import convert_dicom_to_png
convert_dicom_to_png(project_path="/path/to/project", level=2, loglevel="INFO")
- Clone the repository:
git clone https://github.com/jomasator2/piramidaldicom2png.git
cd piramidaldicom2png
- Install the package in development mode:
pip install -e .
To run tests, use pytest:
pytest
This project is licensed under the MIT License. See the LICENSE file for more details.
- jomasator2