-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the comprehensive documentation for HoloGen, a synthetic hologram dataset generation toolkit for machine learning workflows. This documentation covers all features, from basic usage to advanced customization.
- Installation & Setup
- 5-Minute Quickstart
- Complex Fields Quick Start - Fast introduction to complex field support
Start here if you're new to HoloGen or digital holography:
For experimental holography and ML research:
- Complex Field Support - Amplitude, phase, and complex representations
- Noise Simulation - Realistic optical and sensor imperfections
- Holography Methods (Coming Soon) - Inline vs off-axis strategies
- Examples & Recipes (Coming Soon) - Research workflows
For extending HoloGen or building custom pipelines:
- Pipeline Architecture (Coming Soon) - Component design and data flow
- API Reference (Coming Soon) - Complete API documentation
- Shape Generators (Coming Soon) - Creating custom shapes
- Utilities Reference (Coming Soon) - Helper functions
- Complex Field Support - Complete - Amplitude, phase, and complex representations
- Noise Simulation - Complete - Sensor noise, speckle, and aberrations
- Shape Generators (Coming Soon) - Object-domain pattern generation
- Holography Methods (Coming Soon) - Inline and off-axis strategies
- Pipeline Architecture (Coming Soon) - Dataset generation workflow
- I/O Formats (Coming Soon) - File formats and data loading
- CLI Reference (Coming Soon) - Command-line interface guide
- API Reference (Coming Soon) - Complete API documentation
- Utilities Reference (Coming Soon) - Utility functions
- Examples & Recipes (Coming Soon) - Practical code examples
| Feature | Status | Documentation | Description |
|---|---|---|---|
| Complex Field Support | ✅ Complete | COMPLEX_FIELDS.md | Amplitude, phase, and complex representations |
| Noise Simulation | ✅ Complete | NOISE_SIMULATION.md | Sensor noise, speckle, aberrations |
| Inline Holography | ✅ Complete | Coming Soon | On-axis hologram recording |
| Off-Axis Holography | ✅ Complete | Coming Soon | Carrier-based hologram recording |
| Shape Generators | ✅ Complete | Coming Soon | Circle, rectangle, ring, checkerboard patterns |
| Dataset Writers | ✅ Complete | Coming Soon | NumPy .npz and PNG export |
| Reconstruction Pipeline | ✅ Complete | Coming Soon | Object-domain recovery |
| CLI Interface | ✅ Complete | Coming Soon | Command-line dataset generation |
| PyTorch Integration | ✅ Complete | COMPLEX_FIELDS.md | DataLoader examples |
| TensorFlow Integration | ✅ Complete | COMPLEX_FIELDS.md | Dataset examples |
- Python 3.11 or higher
- NumPy 2.3.x
- Pillow 12.x
- SciPy 1.16.x
-
Clone the repository (or download the source):
git clone <repository-url> cd hologen
-
Create a virtual environment:
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Install HoloGen in editable mode:
pip install -e . -
Verify installation:
python -c "import hologen; print(hologen.__version__)"
For development and testing:
pip install pytest pytest-cov black ruffFor visualization examples:
pip install matplotlibGenerate a simple dataset with default settings:
python scripts/generate_dataset.pyThis creates 5 samples in the dataset/ directory with:
- 512×512 pixel resolution
- Inline holography method
- Amplitude-only objects (circles, rectangles, rings)
- Intensity output (backward compatible)
The dataset includes:
dataset/
├── npz/ # NumPy data files
│ ├── sample_00000_circle.npz
│ ├── sample_00001_ring.npz
│ └── ...
└── preview/ # PNG visualizations
├── object/
├── hologram/
└── reconstruction/
python scripts/generate_dataset.py \
--samples 100 \
--object-type phase \
--output-domain complex \
--phase-shift 1.5708Use case: Biological cell imaging, quantitative phase imaging
python scripts/generate_dataset.py \
--samples 100 \
--sensor-shot-noise \
--sensor-read-noise 3.0 \
--speckle-contrast 0.8Use case: Training robust reconstruction models
python scripts/generate_dataset.py \
--samples 100 \
--method off_axis \
--carrier-frequency-x 1e6 \
--carrier-frequency-y 0Use case: Spatial frequency separation, single-shot holography
python scripts/generate_dataset.py \
--samples 10000 \
--output ./large_dataset \
--no-preview \
--seed 42Use case: Training deep learning models
- Learn about complex fields: COMPLEX_FIELDS.md
- Add realistic noise: NOISE_SIMULATION.md
-
Explore all CLI options:
python scripts/generate_dataset.py --help
The following documentation is planned and will be added progressively:
Status: Coming Soon
Documentation for all available shape generators:
- CircleGenerator
- RectangleGenerator
- RingGenerator
- CircleCheckerGenerator
- RectangleCheckerGenerator
- EllipseCheckerGenerator
- TriangleCheckerGenerator
- Creating custom shape generators
Status: Coming Soon
Detailed explanation of holography strategies:
- Inline holography principles and configuration
- Off-axis holography principles and configuration
- Carrier frequency selection
- Angular spectrum propagation
- Method comparison and selection guide
Status: Coming Soon
Understanding the dataset generation pipeline:
- Component overview (Producer, Converter, Generator, Writer)
- Configuration objects (GridSpec, OpticalConfig, HolographyConfig)
- Data flow and transformations
- Customizing the pipeline
- Protocol-based design patterns
Status: Coming Soon
File formats and data loading:
- NPZ format specification (intensity and complex)
- PNG preview format
- Directory structure
- Loading data in PyTorch, TensorFlow, and NumPy
- Backward compatibility
- Writer classes and customization
Status: Coming Soon
Complete command-line interface documentation:
- All argument categories and descriptions
- Common usage patterns
- Argument combinations and validation
- Performance considerations
- Batch generation scripts
Status: Coming Soon
Complete technical API documentation:
- Module organization
- Type definitions and protocols
- Shape generators API
- Converter classes API
- Holography strategies API
- Noise models API
- Utility functions API
- Exception classes
Status: Coming Soon
Utility functions and helpers:
- Field conversion utilities
- I/O utilities
- Mathematical utilities
- Usage examples and best practices
Status: Coming Soon
Practical examples for common tasks:
- Basic examples (simple datasets, loading, visualization)
- Intermediate examples (custom generators, custom noise)
- Advanced examples (multi-scale datasets, ML integration)
- Research examples (parameter studies, ablation studies)
- Code recipes (batch processing, memory efficiency)
HoloGen supports four representations of optical fields:
| Representation | Formula | Information | Use Case |
|---|---|---|---|
| Intensity | I = |E|² | Magnitude squared | Classical holography, backward compatibility |
| Amplitude | A = |E| | Magnitude only | Amplitude-based reconstruction |
| Phase | φ = arg(E) | Phase angle only | Quantitative phase imaging |
| Complex | E = A·exp(iφ) | Complete field | Physics-aware models, full information |
See COMPLEX_FIELDS.md for detailed explanations.
- Amplitude Objects: Absorbing samples (stained cells, printed patterns)
- Phase Objects: Transparent samples (unstained cells, phase masks)
- Complex Objects: Mixed absorption and phase modulation (future)
- Inline: On-axis recording, requires twin-image removal
- Off-Axis: Carrier frequency separation, single-shot reconstruction
- Sensor Noise: Read noise, shot noise, dark current, quantization
- Speckle Noise: Coherent illumination interference patterns
- Aberrations: Optical imperfections (defocus, astigmatism, coma)
See NOISE_SIMULATION.md for parameter details.
python scripts/generate_dataset.py --samples 10python scripts/generate_dataset.py \
--samples 1000 \
--output ./research_dataset \
--method inline \
--height 1024 \
--width 1024 \
--pixel-pitch 3.45e-6 \
--wavelength 532e-9 \
--distance 0.05 \
--object-type phase \
--output-domain complex \
--phase-shift 1.5708 \
--sensor-shot-noise \
--sensor-read-noise 2.5 \
--sensor-bit-depth 12 \
--speckle-contrast 0.7 \
--speckle-correlation 2.5 \
--aberration-defocus 0.15 \
--seed 42python scripts/generate_dataset.py \
--samples 100000 \
--output ./production_dataset \
--method off_axis \
--height 512 \
--width 512 \
--pixel-pitch 6.4e-6 \
--wavelength 532e-9 \
--distance 0.05 \
--carrier-frequency-x 1e6 \
--carrier-frequency-y 0 \
--object-type amplitude \
--output-domain intensity \
--no-preview \
--seed 42- Start with default settings to understand the output
- Use preview images to visualize results
- Begin with small sample counts (10-100) for experimentation
- Read the Complex Fields Quick Start for modern features
- Always set
--seedfor reproducibility - Document all parameters used for dataset generation
- Use realistic noise parameters matching your experimental setup
- Generate separate clean and noisy datasets for ablation studies
- Use complex output for physics-aware models
- Use editable installation (
pip install -e .) for development - Run tests with
pytestbefore committing changes - Follow the protocol-based design patterns for extensions
- Consult the API reference for implementation details (coming soon)
- Use
--no-previewfor large datasets to reduce I/O - Generate in batches if memory is limited
- Use intensity output instead of complex for 2x memory savings
- Reduce grid resolution for faster generation
- Disable noise models when not needed
- Use multiple processes for parallel generation (script modification required)
- Complex fields require 2x storage compared to intensity
- PNG previews add ~30% storage overhead
- Use compression for long-term storage
Issue: ModuleNotFoundError: No module named 'hologen'
Solution: Install the package with pip install -e .
Issue: Phase-only objects look uniform in intensity
Solution: This is correct! Phase objects are invisible in intensity. Check the hologram or use complex output.
Issue: Out of memory errors
Solution: Reduce --samples, --height, or --width, or use --no-preview
Issue: Holograms look too noisy
Solution: Reduce noise parameters or disable noise models
Issue: No contrast in reconstructions
Solution: Check propagation distance and wavelength parameters
- Check the relevant documentation section
- Review the Complex Fields documentation for field-related questions
- Review the Noise Simulation documentation for noise-related questions
- Check the examples in the documentation
- Open an issue on the project repository
Contributions are welcome! Areas where documentation would benefit from community input:
- Additional examples and use cases
- Integration guides for specific ML frameworks
- Performance benchmarks
- Experimental validation studies
- Custom shape generator examples
HoloGen is released under the MIT License. See the LICENSE file for details.
If you use HoloGen in your research, please cite:
@software{hologen,
title = {HoloGen: Synthetic Hologram Dataset Generation Toolkit},
author = {[Author Names]},
year = {2024},
url = {[Repository URL]}
}- ✅ Complex field support (amplitude, phase, complex representations)
- ✅ Comprehensive noise simulation (sensor, speckle, aberrations)
- ✅ Inline and off-axis holography methods
- ✅ Multiple shape generators (7 types)
- ✅ PyTorch and TensorFlow integration examples
- ✅ CLI interface with extensive configuration options
- 📋 Additional shape generators (custom patterns, images)
- 📋 Advanced noise models (atmospheric turbulence, vibration)
- 📋 Multi-wavelength holography
- 📋 Polarization support
- 📋 GPU acceleration for large-scale generation
HoloGen builds on principles from digital holography, computational imaging, and machine learning research. We acknowledge the contributions of the holography and ML communities.