Skip to main content

A Python library for creating DICOM EEG waveform files

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dicomwf-0.3.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dicomwf-0.3.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file dicomwf-0.3.0.tar.gz.

File metadata

  • Download URL: dicomwf-0.3.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for dicomwf-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d445180f66cfca21e46ecc95b7e27bf115c802990ec5b53e26479516896d28dd
MD5 115058214a91de3bdfb23515dcd9c461
BLAKE2b-256 39457a0a45d704c337255adc1db337482f56c5dcc453f996da1254c721e82155

See more details on using hashes here.

File details

Details for the file dicomwf-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dicomwf-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for dicomwf-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd93f6f191c7c429bb75c6dd7d7fd4c2265353779491f5b5ccf90582bb99f4ac
MD5 0cb110e3509a4994d955a0a990d6455d
BLAKE2b-256 904b9e58c6a065a3139933f590707ca5547d25beaff4e39488b772c2434ab409

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page