Metadata-Version: 2.4
Name: selfphish
Version: 0.1.0
Summary: A deep neural network data reconstruction platform for phase retreival
Project-URL: homepage, https://github.com/XYangXRay/selfphish
Project-URL: repository, https://github.com/XYangXRay/selfphish
Project-URL: documentation, https://github.com/XYangXRay/selfphish
Author-email: Xiaogang Yang <xiaogang.yang@outlook.com>
License: BSD 3-Clause License
        
        Copyright (c) 2022, Brookhaven National Lab
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        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.
        
        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.
        
        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.
License-File: AUTHORS.rst
License-File: LICENSE
Keywords: Data reconstruction,GAN,Phase retrieval
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: ipython>=8.36.0
Requires-Dist: matplotlib>=3.7.3
Requires-Dist: numpy>=1.25.0
Requires-Dist: scikit-image>=0.21.1
Requires-Dist: tensorflow[and-cuda]>=2.16.0
Requires-Dist: tifffile>=2024.08.01
Requires-Dist: tqdm>=4.66.1
Provides-Extra: pytorch
Requires-Dist: quantities; extra == 'pytorch'
Requires-Dist: torch>=2.7.0; extra == 'pytorch'
Requires-Dist: torchvision; extra == 'pytorch'
Description-Content-Type: text/markdown

# SELFPHISH: a Self-supervised, Physics-Informed generative networks approach for the phase retrieval

# Overview

SELFPHISH is a data reconstruction framework that harnesses the power of self-supervised, physics-informed generative networks. While traditional reconstruction methods rely on intricate algorithms to piece together fragmented data, SELFPHISH leverages deep generative models that are both self-supervised and guided by physical constraints to reimagine and revitalize the phase retrieval process.

Originally designed for complex phase retrieval in tomography and holography, SELFPHISH shines in its adaptability. With the capability to incorporate user-defined forward models, this framework can be flexibly adapted for various advanced data reconstruction challenges.

# Features

1. Self-supervised, Physics-Informed Networks: At its core, SELFPHISH employs deep generative networks that are both self-supervised and physics-guided, enabling cutting-edge reconstruction performance.
2. Specialized for Phase Retrieval: Optimized for tasks in phase retrieval and tomography, ensuring precise and reliable reconstructions.
3. Modular Design: The architecture allows users to integrate their own forward models, making it adaptable for a range of reconstruction challenges.
4. Efficient and Scalable: Built to manage large datasets, SELFPHISH maintains speed and efficiency without compromising reconstruction accuracy.

# Installation

This guide provides detailed steps for setting up the `selfphish` package in a Conda environment.

## Steps for General Users

### 1. Create & Activate a Conda Environment
Open your terminal and create a new environment named `selfphish` with Python 3.11:

```bash
conda create --name selfphish python=3.10
conda activate selfphish
```

### 2. Install TensorFlow OR PyTorch 
Choose and install either TensorFlow or PyTorch based on your preference.

For TensorFlow:
```bash
pip install tensorflow
```

For PyTorch (ensure you select the correct version for your system from the official website):
```bash
# Example command for installing PyTorch with CUDA support
pip install torch torchvision torchaudio
```

### 3. Install 'selfphish' from PyPI
Finally, install the selfphish package from PyPI:
```bash
pip install selfphish
```

## Steps for Developers

If you are contributing to SELFPHISH development, please follow these steps to set up your development environment:

### 1. Create & Activate a Conda Environment
Open your terminal and create a new conda environment named `selfphish` with Python 3.11:

```bash
conda create --name selfphish python=3.10
conda activate selfphish
```

### 2. Install TensorFlow OR PyTorch 
Choose and install either TensorFlow or PyTorch.

For TensorFlow:
```bash
pip install tensorflow
```

For PyTorch:
```bash
# Example command for installing PyTorch with CUDA support
pip install torch torchvision torchaudio
```

### 3. Clone the SELFPHISH Repository
Clone the repository from GitHub to your local machine:

```bash
git clone https://github.com/XYangXRay/selfphish.git
```

### 4. Install the Required Packages
Navigate to the repository’s main directory and install the necessary packages in editable mode:

```bash
cd selfphish
python3 -m pip install -e .
```

## Additional Notes for Users

### Choosing Between TensorFlow and PyTorch
If unsure which one to choose, consider the requirements of your project or your familiarity with the libraries:
- **TensorFlow** is known for its production deployment capabilities and integration with TensorFlow Extended (TFX).
- **PyTorch** is favored for its simplicity, dynamic computation graph, and strong research community support.

### Installing GPU Support
SELFPHISH is designed for GPU-accelerated tasks. Ensure you install the GPU versions of TensorFlow or PyTorch. Refer to their official websites for instructions on installing GPU support.

# Examples

SELFPHISH currently includes examples for phase retrieval of holography:

1. Holography phase retrieval:
   - [Phase Retrieval Example](https://github.com/XYangXRay/selfphish/blob/main/examples/holography_tf.ipynb)
2. X-ray tomography:
   - [Tomography Example](https://github.com/XYangXRay/selfphish/blob/main/examples/tomography_tf.ipynb)

# References

If you find SELFPHISH useful for your research or projects, please consider citing:

J. Synchrotron Rad. (2020). 27, 486-493.  
Available at: [https://doi.org/10.1107/S1600577520000831](https://doi.org/10.1107/S1600577520000831)