class menpo.base.Targetable[source]

Bases: Copyable

Interface for objects that can produce a target PointCloud.

This could for instance be the result of an alignment or a generation of a PointCloud instance from a shape model.

Implementations must define sensible behavior for:

  • what a target is: see target

  • how to set a target: see set_target()

  • how to update the object after a target is set: see _sync_state_from_target()

  • how to produce a new target after the changes: see _new_target_from_state()

Note that _sync_target_from_state() needs to be triggered as appropriate by subclasses e.g. when from_vector_inplace is called. This will in turn trigger _new_target_from_state(), which each subclass must implement.


Generate an efficient copy of this object.

Note that Numpy arrays and other Copyable objects on self will be deeply copied. Dictionaries and sets will be shallow copied, and everything else will be assigned (no copy will be made).

Classes that store state other than numpy arrays and immutable types should overwrite this method to ensure all state is copied.


type(self) – A copy of this object


Update this object so that it attempts to recreate the new_target.


new_target (PointCloud) – The new target that this object should try and regenerate.

property n_dims

The number of dimensions of the target.



property n_points

The number of points on the target.



property target

The current PointCloud that this object produces.