Skip to main content

Simulated Artifacts for edited Magnetic Resonance Spectroscopy (MRS) data

Project description

SMART_MRS

SMART_MRS is a Python based library (toolbox) for applying simulated artifacts to edited Magnetic Resonance Spectroscopy (MRS) data.

For further information on the toolbox, please see SMART_MRS Preprint

Updates

Current version is 1.0 with no preceding versions.

Module Descriptions

The SMART_MRS package contains 4 modules:

  • IO.py (allows for the import and export of specific data formats such as FID-A and nifti-mrs):

    • get_FIDA_mat_data()
    • return_FIDA_mat_data()
    • get_nifti_mrs_data()
    • return_nifti_mrs_data()
  • support.py (supports data manipulation for the use of other module functions):

    • to_fids()
    • to_specs()
    • interleave()
    • undo_interleave()
    • scale()
    • undo_scale()
  • artifacts.py (for the application of various artifacts):

    • add_time_domain_noise()
    • add_spur_echo_artifact()
    • add_eddy_current_artifact()
    • add_linebroad()
    • add_nuisance_peak()
    • add_baseline()
    • add_freq_drift_linear()
    • add_freq_shift_random()
    • add_zero_order_phase_shift()
    • add_first_order_phase_shift()
  • applied.py (allows for specific iterations of the artifacts):

    • add_progressive_motion_artifact()
    • add_subtle_motion_artifact()
    • add_disruptive_motion_artifact()
    • add_lipid_artifact()

Dependencies

Each of the 4 modules have relative dependencies in addition to the following dependencies:

  • Nibabel (v.5.2.1)
  • NumPy (v.1.25.2)
  • SciPy (v.1.11.4)

SMART_MRS Installation Guide

Download the environment configuration file and create a conda environment:

conda env create -f smart_env.yml

Activate smart_env environment

conda activate smart_env

Use pip package manager to install the SMART_MRS library as below:

pip install SMART_MRS

Usage

Below are example uses of functions from each module in SMART_MRS. For further information on specific functions, please consult SupplementaryMaterial.pdf

import SMART_MRS

# IO Functions example get_nifti_mrs_data() - returns FIDs, time, and ppm
dir = "C:/Users/"
fids, time, ppm = SMART_MRS.IO.get_nifti_mrs_data(dir_nifti=dir+"jdifference_nifti_SMART_MRS_EX.nii.gz")

# Support Functions example scale() - returns scaled FIDs and scale factor
fids, nifti_scale = SMART_MRS.support.scale(fids)

# Artifacts Functions example add_nuisance_peak() - returns FIDs and artifact locations within dataset
# Apply specific user values
gaussian_peak_profile = {
    "peak_type": "G",
    "amp": [0.00015],
    "width": [0.8],    
    "res_freq": [4],
    "edited": 1.4}

# When echo is True, will print non-user specified values used (in this case, the locations of the artifacts)
fids, np_locations = SMART_MRS.artifacts.add_nuisance_peak(fids=fids, time=time, peak_profile=gaussian_peak_profile, num_trans=3, echo=True)

# Applied Functions example add_disruptive_motion_artifact() - returns FIDs and artifact locations within dataset
# use function specific values
fids, motion_locations = SMART_MRS.applied.add_disruptive_motion_artifact(fids=fids, time=time, ppm=ppm, mot_locs=[3, 9], nmb_motion=2)

# Save Fids with Artifacts as original data type
# New nifti should be saved under same name "_SMART.niigz" at same location
fids = SMART_MRS.support.undo_scale(fids=fids, scale_fact=nifti_scale)
SMART_MRS.IO.return_nifti_mrs_data(dir_nifti=dir+"jdifference_nifti_SMART_MRS_EX.nii.gz", fids=fids, edited=True)

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

smart_mrs-1.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

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

SMART_MRS-1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file smart_mrs-1.tar.gz.

File metadata

  • Download URL: smart_mrs-1.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.12

File hashes

Hashes for smart_mrs-1.tar.gz
Algorithm Hash digest
SHA256 579726c838dded70b47a9bd24e3acb917120afbaa06acb9d3d357033426b753a
MD5 bd52a1576bbd2e44a51db62cb9b2953c
BLAKE2b-256 1bffa8a5bcef149ccebde89c2ac506a8204d6c4fa232c96174406b5ee520f900

See more details on using hashes here.

File details

Details for the file SMART_MRS-1-py3-none-any.whl.

File metadata

  • Download URL: SMART_MRS-1-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.12

File hashes

Hashes for SMART_MRS-1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed544efb7f0c5f28d3adec791a27c606fe53f243b241134eb4f947d2c829a5e3
MD5 769945ec9f50f689cd3dc9e85b061b9e
BLAKE2b-256 c889da168e4a71c829f900111fda01b72774672d77912c7a7f741db9d29b8257

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