CopickFilament
copick.models.CopickFilament
Bases: BaseModel
One traced filament: an ordered centreline polyline in tomogram coordinates.
Attributes:
-
instance_id(int) –Filament ID (>= 1), unique within its file. Picks sampled from this filament use it as their instance ID.
-
points(List[Tuple[float, float, float]]) –Ordered vertices
[[x, y, z], ...]in Angstrom, at least two. Consecutive vertices should be no further apart than the trace's voxel spacing, so that linear interpolation follows the centreline. -
polarity_known(bool) –Whether the point order follows the structure's polarity (meaningful for objects whose filament spec has
polar: true). -
score(float) –Confidence score.
-
radius(Optional[float]) –Tube radius in Angstrom, if measured.
-
metadata(Dict[str, Any]) –Additional metadata (user-defined contents).
-
curve(Optional[CopickFilamentCurve]) –The editable or fitted curve
pointswere regenerated from, if any (seeCopickFilamentCurve).
validate_points
At least two finite vertices.
from_curve
A filament whose points are regenerated from curve.
Parameters:
-
instance_id(int) –Filament ID (>= 1).
-
curve(CopickFilamentCurve) –The curve (a known kind).
-
**fields–Other
CopickFilamentfields (polarity_known,score,radius,metadata).
from_control_points
from_control_points(instance_id: int, control_points, step: float, kind: str = 'catmull-rom', alpha: float = 0.5, **fields) -> CopickFilament
A filament traced through control_points (catmull-rom or linear), with regenerated points.
Parameters:
-
instance_id(int) –Filament ID (>= 1).
-
control_points–(n, 3) control points in Angstrom, n >= 2, in order along the filament.
-
step(float) –Arc-length spacing of the regenerated points, in Angstrom (usually the voxel spacing).
-
kind(str, default:'catmull-rom') –"catmull-rom"or"linear"; absplineis made withfrom_curve. -
alpha(float, default:0.5) –Catmull-Rom parameterisation.
-
**fields–Other
CopickFilamentfields.
curve_is_current
Whether the filament has a curve of a known kind that still describes its points.
with_control_points
A copy with moved or new control points and regenerated points, keeping the curve's kind.
A bspline keeps its degree and knots, so it needs as many control points as before. A filament without a
current curve of a known kind gets a catmull-rom curve.
Parameters:
-
control_points–The new (n, 3) control points in Angstrom.
-
step(Optional[float], default:None) –Arc-length spacing of the regenerated points; default the curve's (or, without a curve, the median spacing of
points).
editable_curve
editable_curve(tolerance: Optional[float] = None, step: Optional[float] = None, kinds: Iterable[str] = CURVE_KINDS) -> CopickFilamentCurve
The curve an editor should show: the filament's own if it is current and of one of kinds, otherwise a
catmull-rom curve derived from points (copick.util.filaments.control_points_from_polyline).
Parameters:
-
tolerance(Optional[float], default:None) –Largest distance of the derived curve from
points, in Angstrom; default halfstep. -
step(Optional[float], default:None) –Spacing of the derived curve's points; default the median spacing of
points. -
kinds(Iterable[str], default:CURVE_KINDS) –The curve kinds the editor supports.