Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

preprint paper website Github commit

multicolor DMD-SIM

This repository contains code for designing, analyzing, and carrying out multicolor structured illumination microscopy experiments based on a digital micromirror device (DMD-SIM), including DMD simulation code, DMD pattern generation, SIM reconstruction and instrument control. It also includes a number of useful utilities for simulating the resulting diffraction pattern given certain DMD patterns, determining system point-spread functions and optical transfer functions, and determining the affine transformation between the DMD coordinates and the imaging space coordinates. The various files are described in more detail below.

This repository is associated with the Biomedical Optics Express paper Multicolor structured illumination microscopy and quantitative control of polychromatic light with a digital micromirror device and the BioRxiv preprint. The repository state at the time of publication is archived here, or available as a release on GitHub.

The best way to use this python package is to install it with pip

git clone
cd mcSIM
pip install .

If you would like to edit the code, then install using the -e options,

git clone
cd mcSIM
pip install -e .

The dependencies for the experimental control code are not installed by default because the DMD control code relies on the windows specific pywinusb. To install these dependencies run

git clone
cd mcSIM
pip install .[expt_ctrl]

Some functions can be optionally run on a GPU. If this is desired, ensure your python environment has the appropriate version of CuPy installed

Analysis and simulation code

Code for reconstructing SIM images from raw data using a Gustafsson/Wiener filter style reconstruction. Several different reconstruction options are available, largely following either the approach of openSIM or fairSIM. To get started with reconstructing SIM data, see the example script

Code for simulating the diffraction patterns produced by the DMD. Various scripts illustrating the usage of this code can be found in the examples directory. This simulation code has many useful features, including an analytic solution for the joint blaze/diffraction condition, pattern simulation tools, tools for extracting the intensity pattern in the Fourier plane of a collecting lens, etc.

This file can be used to generate multicolor SIM patterns and other useful calibrations patterns for the DMD. It also contains many tools for working with the basis vector/unit cell representation of DMD patterns. This allows a complete enumeration of DMD diffraction orders in a compact and computationally efficient form.

Code to fit the affine transformation between the DMD coordinates and camera coordinates using imaging data from a DMD pattern consisting of many small points. These code relies on tools for working with affine transformations found here

Code for extracting optical transfer function from measurement of the strength of various Fourier peaks for a given SIM DMD pattern.

Code for doing the periodic/smooth image decomposition, an alternative to apodization for the Fourier transform. This code is taken from (with permission), and included here for convenience.

Miscellaneous image processing tools

Tools for IO of MicroManager style tif files and metadata.


Useful tools for automatically localizing sparse fluorescent beads and performing both 2D and 3D PSF fitting using various PSF models. Also provides useful statistics and figures summarizing the results. This code has now been split out into a separate repository. For more information about these tools, see the readme pip installing the mcsim repository as described above will also pull in these dependncies.


Scripts illustrated examples of different DMD simulations and analysis are stored in examples. Associated data is located in examples/data

Hardware control code


Code for controlling the DLP6500 DMD over USB on Windows. This code was initially based on the approaches of Lightcrafter6500DMDControl and Pycrafter6500.


This is the script used to define pattern sequences on the DMD using patterns which have been previously loaded onto the firmware using the Texas Instruments DLP6500 and DLP9000 GUI. It is a command line interface to, and it is used by run_sim_triggerscop.bsh.


A beanshell script which can be run from MicroManager 2.0 Gamma to acquire SIM data using to set the DMD patterns (assuming they have already been loaded into the DMD firmware as described above). This script programs a Triggerscope 3B, which then provides the analog and digital voltages required to run the rest of the experiment. The camera free runs as the master clock, triggering the Triggerscope. We use a customized version of the Triggerscope firmware V601.

This script supports collecting multidimensional data with the axis order xy-position/time/z-position/channel/SIM pattern. It also supports time-lapse imaging with arbitrary wait time.

This code was initially developed with Micro-Manager 2.0.0-gamma1 20200514, MMCore Version 10.1.0, Device API version 69, Module API version 10. But for more recent development we are using Micro-Manager 2.0.0-gamma1 20210516, MMCore Version 10.1.1, Device API version 70, Module API version 10.


MicroManager configuration file describing the equipment and settings used in the experiment.

Instrument design

Mechanical drawings of some parts used in the setup are included in the parts directory. For a more complete description of the setup and a parts list, see the published paper linked above. See in particular the parts list


Code for running a multicolor structured illumination microscopy (SIM) experiment using a DLP6500 digital micromirror device (DMD) and performing SIM reconstruction.








No packages published