Skip to content

CopickRun

copick.models.CopickRun

Encapsulates all data pertaining to a physical location on a sample (i.e. typically one tilt series and the associated tomograms). This includes voxel spacings (of the reconstructed tomograms), picks, meshes, and segmentations.

Attributes:

  • meta (CopickRunMeta) –

    Metadata for this run.

  • root (CopickRoot) –

    Reference to the root project this run belongs to.

  • voxel_spacings (List[CopickVoxelSpacing]) –

    Voxel spacings for this run. Either populated from config or lazily loaded when CopickRun.voxel_spacings is accessed for the first time.

  • picks (List[CopickPicks]) –

    Picks for this run. Either populated from config or lazily loaded when CopickRun.picks is accessed for the first time.

  • meshes (List[CopickMesh]) –

    Meshes for this run. Either populated from config or lazily loaded when CopickRun.meshes is accessed for the first time.

  • segmentations (List[CopickSegmentation]) –

    Segmentations for this run. Either populated from config or lazily loaded when CopickRun.segmentations is accessed for the first time.

query_voxelspacings() -> List[CopickVoxelSpacing]

Override this method to query for voxel_spacings.

Returns:

  • List[CopickVoxelSpacing]

    List[CopickVoxelSpacing]: List of voxel spacings for this run.

query_picks() -> List[CopickPicks]

Override this method to query for picks.

Returns:

  • List[CopickPicks]

    List[CopickPicks]: List of picks for this run.

query_meshes() -> List[CopickMesh]

Override this method to query for meshes.

Returns:

  • List[CopickMesh]

    List[CopickMesh]: List of meshes for this run.

query_segmentations() -> List[CopickSegmentation]

Override this method to query for segmentations.

Returns:

  • List[CopickSegmentation]

    List[CopickSegmentation]: List of segmentations for this run.

get_voxel_spacing(voxel_size: float, **kwargs) -> Union[CopickVoxelSpacing, None]

Get voxel spacing object by voxel size value.

Parameters:

  • voxel_size (float) –

    Voxel size value to search for.

  • **kwargs

    Additional keyword arguments for the voxel spacing metadata.

Returns:

  • CopickVoxelSpacing ( Union[CopickVoxelSpacing, None] ) –

    The voxel spacing object with the given voxel size value, or None if not found.

user_picks() -> List[CopickPicks]

Get all user generated picks (i.e. picks that have CopickPicks.session_id != 0).

Returns:

  • List[CopickPicks]

    List[CopickPicks]: List of user-generated picks.

tool_picks() -> List[CopickPicks]

Get all tool generated picks (i.e. picks that have CopickPicks.session_id == 0).

Returns:

  • List[CopickPicks]

    List[CopickPicks]: List of tool-generated picks.

get_picks(object_name: str = None, user_id: str = None, session_id: str = None) -> List[CopickPicks]

Get picks by name, user_id or session_id (or combinations).

Parameters:

  • object_name (str, default: None ) –

    Name of the object to search for.

  • user_id (str, default: None ) –

    User ID to search for.

  • session_id (str, default: None ) –

    Session ID to search for.

Returns:

  • List[CopickPicks]

    List[CopickPicks]: List of picks that match the search criteria.

user_meshes() -> List[CopickMesh]

Get all user generated meshes (i.e. meshes that have CopickMesh.session_id != 0).

Returns:

  • List[CopickMesh]

    List[CopickMesh]: List of user-generated meshes.

tool_meshes() -> List[CopickMesh]

Get all tool generated meshes (i.e. meshes that have CopickMesh.session_id == 0).

Returns:

  • List[CopickMesh]

    List[CopickMesh]: List of tool-generated meshes.

get_meshes(object_name: str = None, user_id: str = None, session_id: str = None) -> List[CopickMesh]

Get meshes by name, user_id or session_id (or combinations).

Parameters:

  • object_name (str, default: None ) –

    Name of the object to search for.

  • user_id (str, default: None ) –

    User ID to search for.

  • session_id (str, default: None ) –

    Session ID to search for.

Returns:

  • List[CopickMesh]

    List[CopickMesh]: List of meshes that match the search criteria.

