Skip to content

HMYamano/BiScan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BiScan

Bidirectional scan correction GUI tool for MEMS + Galvano mirror point-scanning microscopes

Overview

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.

Features

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)

Installation

Requirements

Environment Setup (first time only)

Create a dedicated conda environment in the project folder.

conda env create --prefix ".\env" -f environment.yml

Estimated time: 5–10 minutes, Disk usage: ~1–2 GB


Launching

Double-click run.bat

Or from the command prompt:

cd /d "y:\hayato\Code\Bilateral_correction_GUI"
run.bat

Usage

1. Open a File

  • Menu File > Open Raw TIFF or the Open Raw TIFF... button in the Controls panel
  • Number of frames, size, and dtype will be displayed

2. Interleave Preview

  • 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

3. Z-profile

  • 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

4. Shift Measurement

  • 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

5. Export

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 0 to save all frames (default).
    • Example: set to 4 to discard the first 4 interleaved frames (= first 2 raw frames) from the output file.

6. Layout

  • 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

File Structure

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)

Dependencies

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)

About

MEMS + Galvano mirror bidirectional scan correction GUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors