CopickFilaments
copick.models.CopickFilaments
The traced filaments (ordered centrelines) of one pickable object in one run.
Attributes:
-
run(CopickRun) –Reference to the run these filaments belong to.
-
meta(CopickFilamentsFile) –The filaments and their metadata. Loaded from storage when
CopickFilaments.filamentsis first accessed.
__init__
Parameters:
-
run(CopickRun) –Reference to the run these filaments belong to.
-
file(CopickFilamentsFile) –Metadata for this set of filaments.
store
Store the filaments. A curve of a known kind that no longer describes its filament's points is dropped,
with a warning, rather than stored.
numpy
The centrelines as a list of (M, 3) arrays of [x, y, z] in Angstrom, in file order.
from_numpy
from_numpy(polylines: List[ndarray], instance_ids: Optional[List[int]] = None, polarity_known: Optional[List[bool]] = None, scores: Optional[List[float]] = None, radii: Optional[List[Optional[float]]] = None, voxel_spacing: Optional[float] = None, metadata: Optional[List[Optional[Dict[str, Any]]]] = None) -> None
Set the filaments from (M, 3) arrays of ordered points in Angstrom, and store them. The filaments have no
curves; use from_control_points or from_curves for editable ones.
Parameters:
-
polylines(List[ndarray]) –One (M, 3) array per filament, M >= 2, in order along the filament.
-
instance_ids(Optional[List[int]], default:None) –Filament IDs (>= 1, unique). Default 1..K.
-
polarity_known(Optional[List[bool]], default:None) –Per filament, whether the point order follows the polarity. Default False.
-
scores(Optional[List[float]], default:None) –Per filament score. Default 1.0.
-
radii(Optional[List[Optional[float]]], default:None) –Per filament tube radius in Angstrom, or None.
-
voxel_spacing(Optional[float], default:None) –Voxel spacing the filaments were traced in, recorded in the file.
-
metadata(Optional[List[Optional[Dict[str, Any]]]], default:None) –Per filament metadata, or None.
Raises:
-
ValueError–If the arguments' lengths differ or a filament is invalid.
from_curves
from_curves(curves: List[CopickFilamentCurve], instance_ids: Optional[List[int]] = None, polarity_known: Optional[List[bool]] = None, scores: Optional[List[float]] = None, radii: Optional[List[Optional[float]]] = None, voxel_spacing: Optional[float] = None, metadata: Optional[List[Optional[Dict[str, Any]]]] = None) -> None
Set the filaments from curves, regenerating their points, and store them.
Parameters:
-
curves(List[CopickFilamentCurve]) –One
CopickFilamentCurve(or dict of its fields) per filament, of a known kind; for exampleCopickFilamentCurve.from_tck(...)for a scipy spline fit. -
instance_ids, polarity_known, scores, radii, voxel_spacing, metadata–As for
from_numpy.
from_control_points
from_control_points(control_points: List[ndarray], instance_ids: Optional[List[int]] = None, step: Optional[float] = None, kind: str = 'catmull-rom', alpha: float = 0.5, polarity_known: Optional[List[bool]] = None, scores: Optional[List[float]] = None, radii: Optional[List[Optional[float]]] = None, voxel_spacing: Optional[float] = None, metadata: Optional[List[Optional[Dict[str, Any]]]] = None) -> None
Set the filaments from traced control points (catmull-rom or linear curves), regenerating their
points, and store them.
Parameters:
-
control_points(List[ndarray]) –One (n, 3) array per filament, n >= 2, in order along the filament, in Angstrom.
-
instance_ids(Optional[List[int]], default:None) –Filament IDs (>= 1, unique). Default 1..K.
-
step(Optional[float], default:None) –Arc-length spacing of the regenerated points; default
voxel_spacing(or the file's). -
kind(str, default:'catmull-rom') –"catmull-rom"or"linear". -
alpha(float, default:0.5) –Catmull-Rom parameterisation.
-
polarity_known, scores, radii, voxel_spacing, metadata–As for
from_numpy.
control_points
Per filament, in file order, the (n, 3) control points of its current curve, or None.
editable_curve
editable_curve(instance_id: int, tolerance: Optional[float] = None, kinds: Iterable[str] = CURVE_KINDS) -> CopickFilamentCurve
CopickFilament.editable_curve for one filament, deriving a curve at the file's voxel spacing: points
voxel_spacing apart, within half of it of the stored points.
Raises:
-
KeyError–If no filament has this ID.