Abstract
SIGNIFICANCE: Accurate and efficient photon modeling plays an essential role in the rapidly developing field of diffuse optical imaging, whereby the use of model-based analysis and image reconstruction can provide both educational and research benefits. AIM: NIRFASTerFF is a cross-platform (Linux, macOS, and Windows) Python package for finite element method (FEM)-based light propagation modeling, supporting continuous-wave, frequency-domain, and time-resolved data for both exogenous and endogenous optical imaging applications. It also enables modeling of the autocorrelation function ( G1 ) for diffuse correlation spectroscopy. Validation is performed through comparison with the original NIRFAST and gold-standard Monte Carlo simulations. APPROACH: NIRFASTerFF incorporates highly parallelized FEM solvers for efficient computation on both CPU and GPU, leveraging OpenMP and CUDA acceleration. To support image reconstruction tasks, voxel-based interpolation of the optical fluence is implemented, providing a flexible and accurate representation of the forward solution suitable for inverse problem formulations. RESULTS: Compared with its predecessor, NIRFASTer, the optimized algorithms provide a performance boost of 25% to 45% on GPU and up to 20% on CPU, and the results show good agreement with both Monte Carlo and analytical solutions. CONCLUSION: The NIRFASTerFF package provides a fast and license-free tool for photon modeling and can further streamline Python-based data processing in diffuse optical imaging, benefiting the biophotonics community.