Skip to content

GrussmayerLab/TPR4Py

Repository files navigation

TomographicPhaseRetrieval for Python - TPR4Py

TPR4Py is a tool to recover quantitative phase differences from a 3D stack of bright field images. It is based on the Matlab script from https://c4science.ch/source/TomPhaseRet/ further described in:

Descloux, A., Grußmayer, K.S., Bostan, E. et al. Combined multi-plane phase retrieval and super-resolution optical fluctuation imaging for 4D cell microscopy. Nature Photon 12, 165–172 (2018). https://doi.org/10.1038/s41566-018-0109-4

1 Clone & install editable

git clone https://github.com/GrussmayerLab/TPR4Py.git
cd TPR4Py
pip install -e .[dev,napari]   # dev extras include napari, magicgui, numba, pytest

2 Run from the command line\

tpr4py path/to/stack.tif -o results/

run with test data (from source)

 tpr4py tests/data/fiji_test.tif -o tests/data/

run with custom processing file

tpr4py tests/data/fiji_test.tif -o tests/data/ --phase-config settings/default.yaml

3 run from script

 
import pathlib
from tpr4py.core.utils.io import load_data, write_data
from tpr4py.core import run_phase_retrieval
from tpr4py.core.utils.processing_loader import build_phase_structure

input_path = r'path/to/file.tif'
base_name = pathlib.Path(filename).stem
stack, filename = load_data(
            input_path,
            use_bioformats=True, # if available with javaVM, oterhwise fallsback to tifffile
            series=series, # in case of bioformats series specification
            z_slice=z_slice, # in case of 4d data
        )
s = build_phase_structure(path_to_config, config_class)
s.optics_NA = 1.3 # edit parameters if necessary 
qp = run_phase_retrieval.run_phase_retrieval(stack, s)
write_data(qp, out_dir, base_name) # will append a QP_ before the original filename

4 Open Napari and launch the plug‑in (To be fixed)

napari

→ Plugins → tpr_viewer → select your stack → QP appears

License

Copyright © 2018 Adrien Descloux - adrien.descloux@epfl.ch, École Polytechnique Fédérale de Lausanne, LBEN/LOB, BM 5.134, Station 17, 1015 Lausanne, Switzerland.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

About

TPR4Py is a tool to recover quantitative phase differences from a 3D stack of Koehler illuminated bright field images. It is based on the Matlab script from https://c4science.ch/source/TomPhaseRet/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors