LandmarkGroup¶
- class menpo.landmark.base.LandmarkGroup(target, group_label, pointcloud, labels_to_masks, copy=True)[source]¶
Bases: Viewable
An immutable object that holds a PointCloud (or a subclass) and stores labels for each point. These labels are defined via masks on the PointCloud. For this reason, the PointCloud is considered to be immutable.
Parameters: target : Landmarkable
The parent object of this landmark group.
group_label : string
The label of the group.
pointcloud : PointCloud
The pointcloud representing the landmarks.
labels_to_masks : dict of string to boolean ndarrays
For each label, the mask that specifies the indices in to the pointcloud that belong to the label.
copy : boolean, optional
If True, a copy of the PointCloud is stored on the group.
Raises: ValueError :
If no set of label masks is passed.
ValueError :
If any of the label masks differs in size to the pointcloud.
ValueError :
If there exists any point in the pointcloud that is not covered by a label.
- copy()[source]¶
An efficient copy of this landmark group.
Note that the returned landmark group will share the same target as self - the target will not be copied.
Returns: group : LandmarkGroup
A group with an identical set of points, labels, and masks as this one.
- view(**kwargs)¶
View the object using the default rendering engine figure handling. For example, the default behaviour for Matplotlib is that all draw commands are applied to the same figure object.
Parameters: kwargs : dict
Passed through to specific rendering engine.
Returns: viewer : Renderer
The renderer instantiated.
- view_new(**kwargs)¶
View the object on a new figure.
Parameters: kwargs : dict
Passed through to specific rendering engine.
Returns: viewer : Renderer
The renderer instantiated.
- view_on(figure_id, **kwargs)¶
View the object on a a specific figure specified by the given id.
Parameters: figure_id : object
A unique identifier for a figure.
kwargs : dict
Passed through to specific rendering engine.
Returns: viewer : Renderer
The renderer instantiated.
- with_labels(labels=None)[source]¶
Returns a new landmark group that contains only the given labels.
Parameters: labels : string or list of string, optional
Labels that should be kept in the returned landmark group. If None is passed, and if there is only one label on this group, the label will be substituted automatically.
Returns: landmark_group : LandmarkGroup
A new landmark group with the same group label but containing only the given label.
- without_labels(labels)[source]¶
Returns a new landmark group that contains all labels EXCEPT the given label.
Parameters: label : string
Label to exclude.
Returns: landmark_group : LandmarkGroup
A new landmark group with the same group label but containing all labels except the given label.
- lms[source]¶
The pointcloud representing all the landmarks in the group.
Type: PointCloud