torchsim


Nametorchsim JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryA feature-rich MR simulator supporting massive parallelization on GPU and automatic differentiation.
upload_time2024-12-05 11:36:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords epg mri simulation bloch
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            TorchSim
========

TorchSim is a pure Pytorch-based MR simulator, including analytical and EPG model.

|Coverage| |CI/CD| |License| |Codefactor| |Sphinx| |PyPi| |Black| |PythonVersion|

.. |Coverage| image:: https://codecov.io/gh/INFN-MRI/torchsim/graph/badge.svg?token=qtB53xANwI 
   :target: https://codecov.io/gh/INFN-MRI/torchsim

.. |CI/CD| image:: https://github.com/INFN-MRI/torchsim/workflows/CI-CD/badge.svg
   :target: https://github.com/INFN-MRI/torchsim

.. |License| image:: https://img.shields.io/github/license/INFN-MRI/torchsim
   :target: https://github.com/INFN-MRI/torchsim/blob/main/LICENSE.txt

.. |Codefactor| image:: https://www.codefactor.io/repository/github/INFN-MRI/torchsim/badge
   :target: https://www.codefactor.io/repository/github/INFN-MRI/torchsim

.. |Sphinx| image:: https://img.shields.io/badge/docs-Sphinx-blue
   :target: https://infn-mri.github.io/torchsim

.. |PyPi| image:: https://img.shields.io/pypi/v/torchsim
   :target: https://pypi.org/project/torchsim

.. |Black| image:: https://img.shields.io/badge/style-black-black

.. |PythonVersion| image:: https://img.shields.io/badge/Python-%3E=3.10-blue?logo=python&logoColor=white
   :target: https://python.org

Features
--------
TorchSim contains tools to implement parallelized and differentiable MR simulators. Specifically, we provide

1. Automatic vectorization of across multiple atoms (e.g., voxels).
2. Automatic generation of forward and jacobian methods (based on forward-mode autodiff) to be used in parameter fitting or model-based reconstructions.
3. Support for custom manual defined jacobian methods to override auto-generated jacobian.
4. Support for advanced signal models, including diffusion, flow, magnetization transfer and chemical exchange.
5. GPU support.

Installation
------------

TorchSim can be installed via pip as:

.. code-block:: bash

    pip install torchsim

Basic Usage
-----------
Using TorchSim, we can quickly implement and run MR simulations.
We also provide pre-defined simulators for several applications:

.. code-block:: python
    
    import numpy as np
    import torchsim
    
    # generate a flip angle pattern
    flip = np.concatenate((np.linspace(5, 60.0, 300), np.linspace(60.0, 2.0, 300), np.ones(280)*2.0))
    sig, jac = torchsim.mrf_sim(flip=flip, TR=10.0, T1=1000.0, T2=100.0, diff=("T1","T2"))
    
This way we obtained the forward pass signal (``sig``) as well as the jacobian
calculated with respect to ``T1`` and ``T2``.


Development
-----------

If you are interested in improving this project, install TorchSim in editable mode:

.. code-block:: bash

    git clone git@github.com:INFN-MRI/torchsim
    cd torchsim
    pip install -e .[dev,test,doc]


Related projects
----------------

This package is inspired by the following excellent projects:

