CopickRoot
copick.models.CopickRoot
Root of a copick project. Contains references to the runs and pickable objects.
Attributes:
-
config
(CopickConfig
) –Configuration of the copick project.
-
user_id
(str
) –Unique identifier for the user.
-
session_id
(str
) –Unique identifier for the session.
-
runs
(List[CopickRun]
) –References to the runs for this project. Lazy loaded upon access.
-
pickable_objects
(List[CopickObject]
) –References to the pickable objects for this project.
__init__
Parameters:
-
config
(CopickConfig
) –Configuration of the copick project.
get_run
Get run by name.
Parameters:
-
name
(str
) –Name of the run to retrieve.
-
**kwargs
–Additional keyword arguments for the run metadata.
Returns:
-
CopickRun
(Union[CopickRun, None]
) –The run with the given name, or None if not found.
get_object
Get object by name.
Parameters:
-
name
(str
) –Name of the object to retrieve.
Returns:
-
CopickObject
(Union[CopickObject, None]
) –The object with the given name, or None if not found.
save_config
Save the configuration to a JSON file.
Parameters:
-
config_path
(str
) –Path to the configuration file to save.
new_run
Create a new run.
Parameters:
-
name
(str
) –Name of the run to create.
-
exist_ok
(bool
, default:False
) –Whether to raise an error if the run already exists.
-
**kwargs
–Additional keyword arguments for the run metadata.
Returns:
-
CopickRun
(CopickRun
) –The newly created run.
Raises:
-
ValueError
–If a run with the given name already exists.
delete_run
Delete a run by name.
Parameters:
-
name
(str
) –Name of the run to delete.
new_object
new_object(name: str, is_particle: bool, label: Optional[int] = None, color: Optional[Tuple[int, int, int, int]] = None, emdb_id: Optional[str] = None, pdb_id: Optional[str] = None, identifier: Optional[str] = None, map_threshold: Optional[float] = None, radius: Optional[float] = None, metadata: Optional[Dict[str, Any]] = None, exist_ok: bool = False) -> CopickObject
Create a new pickable object and add it to the configuration.
Parameters:
-
name
(str
) –Name of the object.
-
is_particle
(bool
) –Whether this object should be represented by points (True) or segmentation masks (False).
-
label
(Optional[int]
, default:None
) –Numeric label/id for the object. If None, will use the next available label.
-
color
(Optional[Tuple[int, int, int, int]]
, default:None
) –RGBA color for the object. If None, will use a default color.
-
emdb_id
(Optional[str]
, default:None
) –EMDB ID for the object.
-
pdb_id
(Optional[str]
, default:None
) –PDB ID for the object.
-
identifier
(Optional[str]
, default:None
) –Identifier for the object (e.g. Gene Ontology ID or UniProtKB accession).
-
map_threshold
(Optional[float]
, default:None
) –Threshold to apply to the map when rendering the isosurface.
-
radius
(Optional[float]
, default:None
) –Radius of the particle, when displaying as a sphere.
-
metadata
(Optional[Dict[str, Any]]
, default:None
) –Additional metadata for the object (user-defined contents).
-
exist_ok
(bool
, default:False
) –Whether existing objects with the same name should be overwritten..
Returns:
-
CopickObject
(CopickObject
) –The newly created object.
Raises:
-
ValueError
–If an object with the given name already exists and exist_ok is False.