Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
pull_request:

jobs:
test:
name: Tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: pip install -e ".[dev]"

- name: Run tests
run: pytest tests/ -v
env:
QT_QPA_PLATFORM: offscreen # headless Qt on Linux
28 changes: 28 additions & 0 deletions .github/workflows/generate-icns.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Generate macOS Icon

on:
workflow_dispatch: # run manually from GitHub Actions UI

jobs:
generate:
name: Generate Proteus.icns
runs-on: macos-latest

steps:
- uses: actions/checkout@v4

- name: Generate .icns
run: |
mkdir -p packaging/Proteus.iconset
for size in 16 32 64 128 256 512; do
sips -z $size $size src/proteus/resources/Proteus.png \
--out packaging/Proteus.iconset/icon_${size}x${size}.png
done
iconutil -c icns packaging/Proteus.iconset -o packaging/Proteus.icns
echo "Generated: $(ls -lh packaging/Proteus.icns)"

- name: Upload .icns artifact
uses: actions/upload-artifact@v4
with:
name: Proteus-icns
path: packaging/Proteus.icns
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

permissions:
contents: write # needed to create GitHub Release

jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
archive: Proteus-linux.tar.gz
- os: macos-latest
archive: Proteus-macos.tar.gz
- os: windows-latest
archive: Proteus-windows.zip

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Build (Linux / macOS)
if: runner.os != 'Windows'
run: bash packaging/build.sh --skip-tests

- name: Build (Windows)
if: runner.os == 'Windows'
run: packaging\build.bat --skip-tests

- name: Upload archive
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.archive }}
path: ${{ matrix.archive }}

release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest

steps:
- name: Download all archives
uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: Create release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
draft: false
prerelease: false
files: |
Proteus-linux.tar.gz
Proteus-macos.tar.gz
Proteus-windows.zip
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Python
__pycache__/
*.py[cod]
*.egg-info/
*.egg
.eggs/

# Virtual environments
.venv/
venv/

# PyInstaller
build/
dist/
*.spec.bak

# IDE
.vscode/
.idea/

# Testing
.pytest_cache/
.coverage
htmlcov/

# OS
.DS_Store
Thumbs.db
149 changes: 149 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,150 @@
# Proteus

<p align="center">
<img src="src/proteus/resources/Proteus.png" alt="Proteus Logo" width="180">
</p>

<p align="center">
<strong>Scientific Image Processing Desktop Application</strong>
</p>

---

Proteus is a desktop application for scientific image processing, built with PySide6 (Qt) and OpenCV. It provides an interactive canvas with real-time tools for enhancement, analysis, and visualization of grayscale and multi-band imagery.

## Features

- **Image Enhancement** — Histogram equalization, power-law (gamma) transform, partial inversion, pseudocolor mapping (JET colormap)
- **Sharpen / Binarize** — Unsharp mask (Original), Otsu auto-threshold (B/W Auto), fixed threshold at 128 (B/W 128), custom threshold dialog (B/W Custom)
- **Noise Reduction** — Gaussian denoising, blur-divide background correction
- **Multi-Band Pseudocolor** — Merge two images with custom band labels (e.g. UV + IR), blend 50/50, apply JET colormap
- **PCA Analysis** — Covariance and SVD-based principal component analysis for multi-band images (3–16 images), with Prev/Next result navigation
- **Drawing Tools** — Freehand brush for mask creation and region annotation
- **ROI Selection** — Region-of-interest cropping, auto-applied to PCA
- **Undo/Redo** — Full operation history with Undo/Redo support
- **Themes** — Light, Dark, and High-Contrast themes with a one-click toggle, persisted across sessions

## Requirements

- Python 3.10+
- PySide6 >= 6.5.0
- OpenCV >= 4.8.0
- NumPy >= 1.24.0

## Installation (development)

```bash
# Clone the repository
git clone https://github.com/yiyang26/Proteus.git
cd Proteus

# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"
```

## Usage

```bash
# Run via entry point
proteus

# Or run as a module
python -m proteus
```

## Running Tests

```bash
pytest
```

## Building a Standalone Executable

The build scripts handle everything: creating a venv, installing dependencies, running tests, and producing an archive.

> **Note:** Build on the target platform — Linux build for Linux, macOS for macOS, Windows for Windows.

### Linux

```bash
bash packaging/build.sh

# Skip tests
bash packaging/build.sh --skip-tests
```

Output: `dist/Proteus/` + `Proteus-linux.tar.gz`

### macOS

**One-time icon prep** (requires macOS):
```bash
mkdir -p packaging/Proteus.iconset
sips -z 1024 1024 src/proteus/resources/Proteus.png \
--out packaging/Proteus.iconset/icon_512x512@2x.png
iconutil -c icns packaging/Proteus.iconset -o packaging/Proteus.icns
```

```bash
bash packaging/build.sh

# Skip tests
bash packaging/build.sh --skip-tests
```

Output: `dist/Proteus.app` + `Proteus-macos.tar.gz`

### Windows

**One-time icon prep** (requires [ImageMagick](https://imagemagick.org)):
```bat
magick src\proteus\resources\Proteus.png ^
-define icon:auto-resize=256,128,64,32,16 packaging\Proteus.ico
```

```bat
packaging\build.bat

:: Skip tests
packaging\build.bat --skip-tests
```

Output: `dist\Proteus\Proteus.exe` + `Proteus-windows.zip`

## Project Structure

```
Proteus/
├── src/proteus/
│ ├── core/ # Processing logic (no UI dependencies)
│ │ ├── processing.py # Image enhancement & filtering functions
│ │ ├── pca.py # Principal component analysis
│ │ ├── image_io.py # Image load/save utilities
│ │ ├── state.py # ImageState & operation logging
│ │ └── utils.py # Shared helpers
│ ├── ui/ # PySide6 interface
│ │ ├── main_window.py # Main application window & signal wiring
│ │ ├── canvas.py # Interactive image canvas (QGraphicsView)
│ │ ├── top_bar.py # Logo, title, and theme toggle button
│ │ ├── sidebar.py # Collapsible tool panels
│ │ ├── status_bar.py # Status text and zoom controls
│ │ ├── dialogs.py # Parameter input dialogs
│ │ └── theme.py # Light / Dark / High-Contrast QSS theming
│ ├── resources/ # App icon and assets
│ └── app.py # Application entry point
├── tests/ # Test suite
├── packaging/ # Build scripts and PyInstaller spec
│ ├── Proteus.spec # PyInstaller configuration
│ ├── version_info.txt # Windows EXE version metadata
│ ├── build.sh # Linux / macOS build script
│ └── build.bat # Windows build script
└── pyproject.toml # Project metadata & dependencies
```

## License

See [LICENSE](LICENSE) for details.
Loading