Skip to content

mviereck/microscopy-tools

Repository files navigation

microscopy-tools

Tools for microscopy and image focus stacking.

  • Tools already useful, in active development:
    • imfuse: Fuse focus stackshot images with ImageMagick. (Terminal)
    • stackprepare: Batch processing of image stack for contrast, crop, gamma etc.
  • Tools considered to be (mostly) stable and ready for use:
    • stackalign: Align image stack with the help of focus-stack and ImageMagick.
    • imgruler: Draw a ruler or micrometer into an image. (Terminal)
  • Tools awaiting further development, currently less useful:
    • camcfg: Terminal dialog frontend for camera configuration. (Terminal)
  • Deprecated, stored for partial code reuse:
    • stackfuser: Align, prepare and fuse focus stack images. (GUI)
    • stackshooter: Shoot focus stackshots with stepper motor and camera. (GUI)

stackfuser and stackshooter need some further development and documentation before they can be recommended for general use. Especially they need a new GUI backend because the currently used kaptain GUI is outdated and does not run on up-to-date systems.

imfuse

Combines focus stackshot images to an overall sharp image.

Dependencies:

  • imagemagick version 7 (command magick)
  • geeqie and feh (optional image viewers)
  • exiftool (optional to preserve exif meta data)
  • PetteriAimonen/focus-stack (optional for option --align)
  • enfuse (optional, needed for some options)

Much thanks to the developers and supporters of ImageMagick!

stackalign

Aligns image stack.

Dependencies:

The core work is done by focus-stack, this tool helps to crop the images to the usable common area.

stackprepare

Batch processing of image stack for contrast, crop, gamma etc.

Dependencies:

  • imagemagick

imgruler

Draws a ruler into an image. Intended to draw micrometers into micoscopic captures. Contains a calibration instruction in english and german.

Runs on Linux, macOS and (in Cygwin) on MS Windows. Considered to be ready for general use.

Dependencies:

  • imagemagick

camcfg

dialog frontend for gphoto2 camera configuration. Reads possible configurations of a camera and provides a dialog in terminal to choose desired settings. Beta stage, already useable.

  • camcfg shows all available configurations.
  • camcfg ENTRY shows configuration of entry ENTRY. Example: camcfg iso

Dependencies:

  • dialog
  • gphoto2

stackfuser

GUI frontend for image foto stacking with enfuse.

Deprecated, will be replaced by multiple single tools.

Provides:

  • Image preprocessing with imagemagick to enhance contrast and sharpness.
  • Image alignment with ffmpeg/vidstab or align_image_stack.
  • Generating multiple overall sharp images from stackshot with enfuse. Further combining of these results with imagemagick.
  • Animated videos of focus stackshots.

Dependencies, most essentiell:

  • align_image_stack (hugin tools)
  • enfuse
  • geeqie
  • imagemagick
  • imfuse
  • kaptain
  • viewnior

Dependencies, also recommended:

stackshooter

GUI for foto stacking with a stepper motor controlled by an Arduino and a camera connected on USB. Note: The user must be in group dialout to access the Arduino.

Deprecated, will be replaced.

Features:

  • Camera control with gphoto2 for preview videos and tethered shooting.
  • Stepper motor control for focus adjustment.
  • Automated focus stackshots combining camera and stepper motor.

pololu_a4988.ino is my code to control my stepper motor driver with an Arduino. The control commands send by stackshooter to Arduino can be customized in stackshooter configuration dialog.

Dependencies:

  • ffmpeg
  • geeqie
  • gphoto2
  • align_image_stack (hugin tools)
  • kaptain
  • xinput
  • xdotool

Example

Image of some flower pollen. Generated with stackshooter and stackfuser. Technic: Microscope from Hund/Wetzlar with a stepper motor and an arduino. Camera: Canon EOS 1000D. Stackshot result of 240 single captures with slightly different focus:

screenshot

Iconified excerpt of source stackshot:

screenshot

Animated video:

screenshot

Related tools

Free and Open Source

  • CombineZP: Stacker for MS Windows. Works with wine on Linux, too. Good but unfortunately not maintained.
  • enfuse: Enfuse blends differently exposed images of the same scene into a nice output image. Command line tool, used by stackfuser.
  • Entangle: Entangle provides a graphical interface for "tethered shooting", aka taking photographs with a digital camera completely controlled from the computer.
  • PetteriAimonen/focus-stack: A cross-platform tool for focus stacking images based on wavelet algorithms.
  • pulsar123/Macro-scripts: A set of BASH scripts and C++ programs representing a complete workflow for processing macro focus stacking photographs.
  • gphoto2: The gphoto2 library allows access and control of various digital camera models. Command line tool, used by stackshooter and camcfg.
  • hugin: Hugin is a panorama photo stitching program for several overlapping photos taken from the same location, transforming the photos to one larger image.
  • ImageMagick: ImageMagick is a powerful software suite to create, edit, and compose bitmap images. Command line tool, used by almost all tools in this repo.
  • mfkter: GUI for enfuse. Replaces former MacroFusion.
  • RawTherapee: RawTherapee is an advanced program for developing raw photos and for processing non-raw photos.
  • ImageMagick scripts:

Closed Source freeware

  • Picolay: Stacker for MS Windows. Works with wine on Linux, too.
  • stacky: Stacker for MS Windows. Works with wine on Linux, too.

Closed Source commercial

  • Helicon Focus: 30 days trial version. Available for Mac and Windows.
  • ZereneStacker: 30 days trial version. Available for Linux, Mac and Windows.