Skip to content

PickableObject

copick.models.PickableObject

Bases: BaseModel

Metadata for a pickable objects.

Attributes:

  • 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]) –

    Numeric label/id for the object, as used in multilabel segmentation masks. Must be unique.

  • color (Optional[Tuple[int, int, int, int]]) –

    RGBA color for the object.

  • emdb_id (Optional[str]) –

    EMDB ID for the object.

  • pdb_id (Optional[str]) –

    PDB ID for the object.

  • identifier (Optional[str]) –

    Identifier for the object, drawn from an ontology/database namespace (GO, UniProtKB, CHEBI, PDB [dash separator, e.g. PDB-1BXN], UBERON, CL, or CDPO). When using the data portal, this must match the annotation object_id exactly.

  • map_threshold (Optional[float]) –

    Threshold to apply to the map when rendering the isosurface.

  • radius (Optional[float]) –

    Radius of the particle, when displaying as a sphere. For a filament, the tube radius.

  • metadata (Optional[Dict[str, Any]]) –

    Additional metadata for the object (user-defined contents). The key "copick" is reserved for copick's own extensions of the object spec; metadata["copick"]["filament"] declares the object a filament (see FilamentSpec) and is validated when present.

name

name: str

is_particle

is_particle: bool

label

label: Optional[int] = 1

color

color: Optional[Tuple[int, int, int, int]] = (100, 100, 100, 255)

emdb_id

emdb_id: Optional[str] = None

pdb_id

pdb_id: Optional[str] = None

identifier

identifier: Optional[str] = Field(None, alias=AliasChoices('go_id', 'identifier'))

map_threshold

map_threshold: Optional[float] = None

radius

radius: Optional[float] = None

metadata

metadata: Optional[Dict[str, Any]] = Field(default_factory=dict)

go_id

go_id

filament

filament: Optional[FilamentSpec]

The filament declaration of this object, or None if it is not a filament.

is_filament

is_filament: bool

Whether this object is declared a filament.

validate_label

validate_label(v) -> int

Validate the label.

validate_color

validate_color(v) -> Tuple[int, int, int, int]

Validate the color.

validate_name

validate_name(v) -> Optional[str]

Validate the name.

none_to_empty_dict

none_to_empty_dict(v)

validate_filament_spec

validate_filament_spec() -> PickableObject

Validate and normalise metadata["copick"]["filament"] when it is present.

Only that key is checked: any other content of the metadata, including a non-dict value under "copick" written before the key was reserved, is left as it is.

set_filament

set_filament(filament: Union[FilamentSpec, Dict[str, Any], None]) -> None

Declare this object a filament, update its declaration, or remove it (filament=None).

Parameters:

  • filament (Union[FilamentSpec, Dict[str, Any], None]) –

    The filament spec, as a FilamentSpec or a dict of its fields, or None.

Raises:

  • ValueError –

    If the spec is invalid, the object is not a particle, or metadata["copick"] holds a non-dict value.