# 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](https://www.biorxiv.org/content/10.1101/2024.09.19.612894v1)
## 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:
```bash
conda env create -f smart_env.yml
```
Activate smart_env environment
```bash
conda activate smart_env
```
Use pip package manager to install the **SMART_MRS** library as below:
```bash
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
```python
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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "SMART-MRS",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "Magnetic Resonance Spectroscopy, Spectral Simulation, Artifact Simulation",
"author": "Hanna Bugler, Amirmohammad Shamaei,Roberto Souza, Ashley D. Harris",
"author_email": "hanna.bugler@ucalgary.ca",
"download_url": "https://files.pythonhosted.org/packages/1b/ff/a8a5bcef149ccebde89c2ac506a8204d6c4fa232c96174406b5ee520f900/smart_mrs-1.tar.gz",
"platform": null,
"description": "# SMART_MRS\r\n**SMART_MRS** is a Python based library (toolbox) for applying \r\nsimulated artifacts to edited Magnetic Resonance Spectroscopy (MRS) data.\r\n\r\nFor further information on the toolbox, please see [SMART_MRS Preprint](https://www.biorxiv.org/content/10.1101/2024.09.19.612894v1)\r\n\r\n\r\n## Updates\r\nCurrent version is 1.0 with no preceding versions.\r\n\r\n\r\n## Module Descriptions\r\nThe **SMART_MRS** package contains 4 modules:\r\n* **IO.py** (allows for the import and export of specific data formats such as FID-A and nifti-mrs):\r\n * get_FIDA_mat_data()\r\n * return_FIDA_mat_data()\r\n * get_nifti_mrs_data()\r\n * return_nifti_mrs_data()\r\n\r\n* **support.py** (supports data manipulation for the use of other module functions):\r\n * to_fids()\r\n * to_specs()\r\n * interleave()\r\n * undo_interleave()\r\n * scale()\r\n * undo_scale()\r\n\r\n* **artifacts.py** (for the application of various artifacts):\r\n * add_time_domain_noise()\r\n * add_spur_echo_artifact()\r\n * add_eddy_current_artifact()\r\n * add_linebroad()\r\n * add_nuisance_peak()\r\n * add_baseline()\r\n * add_freq_drift_linear()\r\n * add_freq_shift_random()\r\n * add_zero_order_phase_shift()\r\n * add_first_order_phase_shift()\r\n\r\n* **applied.py** (allows for specific iterations of the artifacts):\r\n * add_progressive_motion_artifact()\r\n * add_subtle_motion_artifact()\r\n * add_disruptive_motion_artifact()\r\n * add_lipid_artifact()\r\n\r\n\r\n## Dependencies\r\nEach of the 4 modules have relative dependencies in addition to the following dependencies:\r\n* Nibabel (v.5.2.1)\r\n* NumPy (v.1.25.2)\r\n* SciPy (v.1.11.4)\r\n\r\n\r\n## SMART_MRS Installation Guide\r\nDownload the environment configuration file and create a conda environment:\r\n```bash\r\nconda env create -f smart_env.yml\r\n```\r\n\r\nActivate smart_env environment\r\n```bash\r\nconda activate smart_env\r\n```\r\n\r\nUse pip package manager to install the **SMART_MRS** library as below:\r\n```bash\r\npip install SMART_MRS\r\n```\r\n\r\n\r\n## Usage\r\nBelow are example uses of functions from each module in **SMART_MRS**.\r\nFor further information on specific functions, please consult SupplementaryMaterial.pdf\r\n\r\n```python\r\nimport SMART_MRS\r\n\r\n# IO Functions example get_nifti_mrs_data() - returns FIDs, time, and ppm\r\ndir = \"C:/Users/\"\r\nfids, time, ppm = SMART_MRS.IO.get_nifti_mrs_data(dir_nifti=dir+\"jdifference_nifti_SMART_MRS_EX.nii.gz\")\r\n\r\n# Support Functions example scale() - returns scaled FIDs and scale factor\r\nfids, nifti_scale = SMART_MRS.support.scale(fids)\r\n\r\n# Artifacts Functions example add_nuisance_peak() - returns FIDs and artifact locations within dataset\r\n# Apply specific user values\r\ngaussian_peak_profile = {\r\n \"peak_type\": \"G\",\r\n \"amp\": [0.00015],\r\n \"width\": [0.8], \r\n \"res_freq\": [4],\r\n \"edited\": 1.4}\r\n\r\n# When echo is True, will print non-user specified values used (in this case, the locations of the artifacts)\r\nfids, np_locations = SMART_MRS.artifacts.add_nuisance_peak(fids=fids, time=time, peak_profile=gaussian_peak_profile, num_trans=3, echo=True)\r\n\r\n# Applied Functions example add_disruptive_motion_artifact() - returns FIDs and artifact locations within dataset\r\n# use function specific values\r\nfids, motion_locations = SMART_MRS.applied.add_disruptive_motion_artifact(fids=fids, time=time, ppm=ppm, mot_locs=[3, 9], nmb_motion=2)\r\n\r\n# Save Fids with Artifacts as original data type\r\n# New nifti should be saved under same name \"_SMART.niigz\" at same location\r\nfids = SMART_MRS.support.undo_scale(fids=fids, scale_fact=nifti_scale)\r\nSMART_MRS.IO.return_nifti_mrs_data(dir_nifti=dir+\"jdifference_nifti_SMART_MRS_EX.nii.gz\", fids=fids, edited=True)\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simulated Artifacts for edited Magnetic Resonance Spectroscopy (MRS) data",
"version": "1",
"project_urls": {
"GitHub": "https://github.com/HarrisBrainLab/SMART_MRS",
"Preprint": "https://www.biorxiv.org/content/10.1101/2024.09.19.612894v1"
},
"split_keywords": [
"magnetic resonance spectroscopy",
" spectral simulation",
" artifact simulation"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c889da168e4a71c829f900111fda01b72774672d77912c7a7f741db9d29b8257",
"md5": "769945ec9f50f689cd3dc9e85b061b9e",
"sha256": "ed544efb7f0c5f28d3adec791a27c606fe53f243b241134eb4f947d2c829a5e3"
},
"downloads": -1,
"filename": "SMART_MRS-1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "769945ec9f50f689cd3dc9e85b061b9e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 16312,
"upload_time": "2024-09-24T16:13:33",
"upload_time_iso_8601": "2024-09-24T16:13:33.250683Z",
"url": "https://files.pythonhosted.org/packages/c8/89/da168e4a71c829f900111fda01b72774672d77912c7a7f741db9d29b8257/SMART_MRS-1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1bffa8a5bcef149ccebde89c2ac506a8204d6c4fa232c96174406b5ee520f900",
"md5": "bd52a1576bbd2e44a51db62cb9b2953c",
"sha256": "579726c838dded70b47a9bd24e3acb917120afbaa06acb9d3d357033426b753a"
},
"downloads": -1,
"filename": "smart_mrs-1.tar.gz",
"has_sig": false,
"md5_digest": "bd52a1576bbd2e44a51db62cb9b2953c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 20402,
"upload_time": "2024-09-24T16:13:36",
"upload_time_iso_8601": "2024-09-24T16:13:36.077438Z",
"url": "https://files.pythonhosted.org/packages/1b/ff/a8a5bcef149ccebde89c2ac506a8204d6c4fa232c96174406b5ee520f900/smart_mrs-1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-24 16:13:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HarrisBrainLab",
"github_project": "SMART_MRS",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "smart-mrs"
}