Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Latest commit

 

History

History
168 lines (113 loc) · 4.79 KB

README.rst

File metadata and controls

168 lines (113 loc) · 4.79 KB
Project generated with PyScaffold

PiramidalDCM2PNG

Overview

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.

The package provides a command-line interface (CLI) for easy conversion of these files. The CLI is installed as fibonacci in the current environment when the package is installed.

Installation

To install the package, use pip:

pip install piramidaldicom2png

Requirements

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

Usage

Command-Line Interface (CLI)

The CLI allows for easy conversion of DICOM files to PNG. The basic usage is as follows:

piramidaldicom2png -p <path_to_project> -l <level> [--verbose] [--very-verbose]
  • -p, --project: Path to the BIDS/MIDS project to convert.
  • -l, --level: The level in the pyramidal DICOM to convert.
  • -v, --verbose: Set loglevel to INFO.
  • -vv, --very-verbose: Set loglevel to DEBUG.

Example

To convert a level in a pyramidal DICOM file to PNG images:

piramidaldicom2png -p /path/to/project -l 2 --verbose

Python API

The package also provides a Python API that can be used in scripts or interactive interpreters.

Example

from piramidaldcm2png import convert_dicom_to_png

convert_dicom_to_png(project_path="/path/to/project", level=2, loglevel="INFO")

Development

Setting up for development

  1. Clone the repository:
git clone https://github.com/jomasator2/piramidaldicom2png.git
cd piramidaldicom2png
  1. Install the package in development mode:
pip install -e .

Running Tests

To run tests, use pytest:

pytest

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Author

  • jomasator2

References

```