Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
f44debe
Merge branch 'master' into develop
jmontalt Jul 25, 2022
f4745b9
Add FFT ops from core TensorFlow
jmontalt Jul 26, 2022
d24e41b
Add FFT
jmontalt Jul 26, 2022
de8f1fb
Add multi-threading and env var to control use of FFTW
jmontalt Jul 28, 2022
8872410
Add docs for custom FFT kernels
jmontalt Jul 28, 2022
26cb09d
Refactored linalg submodule
jmontalt Jul 29, 2022
6a08ec3
Tests for LeastSquaresGradientDescent layer
jmontalt Aug 1, 2022
924add9
FFT multi-threading
jmontalt Aug 2, 2022
651c108
Enable reconstruction with dynamic image shape
jmontalt Aug 2, 2022
f153040
fastMRI tutorial
jmontalt Aug 3, 2022
2b5fcb0
Added ModReLU activation, some fixes to API exports
jmontalt Aug 4, 2022
10ea973
Working on fastMRI
jmontalt Aug 4, 2022
817da6b
Preprocess and postprocess for linear operators
jmontalt Aug 15, 2022
6654b9f
k-space scaling layer
jmontalt Aug 15, 2022
2cf2f55
Bug fixes
jmontalt Aug 15, 2022
5615cb4
Refactoring coil sensitivities
jmontalt Aug 17, 2022
fcc720b
Fixed a bug in base linear operator
jmontalt Aug 17, 2022
df4c148
Improvements to documentation
jmontalt Aug 17, 2022
dc7740f
Add ReconAdjoint layer
jmontalt Aug 17, 2022
de4ec46
Add separable filter
jmontalt Aug 17, 2022
21ccdb7
Improved separable filter
jmontalt Aug 17, 2022
4057f44
Add separable argument to filter_kspace
jmontalt Aug 17, 2022
e22dc52
Renamed separable_window
jmontalt Aug 17, 2022
43a8a70
Improved implementation of separable_window
jmontalt Aug 17, 2022
d29e516
Fixed k-space scaling layer
jmontalt Aug 17, 2022
583fc2c
Add coil sensitivity estimation layer
jmontalt Aug 18, 2022
411bbb5
Working on VarNet
jmontalt Aug 18, 2022
b01eeeb
Variational network
jmontalt Aug 18, 2022
7a7d2c7
Working on VarNet
jmontalt Aug 19, 2022
51877e2
Document UNet's resize and concatenate feature
jmontalt Aug 19, 2022
864fc5c
Working on VarNet
jmontalt Aug 20, 2022
b168bad
Working on VarNet
jmontalt Aug 20, 2022
fd1a4e1
Fixed a bug in TensorBoard images callback
jmontalt Aug 20, 2022
ba6433b
Add docs for ReconAdjoint
jmontalt Aug 20, 2022
a1b5038
Added mask functions
jmontalt Aug 21, 2022
3ba2b14
Working on variational network
jmontalt Aug 22, 2022
97169ef
Add compute_output_shape for UNet
jmontalt Aug 22, 2022
3a2e80f
WIP VN
jmontalt Aug 22, 2022
84bc1b7
WIP VN
jmontalt Aug 23, 2022
6c60dc2
Move docs to markdown
jmontalt Aug 24, 2022
dbb913d
Move docs to markdown
jmontalt Aug 24, 2022
a9b5456
Documenting VarNet
jmontalt Aug 24, 2022
fc422f3
Support statically unknown numbers of phases in k-space trajectory
jmontalt Aug 25, 2022
cf5851d
Allow base_resolution to be a tensor in radial_waveform
jmontalt Aug 25, 2022
3fd38dc
Refactored linear operator layers
jmontalt Aug 26, 2022
355e767
Remove print statement
jmontalt Aug 26, 2022
eafc7b0
Add normalization layers
jmontalt Aug 26, 2022
f03be3c
Fixed a bug in linear_operator_layer
jmontalt Aug 26, 2022
98ed0a3
Add tests for normalized layer
jmontalt Aug 26, 2022
19726b3
Added RotationMatrix2D
jmontalt Aug 27, 2022
b7eb06e
Removed TF Graphics dependency
jmontalt Aug 27, 2022
868e2b0
Small docs adjustment
jmontalt Aug 27, 2022
e3502e6
Finalize rotation
jmontalt Aug 27, 2022
3f12903
Added docs to Rotation2D
jmontalt Aug 28, 2022
5c63945
Added doctest discovery
jmontalt Aug 29, 2022
c99819e
Minor changes to new masks
jmontalt Aug 29, 2022
e300199
Fixed a bug in mod relu [skip ci]
jmontalt Aug 29, 2022
3e7402a
Removed deprecated arguments
jmontalt Aug 29, 2022
7f6b538
Add FFTW planning rigor envvar
jmontalt Aug 30, 2022
736cd16
Updated copyright notice for FFT kernels
jmontalt Aug 30, 2022
73da9b5
Refactored coils module
jmontalt Aug 30, 2022
0a9ef14
Universal family, renamed centre -> center
jmontalt Aug 30, 2022
a5ce0dd
Remove conventions guide
jmontalt Aug 30, 2022
72b2657
Add GitHub PR extension
jmontalt Aug 30, 2022
b1cb923
Updated some docstrings
jmontalt Aug 30, 2022
008e651
Some fixes to coil sensitivities
jmontalt Aug 30, 2022
4676e29
Improved docs for custom FFT kernels
jmontalt Aug 30, 2022
626fc4f
Fixed a bug in U-Net
jmontalt Aug 31, 2022
efe3dc6
New recurrent block
jmontalt Aug 31, 2022
d40631e
Working on UNetLSTM
jmontalt Aug 31, 2022
b525d57
Added ConvLSTM block and U-Net
jmontalt Aug 31, 2022
8fbf7ed
Added serialization for custom activations
jmontalt Aug 31, 2022
960ae7f
Changed autodoc config, remove rank arg from PSNR metric
jmontalt Sep 1, 2022
434819b
Removed all VarNet stuff
jmontalt Sep 1, 2022
df0f370
Remove invalid imports
jmontalt Sep 1, 2022
01d02ef
Cleaning up
jmontalt Sep 1, 2022
d93b99d
Cleaning up
jmontalt Sep 1, 2022
eab692c
Working on universal coil compression
jmontalt Sep 1, 2022
ff1e163
Cleaning up
jmontalt Sep 1, 2022
63e9788
Refactoring linalg module, working on type spec for linear operators
jmontalt Sep 1, 2022
ae4d9ac
Working on ReconAdjoint layer
jmontalt Sep 2, 2022
82c2572
Doc improvements
jmontalt Sep 2, 2022
24ec5b4
Fixed bug in linear operator, rotations, add TFMRI doc links
jmontalt Sep 2, 2022
c98dd9f
Add density property to MRI linop
jmontalt Sep 2, 2022
96cfa72
New MRI layers
jmontalt Sep 5, 2022
b2bf5ed
Update API
jmontalt Sep 5, 2022
8176df9
Changed math syntax to MyST
jmontalt Sep 7, 2022
8b9fcc7
Updated copyright strings
jmontalt Sep 7, 2022
51b40a4
Remove universal coil compression
jmontalt Sep 7, 2022
4112958
Replaced note and warning directives with MyST syntax
jmontalt Sep 7, 2022
0c2483d
Removed custom Sphinx extensions in favour of TF manylinux image
jmontalt Sep 7, 2022
fcd3988
Replaced math directives with MyST syntax
jmontalt Sep 7, 2022
b008f21
Linting
jmontalt Sep 7, 2022
d440768
Linting
jmontalt Sep 7, 2022
0904474
Fixed lost static information in ResizeAndConcatenate layer
jmontalt Sep 7, 2022
3638f18
Fixed problems with immutability of MRI operator
jmontalt Sep 8, 2022
0c5a39a
Add dtype to LinearOperatorSpec
jmontalt Sep 8, 2022
1498605
Add LinearOperatorIdentity
jmontalt Sep 8, 2022
63cd062
Added tests for linear operator identity
jmontalt Sep 14, 2022
6d0047a
Fixed README
jmontalt Sep 14, 2022
e24108e
Linting
jmontalt Sep 14, 2022
5a68e77
Fix linop
jmontalt Oct 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/mrphys/tensorflow-manylinux:1.12.0
FROM ghcr.io/mrphys/tensorflow-manylinux:1.14.0

