WBIM is an all-optical serial multiphoton microscope designed for sub-micrometer resolution 3D imaging of organ-scale complex tissue. This system combines multiphoton microscopy with femtosecond laser machining to iteratively image and remove biological tissues with distinct optical and mechanical properties. The system has been tested for in situ imaging of the mouse brain-skull system.
This pipeline was developed using MATLAB 2021b and Python 3.10 on Windows 10. Basic two-photon microscopy operations were implemented using ScanImage. As this repository serves as instrument control software, running the code requires proper setup of the associated hardware, which is detailed in the referenced paper.
This repository contains the software and computational pipelines developed to enable multiday-long automated acquisition. Below is a detailed breakdown of the repository structure:
Analysiscontains the MATLAB script and classes for analyzing experimental results.Calibrationcontains the MATLAB scripts and classes for instrument calibration, including:- Automated HWP-PBS-based laser power control calibration
- Automated Pockels-cell-PBS-based laser power control calibration
- Servo motorized stage controller delay correction
- Femtosecond laser machining characterization
Controlcontains the major classes implemented for microscope control, including:WBIMConfig: base class for storing instrument parameters, coordinate transform, and configuration space.WBIMControlBase: child class ofWBIMConfig. Implements logging, motorized stage control, and piezo control.WBIMImaging: child class ofWBIMControlBase. Implements methods for automated serial imaging, including:- Acquisition grid generation
- Imaging hardware initialization and control (e.g., laser, imaging HWP, imaging shutter)
- Asynchronous data processing TCP server setup and data management
- ROI detection, classification, and acquisition trajectory path planning
- Visual-based quality control and hardware abnormal state detection (e.g., scanner desynchronization, laser failures)
WBIMAblation: child class ofWBIMControlBase. Implements methods for automated femtosecond laser machining, including:- Ablation hardware initialization and control (e.g., laser gating, ablation beam shutter, ablation HWP, pump, refractometers)
- Ablation ROI detection (e.g., multichannel 3D image spectrum unmixing, segmentation, classification)
- Coverage path planning (TSP algorithm)
- Ablation control sequence synthesis, execution, and monitoring
WBIMControl: child class ofWBIMControlBase, integratesWBIMImagingandWBIMAblationfor iterative imaging and ablation, including:- Operation mode switching between exploration, scan, and ablation
- Ablation refinements, including visual quality control, ablation parameter adjustment, and ablation refinement control
- Acquisition statement logging and tile management
- Asynchronous parallel data transfer to the cluster
- Additional classes include:
- Instrument control:
ZaberController,WBIMPowerHWP,ThorlabsPowerMeter - Data management:
WBIMTileManager,WBIMImagingGrid2D - Email and message notification:
WBIMNotification - Ablation control:
WBIMAblationPath3D,WBIMAblationPath2D
- Instrument control:
Laser_controlcontains the classes for controlling and monitoring Coherent Chameleon laser.Postprocessingcontains the scripts and classes for image processing, asynchronous data processing, and data management.Refractometercontains the classes for controlling inline refractometer and adjusting solution index.SITiffConvertercontains the asynchronously parallel tile processing pipeline, including:- Raw ScanImage Tiff stack analysis and conversion to H5 file
- TCP client class handling tile processing and data transfer
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.
If you find this repository helpful, please consider citing our work:
@article{Ji2025,
title={Spatiotemporal focusing enables all optical in situ histology of heterogeneous tissue},
author={Ji, Xiang and Huang, Sincheng and Friedman, Beth and Kleinfeld, David},
journal={Nature Methods},
volume={},
number={},
pages={},
year={2025},
publisher={Springer Nature},
url={}}