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
Override this method to query for voxel_spacings.
Returns:
-
List[CopickVoxelSpacing]
–List[CopickVoxelSpacing]: List of voxel spacings for this run.
query_picks
Override this method to query for picks.
Returns:
-
List[CopickPicks]
–List[CopickPicks]: List of picks for this run.
query_meshes
Override this method to query for meshes.
Returns:
-
List[CopickMesh]
–List[CopickMesh]: List of meshes for this run.
query_segmentations
Override this method to query for segmentations.
Returns:
-
List[CopickSegmentation]
–List[CopickSegmentation]: List of segmentations for this run.
get_voxel_spacing
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
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
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
get_picks(object_name: Union[str, Iterable[str]] = None, user_id: Union[str, Iterable[str]] = None, session_id: Union[str, Iterable[str]] = None) -> List[CopickPicks]
Get picks by name, user_id or session_id (or combinations).
Parameters:
-
object_name
(Union[str, Iterable[str]]
, default:None
) –Name of the object to search for.
-
user_id
(Union[str, Iterable[str]]
, default:None
) –User ID to search for.
-
session_id
(Union[str, Iterable[str]]
, default:None
) –Session ID to search for.
Returns:
-
List[CopickPicks]
–List[CopickPicks]: List of picks that match the search criteria.
user_meshes
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
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
get_meshes(object_name: Union[str, Iterable[str]] = None, user_id: Union[str, Iterable[str]] = None, session_id: Union[str, Iterable[str]] = None) -> List[CopickMesh]
Get meshes by name, user_id or session_id (or combinations).
Parameters:
-
object_name
(Union[str, Iterable[str]]
, default:None
) –Name of the object to search for.
-
user_id
(Union[str, Iterable[str]]
, default:None
) –User ID to search for.
-
session_id
(Union[str, Iterable[str]]
, default:None
) –Session ID to search for.
Returns:
-
List[CopickMesh]
–List[CopickMesh]: List of meshes that match the search criteria.
user_segmentations
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
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
get_segmentations(user_id: Union[str, Iterable[str]] = None, session_id: Union[str, Iterable[str]] = None, is_multilabel: bool = None, name: Union[str, Iterable[str]] = None, voxel_size: Union[float, Iterable[float]] = None) -> List[CopickSegmentation]
Get segmentations by user_id, session_id, name, type or voxel_size (or combinations).
Parameters:
-
user_id
(Union[str, Iterable[str]]
, default:None
) –User ID to search for.
-
session_id
(Union[str, Iterable[str]]
, default:None
) –Session ID to search for.
-
is_multilabel
(bool
, default:None
) –Whether the segmentation is multilabel or not.
-
name
(Union[str, Iterable[str]]
, default:None
) –Name of the segmentation to search for.
-
voxel_size
(Union[float, Iterable[float]]
, default:None
) –Voxel size to search for.
Returns:
-
List[CopickSegmentation]
–List[CopickSegmentation]: List of segmentations that match the search criteria.
new_voxel_spacing
Create a new voxel spacing object.
Parameters:
-
voxel_size
(float
) –Voxel size value for the contained tomograms.
-
exist_ok
(bool
, default:False
) –Whether to raise an error if the voxel spacing already exists.
-
**kwargs
–Additional keyword arguments for the voxel spacing metadata.
Returns:
-
CopickVoxelSpacing
(CopickVoxelSpacing
) –The newly created voxel spacing object.
Raises:
-
ValueError
–If a voxel spacing with the given voxel size already exists for this run.
new_picks
new_picks(object_name: str, session_id: str, user_id: Optional[str] = None, exist_ok: bool = False) -> 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.
-
exist_ok
(bool
, default:False
) –Whether to raise an error if the picks already exists.
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
new_mesh(object_name: str, session_id: str, user_id: Optional[str] = None, exist_ok: bool = False, **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.
-
exist_ok
(bool
, default:False
) –Whether to raise an error if the mesh already exists.
-
**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
new_segmentation(voxel_size: float, name: str, session_id: str, is_multilabel: bool, user_id: Optional[str] = None, exist_ok: bool = False, **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.
-
exist_ok
(bool
, default:False
) –Whether to raise an error if the segmentation already exists.
-
**kwargs
–Additional keyword arguments for the segmentation metadata.
Returns:
-
CopickSegmentation
(CopickSegmentation
) –The newly created segmentation object.
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.
ensure
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.
delete_voxel_spacings
Delete a voxel spacing by voxel size.
Parameters:
-
voxel_size
(float
, default:None
) –Voxel size to delete.
delete_picks
Delete picks by name, user_id or session_id (or combinations).
Parameters:
-
object_name
(str
, default:None
) –Name of the object to delete.
-
user_id
(str
, default:None
) –User ID to delete.
-
session_id
(str
, default:None
) –Session ID to delete.
delete_meshes
Delete meshes by name, user_id or session_id (or combinations).
Parameters:
-
object_name
(str
, default:None
) –Name of the object to delete.
-
user_id
(str
, default:None
) –User ID to delete.
-
session_id
(str
, default:None
) –Session ID to delete.
delete_segmentations
delete_segmentations(user_id: str = None, session_id: str = None, is_multilabel: bool = None, name: str = None, voxel_size: float = None) -> None
Delete segmentation by name, user_id or session_id (or combinations).
Parameters:
-
user_id
(str
, default:None
) –User ID to delete.
-
session_id
(str
, default:None
) –Session ID to delete.
-
is_multilabel
(bool
, default:None
) –Whether the segmentation is multilabel or not.
-
name
(str
, default:None
) –Name of the segmentation to delete.
-
voxel_size
(float
, default:None
) –Voxel size to delete.