# To enable plotting.
RUN apt-get update && \
Expand All @@ -15,6 +15,15 @@ RUN for PYVER in ${PYVERSIONS}; do ${PYBIN}${PYVER} -m pip install ipykernel; do
COPY requirements.txt /tmp/requirements.txt
RUN for PYVER in ${PYVERSIONS}; do ${PYBIN}${PYVER} -m pip install -r /tmp/requirements.txt; done

# For `tf.keras.utils.plot_model`.
RUN apt-get update && \
apt-get install -y graphviz && \
for PYVER in ${PYVERSIONS}; do ${PYBIN}${PYVER} -m pip install pydot; done

# Reinstall Tensorboard.
RUN for PYVER in ${PYVERSIONS}; do ${PYBIN}${PYVER} -m pip uninstall -y tensorboard tb-nightly; done && \
for PYVER in ${PYVERSIONS}; do ${PYBIN}${PYVER} -m pip install tensorboard; done

# Create non-root user.
ARG USERNAME=vscode
ARG USER_UID=1000
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"extensions": [
"ms-python.python",
"ms-vscode.cpptools",
"github.copilot"
"github.copilot",
"github.vscode-pull-request-github"
],
// Enable GPUs.
"runArgs": [
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

name: Build package
runs-on: ubuntu-latest

container:
image: ghcr.io/mrphys/tensorflow-manylinux:1.12.0

Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Build docs
run: |
make docs PY_VERSION=${{ matrix.py_version }}

- name: Upload wheel
if: startsWith(github.ref, 'refs/tags')
uses: actions/upload-artifact@v2
Expand All @@ -81,12 +81,12 @@ jobs:


release:

name: Release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')

steps:

- name: Checkout docs branch
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
uses: softprops/action-gh-release@v1
with:
name: TensorFlow MRI ${{ env.release }}
body_path: RELEASE.rst
body_path: RELEASE.md
prerelease: ${{ contains(env.release, 'a') || contains(env.release, 'b') || contains(env.release, 'rc') }}
fail_on_unmatched_files: true

Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
__pycache__/
artifacts/
build/
logs/
third_party/spiral_waveform
tools/docs/_build
tools/docs/_templates
tools/docs/api_docs
tools/docs/index.rst
tools/docs/index.md
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true
"python.linting.enabled": true,
"notebook.output.textLineLimit": 500
}
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a list of individuals and organizations who are authors
# of this project for copyright purposes.
# For a full list of individuals who have contributed to the project, see the
# CONTRIBUTORS file.

