Picasso: Tools for Painting Super-Resolution Images

repository·master·Indexed 40 days ago

https://github.com/jungmannlab/picasso

A collection of tools for painting super-resolution images, featuring modules for localization (fitting PSFs), rendering, and post-processing. Picasso supports various microscopy data formats, GPU acceleration, and provides both a GUI and a CLI for tasks such as particle averaging, single-molecule spot localization, and ThunderSTORM CSV to HDF5 conversion. It is compatible with Python 3.10–3.14.

Tokens
43.8K
Snippets
97
Records
195
Agent score
99%

What's inside Picasso

  1. Overview of the SPINNA GUI

    master

    SPINNA is a module for analyzing protein oligomerization using super-resolution microscopy data. The Graphical User Interface (GUI) is organized into three primary functional tabs:

    1. Structures: Used to define the geometric model structures (molecular targets and their coordinates) used in simulations.
    2. Simulate: Used for fitting SPINNA models to experimental data, displaying Nearest Neighbor Distances (NND), and running single simulations.
    3. Mask generation: Used to create masks for simulations involving heterogeneous molecular target densities.
  2. Understand 3D Calibration theory and diagnostics

    master

    Picasso performs 3D calibration by fitting a six-degree polynomial to the mean $x$ and $y$ spot widths ($\sigma_x$, $\sigma_y$) across different $z$ positions.

    When calibration finishes, Picasso generates a six-panel diagnostic figure (saved as a .png next to the .yaml calibration file) to verify quality:

    • Mean spot width/height vs stage position: Shows the measured widths and the fitted polynomials. Picasso shifts the axis so fits meet at $z=0$.
    • Spot width vs spot height: A scatter plot of all kept localizations. A narrow band following the curve indicates good calibration; a wide cloud suggests field-dependent PSF or a tilted stage.
    • Spot width/height vs estimated z: Similar to the first plot, but showing individual beads.
    • Estimated z vs stage position: Shows recovered $z$ against known stage position. Points should lie on the diagonal. The range where they follow the diagonal is the usable depth.
    • Deviation to true position: A histogram of estimated z - stage position. It should be single-peaked and centered on 0.
    • Mean z precision vs stage position: The RMS deviation per $z$ step. Note that field-dependent PSF or a tilted stage can impact these values.

    Note: These diagnostics report the self-consistency of the calibration beads, not necessarily the performance on dim single molecules.

  3. Manage multiple cameras and set selection priorities

    master

    When using multiple cameras, Picasso uses the config.yaml to organize the selection UI and automate camera matching.

    Camera Selection Logic

    • Automatic Matching: Picasso attempts to match the camera name in the config with the name found in the Micro-Manager metadata. If no match is found, the first camera listed in the config is selected.
    • Alphabetical Order: By default, configured cameras are displayed in alphabetical order in the dropdown menu.

    Setting Camera Priorities

    To prevent the dropdown menu from becoming cluttered, you can use the CameraPriority key. This allows you to pin specific cameras to the top of the list.

    • The CameraPriority list must contain names that match entries in the Cameras section.
    • Listed cameras appear at the top; all others follow in alphabetical order.
    Cameras:
      Camera1:
      Camera2:
      Camera3:
    
    CameraPriority:
      - Camera3
      - Camera1
  4. Access and manage the Picasso local database

    master

    Picasso stores its local SQL database in the .picasso folder within your home directory.

    • Locating the path: The exact path is displayed in the Getting started-tab on the Status page of the web application.
    • Direct access: To interact with the database directly outside of the Picasso interface, it is recommended to use DB Browser for SQLite.
  5. Handle sCMOS calibrations in multichannel and split FOV workflows

    master

    Multichannel Workflows

    In multichannel spline workflows (e.g., localize.fit_spline_multichannel, fit_spline_multichannel_ratiometric, or get_spots_multichannel), you must provide one calibration per channel via the camera_calibrations argument.

    • If a channel does not have a calibration, it defaults to the plain Poisson model.
    • Picasso automatically handles coordinate registration: each channel's maps are cut at that channel's specific mapped and rounded box origin to ensure noise is sampled from the correct physical pixels.

    Split Field of View (Split FOV)

    For split FOV setups where multiple channels reside on a single physical sensor, use localize.fit_spline_split_fov. This takes a single camera_calibration and applies the full-frame maps to every region. The maps are indexed by absolute frame coordinates, so each region correctly reads its own pixels.

  6. Link photon counts across channels

    master

    When performing multichannel 2D spherical Gaussian fitting, you can choose how photon counts and backgrounds are handled across channels.

    Unlinked (Default)

    Each channel fits its own photon count and background. Only x, y, and width are shared. This is appropriate for channels with different spectral throughput or uneven beam splitters.

    This mode adds the following columns per channel c (supports 2 to 6 channels):

    • photons_ch<c>: The channel's specific photon count.
    • bg_ch<c>: The channel's specific background.
    • rel_photons_ch<c>: The channel's share of the total photons (values sum to 1 per localization).

    Linked

    One photon count and one background are shared across all channels. This assumes the channels are balanced (e.g., equally split, redundant channels).

    Note: In both modes, the photons and bg values represent the totals across all channels, making them directly comparable to spline fits.

  7. Compare drift correction methods in Picasso

    master

    Picasso provides three primary procedures to correct for drift:

    1. AIM (Adaptive Intersection Maximization): Precise, robust, and fast. It requires no user interaction or fiducial markers. Recommended for high resolution.
    2. Marker-based correction: Uses specific structures (e.g., DNA origami, gold nanoparticles, or protein complexes) as drift markers. It can be more precise than RCC and allows for 'ultra-resolution' when combined with AIM or multiple rounds of RCC.
    3. RCC (Redundant Cross-Correlation): Does not require additional sample preparation (unlike marker-based) but generally offers lower precision than AIM or marker-based methods.

    Recommendation for highest resolution: Use AIM or a combination of consecutive RCC applications and multiple rounds of marker-based correction.

  8. Use the Temporal Median Filter for background subtraction

    master

    The Temporal median filter (in the Identification group) helps remove uneven backgrounds like out-of-focus haze or non-uniform illumination by subtracting a rolling per-pixel median over a window of frames.

    Key Details:

    • Identification Only: The filter is applied only during the spot identification phase. Spots are always cut out and fitted using the raw movie data. Therefore, photon counts and localization precision are not affected by the filter.
    • Window (frames): Sets the window size for the median. A default of 51 is recommended. It must be long enough for emitters to be dark most of the time, but short enough to follow background drifts.
    • Tuning: Because subtracting background changes the local gradient scale, you must re-tune the Min. net gradient parameter after enabling the filter. Use the Preview mode to verify.
    • Restriction: The filter is not applied during 3D or experimental PSF calibration, as calibration beads are static and would be subtracted by the filter.
  9. Identify molecules using the 'Sum of channels' mode

    master

    When one channel has very low signal, identifying channels separately may fail to detect molecules. The Sum of channels mode allows identification in a combined signal.

    How it works

    1. All channels are mapped onto the reference channel using the transforms from the loaded calibration.
    2. The channels are summed in photons.
    3. Spots are identified in this summed image.
    4. The resulting detections are then used in a joint fit (the fit itself does not link across channels, as the detections are already cross-channel consensus).

    Requirements and Tips

    • Registration is mandatory: Channels must be registered (via a loaded calibration or prior identification) before they can be summed. If registration is off, the sum will be smeared.
    • Re-tuning: You must re-tune the minimum net gradient because the summed signal scale differs from single-channel scales.
    • Re-alignment: If the calibration registration is poor, run Calibration > Re-align channels (current signal) before attempting to sum.

    API Access

    This mode can be accessed via script using:

    • picasso.localize.identify_multichannel_sum for identification.
    • picasso.localize.SummedChannelsMovie for the summed view.
  10. Set up a Watcher for continuous processing

    master

    A Watcher automatically processes new files in a specific folder using pre-defined settings.

    Key Features:

    • Automatic Detection: Processes all new files and raw files not yet present in the database.
    • Supported Filetypes: .raw, .ome.tif, and .ims.
    • MicroManager Support: Can process consecutive files (e.g., Pos0, Pos0_1) if they contain MMStack_Pos0 in the filename.
    • Parameter Groups: You can define multiple parameter groups to process files with different settings. If you set Number of Parameter Groups > 1, files are saved with suffixes like _pg_1_locs.hdf5 and _pg_2_locs.hdf5.
    • Custom Commands: Allows executing custom scripts after a file is processed.
    • Logging: Each watcher writes to a logfile. You can view logs by selecting the logfile and expanding the Log field in the server UI.
  11. How Picasso plugins work

    master

    A plugin is a single Python (.py) file that extends Picasso by adding new GUI actions, command line subcommands, or importable Python functions.

    Key Concepts:

    • Sandboxing: Plugins are NOT sandboxed. An enabled plugin has the same permissions as Picasso (file access, network, etc.).
    • Activation: Plugins are not loaded until they are explicitly enabled. Simply placing a file in the plugins folder is insufficient.
    • Security: Downloads from the online registry are verified against a SHA-256 hash. Local files (manually added) are not verified and are considered less safe.
    • Scope: Enabling a plugin applies to all interfaces (GUI, CLI, and Python API) simultaneously. Disabling it stops all three.
  12. Choose a SPINNA fitting mode

    master

    In the Optional settings dialog, you can select one of three fitting modes. This selection affects Find best fitting combination, Compare models, and Fit LE...:

    • bayesian (Recommended): Uses Bayesian optimization with Gaussian process regression. This is the most efficient way to explore large search spaces.
    • coarse to fine (Recommended for large spaces): Tests a coarse grid (10% of combinations) first, then tests a finer grid around the best coarse result. Faster than brute force.
    • brute force: Tests all combinations of structures sequentially. This is the slowest method.