GithubHelp home page GithubHelp logo

dixing0908 / mcsim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qi2lab/mcsim

0.0 0.0 0.0 17.31 MB

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

License: GNU General Public License v3.0

Python 100.00%

mcsim's Introduction

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.

Published work using this code

Installation

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

git clone https://github.com/QI2lab/mcSIM.git
cd mcSIM
pip install .

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

git clone https://github.com/QI2lab/mcSIM.git
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 https://github.com/QI2lab/mcSIM.git
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

SIM reconstruction code

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

DMD simulation code

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.

Utility code

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 https://github.com/jacobkimmel/ps_decomp (with permission), and included here for convenience.

Miscellaneous image processing tools, primarily for working with Fourier transforms

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 dependencies.

Examples

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

Hardware control code

Hardware control is based around MicroManager2.0. Currently, we control the instrument using a fork of the napari-micromanager project which controls the MicroManager core using pymmcore-plus. Our fork of this project relies on MicroManager device drives to control cameras and stages, and on python code to control the DMD and DAQ. The "device adapters" for the DMD and DAQ are found below

Code for controlling the DLP6500 DMD over USB on Windows. This code was initially based on the approaches of Lightcrafter6500DMDControl and Pycrafter6500. Extension to other operating systems has not been implemented but should be straightforward.

This file also includes functions used to define pattern sequences on the DMD using patterns have either been previously loaded onto the firmware using the Texas Instruments DLP6500 and DLP9000 GUI or which are loaded "on-the-fly". There is a low-level interface for running these patterns based directly on their index in the firmware. There is also a higher-level interface which supports defining "channels" and "modes" which can be saved in a json configuration file.

When run as a script, this file provides a command line interface to programming DMD pattern sequences.

Code for controlling a national instruments DAQ through PyDAQmx

DAQ configuration file describing "modes" and "channels" for the DAQ. This file is used by nidaq instances created with daq.py

This file is used to create DAQ sequences for SIM and ODT experiments

expt_ctrl/*.cfg

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

useful script files

Example scripts which are useful for controlling various instruments during testing include load_dmd_pattern.py, setup_optotune_mre2.py, and set_dmd_odt_pattern.py

Instrument design

A parts list and mechanical drawings of some parts used in the setup are included in the parts directory. For a more complete description of the optical path, see our BOE paper linked above.

mcsim's People

Contributors

ptbrown1729 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.