Bidirectional scan correction GUI tool for MEMS + Galvano mirror point-scanning microscopes
BiScan is a GUI application that processes raw TIFF data acquired with a point-scanning microscope combining a MEMS mirror (fast resonant scan) and a Galvano mirror (slow scan).
Each raw frame is split into top and bottom halves:
- Top half: Galvano mirror forward scan
- Bottom half: Galvano mirror reverse scan (flipped vertically for correction)
These are used to perform interleave reconstruction.
| Feature | Description |
|---|---|
| Interleave Preview | Real-time preview of interleaved raw frames (zoom/pan supported) |
| Z-profile | Time-series plot of average brightness across all interleaved frames |
| Shift Measurement | Quantify X/Y shift between forward and reverse scans using ECC and phase correlation methods |
| Save Interleaved TIFF | Export as interleaved multi-page TIFF (BigTIFF compatible); optionally skip the first N frames |
| Save Shift Figure | Save a figure summarizing shift measurement results and Z-profile |
| Layout Save | Save and restore window layout to/from file (docking supported) |
- Miniconda or Anaconda
- Windows 10 / 11
Create a dedicated conda environment in the project folder.
conda env create --prefix ".\env" -f environment.ymlEstimated time: 5–10 minutes, Disk usage: ~1–2 GB
Or from the command prompt:
cd /d "y:\hayato\Code\Bilateral_correction_GUI"
run.bat- Menu File > Open Raw TIFF or the Open Raw TIFF... button in the Controls panel
- Number of frames, size, and dtype will be displayed
- Browse interleaved frames with the frame slider
- Even index: Top (forward scan)
- Odd index: Bottom (reverse scan, flipped vertically)
- Mouse wheel to zoom, left drag to pan, double-click to reset
- Toggle displayed frame type with the Top / Bottom checkboxes
- Click Compute Z-profile to calculate and plot the average brightness of all frames
- X-axis: interleaved frame number
- Click Auto-scale to auto-adjust axis range
- Enter the number of frames to average in N frames for avg (0 = all frames)
- Click Measure Shift to run
- Results from both the ECC method (high-precision measurement using time-averaged image) and the phase correlation method (per-frame statistics) are displayed
| Button | Output File |
|---|---|
| Save Interleaved TIFF | {original filename}_interleaved.tif |
| Save Shift Figure | {original filename}_shift_profile.png |
- Skip first N interleaved frames: Enter the number of interleaved frames to skip at the beginning before saving. Set to
0to save all frames (default).- Example: set to
4to discard the first 4 interleaved frames (= first 2 raw frames) from the output file.
- Example: set to
- Drag windows by their title bar to move and resize freely
- Windows can be docked together (tabbed or split layout)
- Layout > Save Layout: save the current layout
- Layout > Reset Layout: restore the default layout
BiScan/
├── biscan.py # Main application
├── run.bat # Launch script (Windows)
├── environment.yml # conda environment definition
├── bilateral_gui.ini # Layout save file (auto-generated)
└── env/ # conda environment (generated after initial setup)
| Package | Purpose |
|---|---|
dearpygui |
GUI framework |
numpy |
Array operations |
tifffile |
TIFF file read/write |
opencv-python |
Shift measurement via ECC and phase correlation |
matplotlib |
Save shift measurement result figures |
tqdm |
Progress bar for CLI scripts (optional) |