Skip to content

LidkeLab/smite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MATLAB

smite: Single Molecule Imaging Toolbox Extraordinaire

This work was supported by the following grants.

This MATLAB-based toolbox provides analysis tools for fluorescence single molecule imaging with an emphasis on single molecule localization microscopy (SMLM) and single particle tracking (SPT).


Overview

Workflow concept

smite is designed around the concept that a parameter structure, the Single Molecule Fitting (SMF) structure, uniquely and completely defines the data analysis. The results are completely contained in a Single Molecule Data (SMD) structure. smite is designed to make lowest-level tools just as easy to use as the higher-level application-specific classes. All tools make use of the SMF and SMD structures.

Code organization

smite is organized into a set of namespaces that group similar tools and concepts. The namespace +smi contains the highest level tools that will be the most common entry point for processing SMLM and SPT data sets. The file SMITEclasses.md provides a short 1-line description of each class in the distribution.

Image and Detector Model

Image arrays follow MATLAB's column-major format. An image coordinate of (1,1) means the center of the top-left pixel, whereas (2,1) would indicate the center of the pixel that is one down from the top, but in the left-most column.


πŸ€– LLM-Assisted Development

This repository includes comprehensive LLM-friendly documentation designed for interactive assistance with smite.

Note: Documentation generated by Claude Sonnet 4.5. Not extensively human-reviewed. Report issues.

Setup (5 minutes)

  1. Clone smite locally (skip if you already have it)

    cd ~/Documents/MATLAB  # or your preferred location
    git clone https://github.com/LidkeLab/smite.git
  2. Install Claude Desktop

    Download from claude.ai/download

  3. Enable filesystem access

    In Claude Desktop: File β†’ Settings β†’ Extensions β†’ Enable "Filesystem"

  4. Configure access to smite

    In the Filesystem extension settings, add the path where you cloned smite:

    • Example (Linux/MacOS): ~/Documents/MATLAB/smite
    • Example (Windows): C:\Users\YourName\Documents\MATLAB\smite
  5. Start using

    In any conversation, tell Claude:

    Read the file: ~/Documents/MATLAB/smite/LLM_DOCS.md
    

    (Use your actual path to smite)

    Then ask questions naturally:

    • "How do I analyze SMLM data?"
    • "Write a script to process my dataset"
    • "Explain the SMF parameters"

Optional: Create a reusable project

For convenience, create a Claude Desktop project for smite to avoid repeating the bootstrap prompt:

  1. In Claude Desktop, create new project named "smite"
  2. Add this project description (copy-paste ready):
    Interactive assistant for smite (Single Molecule Imaging Toolbox Extraordinaire).
    
    smite is a MATLAB toolbox for fluorescence single molecule localization microscopy
    (SMLM) and single particle tracking (SPT). This project provides access to comprehensive
    LLM documentation including API references, workflows, code examples, and troubleshooting
    guides.
    
    Read LLM_DOCS.md on startup to load documentation and provide interactive assistance
    with analysis workflows, code generation, parameter tuning, and problem-solving.
    
  3. In project settings, add custom instructions to automatically load documentation:
    At the start of each conversation, read the file: /path/to/smite/LLM_DOCS.md
    
    (Replace with your actual smite path)
  4. Open this project whenever working with smite

What's Available

The LLM documentation includes:

  • Complete API reference for all classes
  • Installation and troubleshooting guides
  • Code examples for common workflows
  • SMF/SMD structure details
  • GPU/CUDA setup guidance

See LLM_DOCS.md for complete details.


Installation

