LandmarkManager¶
-
class
menpo.landmark.
LandmarkManager
[source]¶ Bases:
MutableMapping
,Transformable
Store for
LandmarkGroup
instances associated with an objectEvery
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.LandmarkGroup
instances are stored under string keys - these keys are refereed to as the group name. A special case is where there is a single unambiguousLandmarkGroup
attached to aLandmarkManager
- in this caseNone
can be used as a key to access the sole group.Note that all landmarks 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
() → list of D's (key, value) pairs, as 2-tuples¶
-
items_matching
(glob_pattern)[source]¶ Yield only items
(group, LandmarkGroup)
where the key matches a given glob.Parameters: glob_pattern (str) – A glob pattern e.g. ‘frontal_face_*’ Yields: item ( (group, LandmarkGroup)
) – Tuple of group, LandmarkGroup where the group matches the glob
-
iteritems
() → an iterator over the (key, value) items of D¶
-
iterkeys
() → an iterator over the keys of D¶
-
itervalues
() → an iterator over the values of D¶
-
keys
() → list of 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
() → list of D's values¶
-
view_widget
(browser_style='buttons', figure_size=(10, 8), style='coloured')[source]¶ Visualizes the landmark manager object using the
visualize_landmarks
widget.Parameters: - browser_style ({
'buttons'
,'slider'
}, optional) – It defines whether the selector of the landmark managers will have the form of plus/minus buttons or a slider. - figure_size ((int, int), optional) – The initial size of the rendered figure.
- style ({
'coloured'
,'minimal'
}, optional) – If'coloured'
, then the style of the widget will be coloured. Ifminimal
, then the style is simple using black and white colours.
- browser_style ({
-
group_labels
¶ All the labels for the landmark set.
Type: list of str
-
has_landmarks
¶ Whether the object has landmarks or not
Type: int
-
n_dims
¶ The total number of dimensions.
Type: int
-
n_groups
¶ Total number of labels.
Type: int
-