CassiniFlow 🪐

CassiniFlow is a modern, high-performance, cross-platform planetary, lunar, and solar astrophotography suite built with .NET 10, C# 14, and Avalonia UI 12.1.5, with both a graphical studio interface (CassiniFlow.Desktop) and a headless CLI (CassiniFlow.Cli).
Covering the entire workflow from preprocessing and multi-zone stacking to real-time Live Stacking & observatory automation, CassiniFlow handles high-speed video streams, atmospheric seeing analysis, multi-point alignment, calibration, real-time wavelet sharpening, and ASCOM Alpaca / ZWO hardware control.
🌟 Key Features
🔄 Four Dedicated Workflow Modes
- Pre-Processing Only: High-speed video/image stabilization, debayering, calibration, seeing ranking, and SER/FITS/TIFF export for external workflows.
- Stacking Only: Multi-zone alignment point (AP) stacking on raw or preprocessed sequences with Drizzle resampling and multi-tier output.
- Direct Stream (All-in-One): End-to-end preprocessing and multi-zone stacking in a single pass.
- Live Stacking (Preview): Real-time planetary acquisition, Top-K rolling-buffer stacking, À Trous wavelet sharpening, live analysis dock, and observatory hardware automation.
- SER (Lucam Recorder): High-speed 8-bit and 16-bit reading and writing (Mono, Bayer RAW, RGB) with v3 UTC trailer timestamp preservation.
- FITS (Flexible Image Transport System): Reading and exporting monochrome and color 16-bit/32-bit astronomical FITS files.
- TIFF & PNG: 16-bit TIFF stacking outputs (raw & wavelet-sharpened) and 8-bit PNG previews.
- Universal Video Containers: AVI, MP4, MOV decoding via OpenCvSharp, with transparent fallback and transcoding via FFmpeg CLI.
- WinJUPOS & Capture Sidecars: Automatic generation of WinJUPOS-compatible filenames (
YYYY-MM-DD-HHMM_S-System) and .CameraSettings.txt capture sidecars.
🔬 Offline Pre-Processing & Multi-Zone Stacking Engine
- Bayer Demosaicing (RAW Processing):
RGGB, BGGR, GBRG, GRBG with Bilinear, HQ Linear, and Malvar-He-Cutler (gradient-corrected) algorithms.
- Planetary Detection, Stabilization & 2D Field Derotation:
- Automatic planetary limb detection, sub-pixel center of gravity (CoG) tracking, apparent diameter measurement (
PlanetSizeAnalyzer), and rotational alignment (AutoRotationAligner).
- 2D Alt-Az / Dobsonian Field Derotation (
FieldDerotationEngine): exact time-varying parallactic angle $q(t) - q(t_{\text{ref}})$ compensation with optical mirror-parity support (IsMirrorInverted) and max-exposure blur estimation.
- Quality Timeline & Unified Frame Retention:
- Multi-algorithm seeing quality scanner (Gradient Sharpness, Peak Histogram) with chronological & sorted quality timeline graphs.
- Single-pass bounded Top-K heap (
< 900 MB RAM on 10,000+ 16-bit frames) and unified retention rules (FrameRetentionRule: percentage tiers or fixed frame counts).
- Multi-Zone AP Alignment & Stacking:
- Adaptive multi-scale alignment point (AP) grid with dark-background pruning and per-video manual grid persistence.
- Drizzle 1.5× / 3.0× resampling, brightness normalization, and Stacked Tier Comparator with objective sharpness scoring.
- Astrophotographic Calibration: Master Dark subtraction, Master Flat & Flat-Dark division, and hot-pixel removal across Batch and Join modes.
🎥 Live Stacking Studio (Preview)
- Real-Time Stacking & Alignment: Top-K rolling buffer, quality weighting, Sigma-Clipping, hybrid Planet CoG / Surface alignment, cloud brightness filter, and overexposed rejection.
- Non-Destructive Real-Time Processing: 6-layer À Trous Wavelets (
L1–L6) with fine/chroma denoising, presets, and instant Before/After split-view comparison; bilateral filter; Richardson-Lucy / Wiener deconvolution; solar H-Alpha enhancement.
- Collapsible Live Analysis Dock:
- RGB Histogram: linear/log scale, Auto-Stretch, Auto-WB (Gray World & Planetary Disk), saturation readout.
- Focus Assistant: 5 strategies (Contrast, Fourier, Histogram, Multi-Star FWHM, Bahtinov).
- Seeing Monitor: live quality curve with auto/manual threshold and seeing-triggered SER recording pause/resume.
- ADC & Drift: visual & digital Atmospheric Dispersion Corrector (
AdcAlignmentIndicatorControl) and cumulative Drift Graph.
- Framing, Reticules & Display FX: Mouse-drawn ROI & Auto-ROI target tracking, centering/collimation/multi-ring reticules with concentricity score, channel isolation/negative/flips/rotation, and Ghost Frame overlay.
- Live Calibration & Capture: Live Master Dark/Flat capture, hot/cold pixel removal, H/V banding suppression, 16-bit raw/sharpened snapshots, and background
.SER recording (frame/time limits, sequences, WinJUPOS naming, EmergencySave).
- Cameras, Profiles & Observatory Automation:
- Cameras: ZWO ASI native SDK, cross-platform ASCOM Alpaca Camera REST, optional third-party native SDK detection, local video/SER playback, TEC cooling/fan/dew-heater control, JSON capture profiles, USB auto-reconnect, and optional simulators (hidden by default).
- Observatory Hardware: ASCOM Alpaca (Mount, Focuser, Filter Wheel), ZWO EFW native SDK, and simulated devices.
- Automation: Closed-loop Mount Feature Tracking, quadratic V-Curve Autofocus, L-R-G-B Planetary Sequencer, and serpentine Lunar/Solar Mosaic Planner.
🖥️ Desktop UI & CLI
- CassiniFlow.Desktop (Avalonia 12.1.5):
- Isolated Live & File Viewers (
AstroViewerControl) with smooth zoom, pan, pixel readout, and split-view comparison.
- Themes: Deep Space (Dark), Clean Lab (Light), and astronomy-safe Night Vision (Red).
- Bilingual (FR / EN) on-the-fly localization with contextual
? HelpBadge tooltips on every accordion.
- Categorized Settings Window: Sidebar navigation (Performance & CPU, Cameras & Hardware, Profiles & Data) plus session settings Import/Export, interactive tutorial, and explicit error diagnostics.
- CassiniFlow.Cli: Headless CLI executable for scripted batch automation.
🏛️ Architecture & Design
CassiniFlow strictly follows Hexagonal Architecture (Ports & Adapters) and Domain-Driven Design (DDD):
┌────────────────────────┐ ┌────────────────────────┐
│ CassiniFlow.Desktop │ │ CassiniFlow.Cli │
│ (Avalonia 12.1.5) │ │ (Console) │
└───────────┬────────────┘ └───────────┬────────────┘
│ │
▼ ▼
┌────────────────────────────────────────────────────────┐
│ CassiniFlow.Application │
│ RunPipeline, PreviewFrame, QualityTimeline, │
│ LiveStackingSession, ObservatoryAutomation │
└───────────┬───────────────────────────────▲────────────┘
│ │
▼ │
┌────────────────────────┐ │
│ CassiniFlow.Domain │ │
│ (Pure, zero deps) │ │
│ AstroFrame, LiveEngine│ │
│ FieldDerotation, │ │
│ PlanetaryAutomation │ │
└────────────────────────┘ │
│
┌───────────────────────────────────────────┴────────────┐
│ CassiniFlow.Infrastructure │
│ Codecs (SER, FITS, TIFF), OpenCV, FFmpeg CLI, │
│ ZWO ASI/EFW, ASCOM Alpaca REST, LocalVideo, Simulators │
└────────────────────────────────────────────────────────┘
- Zero-Allocation Processing Loops: Extensive use of
Span<T>, ReadOnlySpan<T>, Memory<T>, and ArrayPool<T>.
- Cross-Platform: Native execution on Windows and Linux (x64 & ARM64).
🚀 Getting Started
Prerequisites
- .NET 10.0 SDK or later.
- (Optional, for MP4 and non-SER video streams): FFmpeg installed and available on
PATH.
Building & Testing from Source
git clone https://github.com/cloud0259/CassiniFlow.git
cd CassiniFlow
dotnet build CassiniFlow.slnx -c Release
dotnet test tests/CassiniFlow.Tests/CassiniFlow.Tests.csproj -c Release --no-build
📖 Usage
Graphical Interface (Desktop)
dotnet run --project src/CassiniFlow.Desktop/CassiniFlow.Desktop.csproj -c Release
- File Workflows (Pre-Processing, Stacking Only, Direct Stream): Drag and drop SER, FITS, or video files, inspect quality on the timeline, pick a preset or tune accordions, and click Start Processing.
- Live Stacking (Preview): Select your camera (or load a local
.ser/video file), connect, adjust exposure/gain/wavelets/analysis tools, and capture snapshots or .SER sequences.
Command-Line Interface (CLI)
dotnet run --project src/CassiniFlow.Cli/CassiniFlow.Cli.csproj -- [options]
- Center Jupiter, crop to 512×512, and retain the top 25% highest-quality frames:
CassiniFlow.Cli -i "captures/jupiter_raw.ser" -o "output/" --center --crop 512,512 --quality-limit 25% --debayer RGGB
- Stabilize a lunar crescent and export as a 16-bit SER file:
CassiniFlow.Cli -i "captures/moon.avi" -o "output/moon_stabilized.ser" --center --format ser16
- Join Mode: Concatenate multiple sequences with automatic WinJUPOS-compatible naming:
CassiniFlow.Cli -i "captures/*.ser" --mode join -o "output/" --winjupos
🤝 Contributing
- Fork the repository.
- Create a dedicated branch (
git checkout -b feat/new-feature).
- Follow the project’s coding conventions (Hexagonal Architecture, DDD, Conventional Commits,
dotnet format).
- Add unit tests in
tests/CassiniFlow.Tests/.
- Submit a Pull Request targeting
develop.
📄 License
This project is distributed under the MIT License. See LICENSE for details.
评论