A feature-rich MR simulator supporting massive parallelization on GPU and automatic differentiation.
Project description
TorchSim is a pure Pytorch-based MR simulator, including analytical and EPG model.
Features
TorchSim contains tools to implement parallelized and differentiable MR simulators. Specifically, we provide
Automatic vectorization of across multiple atoms (e.g., voxels).
Automatic generation of forward and jacobian methods (based on forward-mode autodiff) to be used in parameter fitting or model-based reconstructions.
Support for custom manual defined jacobian methods to override auto-generated jacobian.
Support for advanced signal models, including diffusion, flow, magnetization transfer and chemical exchange.
GPU support.
Installation
TorchSim can be installed via pip as:
pip install torchsim
Basic Usage
Using TorchSim, we can quickly implement and run MR simulations. We also provide pre-defined simulators for several applications:
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:
git clone git@github.com:INFN-MRI/torchsim
cd torchsim
pip install -e .[dev,test,doc]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torchsim-0.0.3.tar.gz.
File metadata
- Download URL: torchsim-0.0.3.tar.gz
- Upload date:
- Size: 12.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5db1f32d4bfa8775d3224636dd30c6fb7bec9ebe6c8b4583996919cd498b5829
|
|
| MD5 |
8404455ac0a77089be7da288da19cf75
|
|
| BLAKE2b-256 |
1e8b354e95f3e205eea7a225c5636b4a2f6727535e146fc54389137292dd2aeb
|
Provenance
The following attestation bundles were made for torchsim-0.0.3.tar.gz:
Publisher:
tags-release.yml on INFN-MRI/torchsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchsim-0.0.3.tar.gz -
Subject digest:
5db1f32d4bfa8775d3224636dd30c6fb7bec9ebe6c8b4583996919cd498b5829 - Sigstore transparency entry: 153582596
- Sigstore integration time:
-
Permalink:
INFN-MRI/torchsim@a9e0d6479a6973d31dbcdb3e24a9a118f6a9164f -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/INFN-MRI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
tags-release.yml@a9e0d6479a6973d31dbcdb3e24a9a118f6a9164f -
Trigger Event:
push
-
Statement type:
File details
Details for the file torchsim-0.0.3-py3-none-any.whl.
File metadata
- Download URL: torchsim-0.0.3-py3-none-any.whl
- Upload date:
- Size: 47.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
742c0a5318ddce3d869281520a99ed07adaaa594f38eaf5d8ec7db546a0cea9a
|
|
| MD5 |
786f24ddb0c0e6adffc9a9c976349d93
|
|
| BLAKE2b-256 |
ee929e6be38a0bdd7480053124c7ba785255cd72780360d7bea89150ea74634a
|
Provenance
The following attestation bundles were made for torchsim-0.0.3-py3-none-any.whl:
Publisher:
tags-release.yml on INFN-MRI/torchsim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torchsim-0.0.3-py3-none-any.whl -
Subject digest:
742c0a5318ddce3d869281520a99ed07adaaa594f38eaf5d8ec7db546a0cea9a - Sigstore transparency entry: 153582598
- Sigstore integration time:
-
Permalink:
INFN-MRI/torchsim@a9e0d6479a6973d31dbcdb3e24a9a118f6a9164f -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/INFN-MRI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
tags-release.yml@a9e0d6479a6973d31dbcdb3e24a9a118f6a9164f -
Trigger Event:
push
-
Statement type: