menpo/landmark/labels.py
def _relabel_group_from_dict(pointcloud, labels_to_ranges):
    """
    Label the given pointcloud according to the given ordered dictionary
    of labels to ranges. This assumes that you can semantically label the group
    by using ranges in to the existing points e.g ::

        labels_to_ranges = {'jaw': (0, 17, False)}

    The third element of the range tuple is whether the range is a closed loop
    or not. For example, for an eye landmark this would be ``True``, as you
    do want to create a closed loop for an eye.

    Parameters
    ----------
    pointcloud : :map:`PointCloud`
        The pointcloud to apply semantic labels to.
    labels_to_ranges : `OrderedDict`
        Ordered dictionary of string labels to range tuples.

    Returns
    -------
    landmark_group: :map:`LandmarkGroup`
        New landmark group

    Raises
    ------
    :class:`menpo.landmark.exceptions.LabellingError`
        If the given pointcloud contains less than ``n_expected_points``
        points.
    """
    from menpo.shape import PointUndirectedGraph

    n_points = pointcloud.n_points
    masks = OrderedDict()
    adjacency_lists = []
    for label, tup in labels_to_ranges.items():
        range_tuple = tup[:-1]
        close_loop = tup[-1]
        adjacency_lists.append(_connectivity_from_range(
            range_tuple, close_loop=close_loop))
        masks[label] = _mask_from_range(range_tuple, n_points)
    adjacency_array = np.vstack(adjacency_lists)

    new_landmark_group = LandmarkGroup(
        PointUndirectedGraph(pointcloud.points, adjacency_array), masks)

    return new_landmark_group

    Label the given pointcloud according to the given ordered dictionary
    of labels to ranges. This assumes that you can semantically label the group
    by using ranges in to the existing points e.g ::

        labels_to_ranges = {'jaw': (0, 17, False)}

    The third element of the range tuple is whether the range is a closed loop
    or not. For example, for an eye landmark this would be ``True``, as you
    do want to create a closed loop for an eye.

    Parameters
    ----------
    pointcloud : :map:`PointCloud`
        The pointcloud to apply semantic labels to.
    labels_to_ranges : `OrderedDict`
        Ordered dictionary of string labels to range tuples.

    Returns
    -------
    landmark_group: :map:`LandmarkGroup`
        New landmark group

    Raises
    ------
    :class:`menpo.landmark.exceptions.LabellingError`
        If the given pointcloud contains less than ``n_expected_points``
        points.
    
Label the given pointcloud according to the given ordered dictionary
of labels to ranges. This assumes that you can semantically label the group
by using ranges in to the existing points e.g :.



The third element of the range tuple is whether the range is a closed loop
or not. For example, for an eye landmark this would be ``True``, as you
do want to create a closed loop for an eye.

Parameters

pointcloud : :map:`PointCloud`
The pointcloud to apply semantic labels to.
labels_to_ranges : `OrderedDict`
Ordered dictionary of string labels to range tuples.

Returns

:map:`LandmarkGroup`
New landmark group

Raises
Label the given pointcloud according to the given ordered dictionary of labels to ranges . This assumes that you can semantically label the group by using ranges in to the existing points e . g : . The third element of the range tuple is whether the range is a closed loop or not . For example for an eye landmark this would be ` ` True ` ` as you do want to create a closed loop for an eye . Parameters pointcloud : : map : ` PointCloud ` The pointcloud to apply semantic labels to . labels_to_ranges : ` OrderedDict ` Ordered dictionary of string labels to range tuples . Returns : map : ` LandmarkGroup ` New landmark group Raises
def _relabel_group_from_dict(pointcloud, labels_to_ranges):
    from menpo.shape import PointUndirectedGraph
    n_points = pointcloud.n_points
    masks = OrderedDict()
    adjacency_lists = []
    for label, tup in labels_to_ranges.items():
        range_tuple = tup[:-1]
        close_loop = tup[-1]
        adjacency_lists.append(_connectivity_from_range(
            range_tuple, close_loop=close_loop))
        masks[label] = _mask_from_range(range_tuple, n_points)
    adjacency_array = np.vstack(adjacency_lists)
    new_landmark_group = LandmarkGroup(
        PointUndirectedGraph(pointcloud.points, adjacency_array), masks)
    return new_landmark_group
def _relabel_group_from_dict ( pointcloud , labels_to_ranges ) : from menpo . shape import PointUndirectedGraph n_points = pointcloud . n_points masks = OrderedDict ( ) adjacency_lists = [ ] for label , tup in labels_to_ranges . items ( ) : range_tuple = tup [ : - 1 ] close_loop = tup [ - 1 ] adjacency_lists . append ( _connectivity_from_range ( range_tuple , close_loop = close_loop ) ) masks [ label ] = _mask_from_range ( range_tuple , n_points ) adjacency_array = np . vstack ( adjacency_lists ) new_landmark_group = LandmarkGroup ( PointUndirectedGraph ( pointcloud . points , adjacency_array ) , masks ) return new_landmark_group
Label the given pointcloud according to the given ordered dictionary
of labels to ranges.
Label the given pointcloud according to the given ordered dictionary of labels to ranges .
"""
    Label the given pointcloud according to the given ordered dictionary
    of labels to ranges. This assumes that you can semantically label the group
    by using ranges in to the existing points e.g ::

        labels_to_ranges = {'jaw': (0, 17, False)}

    The third element of the range tuple is whether the range is a closed loop
    or not. For example, for an eye landmark this would be ``True``, as you
    do want to create a closed loop for an eye.

    Parameters
    ----------
    pointcloud : :map:`PointCloud`
        The pointcloud to apply semantic labels to.
    labels_to_ranges : `OrderedDict`
        Ordered dictionary of string labels to range tuples.

    Returns
    -------
    landmark_group: :map:`LandmarkGroup`
        New landmark group

    Raises
    ------
    :class:`menpo.landmark.exceptions.LabellingError`
        If the given pointcloud contains less than ``n_expected_points``
        points.
    """
pointcloud
labels_to_ranges
class
`menpo.landmark.exceptions.LabellingError`
If the given pointcloud contains less than ``n_expected_points``
points.
` menpo . landmark . exceptions . LabellingError ` If the given pointcloud contains less than ` ` n_expected_points ` ` points .