Skip to content

Commit

Permalink
Merge pull request #803 from nontas/3dwidgets
Browse files Browse the repository at this point in the history
3D LabelledPointUndirectedGraph visualization
  • Loading branch information
nontas committed May 14, 2017
2 parents 9a777cf + b2aefa7 commit 58671b2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion menpo/landmark/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __iter__(self):
def __setitem__(self, group, value):
"""
Sets a new landmark group for the given label. This can be set using
an any :map`PointCloud` subclass. Existing landmark groups will be
any :map`PointCloud` subclass. Existing landmark groups will be
replaced.
Parameters
Expand Down
2 changes: 1 addition & 1 deletion menpo/shape/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2273,7 +2273,7 @@ def _view_landmarks_2d(self, group=None, with_labels=None,
return landmark_view

def _view_3d(self, figure_id=None, new_figure=True, render_lines=True,
line_colour='r', line_width=4, render_markers=True,
line_colour='r', line_width=2, render_markers=True,
marker_style='sphere', marker_size=None, marker_colour='k',
marker_resolution=8, step=None, alpha=1.0,
render_numbering=False, numbers_colour='k', numbers_size=None):
Expand Down
27 changes: 24 additions & 3 deletions menpo/shape/labelled.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,11 +739,32 @@ def _view_2d(self, with_labels=None, without_labels=None, group='group',
axes_y_limits=axes_y_limits, axes_x_ticks=axes_x_ticks,
axes_y_ticks=axes_y_ticks, figure_size=figure_size)

def _view_3d(self, figure_id=None, new_figure=False, **kwargs):
def _view_3d(self, with_labels=None, without_labels=None, group='group',
figure_id=None, new_figure=False, render_lines=True,
line_colour=None, line_width=2, render_markers=True,
marker_style='sphere', marker_size=None, marker_colour=None,
marker_resolution=8, step=None, alpha=1.0,
render_numbering=False, numbers_colour='k', numbers_size=None):
try:
from menpo3d.visualize import LandmarkViewer3d
return LandmarkViewer3d(
figure_id, new_figure, self).render(**kwargs)
if with_labels is not None and without_labels is not None:
raise ValueError('You may only pass one of `with_labels` or '
'`without_labels`.')
elif with_labels is not None:
lmark_group = self.with_labels(with_labels)
elif without_labels is not None:
lmark_group = self.without_labels(without_labels)
else:
lmark_group = self # Fall through
landmark_viewer = LandmarkViewer3d(figure_id, new_figure,
group, lmark_group)
return landmark_viewer.render(
render_lines=render_lines, line_colour=line_colour,
line_width=line_width, render_markers=render_markers,
marker_style=marker_style, marker_size=marker_size,
marker_colour=marker_colour, marker_resolution=marker_resolution,
step=step, alpha=alpha, render_numbering=render_numbering,
numbers_colour=numbers_colour, numbers_size=numbers_size)
except ImportError:
from menpo.visualize import Menpo3dMissingError
raise Menpo3dMissingError()
Expand Down

0 comments on commit 58671b2

Please sign in to comment.