MIRTorch 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. mirtorch-0.1.0/.github/workflows/python-ci.yml +56 -0
  2. mirtorch-0.1.0/.github/workflows/python-publish.yml +48 -0
  3. mirtorch-0.1.0/.gitignore +44 -0
  4. mirtorch-0.1.0/.pre-commit-config.yaml +31 -0
  5. mirtorch-0.1.0/.readthedocs.yaml +20 -0
  6. mirtorch-0.1.0/LICENSE +80 -0
  7. mirtorch-0.1.0/MIRTorch.egg-info/PKG-INFO +158 -0
  8. mirtorch-0.1.0/MIRTorch.egg-info/SOURCES.txt +120 -0
  9. mirtorch-0.1.0/MIRTorch.egg-info/dependency_links.txt +1 -0
  10. mirtorch-0.1.0/MIRTorch.egg-info/entry_points.txt +2 -0
  11. mirtorch-0.1.0/MIRTorch.egg-info/requires.txt +20 -0
  12. mirtorch-0.1.0/MIRTorch.egg-info/top_level.txt +1 -0
  13. mirtorch-0.1.0/PKG-INFO +158 -0
  14. mirtorch-0.1.0/README.md +125 -0
  15. mirtorch-0.1.0/docs/API.rst +12 -0
  16. mirtorch-0.1.0/docs/Algorithms.rst +14 -0
  17. mirtorch-0.1.0/docs/DL.rst +11 -0
  18. mirtorch-0.1.0/docs/HISTORY.md +22 -0
  19. mirtorch-0.1.0/docs/LinearMap.rst +70 -0
  20. mirtorch-0.1.0/docs/Makefile +20 -0
  21. mirtorch-0.1.0/docs/Prox.rst +17 -0
  22. mirtorch-0.1.0/docs/README.md +123 -0
  23. mirtorch-0.1.0/docs/conf.py +64 -0
  24. mirtorch-0.1.0/docs/generated/mirtorch.alg.CG.rst +17 -0
  25. mirtorch-0.1.0/docs/generated/mirtorch.alg.FBPD.rst +17 -0
  26. mirtorch-0.1.0/docs/generated/mirtorch.alg.FISTA.rst +17 -0
  27. mirtorch-0.1.0/docs/generated/mirtorch.alg.POGM.rst +17 -0
  28. mirtorch-0.1.0/docs/generated/mirtorch.alg.power_iter.rst +6 -0
  29. mirtorch-0.1.0/docs/generated/mirtorch.dic.soup.rst +6 -0
  30. mirtorch-0.1.0/docs/generated/mirtorch.linear.Add.rst +29 -0
  31. mirtorch-0.1.0/docs/generated/mirtorch.linear.BlockDiagonal.rst +29 -0
  32. mirtorch-0.1.0/docs/generated/mirtorch.linear.ConjTranspose.rst +29 -0
  33. mirtorch-0.1.0/docs/generated/mirtorch.linear.FFTCn.rst +29 -0
  34. mirtorch-0.1.0/docs/generated/mirtorch.linear.Kron.rst +29 -0
  35. mirtorch-0.1.0/docs/generated/mirtorch.linear.Matmul.rst +29 -0
  36. mirtorch-0.1.0/docs/generated/mirtorch.linear.Multiply.rst +29 -0
  37. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Convolve1d.rst +29 -0
  38. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Convolve2d.rst +29 -0
  39. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Convolve3d.rst +29 -0
  40. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Diag.rst +29 -0
  41. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Diff2dframe.rst +30 -0
  42. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Diff2dgram.rst +30 -0
  43. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Diff3dframe.rst +30 -0
  44. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Diff3dgram.rst +30 -0
  45. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Diffnd.rst +29 -0
  46. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Identity.rst +29 -0
  47. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Patch2D.rst +29 -0
  48. mirtorch-0.1.0/docs/generated/mirtorch.linear.basics.Patch3D.rst +29 -0
  49. mirtorch-0.1.0/docs/generated/mirtorch.linear.ct.Bdd.rst +30 -0
  50. mirtorch-0.1.0/docs/generated/mirtorch.linear.mri.FFTCn.rst +29 -0
  51. mirtorch-0.1.0/docs/generated/mirtorch.linear.mri.Gmri.rst +29 -0
  52. mirtorch-0.1.0/docs/generated/mirtorch.linear.mri.NuSense.rst +29 -0
  53. mirtorch-0.1.0/docs/generated/mirtorch.linear.mri.NuSenseFrame.rst +29 -0
  54. mirtorch-0.1.0/docs/generated/mirtorch.linear.mri.NuSenseGram.rst +29 -0
  55. mirtorch-0.1.0/docs/generated/mirtorch.linear.mri.Sense.rst +29 -0
  56. mirtorch-0.1.0/docs/generated/mirtorch.linear.spect.SPECT.rst +29 -0
  57. mirtorch-0.1.0/docs/generated/mirtorch.linear.wavelets.Wavelet2D.rst +29 -0
  58. mirtorch-0.1.0/docs/generated/mirtorch.prox.BoxConstraint.rst +16 -0
  59. mirtorch-0.1.0/docs/generated/mirtorch.prox.Conj.rst +16 -0
  60. mirtorch-0.1.0/docs/generated/mirtorch.prox.Const.rst +16 -0
  61. mirtorch-0.1.0/docs/generated/mirtorch.prox.L0Regularizer.rst +16 -0
  62. mirtorch-0.1.0/docs/generated/mirtorch.prox.L1Regularizer.rst +16 -0
  63. mirtorch-0.1.0/docs/generated/mirtorch.prox.L2Regularizer.rst +16 -0
  64. mirtorch-0.1.0/docs/generated/mirtorch.prox.SquaredL2Regularizer.rst +16 -0
  65. mirtorch-0.1.0/docs/index.rst +21 -0
  66. mirtorch-0.1.0/docs/make.bat +35 -0
  67. mirtorch-0.1.0/docs/requirements.txt +8 -0
  68. mirtorch-0.1.0/examples/AXT2_210_6001736_layer11.npz +0 -0
  69. mirtorch-0.1.0/examples/demo_3d.ipynb +275 -0
  70. mirtorch-0.1.0/examples/demo_cs.ipynb +677 -0
  71. mirtorch-0.1.0/examples/demo_dl.ipynb +304 -0
  72. mirtorch-0.1.0/examples/demo_mlem.ipynb +662 -0
  73. mirtorch-0.1.0/examples/demo_mnist.ipynb +259 -0
  74. mirtorch-0.1.0/examples/demo_mri.ipynb +797 -0
  75. mirtorch-0.1.0/mirtorch/__init__.py +6 -0
  76. mirtorch-0.1.0/mirtorch/alg/__init__.py +12 -0
  77. mirtorch-0.1.0/mirtorch/alg/cg.py +153 -0
  78. mirtorch-0.1.0/mirtorch/alg/fbpd.py +95 -0
  79. mirtorch-0.1.0/mirtorch/alg/fista.py +87 -0
  80. mirtorch-0.1.0/mirtorch/alg/pogm.py +93 -0
  81. mirtorch-0.1.0/mirtorch/alg/spectral.py +40 -0
  82. mirtorch-0.1.0/mirtorch/alg/util.py +0 -0
  83. mirtorch-0.1.0/mirtorch/dic/__init__.py +5 -0
  84. mirtorch-0.1.0/mirtorch/dic/soup.py +125 -0
  85. mirtorch-0.1.0/mirtorch/dic/util.py +48 -0
  86. mirtorch-0.1.0/mirtorch/linear/__init__.py +58 -0
  87. mirtorch-0.1.0/mirtorch/linear/basics.py +573 -0
  88. mirtorch-0.1.0/mirtorch/linear/linearmaps.py +426 -0
  89. mirtorch-0.1.0/mirtorch/linear/mri.py +689 -0
  90. mirtorch-0.1.0/mirtorch/linear/spect.py +154 -0
  91. mirtorch-0.1.0/mirtorch/linear/util.py +338 -0
  92. mirtorch-0.1.0/mirtorch/linear/wavelets.py +213 -0
  93. mirtorch-0.1.0/mirtorch/prox/__init__.py +21 -0
  94. mirtorch-0.1.0/mirtorch/prox/prox.py +319 -0
  95. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/__init__.py +35 -0
  96. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/_version.py +2 -0
  97. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dtcwt/__init__.py +6 -0
  98. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dtcwt/coeffs.py +142 -0
  99. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dtcwt/data/__init__.py +0 -0
  100. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dtcwt/lowlevel.py +381 -0
  101. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dtcwt/lowlevel2.py +663 -0
  102. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dtcwt/transform2d.py +299 -0
  103. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dtcwt/transform_funcs.py +495 -0
  104. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dwt/__init__.py +0 -0
  105. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dwt/lowlevel.py +997 -0
  106. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dwt/swt_inverse.py +213 -0
  107. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dwt/transform1d.py +117 -0
  108. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/dwt/transform2d.py +223 -0
  109. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/scatternet/__init__.py +3 -0
  110. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/scatternet/layers.py +209 -0
  111. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/scatternet/lowlevel.py +779 -0
  112. mirtorch-0.1.0/mirtorch/vendors/pytorch_wavelets/utils.py +243 -0
  113. mirtorch-0.1.0/pyproject.toml +76 -0
  114. mirtorch-0.1.0/setup.cfg +4 -0
  115. mirtorch-0.1.0/setup.py +3 -0
  116. mirtorch-0.1.0/tests/basics_tests.py +154 -0
  117. mirtorch-0.1.0/tests/linops_tests.py +109 -0
  118. mirtorch-0.1.0/tests/mri_tests.py +76 -0
  119. mirtorch-0.1.0/tests/prox_tests.py +132 -0
  120. mirtorch-0.1.0/tests/spect_tests.py +112 -0
  121. mirtorch-0.1.0/tests/util_tests.py +109 -0
  122. mirtorch-0.1.0/tests/utils.py +1035 -0