Javier Montalt-Tordera <javier.montalt@outlook.com>
University College London
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @jmontalt
6 changes: 6 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file contains a list of individuals who have made a contribution to this
# project. If you are making a contribution, please add yourself to this list
# using the format:
# Name <email>

Javier Montalt-Tordera <javier.montalt@outlook.com>
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ TF_LDFLAGS := $(shell $(PYTHON) -c 'import tensorflow as tf; print(" ".join(tf.s
CFLAGS := -O3 -march=x86-64 -mtune=generic

CXXFLAGS := $(CFLAGS)
CXXFLAGS += $(TF_CFLAGS) -fPIC -std=c++14
CXXFLAGS += $(TF_CFLAGS) -fPIC -std=c++17 -fopenmp
CXXFLAGS += -I$(ROOT_DIR)

LDFLAGS := $(TF_LDFLAGS)
LDFLAGS += -lfftw3_omp -lfftw3f_omp -lfftw3 -lfftw3f -lm
LDFLAGS += -l:libspiral_waveform.a

all: lib wheel
Expand Down
135 changes: 135 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<div align="center">
<img src="https://raw.githubusercontent.com/mrphys/tensorflow-mri/v0.21.0/tools/assets/tfmri_logo.svg?sanitize=true">
</div>

[![PyPI](https://badge.fury.io/py/tensorflow-mri.svg)](https://badge.fury.io/py/tensorflow-mri)
[![Build](https://github.com/mrphys/tensorflow-mri/actions/workflows/build-package.yml/badge.svg)](https://github.com/mrphys/tensorflow-mri/actions/workflows/build-package.yml)
[![Docs](https://img.shields.io/badge/api-reference-blue.svg)](https://mrphys.github.io/tensorflow-mri/)
[![DOI](https://zenodo.org/badge/388094708.svg)](https://zenodo.org/badge/latestdoi/388094708)

<!-- start-intro -->

TensorFlow MRI is a library of TensorFlow operators for computational MRI.
The library has a Python interface and is mostly written in Python. However,
computations are efficiently performed by the TensorFlow backend (implemented in
C++/CUDA), which brings together the ease of use and fast prototyping of Python
with the speed and efficiency of optimized lower-level implementations.

Being an extension of TensorFlow, TensorFlow MRI integrates seamlessly in ML
applications. No additional interfacing is needed to include a SENSE operator
within a neural network, or to use a trained prior as part of an iterative
reconstruction. Therefore, the gap between ML and non-ML components of image
processing pipelines is eliminated.

Whether an application involves ML or not, TensorFlow MRI operators can take
full advantage of the TensorFlow framework, with capabilities including
automatic differentiation, multi-device support (CPUs and GPUs), automatic
device placement and copying of tensor data, and conversion to fast,
serializable graphs.

TensorFlow MRI contains operators for:

- Multicoil arrays
([`tfmri.coils`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/coils)):
coil combination, coil compression and estimation of coil sensitivity
maps.
- Convex optimization
([`tfmri.convex`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/convex)):
convex functions (quadratic, L1, L2, Tikhonov, total variation, etc.) and
optimizers (ADMM).
- Keras initializers
([`tfmri.initializers`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/initializers)):
neural network initializers, including support for complex-valued weights.
- I/O (`tfmri.io`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/io)):
additional I/O functions potentially useful when working with MRI data.
- Keras layers
([`tfmri.layers`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/layers)):
layers and building blocks for neural networks, including support for
complex-valued weights, inputs and outputs.
- Linear algebra
([`tfmri.linalg`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/linalg)):
linear operators specialized for image processing and MRI.
- Loss functions
([`tfmri.losses`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/losses)):
for classification, segmentation and image restoration.
- Metrics
([`tfmri.metrics`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/metrics)):
for classification, segmentation and image restoration.
- Image processing
([`tfmri.image`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/image)):
filtering, gradients, phantoms, image quality assessment, etc.
- Image reconstruction
([`tfmri.recon`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/recon)):
Cartesian/non-Cartesian, 2D/3D, parallel imaging, compressed sensing.
- *k*-space sampling
([`tfmri.sampling`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/sampling)):
Cartesian masks, non-Cartesian trajectories, sampling density compensation,
etc.
- Signal processing
([`tfmri.signal`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/signal)):
N-dimensional fast Fourier transform (FFT), non-uniform FFT (NUFFT)
([see also `TensorFlow NUFFT`](https://github.com/mrphys/tensorflow-nufft)),
discrete wavelet transform (DWT), *k*-space filtering, etc.
- Unconstrained optimization
([`tfmri.optimize`](https://mrphys.github.io/tensorflow-mri/api_docs/tfmri/optimize)):
gradient descent, L-BFGS.
- And more, e.g., supporting array manipulation and math tasks.

<!-- end-intro -->

## Installation

<!-- start-install -->

You can install TensorFlow MRI with ``pip``:

```
pip install tensorflow-mri
```

Note that only Linux is currently supported.

### TensorFlow Compatibility

Each TensorFlow MRI release is compiled against a specific version of
TensorFlow. To ensure compatibility, it is recommended to install matching
versions of TensorFlow and TensorFlow MRI according to the table below.

<!-- start-compatibility-table -->

| TensorFlow MRI Version | TensorFlow Compatibility | Release Date |
| ---------------------- | ------------------------ | ------------ |
| v0.22.0 | v2.9.x | Jul 24, 2022 |
| v0.21.0 | v2.9.x | Jul 24, 2022 |
| v0.20.0 | v2.9.x | Jun 18, 2022 |
| v0.19.0 | v2.9.x | Jun 1, 2022 |
| v0.18.0 | v2.8.x | May 6, 2022 |

<!-- end-compatibility-table -->

<!-- end-install -->

## Documentation

Visit the [docs](https://mrphys.github.io/tensorflow-mri/) for guides,
tutorials and the API reference.

## Issues

If you use this package and something does not work as you expected, please
[file an issue](https://github.com/mrphys/tensorflow-mri/issues/new)
describing your problem. We're here to help!

## Credits

If you like this software, star the repository! [![Stars](https://img.shields.io/github/stars/mrphys/tensorflow-mri?style=social)](https://github.com/mrphys/tensorflow-mri/stargazers)

If you find this software useful in your research, you can cite TensorFlow MRI
using its [Zenodo record](https://doi.org/10.5281/zenodo.5151590).

In the above link, scroll down to the "Export" section and select your favorite
export format to get an up-to-date citation.

## Contributions

Contributions of any kind are welcome! Open an issue or pull request to begin.
Loading