Skip to content

Open Operations

The copick.ops.open module provides functions for opening and creating Copick projects from various sources, including configuration files and CryoET Data Portal datasets.

Functions

copick.ops.open.from_string

from_string(data: str)

copick.ops.open.from_file

from_file(path: str)

copick.ops.open.from_czcdp_datasets

from_czcdp_datasets(dataset_ids: List[int], overlay_root: str, overlay_fs_args: Union[Dict[str, Any], None] = None, user_id: Union[str, None] = None, session_id: Union[str, None] = None, output_path: Union[str, None] = None) -> CopickRootCDP

Create a Copick project from datasets in the CZ cryoET Data Portal.

Parameters:

  • dataset_ids (List[int]) –

    List of dataset IDs to include in the project.

  • overlay_root (str) –

    The root path to the overlay directory.

  • overlay_fs_args (Union[Dict[str, Any], None], default: None ) –

    Arguments to pass to the overlay filesystem.

  • user_id (Union[str, None], default: None ) –

    The user ID to use for the project.

  • session_id (Union[str, None], default: None ) –

    The session ID to use for the project.

  • output_path (Union[str, None], default: None ) –

    The path to write the project configuration to.

Returns:

  • CopickRootCDP ( CopickRootCDP ) –

    The initialized Copick project.

Usage Examples

Opening from Configuration File

from copick.ops.open import from_file

# Open project from configuration file
root = from_file("path/to/config.json")

# Access project data
runs = root.runs
tomograms = root.runs[0].voxel_spacings[0].tomograms

Opening from String Configuration

from copick.ops.open import from_string
import json

# Create configuration as string
config = {
    "name": "My Project",
    "description": "Example project",
    "version": "1.0.0",
    "config_type": "filesystem",
    "static_root": "/path/to/static",
    "overlay_root": "/path/to/overlay",
    "pickable_objects": []
}

# Open project from string
root = from_string(json.dumps(config))

Opening from CryoET Data Portal

from copick.ops.open import from_czcdp_datasets

# Create project from Data Portal dataset
root = from_czcdp_datasets(
    dataset_ids=[10001, 10002],
    overlay_root="/path/to/local/storage",
    config_name="My CryoET Project"
)

# Access portal data with local overlay
runs = root.runs
tomograms = root.runs[0].voxel_spacings[0].tomograms