Metadata-Version: 2.4
Name: mbipy
Version: 0.1.0
Summary: Modulation-based x-ray phase contrast imaging.
Author-email: Chris Ninham <christopher.ninham@insa-lyon.fr>
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: array-api-compat
Requires-Dist: numpy>=1.21
Requires-Dist: cupy ; extra == "cupy"
Requires-Dist: pyvkfft ; extra == "cupy"
Requires-Dist: jax ; extra == "jax"
Requires-Dist: jaxwt ; extra == "jax"
Requires-Dist: numba ; extra == "numba"
Requires-Dist: rocket-fft ; extra == "numba"
Requires-Dist: pywavelets ; extra == "numpy"
Requires-Dist: scipy ; extra == "numpy"
Requires-Dist: array-api-strict ; extra == "strict"
Requires-Dist: pytest ; extra == "test"
Requires-Dist: pytest-cov ; extra == "test"
Requires-Dist: pytest-env ; extra == "test"
Requires-Dist: pytest-randomly ; extra == "test"
Requires-Dist: torch>=1.13 ; extra == "torch"
Requires-Dist: torch-dct ; extra == "torch"
Requires-Dist: ptwt ; extra == "torch"
Project-URL: Bug Tracker, https://github.com/Nin17/mbipy/issues
Project-URL: Homepage, https://github.com/Nin17/mbipy
Provides-Extra: cupy
Provides-Extra: jax
Provides-Extra: numba
Provides-Extra: numpy
Provides-Extra: strict
Provides-Extra: test
Provides-Extra: torch

# mbipy

[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

Modulation based x-ray phase contrast imaging.

## Installation

Clone the repository and `cd` to the directory, then:

```shell
pip install .
```

## Usage

See the [example notebooks](examples).

## Algorithms

### Normal Integration

<details closed>
  <summary>Functional Interface</summary>

  | *function*  |   CuPy    |    JAX    |   Numba   |   NumPy   |  PyTorch  |
  | :---------: | :-------: | :-------: | :-------: | :-------: | :-------: |
  |   arnison   | &#128994; | &#128994; | &#128994; | &#128994; | &#128994; |
  | dct_poisson | &#128994; | &#128994; | &#128994; | &#128994; | &#128994; |
  | dst_poisson | &#128994; | &#128994; | &#128994; | &#128994; | &#128994; |
  |   frankot   | &#128994; | &#128994; | &#128994; | &#128994; | &#128994; |
  |   kottler   | &#128994; | &#128994; | &#128994; | &#128994; | &#128994; |
  |     li      | &#128994; | &#128308; | &#128308; | &#128994; | &#128308; |
  |  southwell  | &#10067;  | &#128308; | &#128308; | &#128994; | &#128308; |

</details>

<details closed>
  <summary>OOP Interface</summary>

  |  *class*  |   CuPy    |    JAX    |   Numba   |   NumPy   |  PyTorch  |
  | :-------: | :-------: | :-------: | :-------: | :-------: | :-------: |
  |    Li     | &#128994; | &#128308; | &#128308; | &#128994; | &#128308; |
  | Southwell | &#10067;  | &#128308; | &#128308; | &#128994; | &#128308; |

</details>

### Phase Retrieval

#### Implicit

<details closed>
  <summary>Functional Interface</summary>

  | *function* |   CuPy   |    JAX    |  Numba   |   NumPy   |  PyTorch  |
  | :--------: | :------: | :-------: | :------: | :-------: | :-------: |
  |    lcs     | &#10067; | &#128994; | &#10067; | &#128994; | &#128994; |
  |   lcs_df   | &#10067; | &#128994; | &#10067; | &#128994; | &#128994; |
  |  lcs_ddf   | &#10067; | &#128994; | &#10067; | &#128994; | &#128994; |

</details>

<details closed>
  <summary>OOP Interface</summary>

  | *class* |   CuPy   |   JAX    |  Numba   |   NumPy   |  PyTorch  |
  | :-----: | :------: | :------: | :------: | :-------: | :-------: |
  |   Lcs   | &#10067; | &#10067; | &#10067; | &#128994; | &#128994; |
  |  LcsDf  | &#10067; | &#10067; | &#10067; | &#128994; | &#128994; |
  | LcsDDf  | &#10067; | &#10067; | &#10067; | &#128994; | &#128994; |

</details>

#### Explicit

<details closed>
  <summary>Functional Interface</summary>

  | function |   CuPy   |    JAX     |  Numba   |   NumPy   | PyTorch  |
  | :------: | :------: | :--------: | :------: | :-------: | :------: |
  |   umpa   | &#10067; | &#10067; ¹ | &#10067; | &#128994; | &#10067; |
  |   xst    | &#10067; | &#10067; ¹ | &#10067; | &#128994; | &#10067; |
  |   xsvt   | &#10067; | &#10067; ¹ | &#10067; | &#128994; | &#10067; |
  | xst_xsvt | &#10067; | &#10067; ¹ | &#10067; | &#128994; | &#10067; |

</details>

<details closed>
  <summary>OOP Interface</summary>

  | function |   CuPy   |    JAX     |  Numba   |   NumPy   | PyTorch  |
  | :------: | :------: | :--------: | :------: | :-------: | :------: |
  |   Umpa   | &#10067; | &#10067; ¹ | &#10067; | &#128994; | &#10067; |
  |   Xst    | &#10067; | &#10067; ¹ | &#10067; | &#128994; | &#10067; |
  |   Xsvt   | &#10067; | &#10067; ¹ | &#10067; | &#128994; | &#10067; |
  | XstXsvt  | &#10067; | &#10067; ¹ | &#10067; | &#128994; | &#10067; |

</details>

<!-- TODO nin17: check these are actually correct -->

¹ Has significant memory usage during compilation due to lack of strides in JAX.

² No wavelet transform available in numba - contributions welcome!

## Data

To download the data for the examples, you need to use [git-lfs](https://git-lfs.com).

## Dependencies

* [array-api-compat](https://pypi.org/project/array-api-compat/)
* [numpy](https://pypi.org/project/numpy/)

Optional:

* [scipy](https://pypi.org/project/)
* [pywavelets](https://pypi.org/project/PyWavelets/)
* [cupy](https://pypi.org/project/cupy/)
  * [pyvkfft](https://pypi.org/project/pyvkfft/)
* [numba](https://pypi.org/project/numba/)
  * [rocket-fft](https://pypi.org/project/rocket-fft/)
* [jax](https://pypi.org/project/jax/)
  * [jaxwt](https://pypi.org/project/jaxwt/)
* [torch](https://pypi.org/project/torch/)
  * [torch-dct](https://pypi.org/project/torch-dct/)
  * [ptwt](https://pypi.org/project/ptwt/)

