Advanced PSF Modeling
Microscopy-grade optics modeling, dropped into ComfyUI
- image
- processed_image
- processing_info
If you've landed on this page wondering what a "numerical aperture" is doing in a ComfyUI node, you're not the target user for most of this pack - and that's fine, because this node isn't either. It's a point-spread-function (PSF) modeling tool built with real optical physics parameters, the kind of thing you'd expect in fluorescence microscopy or astrophotography software, not an AI image generator's post-processing toolkit. Most people generating images in ComfyUI will never touch this node. If you're restoring microscope captures or telescope images and happen to be using ComfyUI as your processing graph, this is exactly the tool.
How it works
A point-spread function describes how a single point of light gets smeared by an optical system before it reaches the sensor - every real lens or microscope objective blurs a point source into some characteristic shape, and if you know that shape you can (partially) invert it via deconvolution, the same basic idea as RichardsonLucyGPUNode elsewhere in this pack, but grounded in actual optical theory rather than a generic Gaussian or motion-streak approximation. psf_type offers four real, established models: airy_disk is the theoretical diffraction-limited PSF any perfect lens produces; gibson_lanni is a widely-used model for fluorescence microscopy that accounts for real optical aberrations from mismatched refractive indices between the sample, coverslip, and immersion medium; born_wolf is a classic vector diffraction theory model, more rigorous than the scalar Airy approximation; blind_estimation skips the physics model entirely and tries to estimate the PSF directly from the image. wavelength and numerical_aperture are the actual physical parameters that determine an optical system's real resolution limit - this node isn't approximating them, it's using them.
The inputs and outputs that matter
image- required.psf_type-airy_disk,gibson_lanni,born_wolf, orblind_estimation.psf_size(5–63, odd numbers only, default 15) - small (7–15) for subtle correction, medium (15–31) for balanced processing, large (31–63) for strong aberrations.wavelength(optional, meters, default 5.5e-7 = 550nm/green light) - matches the actual light wavelength your imaging setup used; blue around 400–500nm, red around 600–700nm.numerical_aperture(optional, 0.1–1.5, default 1.4) - a real property of your optical setup; higher values (1.0–1.5, oil immersion territory) mean higher resolution and a tighter, more demanding PSF to model correctly.noise_ratio(optional, 0.001–0.1, default 0.01) - feeds the deconvolution step; higher if your source is noisier.preset(optional, defaultnone) -fluorescence_40x,fluorescence_100x,confocal_high_na,airy_theoretical- bundled parameter sets for common real microscopy setups, worth starting from if you actually know what kind of objective produced your image.- Outputs:
processed_imageandprocessing_info.
How to install it
Search Eric_Image_Processing_Nodes in ComfyUI Manager, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/Eric_Image_Processing_Nodes
cd Eric_Image_Processing_Nodes
pip install -r requirements.txt
Restart ComfyUI. This is physics-based modeling and deconvolution, not a pretrained network - nothing downloads on first use. Only the pack's core requirements (numpy, opencv-python, scikit-image, scipy, PyWavelets) apply.
Common issues & troubleshooting
You're not sure what any of this means and just want to sharpen a normal photo. This node isn't built for that use case - for ordinary photos, use RichardsonLucyGPUNode's Gaussian/motion presets, or one of the pack's AI-based restorers (SwinIR, Restormer) instead. AdvancedPSFNode assumes you actually know or can estimate your optical system's real parameters.
Don't know your wavelength/numerical_aperture values. If you're processing genuine microscopy output, check your acquisition software or scope metadata for the objective's NA and the fluorophore's emission wavelength rather than guessing - these are physical constants of your specific setup, not tunable aesthetic parameters. If you can't get real values, blind_estimation skips needing them entirely.
Result looks over- or under-corrected. psf_size too small won't capture the real extent of the blur; too large can overreach and introduce artifacts. Start from one of the preset bundles closest to your actual imaging setup rather than tuning psf_size blind.
Using this on astrophotography instead of microscopy. airy_disk and born_wolf are general diffraction models, not microscopy-specific - they're reasonable starting points for telescope optics too. gibson_lanni, with its refractive-index-mismatch modeling, is the one that's specifically about microscope sample geometry and won't map cleanly onto astronomical imaging.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| psf_type | COMBO | airy_disk | PSF modeling type: • airy_disk: Theoretical diffraction limit • gibson_lanni: Fluorescence microscopy with aberrations • born_wolf: Vector diffraction theory • blind_estimation: Estimate PSF from image |
| psf_size | INT | 155–63 | PSF size (odd numbers only): • 7-15: Small PSF for subtle effects • 15-31: Medium PSF for balanced processing • 31-63: Large PSF for strong aberrations |
| wavelengthopt | FLOAT | 04e-7–7e-7 | Light wavelength in meters: • 400-500nm: Blue light • 500-600nm: Green light (default 550nm) • 600-700nm: Red light |
| numerical_apertureopt | FLOAT | 1.40.1–1.5 | Numerical aperture: • 0.1-0.5: Low resolution • 0.5-1.0: Medium resolution • 1.0-1.5: High resolution (oil immersion) |
| noise_ratioopt | FLOAT | 0.0100.001–0.1 | Noise ratio for deconvolution: • 0.001: Low noise • 0.01: Medium noise • 0.1: High noise |
| presetopt | COMBO | none | PSF presets: • none: Use manual settings • fluorescence_40x: 40x fluorescence objective • fluorescence_100x: 100x oil immersion • confocal_high_na: High-NA confocal |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| processed_image | IMAGE | — |
| processing_info | STRING | — |