Clone (Linux/MacOS example; similar for Windows) into ~/Documents/MATLAB the smite GitHub distribution (https://github.com/LidkeLab/smite.git) to obtain the development version. Otherwise, choose the latest release (https://github.com/LidkeLab/smite/releases) for the most recent frozen version. Add to ~/Documents/MATLAB/startup.m the following:

   addpath '~/Documents/MATLAB/smite/MATLAB'
   setupSMITE

Now, smite contains some mex and CUDA files. Precompiled files for 64-bit Linux, MacOS and Windows (mex extensions: mexa64, mexmaci64, mexw64, respectively; CUDA extension: ptx) come with the repository, so often no further installation will be needed. Note that the GPU compute capability is assumed to be 5.0 or greater. However, if for some reason (for example, the user modifies a mex or CUDA source file), recompilation of the appropriate file is necessary, then see mex+CUDA for details.

To verify that smite is running properly, see the Testing subsection below.

Dependencies

For full functionality, smite requires:

  • Linux, MacOS or Windows
  • MATLAB version R2021a or later
  • NVIDIA GPU with CUDA compute capability (>= 5.0) supported by your version of MATLAB
  • MATLAB Curve Fitting Toolbox [ONLY smi_cluster, smi_core.FRC, smi_stat.DiffusionEstimator]
  • MATLAB Image Processing Toolbox
  • MATLAB Optimization Toolbox [ONLY smi_cluster.PairCorrelation, smi_stat.DiffusionEstimator]
  • MATLAB Parallel Computing Toolbox
  • MATLAB Signal Processing Toolbox [ONLY smi_core.FRC]
  • MATLAB Statistics and Machine Learning Toolbox
  • ffmpeg installed for Linux (https://ffmpeg.org) [smi_core.LocalizeData.genLocalizations for obj.Verbose >= 3]

Simple Examples

Working with SMF

SMF is implemented as a class to enable a gui and to provide useful helper methods. However, the most common use will be as a structure with fixed fields.

Create an SMF object:

  SMF = smi_core.SingleMoleculeFitting()

Get an SMF property:

  B = SMF.BoxFinding.BoxOverlap

Set an SMF property:

  SMF.BoxFinding.BoxOverlap = 0

Use the SMF GUI to interactively set values:

  SMF.gui()

Finding coordinates from a stack of images containing blobs

Create a test dataset and make it noisy:

  B = smi_sim.GaussBlobs.genRandomBlobImage();
  B = poissrnd(B);

Create an SMF object with default values:

  SMF = smi_core.SingleMoleculeFitting()

Create a LocalizeData object with our SMF:

  LD = smi_core.LocalizeData(B, SMF)

Localize:

  [SMD] = LD.genLocalizations();

Localize again with Verbose = 3 to show color overlay output:

  LD.Verbose = 3;
  [SMD] = LD.genLocalizations();

High level SMLM analysis

Create an SMLM object. When there are no input aruments, it will open the GUI:

  SMLMobj = smi.SMLM()  

Use the GUI to navigate to a test dataset such as available from

  • Pallikkuth, S., Martin, C., Farzam, F., Edwards, J. S., Lakin, M. R., Lidke, D. S., & Lidke, K. A. (2018). Supporting data for Sequential Super-Resolution Imaging using DNA Strand Displacement [Data set]. University of New Mexico https://doi.org/10.25827/CS2A-DH13.
  • Wester, Michael J., Mazloom-Farsibaf, Hanieh, Farzam, Farzin, Fazel, Mohamadreza, Meddens, Marjolein B. M., & Lidke, Keith A. (2020), Comparing Lifeact and Phalloidin for super-resolution imaging of actin in fixed cells, Dryad, Dataset, https://doi.org/10.5061/dryad.xsj3tx9cn.

Set SMF values from within the GUI and run either a test dataset or analyze all datasets.


Getting Started

  • Install smite as discussed above.
  • Run the collection of unit tests as discussed in the Testing section below to verify that smite has been properly installed.
  • Run some of the Code Examples linked to below which simulate data.
  • Obtain or generate a dataset (see the citations above) and try out the core functionality (see Overview section below). The user can also obtain a dataset by running the SMLM unitTest, which will produce the ~1 Gb tempdir/smite/unitTest/SMLM/SMLM_testData.h5.

Testing

run_tests run a series of unit tests that cover major smite core functionality. Much output will be saved in tempdir/smite/unitTest/name_of_test. Note that the first two tests (smi.SMLM.unitTest and smi.SPT.unitTestFFGC) test a great deal of functionality all at once, and so their success is a good indicator that smite is working. ExpectedResults are provided in the smite/MATLAB directory in which run_tests.m resides, noting that very large files have been deleted so as to not bloat up the the smite distribution (these files are listed in the various ExpectedResults READMEs). Also, the tests are frequently stochastic in nature, so outputs from run to run will not necessarily be identical, even on the same system, but the ExpectedResults will provide a flavor of what to expect.

Additional smite examples can be found in the examples subdirectory of MATLAB as well as the unitTests for some of the classes (see here for a summary). Some of the examples generate and analyze their own data, while others provide a template for how to run the example given supplied data. (The unit tests always generate their own data if any is needed.)

Additional details on the core functionality of smite can be found here, including both simple and extended examples of usage.

Typical Univerisity of New Mexico workflows for smite software.


Contributions/Support

Issues or problems and people seeking support with the software should be reported via the Issues tab of the smite GitHub repository. Contributions to smite should be performed on new branches which are then requested to merge with the main branch via Pull Requests.


Related Software

Please note the related software: MATLAB Instrument Control (MIC), a collection of MATLAB classes for automated data collection on complex, multi-component custom built microscopes. This software can be obtained from the MIC GitHub distribution (https://github.com/LidkeLab/matlab-instrument-control.git).