This repository contains the official implementation of the research described in:
NanoDriftGuard: open-source isotropic ångström-scale active stabilization for super-resolution microscopy
Any reuse of this code should cite the original associated publication.
Advanced active stabilization software achieving ångström-scale precision through sub-pixel image registration and incremental PID control. Built in MATLAB with GPU acceleration, NanoDriftGuard delivers real-time 3D drift correction at >50 Hz rates, making it ideal for ultra-high-precision microscopy applications. Its language-agnostic file I/O interface enables seamless integration with any programming environment, offering exceptional flexibility for diverse experimental setups.
-
Install the following prerequisites on a computer with a CUDA-compatible GPU:
- MATLAB R2023a or later
- Parallel Computing Toolbox
- MATLAB R2023a or later
-
Clone the repository
-
Open MATLAB and navigate to the project folder
-
Run the script
Demo.m
orBenchmark.m
- Specialized imaging system with fiducial marker detection capabilities
- GenTL-compatible camera
- MATLAB Image Acquisition Toolbox
- MATLAB Image Acquisition Toolbox Support Package for GenICam™ Interface
- Physik Instrumente (PI) nano-positioning stage
Note: Other hardware setups may require modifications to the control code.
-
Edit the example configuration file
NDG_Config.ini
according to your specific setup -
Run the following code in the MATLAB command window:
initMatlab; lventry('NDG_Config.ini');
If the settings are correct, you should see a figure displaying the initial image along with the linear fit. The command window will then print the running status.
Note: The paths in the examples are configured for Windows-style path conventions. If you are using a different operating system, please modify the path-related code (e.g.,
lvini2struct
inreadConfig.m
) accordingly.
This project builds upon Efficient subpixel image registration algorithms
@article{guizar-sicairosEfficientSubpixelImage2008,
author = {Guizar-Sicairos, Manuel and Thurman, Samuel T. and Fienup, James R.},
title = {Efficient Subpixel Image Registration Algorithms},
year = {2008},
doi = {10.1364/OL.33.000156},
journal = {Optics Letters}
}
lventry
: Entry point for the real-time control loop
regisXpress3
: High-efficiency 3D subpixel image registration with GPU acceleration, optimized for real-time applicationsPidManager
: Incremental PID controller for stage management, inherited fromStageManager64
StageManager64
: Custom PI stage control classfileManage
: File management utilitiesconnectCam
&getImg
: Utility functions for GenTL camera connection and image acquisitiongetReference
: Utility function for reference image acquisition and parameters of Z estimationreadConfig
: Utility function for readingini
configuration file in LabVIEW format
This project does not include a GUI. You can create your own GUI for better visualization of the drift status using MATLAB figures or other platforms.
This project incorporates code from , which is licensed under the BSD 3-Clause License.
NanoDriftGuard modifications are licensed under the MIT License.