@@ -0,0 +1,56 @@
1
+ name: Python-CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ - develop
8
+ - feature/*
9
+ pull_request:
10
+ branches:
11
+ - master
12
+ - develop
13
+ - feature/*
14
+
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: "3.10" # Specify the Python version you need
25
+ cache: 'pip' # caching pip dependencies
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install --upgrade pip
30
+ pip install -e .
31
+ pip install ruff pytest python-semantic-release
32
+
33
+ - name: Lint with Ruff
34
+ run: |
35
+ ruff check ./mirtorch
36
+
37
+ - name: Test with pytest
38
+ run: |
39
+ pytest ./tests/*
40
+
41
+ - name: Python Semantic Release
42
+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
43
+ env:
44
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45
+ run: |
46
+ git config user.name github-actions
47
+ git config user.email github-actions@github.com
48
+ semantic-release version
49
+ semantic-release publish
50
+
51
+ - name: Push changes
52
+ if: github.ref == 'refs/heads/master' && github.event_name == 'push'
53
+ env:
54
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55
+ run: |
56
+ git push && git push --tags
@@ -0,0 +1,48 @@
1
+ # This workflow will upload a Python Package using Twine when a release is created
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+ # This workflow uses actions that are not certified by GitHub.
5
+ # They are provided by a third-party and are governed by
6
+ # separate terms of service, privacy policy, and support
7
+ # documentation.
8
+
9
+ name: Upload Python Package
10
+
11
+ on:
12
+ release:
13
+ types: [published]
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ deploy:
20
+
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - uses: actions/checkout@v3
25
+ - name: Set up Python
26
+ uses: actions/setup-python@v3
27
+ with:
28
+ python-version: '3.x'
29
+ - name: Install pypa/build
30
+ run: >-
31
+ python3 -m
32
+ pip install
33
+ build
34
+ --user
35
+ - name: Build a binary wheel and a source tarball
36
+ run: python3 -m build
37
+ - name: Store the distribution packages
38
+ uses: actions/upload-artifact@v3
39
+ with:
40
+ name: python-package-distributions
41
+ path: dist/
42
+ - name: Download all the dists
43
+ uses: actions/download-artifact@v3
44
+ with:
45
+ name: python-package-distributions
46
+ path: dist/
47
+ - name: Publish distribution 📦 to PyPI
48
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,44 @@
1
+ *
2
+
3
+ # except
4
+ !.gitignore
5
+ !*.m
6
+ !*.h
7
+ !*.c
8
+ !*.cpp
9
+ !*.txt
10
+ !*.md
11
+ !*.py
12
+ !*.pdf
13
+ !*.rst
14
+ !*.ipynb
15
+ !*.npz
16
+ !*.yml
17
+ !*.yaml
18
+ !*.toml
19
+
20
+
21
+ # even if in sub-dirs
22
+ !*/
23
+
24
+ # but never in these folders
25
+ *.egg-info/
26
+ *.ipynb_checkpoints/
27
+ *back/
28
+ *arch/
29
+ *.vscode/
30
+ *.idea/
31
+ *tmp/
32
+ *temp/
33
+ *.vector_cache/
34
+ *data/
35
+ *prof/
36
+ *build/
37
+ *dist/
38
+ *.pyc
39
+ *tests/dev
40
+ mrt/
41
+ docs/_build
42
+ docs/_static
43
+ docs/_templates
44
+ .ruff_cache
@@ -0,0 +1,31 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.0.1 # Use the latest version
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: check-yaml
7
+ - id: end-of-file-fixer
8
+ - id: check-added-large-files
9
+
10
+ - repo: https://github.com/psf/black
11
+ rev: 22.3.0 # Use the latest version
12
+ hooks:
13
+ - id: black
14
+ language_version: python3
15
+ exclude: ^(?:tests|docs|examples)/
16
+
17
+ - repo: https://github.com/astral-sh/ruff-pre-commit
18
+ # Ruff version.
19
+ rev: v0.3.3
20
+ hooks:
21
+ # Run the linter.
22
+ - id: ruff
23
+ types_or: [python, pyi, jupyter]
24
+ args: [--fix]
25
+ exclude: ^(?:tests|docs|examples)/
26
+
27
+ - repo: https://github.com/codespell-project/codespell
28
+ rev: v2.1.0
29
+ hooks:
30
+ - id: codespell
31
+ exclude: ^(?:tests|docs|examples|mirtorch/vendors)/
@@ -0,0 +1,20 @@
1
+ # .readthedocs.yaml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ # Build documentation in the docs/ directory with Sphinx
9
+ sphinx:
10
+ configuration: docs/conf.py
11
+
12
+ # If using Sphinx, optionally build your docs in additional formats such as PDF
13
+ # formats:
14
+ # - pdf
15
+
16
+ # Optionally declare the Python requirements required to build your docs
17
+ python:
18
+ version: 3.9
19
+ install:
20
+ - requirements: docs/requirements.txt
mirtorch-0.1.0/LICENSE ADDED
@@ -0,0 +1,80 @@
1
+ Copyright (c) 2021, Guanhua Wang, Neel Shah, Keyue Zhu and Jeffrey Fessler
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
+
13
+
14
+
15
+ -------------------- LICENSE FOR fastMRI ------------------
16
+
17
+ MIT License
18
+
19
+ Copyright (c) Facebook, Inc. and its affiliates.
20
+
21
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
22
+
23
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+
28
+ -------------------- LICENSE FOR SigPy ------------------
29
+
30
+ Copyright (c) 2016, Frank Ong.
31
+ Copyright (c) 2016, The Regents of the University of California.
32
+ All rights reserved.
33
+
34
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
35
+
36
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
37
+
38
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
39
+
40
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
41
+
42
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
+
44
+
45
+ ----------------------------- LICENSE FOR numpy-ml --------------------------------
46
+ GNU GENERAL PUBLIC LICENSE
47
+ Version 3, 29 June 2007
48
+
49
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
50
+ Everyone is permitted to copy and distribute verbatim copies
51
+ of this license document, but changing it is not allowed.
52
+
53
+ ----------------------------- LICENSE for pytorch_wavelets----------------------------
54
+ This licence applies to any parts of this library which are novel in comparison
55
+ to the original DTCWT MATLAB toolbox written by Nick Kingsbury and Cian
56
+ Shaffrey. See the Provenance section of README.rst file for details on any further
57
+ restrictions of use. If you wish to use the DTCWT, you should read that license as well.
58
+ The DWT sections come under this license.
59
+
60
+ MIT License
61
+
62
+ Copyright (c) 2020 Fergal Cotter
63
+
64
+ Permission is hereby granted, free of charge, to any person obtaining a copy
65
+ of this software and associated documentation files (the "Software"), to deal
66
+ in the Software without restriction, including without limitation the rights
67
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
68
+ copies of the Software, and to permit persons to whom the Software is
69
+ furnished to do so, subject to the following conditions:
70
+
71
+ The above copyright notice and this permission notice shall be included in all
72
+ copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
75
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
76
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
77
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
78
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
79
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
80
+ SOFTWARE.
@@ -0,0 +1,158 @@
1
+ Metadata-Version: 2.1
2
+ Name: MIRTorch
3
+ Version: 0.1.0
4
+ Summary: a PyTorch-based image reconstruction toolbox
5
+ Author-email: Guanhua Wang <guanhuaw@umich.edu>
6
+ License: BSD-3-Clause
7
+ Project-URL: repository, https://github.com/guanhuaw/MIRTorch
8
+ Keywords: signal processing,inverse problems
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: BSD License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Development Status :: 2 - Pre-Alpha
13
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: torch>=1.13
18
+ Requires-Dist: torchvision
19
+ Requires-Dist: torchkbnufft>=1.4.0
20
+ Requires-Dist: numpy>=1.24
21
+ Requires-Dist: dominate
22
+ Requires-Dist: scipy
23
+ Requires-Dist: PyWavelets
24
+ Requires-Dist: requests
25
+ Requires-Dist: importlib-metadata; python_version < "3.8"
26
+ Requires-Dist: einops
27
+ Requires-Dist: matplotlib
28
+ Provides-Extra: dev
29
+ Requires-Dist: check-manifest; extra == "dev"
30
+ Provides-Extra: test
31
+ Requires-Dist: coverage; extra == "test"
32
+ Requires-Dist: pytest; extra == "test"
33
+
34
+ # MIRTorch
35
+
36
+ ![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/guanhuaw/mirtorch?include_prereleases)
37
+ ![Read the Docs](https://img.shields.io/readthedocs/mirtorch)
38
+
39
+ A Py***Torch***-based differentiable ***I***mage ***R***econstruction ***T***oolbox, developed at the University of ***M***ichigan.
40
+
41
+ The work is inspired by [MIRT](https://github.com/JeffFessler/mirt), a well-acclaimed toolbox for medical imaging reconstruction.
42
+
43
+ The main objective is to facilitate rapid, data-driven medical image reconstruction using CPUs and GPUs, for fast prototyping. Researchers can conveniently develop new model-based and learning-based methods (e.g., unrolled neural networks) with abstraction layers. The availability of auto-differentiation enables optimization of imaging protocols and reconstruction parameters using gradient methods.
44
+
45
+ Documentation: https://mirtorch.readthedocs.io/en/latest/
46
+
47
+ ------
48
+
49
+ ### Installation
50
+
51
+ We recommend to [pre-install `PyTorch` first](https://pytorch.org/).
52
+ Use `pip install mirtorch` to install.
53
+ To install the `MIRTorch` locally, after cloning the repo, please try `pip install -e .`(one may modify the package locally with this option.)
54
+
55
+ ------
56
+
57
+ ### Features
58
+
59
+ #### Linear maps
60
+
61
+ The `LinearMap` class overloads common matrix operations, such as `+, - , *`.
62
+
63
+ Instances include basic linear operations (like convolution), classical imaging processing, and MRI system matrix (Cartesian and Non-Cartesian, sensitivity- and B0-informed system models). ***NEW!*** MIRTorch recently adds the support for SPECT and CT.
64
+
65
+ Since the Jacobian matrix of a linear operator is itself, the toolbox can actively calculate such Jacobians during backpropagation, avoiding the large cache cost required by auto-differentiation.
66
+
67
+ When defining linear operators, please make sure that all torch tensors are on the same device and compatible. For example, `torch.cfloat` are compatible with `torch.float` but not `torch.double`. Similarly, `torch.chalf` is compatible with `torch.half`.
68
+ When the data is image, there are 2 empirical formats: `[num_batch, num_channel, nx, ny, (nz)]` and `[nx, ny, (nz)]`.
69
+ For some LinearMaps, there is a boolean `batchmode` to control the shape.
70
+
71
+ #### Proximal operators
72
+
73
+ The toolbox contains common proximal operators such as soft thresholding. These operators also support the regularizers that involve multiplication with diagonal or unitary matrices, such as orthogonal wavelets.
74
+
75
+ #### Iterative reconstruction (MBIR) algorithms
76
+
77
+ Currently, the package includes the conjugate gradient (CG), fast iterative thresholding (FISTA), optimized gradient method (POGM), forward-backward primal-dual (FBPD) algorithms for image reconstruction.
78
+
79
+ #### Dictionary learning
80
+
81
+ For dictionary learning-based reconstruction, we implemented an efficient dictionary learning algorithm ([SOUP-DIL](https://arxiv.org/abs/1511.06333)) and orthogonal matching pursuit ([OMP](https://ieeexplore.ieee.org/abstract/document/342465/?casa_token=aTDkQVCM9WEAAAAA:5rXu9YikP822bCBvkhYxKWlBTJ6Fn6baTQJ9kuNrU7K-64EmGOAczYvF2dTW3al3PfPdwJAiYw)). Due to PyTorch’s limited support of sparse matrices, we use SciPy as the backend.
82
+
83
+ #### Multi-GPU support
84
+
85
+ Currently, MIRTorch uses `torch.DataParallel` to support multiple GPUs. One may re-package the `LinearMap`, `Prox` or `Alg` inside a `torch.nn.Module` to enable data parallel. See [this tutorial](https://pytorch.org/tutorials/beginner/blitz/data_parallel_tutorial.html) for detail.
86
+
87
+ ------
88
+
89
+ ### Usage and examples
90
+
91
+ Generally, MIRTorch solves the image reconstruction problems that have the cost function $\textit{argmin}_{x} \|Ax-y\|_2^2 + \lambda \textit{R}(x)$. $A$ stands for the system matrix. When it is linear, one may use `LinearMap` to efficiently compute it. `y` usually denotes measurements. $\textit{R}(\cdot)$ denotes regularizers, which determines which `Alg` to be used. One may refer to [1](https://web.eecs.umich.edu/~fessler/book/), [2](https://web.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf) and [3](https://www.youtube.com/watch?v=J6_5rPYnr_s) for more tutorials on optimization.
92
+
93
+ Here we provide several notebook tutorials focused on MRI, where $A$ is FFT or NUFFT.
94
+
95
+ - `/example/demo_mnist.ipynb` shows the LASSO on MNIST with FISTA and POGM.
96
+ - `/example/demo_mri.ipynb` contains the SENSE (CG-SENSE) and **B0**-informed reconstruction with penalized weighted least squares (*PWLS*).
97
+ - `/example/demo_3d.ipynb` contains the 3d non-Cartesian MR reconstruction. *New!* Try the Toeplitz-embedding version of B0-informed reconstruction, which reduce hour-long recon to 5 secs.
98
+ - `/example/demo_cs.ipynb` shows the compressed sensing reconstruction of under-determined MRI signals.
99
+ - `/example/demo_dl.ipynb` exhibits the dictionary learning results.
100
+ - `/example/demo_mlem` showcase SPECT recon algorithms, including EM and CNN.
101
+
102
+ Since MIRTorch is differentiable, one may use AD to update many parameters. For example, updating the reconstruction neural network's weights. More importantly, one may update the imaging system itself via gradient-based and data-driven methods. As a user case, [Bjork repo](https://github.com/guanhuaw/Bjork) contains MRI sampling pattern optimization examples. One may use the reconstruction loss as the objective function to jointly optimize reconstruction algorithms and the sampling pattern. See [this video](https://www.youtube.com/watch?v=sLFOf5EvVAs) on how to jointly optimize reconstruction and acquisition.
103
+
104
+ ------
105
+
106
+ ### Acknowledgments
107
+
108
+ This work is inspired by (but not limited to):
109
+
110
+ * SigPy: https://github.com/mikgroup/sigpy
111
+
112
+ * MIRT: https://github.com/JeffFessler/mirt
113
+
114
+ * MIRT.jl: https://github.com/JeffFessler/MIRT.jl
115
+
116
+ * PyLops: https://github.com/PyLops/pylops
117
+
118
+ If the code is useful to your research, please consider citing:
119
+
120
+ ```bibtex
121
+ @article{wang:22:bjork,
122
+ author={Wang, Guanhua and Luo, Tianrui and Nielsen, Jon-Fredrik and Noll, Douglas C. and Fessler, Jeffrey A.},
123
+ journal={IEEE Transactions on Medical Imaging},
124
+ title={B-spline Parameterized Joint Optimization of Reconstruction and K-space Trajectories ({BJORK}) for Accelerated {2D} {MRI}},
125
+ year={2022},
126
+ pages={1-1},
127
+ doi={10.1109/TMI.2022.3161875}}
128
+ ```
129
+
130
+ ```bibtex
131
+ @inproceedings{wang:22:mirtorch,
132
+ title={{MIRTorch}: A {PyTorch}-powered Differentiable Toolbox for Fast Image Reconstruction and Scan Protocol Optimization},
133
+ author={Wang, Guanhua and Shah, Neel and Zhu, Keyue and Noll, Douglas C. and Fessler, Jeffrey A.},
134
+ booktitle={Proc. Intl. Soc. Magn. Resonance. Med. (ISMRM)},
135
+ pages={4982},
136
+ year={2022}
137
+ }
138
+ ```
139
+ If you use the SPECT code, please consider citing:
140
+
141
+ ```bibtex
142
+ @ARTICLE{li:23:tet,
143
+ author={Li, Zongyu and Dewaraja, Yuni K. and Fessler, Jeffrey A.},
144
+ journal={IEEE Transactions on Radiation and Plasma Medical Sciences},
145
+ title={Training End-to-End Unrolled Iterative Neural Networks for SPECT Image Reconstruction},
146
+ year={2023},
147
+ volume={7},
148
+ number={4},
149
+ pages={410-420},
150
+ doi={10.1109/TRPMS.2023.3240934}}
151
+ ```
152
+
153
+
154
+ ------
155
+
156
+ ### License
157
+
158
+ This package uses the BSD3 license.
@@ -0,0 +1,120 @@
1
+ .gitignore
2
+ .pre-commit-config.yaml
3
+ .readthedocs.yaml
4
+ LICENSE
5
+ README.md
6
+ pyproject.toml
7
+ setup.py
8
+ .github/workflows/python-ci.yml
9
+ .github/workflows/python-publish.yml
10
+ MIRTorch.egg-info/PKG-INFO
11
+ MIRTorch.egg-info/SOURCES.txt
12
+ MIRTorch.egg-info/dependency_links.txt
13
+ MIRTorch.egg-info/entry_points.txt
14
+ MIRTorch.egg-info/requires.txt
15
+ MIRTorch.egg-info/top_level.txt
16
+ docs/API.rst
17
+ docs/Algorithms.rst
18
+ docs/DL.rst
19
+ docs/HISTORY.md
20
+ docs/LinearMap.rst
21
+ docs/Makefile
22
+ docs/Prox.rst
23
+ docs/README.md
24
+ docs/conf.py
25
+ docs/index.rst
26
+ docs/make.bat
27
+ docs/requirements.txt
28
+ docs/generated/mirtorch.alg.CG.rst
29
+ docs/generated/mirtorch.alg.FBPD.rst
30
+ docs/generated/mirtorch.alg.FISTA.rst
31
+ docs/generated/mirtorch.alg.POGM.rst
32
+ docs/generated/mirtorch.alg.power_iter.rst
33
+ docs/generated/mirtorch.dic.soup.rst
34
+ docs/generated/mirtorch.linear.Add.rst
35
+ docs/generated/mirtorch.linear.BlockDiagonal.rst
36
+ docs/generated/mirtorch.linear.ConjTranspose.rst
37
+ docs/generated/mirtorch.linear.FFTCn.rst
38
+ docs/generated/mirtorch.linear.Kron.rst
39
+ docs/generated/mirtorch.linear.Matmul.rst
40
+ docs/generated/mirtorch.linear.Multiply.rst
41
+ docs/generated/mirtorch.linear.basics.Convolve1d.rst
42
+ docs/generated/mirtorch.linear.basics.Convolve2d.rst
43
+ docs/generated/mirtorch.linear.basics.Convolve3d.rst
44
+ docs/generated/mirtorch.linear.basics.Diag.rst
45
+ docs/generated/mirtorch.linear.basics.Diff2dframe.rst
46
+ docs/generated/mirtorch.linear.basics.Diff2dgram.rst
47
+ docs/generated/mirtorch.linear.basics.Diff3dframe.rst
48
+ docs/generated/mirtorch.linear.basics.Diff3dgram.rst
49
+ docs/generated/mirtorch.linear.basics.Diffnd.rst
50
+ docs/generated/mirtorch.linear.basics.Identity.rst
51
+ docs/generated/mirtorch.linear.basics.Patch2D.rst
52
+ docs/generated/mirtorch.linear.basics.Patch3D.rst
53
+ docs/generated/mirtorch.linear.ct.Bdd.rst
54
+ docs/generated/mirtorch.linear.mri.FFTCn.rst
55
+ docs/generated/mirtorch.linear.mri.Gmri.rst
56
+ docs/generated/mirtorch.linear.mri.NuSense.rst
57
+ docs/generated/mirtorch.linear.mri.NuSenseFrame.rst
58
+ docs/generated/mirtorch.linear.mri.NuSenseGram.rst
59
+ docs/generated/mirtorch.linear.mri.Sense.rst
60
+ docs/generated/mirtorch.linear.spect.SPECT.rst
61
+ docs/generated/mirtorch.linear.wavelets.Wavelet2D.rst
62
+ docs/generated/mirtorch.prox.BoxConstraint.rst
63
+ docs/generated/mirtorch.prox.Conj.rst
64
+ docs/generated/mirtorch.prox.Const.rst
65
+ docs/generated/mirtorch.prox.L0Regularizer.rst
66
+ docs/generated/mirtorch.prox.L1Regularizer.rst
67
+ docs/generated/mirtorch.prox.L2Regularizer.rst
68
+ docs/generated/mirtorch.prox.SquaredL2Regularizer.rst
69
+ examples/AXT2_210_6001736_layer11.npz
70
+ examples/demo_3d.ipynb
71
+ examples/demo_cs.ipynb
72
+ examples/demo_dl.ipynb
73
+ examples/demo_mlem.ipynb
74
+ examples/demo_mnist.ipynb
75
+ examples/demo_mri.ipynb
76
+ mirtorch/__init__.py
77
+ mirtorch/alg/__init__.py
78
+ mirtorch/alg/cg.py
79
+ mirtorch/alg/fbpd.py
80
+ mirtorch/alg/fista.py
81
+ mirtorch/alg/pogm.py
82
+ mirtorch/alg/spectral.py
83
+ mirtorch/alg/util.py
84
+ mirtorch/dic/__init__.py
85
+ mirtorch/dic/soup.py
86
+ mirtorch/dic/util.py
87
+ mirtorch/linear/__init__.py
88
+ mirtorch/linear/basics.py
89
+ mirtorch/linear/linearmaps.py
90
+ mirtorch/linear/mri.py
91
+ mirtorch/linear/spect.py
92
+ mirtorch/linear/util.py
93
+ mirtorch/linear/wavelets.py
94
+ mirtorch/prox/__init__.py
95
+ mirtorch/prox/prox.py
96
+ mirtorch/vendors/pytorch_wavelets/__init__.py
97
+ mirtorch/vendors/pytorch_wavelets/_version.py
98
+ mirtorch/vendors/pytorch_wavelets/utils.py
99
+ mirtorch/vendors/pytorch_wavelets/dtcwt/__init__.py
100
+ mirtorch/vendors/pytorch_wavelets/dtcwt/coeffs.py
101
+ mirtorch/vendors/pytorch_wavelets/dtcwt/lowlevel.py
102
+ mirtorch/vendors/pytorch_wavelets/dtcwt/lowlevel2.py
103
+ mirtorch/vendors/pytorch_wavelets/dtcwt/transform2d.py
104
+ mirtorch/vendors/pytorch_wavelets/dtcwt/transform_funcs.py
105
+ mirtorch/vendors/pytorch_wavelets/dtcwt/data/__init__.py
106
+ mirtorch/vendors/pytorch_wavelets/dwt/__init__.py
107
+ mirtorch/vendors/pytorch_wavelets/dwt/lowlevel.py
108
+ mirtorch/vendors/pytorch_wavelets/dwt/swt_inverse.py
109
+ mirtorch/vendors/pytorch_wavelets/dwt/transform1d.py
110
+ mirtorch/vendors/pytorch_wavelets/dwt/transform2d.py
111
+ mirtorch/vendors/pytorch_wavelets/scatternet/__init__.py
112
+ mirtorch/vendors/pytorch_wavelets/scatternet/layers.py
113
+ mirtorch/vendors/pytorch_wavelets/scatternet/lowlevel.py
114
+ tests/basics_tests.py
115
+ tests/linops_tests.py
116
+ tests/mri_tests.py
117
+ tests/prox_tests.py
118
+ tests/spect_tests.py
119
+ tests/util_tests.py
120
+ tests/utils.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ my-script = my_package.module:function
@@ -0,0 +1,20 @@
1
+ torch>=1.13
2
+ torchvision
3
+ torchkbnufft>=1.4.0
4
+ numpy>=1.24
5
+ dominate
6
+ scipy
7
+ PyWavelets
8
+ requests
9
+ einops
10
+ matplotlib
11
+
12
+ [:python_version < "3.8"]
13
+ importlib-metadata
14
+
15
+ [dev]
16
+ check-manifest
17
+
18
+ [test]
19
+ coverage
20
+ pytest
@@ -0,0 +1 @@
1
+ mirtorch