user_segmentations() -> List[CopickSegmentation]

Get all user generated segmentations (i.e. segmentations that have CopickSegmentation.session_id != 0).

Returns:

  • List[CopickSegmentation]

    List[CopickSegmentation]: List of user-generated segmentations.

tool_segmentations() -> List[CopickSegmentation]

Get all tool generated segmentations (i.e. segmentations that have CopickSegmentation.session_id == 0).

Returns:

  • List[CopickSegmentation]

    List[CopickSegmentation]: List of tool-generated segmentations.

get_segmentations(user_id: str = None, session_id: str = None, is_multilabel: bool = None, name: str = None, voxel_size: float = None) -> List[CopickSegmentation]

Get segmentations by user_id, session_id, name, type or voxel_size (or combinations).

Parameters:

  • user_id (str, default: None ) –

    User ID to search for.

  • session_id (str, default: None ) –

    Session ID to search for.

  • is_multilabel (bool, default: None ) –

    Whether the segmentation is multilabel or not.

  • name (str, default: None ) –

    Name of the segmentation to search for.

  • voxel_size (float, default: None ) –

    Voxel size to search for.

Returns:

  • List[CopickSegmentation]

    List[CopickSegmentation]: List of segmentations that match the search criteria.

new_voxel_spacing(voxel_size: float, **kwargs) -> CopickVoxelSpacing

Create a new voxel spacing object.

Parameters:

  • voxel_size (float) –

    Voxel size value for the contained tomograms.

  • **kwargs

    Additional keyword arguments for the voxel spacing metadata.

Returns:

Raises:

  • ValueError

    If a voxel spacing with the given voxel size already exists for this run.

new_picks(object_name: str, session_id: str, user_id: Optional[str] = None) -> CopickPicks

Create a new picks object.

Parameters:

  • object_name (str) –

    Name of the object to pick.

  • session_id (str) –

    Session ID for the picks.

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

    User ID for the picks.

Returns:

  • CopickPicks ( CopickPicks ) –

    The newly created picks object.

Raises:

  • ValueError

    If picks for the given object name, session ID and user ID already exist, if the object name is not found in the pickable objects, or if the user ID is not set in the root config or supplied.

new_mesh(object_name: str, session_id: str, user_id: Optional[str] = None, **kwargs) -> CopickMesh

Create a new mesh object.

Parameters:

  • object_name (str) –

    Name of the object to mesh.

  • session_id (str) –

    Session ID for the mesh.

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

    User ID for the mesh.

  • **kwargs

    Additional keyword arguments for the mesh metadata.

Returns:

  • CopickMesh ( CopickMesh ) –

    The newly created mesh object.

Raises:

  • ValueError

    If a mesh for the given object name, session ID and user ID already exist, if the object name is not found in the pickable objects, or if the user ID is not set in the root config or supplied.

new_segmentation(voxel_size: float, name: str, session_id: str, is_multilabel: bool, user_id: Optional[str] = None, **kwargs) -> CopickSegmentation

Create a new segmentation object.

Parameters:

  • voxel_size (float) –

    Voxel size for the segmentation.

  • name (str) –

    Name of the segmentation.

  • session_id (str) –

    Session ID for the segmentation.

  • is_multilabel (bool) –

    Whether the segmentation is multilabel or not.

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

    User ID for the segmentation.

  • **kwargs

    Additional keyword arguments for the segmentation metadata.

Returns:

Raises:

  • ValueError

    If a segmentation for the given name, session ID, user ID, voxel size and multilabel flag already exist, if the object name is not found in the pickable objects, if the voxel size is not found in the voxel spacings, or if the user ID is not set in the root config or supplied.

refresh_voxel_spacings() -> None

Refresh the voxel spacings.

refresh_picks() -> None

Refresh the picks.

refresh_meshes() -> None

Refresh the meshes.

refresh_segmentations() -> None

Refresh the segmentations.

refresh() -> None

Refresh all child types.

ensure(create: bool = False) -> bool

Check if the run record exists, optionally create it if it does not.

Parameters:

  • create (bool, default: False ) –

    Whether to create the run record if it does not exist.

Returns:

  • bool ( bool ) –

    True if the run record exists, False otherwise.