This repository contains a Python script that automates the stitching of images captured with a Keyence microscope using the BZ_X800 Analyzer Software. The script uses the pyautogui library to simulate user interactions, streamlining the stitching process.
- Automates the opening of image folders and
.gcifiles. - Simulates key presses and mouse clicks for the stitching workflow in the BZ_X800 Analyzer Software.
- Customizable delays to adapt to different system setups.
- Automatically stitches images and saves the channels and overlays in the specified folder.
- Keyence BZ_X800 Analyzer Software installed on your system.
- A Windows operating system (required for
pyautoguioperations). - Python 3.7 or later.
- Clone this repository to your local machine:
git clone https://github.com/MehdiAliomrani/keyence-image-stitching.git
- Navigate to the project directory:
cd keyence-image-stitching - Install the required Python dependencies:
pip install -r requirements.txt
- Update the
test_foldervariable institch_images.pyto point to the directory containing your images. - Open a terminal and navigate to the project directory.
- Run the script:
python stitch_images.py
Important Notes:
- Ensure all images to be stitched are organized in subfolders within the
test_folder. - The script uses pre-configured delays (
time.sleep) and mouse/keyboard actions tailored for the Keyence BZ_X800 Analyzer Software. Adjust these as needed for your setup.
Here’s how the folder structure should look:
Captured slides/
├── XY01/
│ ├── Image_XY01.gci
├── XY02/
│ ├── Image_XY02.gci
The script will:
- Open each folder.
- Process the
.gcifiles using the BZ_X800 software. - Automate the stitching process through key presses and mouse clicks.
- Save all channels and overlays to the specified folder.
- The script relies on hardcoded mouse coordinates. If your screen resolution or software layout differs, adjust the coordinates in the script.
- Ensure the Keyence BZ_X800 software is running and in focus when the script starts.
Contributions are welcome! If you have suggestions for improvements or new features, feel free to submit an issue or a pull request.
This project is licensed under the MIT License.
Thanks to the Ghashghaei Lab for supporting this work.