rusty_psf/
types.rs

1use ndarray::{Array2, Array3};
2use num_complex::Complex64;
3use std::f64::consts::PI;
4
5/// Representation of a 2D or 3D point spread function
6#[derive(Clone, Debug)]
7pub struct PSF {
8    /// The PSF data array
9    pub data: Array3<f64>,
10    /// Physical size of each pixel/voxel in micrometers
11    pub spacing: [f64; 3],
12    /// Wavelength of light in micrometers
13    pub wavelength: f64,
14    /// Numerical aperture
15    pub numerical_aperture: f64,
16}
17
18/// Parameters for optical calculations
19#[derive(Clone, Debug)]
20pub struct OpticalParameters {
21    /// Numerical aperture
22    pub na: f64,
23    /// Wavelength in micrometers
24    pub wavelength: f64,
25    /// Refractive index
26    pub refractive_index: f64,
27}
28
29impl Default for OpticalParameters {
30    fn default() -> Self {
31        Self {
32            na: 1.4,
33            wavelength: 0.532,  // Green light in micrometers
34            refractive_index: 1.518,  // Oil immersion
35        }
36    }
37}
38
39/// Complex-valued wavefront
40pub type Wavefront = Array2<Complex64>;
41
42/// Real-valued phase
43pub type Phase = Array2<f64>;
44
45/// Constants used throughout the library
46pub mod constants {
47    use super::*;
48    
49    pub const TWO_PI: f64 = 2.0 * PI;
50    pub const SQRT_2: f64 = std::f64::consts::SQRT_2;
51    pub const DEFAULT_GRID_SIZE: usize = 64;
52}