Get Operations
The copick.ops.get
module provides query functions for retrieving data from Copick projects. These functions offer convenient ways to search, filter, and access runs, tomograms, picks, segmentations, and other data entities.
Functions
copick.ops.get.get_segmentations
get_segmentations(root: Union[str, CopickRoot], runs: Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None] = None, user_id: Union[str, Iterable[str], None] = None, session_id: Union[str, Iterable[str], None] = None, is_multilabel: bool = None, name: Union[str, Iterable[str], None] = None, voxel_size: Union[float, Iterable[float], None] = None, parallel: bool = False, workers: Optional[int] = 8, show_progress: bool = True) -> Union[List[CopickSegmentation], None]
Query segmentations from a Copick project.
Parameters:
-
root
(Union[str, CopickRoot]
) –The Copick project root.
-
runs
(Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None]
, default:None
) –The runs to query segmentations from. If
None
, query all runs. -
user_id
(Union[str, Iterable[str], None]
, default:None
) –The user ID of the segmentations. If
None
, query all users. -
session_id
(Union[str, Iterable[str], None]
, default:None
) –The session ID of the segmentations. If
None
, query all sessions. -
is_multilabel
(bool
, default:None
) –Whether the segmentations are multilabel. If
None
, query all segmentations. -
name
(Union[str, Iterable[str], None]
, default:None
) –The name of the segmentation. If
None
, query all segmentations. -
voxel_size
(Union[float, Iterable[float], None]
, default:None
) –The voxel size of the segmentation. If
None
, query all segmentations. -
parallel
(bool
, default:False
) –Whether to query segmentations in parallel. Default is
False
. -
workers
(Optional[int]
, default:8
) –The number of workers to use. Default is
8
. -
show_progress
(bool
, default:True
) –Whether to show progress. Default is
True
.
copick.ops.get.get_meshes
get_meshes(root: Union[str, CopickRoot], runs: Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None] = None, user_id: Union[str, Iterable[str], None] = None, session_id: Union[str, Iterable[str], None] = None, object_name: Union[str, Iterable[str], None] = None, parallel: bool = False, workers: Optional[int] = 8, show_progress: bool = True) -> Union[List[CopickMesh], None]
Query meshes from a Copick project.
Parameters:
-
root
(Union[str, CopickRoot]
) –The Copick project root.
-
runs
(Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None]
, default:None
) –The runs to query meshes from. If
None
, query all runs. -
user_id
(Union[str, Iterable[str], None]
, default:None
) –The user ID of the meshes. If
None
, query all users. -
session_id
(Union[str, Iterable[str], None]
, default:None
) –The session ID of the meshes. If
None
, query all sessions. -
object_name
(Union[str, Iterable[str], None]
, default:None
) –The pickable object of the meshes. If
None
, query all meshes. -
parallel
(bool
, default:False
) –Whether to query meshes in parallel. Default is
False
. -
workers
(Optional[int]
, default:8
) –The number of workers to use. Default is
8
. -
show_progress
(bool
, default:True
) –Whether to show progress. Default is
True
.
Returns:
-
Union[List[CopickMesh], None]
–A list of meshes.
copick.ops.get.get_picks
get_picks(root: Union[str, CopickRoot], runs: Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None] = None, user_id: Union[str, Iterable[str], None] = None, session_id: Union[str, Iterable[str], None] = None, object_name: Union[str, Iterable[str], None] = None, parallel: bool = False, workers: Optional[int] = 8, show_progress: bool = True) -> Union[List[CopickPicks], None]
Query picks from a Copick project.
Parameters:
-
root
(Union[str, CopickRoot]
) –The Copick project root.
-
runs
(Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None]
, default:None
) –The runs to query picks from. If
None
, query all runs. -
user_id
(Union[str, Iterable[str], None]
, default:None
) –The user ID of the picks. If
None
, query all users. -
session_id
(Union[str, Iterable[str], None]
, default:None
) –The session ID of the picks. If
None
, query all sessions. -
object_name
(Union[str, Iterable[str], None]
, default:None
) –The pickable object of the picks. If
None
, query all picks. -
parallel
(bool
, default:False
) –Whether to query picks in parallel. Default is
False
. -
workers
(Optional[int]
, default:8
) –The number of workers to use. Default is
8
. -
show_progress
(bool
, default:True
) –Whether to show progress. Default is
True
.
Returns:
-
Union[List[CopickPicks], None]
–A list of picks.
copick.ops.get.get_voxelspacings
get_voxelspacings(root: Union[str, CopickRoot], runs: Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None] = None, voxel_size: Union[float, Iterable[float], None] = None, parallel: bool = False, workers: Optional[int] = 8, show_progress: bool = True) -> Union[List[CopickVoxelSpacing], None]
Query voxel spacings from a Copick project.
Parameters:
-
root
(Union[str, CopickRoot]
) –The Copick project root.
-
runs
(Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None]
, default:None
) –The runs to query voxel spacings from. If
None
, query all runs. -
voxel_size
(Union[float, Iterable[float], None]
, default:None
) –The voxel size of the voxel spacings. If
None
, query all voxel spacings. -
parallel
(bool
, default:False
) –Whether to query voxel spacings in parallel. Default is
False
. -
workers
(Optional[int]
, default:8
) –The number of workers to use. Default is
8
. -
show_progress
(bool
, default:True
) –Whether to show progress. Default is
True
.
Returns:
-
Union[List[CopickVoxelSpacing], None]
–A list of voxel spacings.
copick.ops.get.get_tomograms
get_tomograms(root: Union[str, CopickRoot], runs: Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None] = None, voxel_size: Union[float, Iterable[float], None] = None, tomo_type: Union[str, Iterable[str], None] = None, parallel: bool = False, workers: Optional[int] = 8, show_progress: bool = True) -> List[CopickTomogram]
Query tomograms from a Copick project.
Parameters:
-
root
(Union[str, CopickRoot]
) –The Copick project root.
-
runs
(Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None]
, default:None
) –The runs to query tomograms from. If
None
, query all runs. -
voxel_size
(Union[float, Iterable[float], None]
, default:None
) –The voxel size of the tomograms. If
None
, query all tomograms. -
tomo_type
(Union[str, Iterable[str], None]
, default:None
) –The type of the tomograms. If
None
, query all tomograms. -
parallel
(bool
, default:False
) –Whether to query tomograms in parallel. Default is
False
. -
workers
(Optional[int]
, default:8
) –The number of workers to use. Default is
8
. -
show_progress
(bool
, default:True
) –Whether to show progress. Default is
True
.
Returns:
-
List[CopickTomogram]
–A list of tomograms.
copick.ops.get.get_features
get_features(root: Union[str, CopickRoot], runs: Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None] = None, voxel_size: Union[float, Iterable[float], None] = None, tomo_type: Union[str, Iterable[str], None] = None, feature_type: Union[str, Iterable[str], None] = None, parallel: bool = False, workers: Optional[int] = 8, show_progress: bool = True) -> List[CopickFeatures]
Query features from a Copick project.
Parameters:
-
root
(Union[str, CopickRoot]
) –The Copick project root.
-
runs
(Union[str, CopickRun, Iterable[str], Iterable[CopickRun], None]
, default:None
) –The runs to query features from. If
None
, query all runs. -
voxel_size
(Union[float, Iterable[float], None]
, default:None
) –The voxel size of the features. If
None
, query all features. -
tomo_type
(Union[str, Iterable[str], None]
, default:None
) –The type of the tomograms. If
None
, query all features. -
feature_type
(Union[str, Iterable[str], None]
, default:None
) –The type of the features. If
None
, query all features. -
parallel
(bool
, default:False
) –Whether to query features in parallel. Default is
False
. -
workers
(Optional[int]
, default:8
) –The number of workers to use. Default is
8
. -
show_progress
(bool
, default:True
) –Whether to show progress. Default is
True
.
Returns:
-
List[CopickFeatures]
–A list of features.
copick.ops.get.get_runs
get_runs(root: Union[str, CopickRoot], names: Union[str, Iterable[str], None] = None) -> List[CopickRun]
Query runs from a Copick project.
Parameters:
-
root
(Union[str, CopickRoot]
) –The Copick project root.
Returns:
-
List[CopickRun]
–A list of runs.
Usage Examples
Getting Runs
from copick.ops.get import get_runs
from copick.impl.filesystem import CopickRootFSSpec
# Open a project
root = CopickRootFSSpec.from_file("config.json")
# Get all runs
all_runs = get_runs(root)
# Get runs with specific names
selected_runs = get_runs(root, run_names=["experiment_001", "experiment_002"])
# Get runs with query filtering
filtered_runs = get_runs(root, query={"tilt_series_id": "12345"})
Getting Tomograms
from copick.ops.get import get_tomograms
# Get all tomograms from specific runs
tomograms = get_tomograms(
root=root,
run_names=["experiment_001"],
voxel_spacings=[10.0, 20.0],
tomo_types=["wbp", "ctf_corrected"]
)
# Get tomograms with user filtering
user_tomograms = get_tomograms(
root=root,
user_id="researcher_001",
session_id="session_123"
)
Getting Picks
from copick.ops.get import get_picks
# Get picks for specific objects
ribosome_picks = get_picks(
root=root,
object_names=["ribosome"],
user_id="annotation_tool",
run_names=["experiment_001"]
)
# Get picks with confidence filtering
high_confidence_picks = get_picks(
root=root,
query={"confidence": {"$gt": 0.8}}
)
Getting Segmentations
from copick.ops.get import get_segmentations
# Get segmentations by type
membrane_segmentations = get_segmentations(
root=root,
segmentation_types=["membrane", "organelle"],
voxel_spacings=[10.0]
)
# Get multilabel segmentations
multilabel_segs = get_segmentations(
root=root,
is_multilabel=True,
user_id="segmentation_model"
)