Skip to content

Features & Pickers

Small helpers for feature extraction and grid picking.

Features

copick_utils.features computes multiscale image features (intensity, edges, texture) from a tomogram using scikit-image — useful as inputs to pixel classifiers.

copick_utils.features.skimage.compute_skimage_features

compute_skimage_features(tomogram, feature_type, copick_root, intensity=True, edges=True, texture=True, sigma_min=0.5, sigma_max=16.0, feature_chunk_size=None)

Processes the tomogram chunkwise and computes the multiscale basic features. Allows for optional feature chunk size.

Pickers

copick_utils.pickers provides simple, non-ML pick generators.

copick_utils.pickers.grid_picker.grid_picker

grid_picker(pickable_obj, run, tomogram, grid_spacing_factor, session_id='0', user_id='gridPicker')

Creates a grid of picks for a pickable object based on a tomogram and grid spacing factor.

Parameters:

  • pickable_obj

    The pickable object (particle).

  • run

    The Copick run.

  • tomogram

    The tomogram data.

  • grid_spacing_factor

    Factor to multiply the particle radius by to determine grid spacing.

  • session_id

    The session ID for the segmentation.

  • user_id

    The user ID for segmentation creation.

Usage Examples

Generate a regular grid of picks

import copick
from copick_utils.pickers.grid_picker import grid_picker

root = copick.from_file("config.json")
run = root.get_run("TS_001")
tomo = run.get_voxel_spacing(10.0).get_tomograms("wbp")[0]

picks = grid_picker(
    pickable_obj=root.get_object("ribosome"),
    run=run,
    tomogram=tomo,
    grid_spacing_factor=1.0,   # spacing as a multiple of the object radius
    session_id="0",
    user_id="gridPicker",
)

Compute scikit-image features for a tomogram

from copick_utils.features.skimage import compute_skimage_features

features = compute_skimage_features(
    tomogram=tomo,
    feature_type="skimage-multiscale",
    copick_root=root,
    intensity=True,
    edges=True,
    texture=True,
)