- epyg <https://github.com/brennerd11/EpyG>
- sycomore <https://github.com/lamyj/sycomore/>
- mri-sim-py <https://somnathrakshit.github.io/projects/project-mri-sim-py-epg/>
- ssfp <https://github.com/mckib2/ssfp>
- erwin <https://github.com/lamyj/erwin>


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "torchsim",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "epg, mri, simulation, bloch",
    "author": null,
    "author_email": "Matteo Cencini <matteo.cencini@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/1e/8b/354e95f3e205eea7a225c5636b4a2f6727535e146fc54389137292dd2aeb/torchsim-0.0.3.tar.gz",
    "platform": null,
    "description": "TorchSim\n========\n\nTorchSim is a pure Pytorch-based MR simulator, including analytical and EPG model.\n\n|Coverage| |CI/CD| |License| |Codefactor| |Sphinx| |PyPi| |Black| |PythonVersion|\n\n.. |Coverage| image:: https://codecov.io/gh/INFN-MRI/torchsim/graph/badge.svg?token=qtB53xANwI \n   :target: https://codecov.io/gh/INFN-MRI/torchsim\n\n.. |CI/CD| image:: https://github.com/INFN-MRI/torchsim/workflows/CI-CD/badge.svg\n   :target: https://github.com/INFN-MRI/torchsim\n\n.. |License| image:: https://img.shields.io/github/license/INFN-MRI/torchsim\n   :target: https://github.com/INFN-MRI/torchsim/blob/main/LICENSE.txt\n\n.. |Codefactor| image:: https://www.codefactor.io/repository/github/INFN-MRI/torchsim/badge\n   :target: https://www.codefactor.io/repository/github/INFN-MRI/torchsim\n\n.. |Sphinx| image:: https://img.shields.io/badge/docs-Sphinx-blue\n   :target: https://infn-mri.github.io/torchsim\n\n.. |PyPi| image:: https://img.shields.io/pypi/v/torchsim\n   :target: https://pypi.org/project/torchsim\n\n.. |Black| image:: https://img.shields.io/badge/style-black-black\n\n.. |PythonVersion| image:: https://img.shields.io/badge/Python-%3E=3.10-blue?logo=python&logoColor=white\n   :target: https://python.org\n\nFeatures\n--------\nTorchSim contains tools to implement parallelized and differentiable MR simulators. Specifically, we provide\n\n1. Automatic vectorization of across multiple atoms (e.g., voxels).\n2. Automatic generation of forward and jacobian methods (based on forward-mode autodiff) to be used in parameter fitting or model-based reconstructions.\n3. Support for custom manual defined jacobian methods to override auto-generated jacobian.\n4. Support for advanced signal models, including diffusion, flow, magnetization transfer and chemical exchange.\n5. GPU support.\n\nInstallation\n------------\n\nTorchSim can be installed via pip as:\n\n.. code-block:: bash\n\n    pip install torchsim\n\nBasic Usage\n-----------\nUsing TorchSim, we can quickly implement and run MR simulations.\nWe also provide pre-defined simulators for several applications:\n\n.. code-block:: python\n    \n    import numpy as np\n    import torchsim\n    \n    # generate a flip angle pattern\n    flip = np.concatenate((np.linspace(5, 60.0, 300), np.linspace(60.0, 2.0, 300), np.ones(280)*2.0))\n    sig, jac = torchsim.mrf_sim(flip=flip, TR=10.0, T1=1000.0, T2=100.0, diff=(\"T1\",\"T2\"))\n    \nThis way we obtained the forward pass signal (``sig``) as well as the jacobian\ncalculated with respect to ``T1`` and ``T2``.\n\n\nDevelopment\n-----------\n\nIf you are interested in improving this project, install TorchSim in editable mode:\n\n.. code-block:: bash\n\n    git clone git@github.com:INFN-MRI/torchsim\n    cd torchsim\n    pip install -e .[dev,test,doc]\n\n\nRelated projects\n----------------\n\nThis package is inspired by the following excellent projects:\n\n- epyg <https://github.com/brennerd11/EpyG>\n- sycomore <https://github.com/lamyj/sycomore/>\n- mri-sim-py <https://somnathrakshit.github.io/projects/project-mri-sim-py-epg/>\n- ssfp <https://github.com/mckib2/ssfp>\n- erwin <https://github.com/lamyj/erwin>\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A feature-rich MR simulator supporting massive parallelization on GPU and automatic differentiation.",
    "version": "0.0.3",
    "project_urls": {
        "Bug Reports": "https://github.com/INFN-MRI/torchsim/issues",
        "Homepage": "https://github.com/INFN-MRI/torchsim",
        "Source": "https://github.com/INFN-MRI/torchsim"
    },
    "split_keywords": [
        "epg",
        " mri",
        " simulation",
        " bloch"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee929e6be38a0bdd7480053124c7ba785255cd72780360d7bea89150ea74634a",
                "md5": "786f24ddb0c0e6adffc9a9c976349d93",
                "sha256": "742c0a5318ddce3d869281520a99ed07adaaa594f38eaf5d8ec7db546a0cea9a"
            },
            "downloads": -1,
            "filename": "torchsim-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "786f24ddb0c0e6adffc9a9c976349d93",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 47436,
            "upload_time": "2024-12-05T11:36:10",
            "upload_time_iso_8601": "2024-12-05T11:36:10.495828Z",
            "url": "https://files.pythonhosted.org/packages/ee/92/9e6be38a0bdd7480053124c7ba785255cd72780360d7bea89150ea74634a/torchsim-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1e8b354e95f3e205eea7a225c5636b4a2f6727535e146fc54389137292dd2aeb",
                "md5": "8404455ac0a77089be7da288da19cf75",
                "sha256": "5db1f32d4bfa8775d3224636dd30c6fb7bec9ebe6c8b4583996919cd498b5829"
            },
            "downloads": -1,
            "filename": "torchsim-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "8404455ac0a77089be7da288da19cf75",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 12348831,
            "upload_time": "2024-12-05T11:36:13",
            "upload_time_iso_8601": "2024-12-05T11:36:13.266109Z",
            "url": "https://files.pythonhosted.org/packages/1e/8b/354e95f3e205eea7a225c5636b4a2f6727535e146fc54389137292dd2aeb/torchsim-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-05 11:36:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "INFN-MRI",
    "github_project": "torchsim",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "torchsim"
}
        
Elapsed time: 1.15544s