LandmarkManager¶
-
class
menpo.landmark.
LandmarkManager
[source]¶ Bases:
MutableMapping
,Transformable
Store for
PointCloud
or :LabelledPointUndirectedGraph
instances associated with an object.Every
Landmarkable
instance has an instance of this class available at the.landmarks
property. It is through this class that all access to landmarks attached to instances is handled. In general theLandmarkManager
provides a dictionary-like interface for storing landmarks. The LandmarkManager will contain instances ofPointCloud
orLabelledPointUndirectedGraph
or subclasses thereof.LabelledPointUndirectedGraph
is unique in it’s ability to include labels that refer to subsets of the underlying points that represent interesting semantic labels. ThesePointCloud
orLabelledPointUndirectedGraph
(or subclasses) are stored under string keys - these keys are refereed to as the group name. A special case is where there is a single unambiguous group attached to aLandmarkManager
- in this caseNone
can be used as a key to access this sole group.Note that all groups stored on a
Landmarkable
in it’s attachedLandmarkManager
are automatically transformed and copied with their parent object.-
clear
() → None. Remove all items from D.¶
-
copy
()[source]¶ Generate an efficient copy of this
LandmarkManager
.- Returns
type(self)
– A copy of this object
-
get
(k[, d]) → D[k] if k in D, else d. d defaults to None.¶
-
items
() → a set-like object providing a view on D's items¶
-
items_matching
(glob_pattern)[source]¶ Yield only items
(group, PointCloud)
where the key matches a given glob.- Parameters
glob_pattern (str) – A glob pattern e.g. ‘frontal_face_*’
- Yields
item (
(group, PointCloud)
) – Tuple of (str, PointCloud) where the group matches the glob.
-
keys
() → a set-like object providing a view on D's keys¶
-
keys_matching
(glob_pattern)[source]¶ Yield only landmark group names (keys) matching a given glob.
- Parameters
glob_pattern (str) – A glob pattern e.g. ‘frontal_face_*’
- Yields
keys (group labels that match the glob pattern)
-
pop
(k[, d]) → v, remove specified key and return the corresponding value.¶ If key is not found, d is returned if given, otherwise KeyError is raised.
-
popitem
() → (k, v), remove and return some (key, value) pair¶ as a 2-tuple; but raise KeyError if D is empty.
-
setdefault
(k[, d]) → D.get(k,d), also set D[k]=d if k not in D¶
-
update
([E, ]**F) → None. Update D from mapping/iterable E and F.¶ If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
-
values
() → an object providing a view on D's values¶
-
property
group_labels
¶ All the labels for the landmark set sorted by insertion order.
- Type
list of str
-
property
has_landmarks
¶ Whether the object has landmarks or not
- Type
int
-
property
n_dims
¶ The total number of dimensions.
- Type
int
-
property
n_groups
¶ Total number of labels.
- Type
int
-