Metadata-Version: 2.4
Name: dicomwf
Version: 0.3.0
Summary: A Python library for creating DICOM EEG waveform files
Author: Clément Chesnin
Author-email: Evgenia Kartsaki <evgenia.kartsaki@inria.fr>, Thomas Prampart <thomas.prampart@inria.fr>, Michael Kain <michael.kain@inria.fr>, Eric Poiseau <eric.poiseau@inria.fr>
License-Expression: MIT
Project-URL: Homepage, https://gitlab.inria.fr/openvibe/dicomwf
Project-URL: Repository, https://gitlab.inria.fr/openvibe/dicomwf
Keywords: dicom,eeg,waveform,medical,imaging
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Software Development :: Libraries
Requires-Python: ==3.11.*
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: numpy>=1.20.0
Requires-Dist: pydicom>=2.3.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: mne>=1.11.0; extra == "dev"
Requires-Dist: build>=1.4.0; extra == "dev"
Requires-Dist: twine>=6.0.0; extra == "dev"
Dynamic: license-file

# dicomwf

A Python library for integrating waveforms in DICOM files.

## Features

Supported waveforms IODs:
- RoutineScalpEEG

## Installation

### User Installation

Install directly from PyPI:

```bash
pip install dicomwf
```

### Developer Installation

1. Clone the repository:

```bash
git clone https://gitlab.inria.fr/openvibe/dicomwf.git
cd dicomwf
```

2. Create and activate a virtual environment:

```bash
python -m venv .venv

# On Windows
.venv\Scripts\activate

# On Unix/macOS
source .venv/bin/activate
```

3. Install in editable mode with development dependencies:

```bash
pip install -e ".[dev]"
```

This installs the package in editable mode along with development tools.

## Quick Start

We will use the EEG data in the edf format from the [EEGBCI dataset](https://doi.org/10.1109/TBME.2004.827072). 

```python
import numpy as np
from dicomwf import *
from urllib.request import urlretrieve
import mne

# Load EEG data
url = "https://physionet.org/files/eegmmidb/1.0.0/S001/S001R01.edf?download"
raw_fname = "S001R01.edf"
urlretrieve(url, raw_fname)

raw = mne.io.read_raw_edf(raw_fname, preload=True)

# Create DICOM EEG
dicom_eeg_data = RoutineScalpEEGData(
    patient=Patient(name="Doe^John", birth_date="20250101", sex="M"),
    study=GeneralStudy(id="1",date="19940423", time="101601.934000", accession_number="1"),
    equipment=GeneralEquipment(
        manufacturer="PyDICOM",
        manufacturer_model_name="PyDICOM",
        device_serial_number="1",
        software_versions="1.0",
    ),
    waveform_identification=WaveformIdentification(),
    waveform=Waveform(
        channel_count=raw.info["nchan"],
        sampling_frequency=raw.info["sfreq"],
        channel_names=raw.ch_names,
        data=np.transpose(raw.get_data()),
    ),
)

dicom_eeg = RoutineScalpEEG(uid_root="1.2.3.4.5.", rse_data=dicom_eeg_data)
dicom_eeg.save_as("output.dcm")
```

## Dependencies

**Required:**
- numpy >= 1.20.0
- pydicom >= 2.3.0

**Optional (for development):**
- pytest >= 7.0.0
- mne>=1.11.0

## Running Tests

```bash
pytest
```

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.

## Authors

- Evgenia Kartsaki
- Thomas Prampart
- Michael Kain
- Eric Poiseau
- Clement Chesnin

## Data Sources
This project uses the following data for unit testing:
* **[EEG Motor Movement/Imagery Dataset]**: Sourced from [https://physionet.org/content/eegmmidb/1.0.0/S001/].
* **License**: This data is licensed under the [Open Data Commons Attribution License (ODC-By) v1.0](https://physionet.org/content/eegmmidb/view-license/1.0.0/).

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.
