Science Score: 57.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
✓Institutional organization owner
Organization ssec-jhu has institutional domain (ai.jhu.edu) -
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.2%) to scientific vocabulary
Repository
Fourier Light Field Microscopy
Basic Info
- Host: GitHub
- Owner: ssec-jhu
- License: bsd-3-clause
- Language: Python
- Default Branch: main
- Size: 577 KB
Statistics
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 25
- Releases: 3
Metadata Files
README.md
SSEC-JHU flfm

Fourier Light Field Microscopy (FLFM)
Fourier Light Field Microscopy (FLFM) is a technique for scan-free volumetric imaging. FLFM utilizes an array of lenses to simultaneously acquire several images from different viewpoints. These images are then post-processed to generate a 3D volume using a Richardson-Lucy-based deconvolution algorithm. This enables volumetric imaging at the exposure time of the camera, a speed unmatched by conventional volumetric scanning. This fast imaging is particularly useful for samples with transient signals, where the time spent scanning will miss relevant information. For example, FLFM is ideal for capturing the transient activity of point-like neurons in 3D.
Quickstart
term
pip install git+https://github.com/ssec-jhu/flfm.git
See Usage for quick and easy usage instructions for this Python package.
To start using the local GUI application run:
term
pip install -r requirements/app.txt
python flfm/cli.py app
For further detail regarding the GUI application see Starting the UI app and GUI user manual.
Installation, Build, & Run instructions
Git LFS:
- This repo uses git Large File Storage (git-lfs) for tracking data files, i.e., image file. To download these data
files git-lfs is required. To install git-lfs please follow these git-lfs instructions.
Conda:
For additional cmds see the Conda cheat-sheet.
- Download and install either miniconda or anaconda.
- Create new environment (env) and install
conda create -n <environment_name> - Activate/switch to new env
conda activate <environment_name> cdinto repo dir.- Install
pythonandpipconda install python=3.11 pip - Install all required dependencies (assuming local dev work), there are two ways to do this
- If working with tox (recommended)
pip install -r requirements/dev.txt. - If you would like to setup an environment with all requirements to run outside of tox
pip install -r requirements/all.txt.
- If working with tox (recommended)
Build:
#### with Python ecosystem:
* cd into repo dir.
* conda activate <environment_name>
* Build and install package in pip install .
* Do the same but in dev/editable mode (changes to repo will be reflected in env installation upon python kernel restart)
[!NOTE] This is the preferred installation method for dev work.
pip install -e ..[!NOTE] If you didn't install dependencies from
requirements/dev.txt, you can install a looser constrained set of deps using:pip install -e .[dev].[!NOTE] For GPU acceleration either PyTorch or JAX can be re-installed with their accelerator options. For PyTorch see the PyTorch installation docs. E.g.,
pip install --force -r requirements/pytorch.txt --index-url https://download.pytorch.org/whl/cu126. For JAX see the JAX installation docs. E.g.,pip install --force jax["cuda12"]. Since both are installed viarequirements/prd.txt,--forceor--upgrademust be used to re-install the accelerator versions.--forceis preferable as it will error if the distribution is not available at the given url index, however--upgrademay not.
#### with Docker (C++ version only):
* Download & install Docker - see Docker install docs.
* cd into repo dir.
* OpneCV with CUDA support: docker buildx build -f docker/Dockerfile.opencv --platform linux/amd64 . -t opencv_image
* flfm.exe: docker buildx build -f docker/Dockerfile.flfm --platform linux/amd64 . -t flfm
* Run container interactively: docker run --platform linux/amd64 -it flfm sh
Usage
Follow the above Quickstart or Build with Python ecosystem instructions.
Using the command line interface (i.e., from a terminal prompt):
term
python flfm/cli.py main flfm/tests/data/yale/light_field_image.tif flfm/tests/data/yale/measured_psf.tif reconstructed_image.tiff --normalize_psf=True --lens_radius=230 --lens_center="(1000,980)" --backend=torch
_NOTE: The above data files are only present when cloning the repo and not when pip installing the package.
Within a Python session or Jupyter notebook: ```python import flfm.util from flfm.backends import reload_backend
The following can be pre-set in flfm/settings.py prior to import, or prior to invoking the notebook when using env vars,
e.g., FLFM_BACKEND=jax jupyter notebook. However, to dynamically change the backend the following code snippet
can be used.
reload_backend("jax") # or "torch"
import flfm.io import flfm.restoration
Read in images. NOTE: These data files are only present when cloning the repo and not when pip installing the package.
image = flfm.io.open(flfm.util.findpackagelocation() / "tests" / "data" / "yale" / "lightfieldimage.tif") psf = flfm.io.open(flfm.util.findpackagelocation() / "tests" / "data" / "yale" / "measured_psf.tif")
Normalize PSF.
psf_norm = psf / flfm.restoration.sum(psf)
Compute reconstruction.
reconstruction = flfm.restoration.reconstruct(image, psf_norm)
Clip image to view only the central lens perspective.
croppedreconstruction = flfm.util.cropandapplycircle_mask(reconstruction, center=(1000, 980), radius=230)
Save cropped reconstruction to file.
flfm.io.save("reconstructedimage.tif", croppedreconstruction) ```
Starting the UI app
Follow the above Build with Python ecosystem instructions. Then install the additional application dependencies:
terminal
pip install -r requirements/app.txt
Start the app from a terminal with:
terminal
python flfm/app/main.py
The app should then be reachable from a browser at 127.0.0.1:8080.
The host IP and port number are set and can be edited in flfm/settings.py. The following environmental variables can also be used.
* FLFM_APP_HOST
* FLFM_APP_PORT
For example, to change the port number before starting the app you can use:
terminal
FLFM_APP_PORT=8000 python flfm/app/main.py
From a Jupyter notebook
Run the following in a notebook cell.
python
from flfm.app.main import dash_app
dash_app.run()
See dash in jupyter for further options and details.
Manually using uvicorn/gunicorn
Run either of the following from a terminal:
terminal
FLFM_APP_WEB_API=fastapi uvicorn flfm.app.main:app --host=127.0.0.1 --port=8080
terminal
FLFM_APP_WEB_API=flask gunicorn flfm.app.main:dash_server -b 127.0.0.1:8080
ImageJ Plugin
A plugin for ImageJ is available from ssec-jhu/flfm-ij-plugin.
Testing
NOTE: The following steps require pip install -r requirements/dev.txt.
Using tox
- Run tox
tox. This will run all of linting, security, test, docs and package building within tox virtual environments. - To run an individual step, use
tox -e {step}for example,tox -e test,tox -e build-docs, etc.
Typically, the CI tests run in github actions will use tox to run as above. See also ci.yml.
Outside of tox:
The below assume you are running steps without tox, and that all requirements are installed into a conda environment, e.g. with pip install -r requirements/all.txt.
NOTE: Tox will run these for you, this is specifically if there is a requirement to setup environment and run these outside the purview of tox.
Linting:
Facilitates in testing typos, syntax, style, and other simple code analysis tests.
* cd into repo dir.
* Switch/activate correct environment: conda activate <environment_name>
* Run ruff .
* This can be automatically run (recommended for devs) every time you git push by installing the provided
pre-push git hook available in ./githooks.
Instructions are in that file - just cp ./githooks/pre-push .git/hooks/;chmod +x .git/hooks/pre-push.
Security Checks:
Facilitates in checking for security concerns using Bandit.
* cd into repo dir.
* bandit --severity-level=medium -r flfm
Unit Tests:
Facilitates in testing core package functionality at a modular level.
* cd into repo dir.
* Run all available tests: pytest .
* Run specific test: pytest tests/test_util.py::test_base_dummy.
Regression tests:
Facilitates in testing whether core data results differ during development. * WIP
Smoke Tests:
Facilitates in testing at the application and infrastructure level. * WIP
Build Docs:
Facilitates in building, testing & viewing the docs.
* cd into repo dir.
* pip install -r requirements/docs.txt
* cd docs
* make clean
* make html
* To view the docs in your default browser run open docs/_build/html/index.html.
Owner
- Name: Scientific Software Engineering Center at JHU
- Login: ssec-jhu
- Kind: organization
- Email: ssec@jhu.edu
- Location: United States of America
- Website: https://ai.jhu.edu/ssec/
- Repositories: 1
- Profile: https://github.com/ssec-jhu
Accelerating Software Development for Science Research
GitHub Events
Total
- Create event: 26
- Release event: 1
- Issues event: 104
- Watch event: 1
- Delete event: 22
- Issue comment event: 103
- Push event: 102
- Public event: 1
- Pull request review event: 68
- Pull request review comment event: 56
- Pull request event: 54
- Fork event: 2
Last Year
- Create event: 26
- Release event: 1
- Issues event: 104
- Watch event: 1
- Delete event: 22
- Issue comment event: 103
- Push event: 102
- Public event: 1
- Pull request review event: 68
- Pull request review comment event: 56
- Pull request event: 54
- Fork event: 2
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 80
- Total pull requests: 33
- Average time to close issues: 4 months
- Average time to close pull requests: 22 days
- Total issue authors: 2
- Total pull request authors: 4
- Average comments per issue: 0.61
- Average comments per pull request: 1.61
- Merged pull requests: 18
- Bot issues: 0
- Bot pull requests: 9
Past Year
- Issues: 80
- Pull requests: 33
- Average time to close issues: 4 months
- Average time to close pull requests: 22 days
- Issue authors: 2
- Pull request authors: 4
- Average comments per issue: 0.61
- Average comments per pull request: 1.61
- Merged pull requests: 18
- Bot issues: 0
- Bot pull requests: 9
Top Authors
Issue Authors
- jamienoss (71)
- ryanhausen (9)
Pull Request Authors
- jamienoss (20)
- dependabot[bot] (9)
- ryanhausen (3)
- rayadkins4 (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- ai.djl.pytorch:pytorch-engine 0.32.0
- ai.djl:api 0.32.0
- info.picocli:picocli 4.7.7
- net.imagej:ij 1.54p
- org.apache.commons:commons-imaging 1.0.0-alpha5
- org.junit.jupiter:junit-jupiter-api test
- org.junit.jupiter:junit-jupiter-params test
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/upload-artifact v4 composite
- codecov/codecov-action v3 composite
- actions/checkout v4 composite
- actions/download-artifact v4.1.7 composite
- actions/setup-python v4 composite
- actions/upload-artifact v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- python 3.11-slim build