Skip to main content

Create Pulseq sequences from dsv.

Project description

dsv2pulseq

Create Pulseq sequence files from Siemens dsv simulation files. The converter was only tested with VE/VX dsv file layouts. VB/VD files are not supported, as the simulator can not output RF phase data.
RF values might be differing slightly compared to the original sequence, as the dsv files contain RF values only on a 5us raster.

Installation

The package can be install with pip install dsv2pulseq.

Alternatively, a Python environment with the package installed can be created with the provided yml file: conda env create -f dsv2pulseq.yml.

Unittests can be run with python -m unittest discover test/. This includes testing, whether the conversion is successful for each dsv dataset in the folder "test/test_data".

This package only depends on numpy and PyPulseq [1].

Merging data to the original Siemens raw data file for retrospective reconstruction (see "Reconstruction of Pulseq data") requires the twixtools package (https://github.com/pehses/twixtools).

Sequence simulation

Simulate the sequence with the following settings:

  • Transversal orientation with phase-encode direction A->P and no FOV shift (which is the default)
  • Simulate with RF phase output (sim /RFP+).
  • Mandatory dsv files are "_INF", "_RFD", "_RFP", "_GRX", "_GRY" and "_GRZ".

Example data "MiniFLASH.dsv" can be found in the test/test_data folder. These simulation files are from the Siemens MiniFLASH demo sequence.

Create Pulseq output

The conversion can be started by running:

dsv_to_pulseq -o OUT_FILE -r REF_VOLT IN_FILE_PREFIX

from the shell.

The IN_FILE_PREFIX is the prefix of the dsv files, e.g. "gre" for "gre_XXX.dsv". The OUT_FILE is the Pulseq output sequence file (default: "external.seq"). The reference voltage is the voltage the sequence was simulated with (Siemens default: 223.529007 V).

The conversion can also be done in Python by running:

from dsv2pulseq import read_dsv
seq = read_dsv('/path/to/dsv/dsv_prefix')
seq_pulseq = seq.make_pulseq_sequence('external.seq')

There is an experimental function to check the shapes of RF waveforms and gradients that plots the difference between the original and converted waveforms:

from dsv2pulseq import check_dsv
check_dsv('/path_to_dsv/dsv_prefix_original', 'path_to_dsv/dsv_prefix_pulseq')

Note that:

  • Only single transmit channel RF pulses are currently supported.
  • The Pulseq sequence has the same orientation as the original sequence in the physical/scanner coordinate system, when running the Pulseq interpreter in "XYZ in TRA" mode.
  • The Pulseq interpreter version 1.5.0 should be used, as the versions before contain a bug in setting the RF raster time correctly.
  • RF and gradient waveforms might be slightly different compared to the original sequence due to limited numerical accuracy of the DSV files.
  • RF pulse values are on a 5us raster in the dsv files, which might be insufficient for pulses with rapidly varying phase

Reconstruction of Pulseq data

Data acquired with the converted Pulseq sequence cannot be easily reconstructed, as the scan headers containing the meta information are missing. The data from the Pulseq sequence (IN_FILE_2) can be inserted into a raw data file acquired with the original sequence (IN_FILE_1) using twixtools (see dependencies). If twixtools is installed, the following command will insert the data:

insert_twix_data IN_FILE_1 IN_FILE_2 -o OUT_FILE

The merged output file (OUT_FILE) can be used for rectrospective reconstruction at the scanner. Alternatively the Pulseq data file can also be in the MRD format (requires ISMRMRD python package)

References

[1] Ravi, Keerthi, Sairam Geethanath, and John Vaughan. "PyPulseq: A Python Package for MRI Pulse Sequence Design." Journal of Open Source Software 4.42 (2019): 1725., https://github.com/imr-framework/pypulseq

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

dsv2pulseq-0.1.4.tar.gz (483.9 kB view details)

Uploaded Source

Built Distribution

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

dsv2pulseq-0.1.4-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file dsv2pulseq-0.1.4.tar.gz.

File metadata

  • Download URL: dsv2pulseq-0.1.4.tar.gz
  • Upload date:
  • Size: 483.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for dsv2pulseq-0.1.4.tar.gz
Algorithm Hash digest
SHA256 228ca4067e8bc5157db68c53304895998d2a746b7d29c48b1780788ad036ab25
MD5 f2d047eac0cf4ec85b236c79f69eec31
BLAKE2b-256 7d80bdde0e62332e6e9faeccb8027180ba6fca1a4b0a8bace6533582f4aa64fc

See more details on using hashes here.

File details

Details for the file dsv2pulseq-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: dsv2pulseq-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for dsv2pulseq-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eb9c58d496bf2cf765cb9735d786dd3de039adb11ae326027b22ec0f3194cf20
MD5 d118b862592872bdebb18836bb0cde12
BLAKE2b-256 088caca4340396004b8795cf0d1f8b82744875e12ccdf07054513cf923b9e098

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