Skip to main content

dicomwf

A Python library for integrating waveforms in DICOM files.

Features

Supported waveforms IODs:

  • RoutineScalpEEG

Installation

User Installation

Install directly from PyPI:

pip install dicomwf

Developer Installation

  1. Clone the repository:
git clone https://gitlab.inria.fr/openvibe/dicomwf.git
cd dicomwf
  1. Create and activate a virtual environment:
python -m venv .venv

# On Windows
.venv\Scripts\activate

# On Unix/macOS
source .venv/bin/activate
  1. Install in editable mode with development dependencies:
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.

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

pytest

License

This project is licensed under the MIT License - see the 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:

Contributing

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

Metadata

Release files for dicomwf 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dicomwf 0.3.0
File Size Uploaded
dicomwf-0.3.0.tar.gz 10.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dicomwf 0.3.0
File Interpreter ABI Platform
dicomwf-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / dicomwf-0.3.0.tar.gz

Download URL dicomwf-0.3.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d445180f66cfca21e46ecc95b7e27bf115c802990ec5b53e26479516896d28dd
BLAKE2b-256 checksum
How to use checksums
39457a0a45d704c337255adc1db337482f56c5dcc453f996da1254c721e82155
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / dicomwf-0.3.0-py3-none-any.whl

Download URL dicomwf-0.3.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd93f6f191c7c429bb75c6dd7d7fd4c2265353779491f5b5ccf90582bb99f4ac
BLAKE2b-256 checksum
How to use checksums
904b9e58c6a065a3139933f590707ca5547d25beaff4e39488b772c2434ab409
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page