less-denoise 0.1.0
LESS: Linear Expansion of SubSpace Thresholding for Neural Image Denoising
Requires Python: >=3.7

# LESS: Linear Expansion of SubSpace Thresholding for Neural Image Denoising

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

<div align="center">
  <img src="logo.png" alt="LESS Logo" width="500">
</div>

LESS (Linear Expansion of SubSpace thresholding) is an ultrafast and robust denoising algorithm engineered specifically for neuron imaging. By leveraging noise statistics and the intrinsic low-rank structure of neural data, LESS effectively eliminates noise while strictly preserving neuronal morphology and activity patterns. Its unique combination of processing speed and high-fidelity restoration makes it the ideal choice for rapid prototyping and real-time analysis workflows.

## Features

- <b>Extreme computational efficiency</b>: achieve >1000-fold speed improvements compared to recent self-supervised denoising algorithms  
- <b>Superior restoration quality</b>: validated on both simulated and real-world datasets across various challenging imaging conditions
- <b>Theoretical reliability </b>: clear mathematical principles, making the processing transparent and interpretable
- <b>Broad accessibility</b>: available as a comprehensive library (Python, MATLAB, and Java) and user-friendly plugins in napari and ImageJ

## Quick Start

### Python Installation

**From PyPI:**
```bash
pip install less-denoise
```

**From source:**
```bash
git clone https://github.com/TISGroup/LESS.git
cd LESS
pip install -e .
```

### Basic Usage

```python
from less import less_denoise

# Denoise with automatic parameter estimation
denoised = less_denoise(
    data_input='data/demoMovie.tif',  # Use demo file or your own data
    save_path='denoised_output.tif',
    estimate_params=True,
    verbose=True
)
```

Or via command line:

```bash
less-denoise --data data/demoMovie.tif --estimate-params --verbose
```

## Repository Structure

```
LESS/
├── less/           # Python library (core implementation)
├── examples/       # Example scripts for basic and advanced usage
├── notebooks/      # Jupyter/Colab notebooks and tutorials
├── benchmarks/     # Denoising speed and quality benchmarks
├── tests/          # Unit and integration tests
├── matlab/         # MATLAB implementation and scripts
├── imagej/         # ImageJ/Fiji plugin
├── docs/           # Documentation sources
├── external/       # External and referenced repositories
├── setup.py        # Python package build script
├── pyproject.toml  # Python packaging configuration (PEP 517/518)
└── requirements.txt # Python dependencies list
```

**Notes:**
- The `less/` directory contains the main Python denoising implementation and CLI.
- `matlab/` contains the current MATLAB implementation (see status below).
- `imagej/` is under development as a Java plugin for ImageJ/Fiji.
- Examples use demo data in the `data/` subfolder (not shown here).

## Comparison with Other Implementations

| Feature | Python | MATLAB | ImageJ (Java) |
|---------|--------|--------|---------------|
| GUI | CLI | Script | ✅ Dialog |
| GPU Support | ✅ CUDA | ✅ MATLAB GPU | ✅ CLIJ2  |
| Multi-GPU | ✅ | ❌ | ❌ |
| Parameter Estimation | ✅ | ❌ | ❌ |
| External Calling | ✅ | ✅ | ✅ |

## Examples

### Python Examples

See the `examples/` directory for:
- `demo.py`: Basic denoising example using `data/demoMovie.tif`
- `basic_usage.py`: Various usage patterns with demo data

### Jupyter Notebooks

- `notebooks/tutorial.ipynb`: Step-by-step tutorial
- `notebooks/colab/less_colab_demo.ipynb`: Google Colab demo

## Benchmarks

Run performance benchmarks:

```bash
cd benchmarks
python benchmark_gpu.py --data /path/to/test/data.tif
python benchmark_data_size.py
```

## Requirements

### Python

- Python 3.7+
- PyTorch
- NumPy
- tifffile
- See `requirements.txt` for full list

## Citation

If you use LESS in your research, please cite:

```bibtex
@article{less2024,
  title={LESS: Linear Expansion of SubSpace Thresholding for Neural Image Denoising},
  author={Your Name},
  journal={Journal Name},
  year={2024}
}
```

## License

This project is licensed under the MIT License - see the LICENSE file for details.


## Contact

For questions, issues, or contributions, please open an issue on GitHub.