Skip to content

Commit

Permalink
Merge pull request #14 from nontas/widgets_upgrade
Browse files Browse the repository at this point in the history
Visualization and Widgets upgrade
  • Loading branch information
Patrick Snape committed Jan 28, 2015
2 parents b70995a + 7c4cae5 commit e427b28
Show file tree
Hide file tree
Showing 17 changed files with 4,120 additions and 1,148 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ install:
- wget https://raw.githubusercontent.com/jabooth/condaci/v0.2.0/condaci.py -O condaci.py
- python condaci.py setup $PYTHON_VERSION --channel $BINSTAR_USER
- export PATH=$HOME/miniconda/bin:$PATH
#- conda config --add channels $BINSTAR_USER/channel/master
- conda config --add channels $BINSTAR_USER/channel/master

script:
- python condaci.py auto ./conda --binstaruser $BINSTAR_USER --binstarkey $BINSTAR_KEY
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ platform:
init:
- ps: Start-FileDownload 'https://raw.githubusercontent.com/jabooth/condaci/v0.2.0/condaci.py' C:\\condaci.py; echo "Done"
- cmd: python C:\\condaci.py setup %PYTHON_VERSION% --channel %BINSTAR_USER%
#- cmd: C:\\Miniconda\\Scripts\\conda config --add channels %BINSTAR_USER%/channel/master
- cmd: C:\\Miniconda\\Scripts\\conda config --add channels %BINSTAR_USER%/channel/master

install:
- cmd: C:\\Miniconda\\python C:\\condaci.py auto ./conda --binstaruser %BINSTAR_USER% --binstarkey %BINSTAR_KEY%
Expand Down
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ requirements:

run:
- python
- menpo 0.4.0a3
- menpo
- numpy 1.9.0
- scipy 0.14.0
- scikit-learn 0.15.2
Expand Down
119 changes: 94 additions & 25 deletions menpofit/aam/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,47 +181,116 @@ def _str_title(self):
"""
return 'Active Appearance Model'

def view_widget(self, n_shape_parameters=5, n_appearance_parameters=5,
parameters_bounds=(-3.0, 3.0), mode='multiple',
popup=False):
def view_shape_models_widget(self, n_parameters=5,
parameters_bounds=(-3.0, 3.0), mode='multiple',
popup=False, figure_size=(10, 8)):
r"""
Visualizes the AAM object using the
menpo.visualize.widgets.visualize_aam widget.
Visualizes the shape models of the AAM object using the
`menpo.visualize.widgets.visualize_shape_model` widget.
Parameters
-----------
n_shape_parameters : `int` or `list` of `int` or None, optional
n_parameters : `int` or `list` of `int` or ``None``, optional
The number of shape principal components to be used for the
parameters sliders.
If int, then the number of sliders per level is the minimum between
n_parameters and the number of active components per level.
If list of int, then a number of sliders is defined per level.
If None, all the active components per level will have a slider.
If `int`, then the number of sliders per level is the minimum
between `n_parameters` and the number of active components per
level.
If `list` of `int`, then a number of sliders is defined per level.
If ``None``, all the active components per level will have a slider.
parameters_bounds : (`float`, `float`), optional
The minimum and maximum bounds, in std units, for the sliders.
mode : {``single``, ``multiple``}, optional
If ``'single'``, only a single slider is constructed along with a
drop down menu.
If ``'multiple'``, a slider is constructed for each parameter.
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
figure_size : (`int`, `int`), optional
The size of the plotted figures.
"""
from menpofit.visualize import visualize_shape_model
visualize_shape_model(self.shape_models, n_parameters=n_parameters,
parameters_bounds=parameters_bounds,
figure_size=figure_size, mode=mode, popup=popup)

def view_appearance_models_widget(self, n_parameters=5,
parameters_bounds=(-3.0, 3.0),
mode='multiple', popup=False,
figure_size=(10, 8)):
r"""
Visualizes the appearance models of the AAM object using the
`menpo.visualize.widgets.visualize_appearance_model` widget.
n_appearance_parameters : `int` or `list` of `int` or None, optional
Parameters
-----------
n_parameters : `int` or `list` of `int` or ``None``, optional
The number of appearance principal components to be used for the
parameters sliders.
If int, then the number of sliders per level is the minimum between
n_parameters and the number of active components per level.
If list of int, then a number of sliders is defined per level.
If None, all the active components per level will have a slider.
If `int`, then the number of sliders per level is the minimum
between `n_parameters` and the number of active components per
level.
If `list` of `int`, then a number of sliders is defined per level.
If ``None``, all the active components per level will have a slider.
parameters_bounds : (`float`, `float`), optional
The minimum and maximum bounds, in std units, for the sliders.
mode : {``single``, ``multiple``}, optional
If ``'single'``, only a single slider is constructed along with a
drop down menu.
If ``'multiple'``, a slider is constructed for each parameter.
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
figure_size : (`int`, `int`), optional
The size of the plotted figures.
"""
from menpofit.visualize import visualize_appearance_model
visualize_appearance_model(self.appearance_models,
n_parameters=n_parameters,
parameters_bounds=parameters_bounds,
figure_size=figure_size, mode=mode,
popup=popup)

def view_aam_widget(self, n_shape_parameters=5, n_appearance_parameters=5,
parameters_bounds=(-3.0, 3.0), mode='multiple',
popup=False, figure_size=(10, 8)):
r"""
Visualizes both the shape and appearance models of the AAM object using
the `menpo.visualize.widgets.visualize_aam` widget.
mode : 'single' or 'multiple', optional
If single, only a single slider is constructed along with a drop down
menu.
If multiple, a slider is constructed for each parameter.
popup : `boolean`, optional
If enabled, the widget will appear as a popup window.
Parameters
-----------
n_shape_parameters : `int` or `list` of `int` or None, optional
The number of shape principal components to be used for the
parameters sliders.
If `int`, then the number of sliders per level is the minimum
between `n_parameters` and the number of active components per
level.
If `list` of `int`, then a number of sliders is defined per level.
If ``None``, all the active components per level will have a slider.
n_appearance_parameters : `int` or `list` of `int` or None, optional
The number of appearance principal components to be used for the
parameters sliders.
If `int`, then the number of sliders per level is the minimum
between `n_parameters` and the number of active components per
level.
If `list` of `int`, then a number of sliders is defined per level.
If ``None``, all the active components per level will have a slider.
parameters_bounds : (`float`, `float`), optional
The minimum and maximum bounds, in std units, for the sliders.
mode : {``single``, ``multiple``}, optional
If ``'single'``, only a single slider is constructed along with a
drop down menu.
If ``'multiple'``, a slider is constructed for each parameter.
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
figure_size : (`int`, `int`), optional
The size of the plotted figures.
"""
from menpofit.visualize import visualize_aam
visualize_aam(self, n_shape_parameters=n_shape_parameters,
n_appearance_parameters=n_appearance_parameters,
parameters_bounds=parameters_bounds, figure_size=(7, 7),
mode=mode, popup=popup)
parameters_bounds=parameters_bounds,
figure_size=figure_size, mode=mode, popup=popup)

def __str__(self):
out = "{}\n - {} training images.\n".format(self._str_title,
Expand Down
68 changes: 51 additions & 17 deletions menpofit/atm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,42 @@ def _str_title(self):
"""
return 'Active Template Model'

def view_widget(self, n_shape_parameters=5, parameters_bounds=(-3.0, 3.0),
mode='multiple', popup=False):
def view_shape_models_widget(self, n_parameters=5,
parameters_bounds=(-3.0, 3.0), mode='multiple',
popup=False, figure_size=(10, 8)):
r"""
Visualizes the shape models of the AAM object using the
`menpo.visualize.widgets.visualize_shape_model` widget.
Parameters
-----------
n_parameters : `int` or `list` of `int` or ``None``, optional
The number of shape principal components to be used for the
parameters sliders.
If `int`, then the number of sliders per level is the minimum
between `n_parameters` and the number of active components per
level.
If `list` of `int`, then a number of sliders is defined per level.
If ``None``, all the active components per level will have a slider.
parameters_bounds : (`float`, `float`), optional
The minimum and maximum bounds, in std units, for the sliders.
mode : {``single``, ``multiple``}, optional
If ``'single'``, only a single slider is constructed along with a
drop down menu.
If ``'multiple'``, a slider is constructed for each parameter.
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
figure_size : (`int`, `int`), optional
The size of the plotted figures.
"""
from menpofit.visualize import visualize_shape_model
visualize_shape_model(self.shape_models, n_parameters=n_parameters,
parameters_bounds=parameters_bounds,
figure_size=figure_size, mode=mode, popup=popup)

def view_atm_widget(self, n_shape_parameters=5,
parameters_bounds=(-3.0, 3.0), mode='multiple',
popup=False, figure_size=(10, 8)):
r"""
Visualizes the ATM object using the
menpo.visualize.widgets.visualize_atm widget.
Expand All @@ -177,26 +211,26 @@ def view_widget(self, n_shape_parameters=5, parameters_bounds=(-3.0, 3.0),
n_shape_parameters : `int` or `list` of `int` or None, optional
The number of shape principal components to be used for the
parameters sliders.
If int, then the number of sliders per level is the minimum between
n_parameters and the number of active components per level.
If list of int, then a number of sliders is defined per level.
If None, all the active components per level will have a slider.
If `int`, then the number of sliders per level is the minimum
between `n_parameters` and the number of active components per
level.
If `list` of `int`, then a number of sliders is defined per level.
If ``None``, all the active components per level will have a slider.
parameters_bounds : (`float`, `float`), optional
The minimum and maximum bounds, in std units, for the sliders.
mode : 'single' or 'multiple', optional
If single, only a single slider is constructed along with a drop down
menu.
If multiple, a slider is constructed for each parameter.
popup : `boolean`, optional
If enabled, the widget will appear as a popup window.
mode : {``single``, ``multiple``}, optional
If ``'single'``, only a single slider is constructed along with a
drop down menu.
If ``'multiple'``, a slider is constructed for each parameter.
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
figure_size : (`int`, `int`), optional
The size of the plotted figures.
"""
from menpofit.visualize import visualize_atm
visualize_atm(self, n_shape_parameters=n_shape_parameters,
parameters_bounds=parameters_bounds, figure_size=(7, 7),
mode=mode, popup=popup)
parameters_bounds=parameters_bounds,
figure_size=figure_size, mode=mode, popup=popup)

def __str__(self):
out = "{}\n - {} training shapes.\n".format(self._str_title,
Expand Down
41 changes: 21 additions & 20 deletions menpofit/clm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,37 +201,38 @@ def _str_title(self):
"""
return 'Constrained Local Model'

def view_widget(self, n_parameters=5, parameters_bounds=(-3.0, 3.0),
mode='multiple', popup=False):
def view_shape_models_widget(self, n_parameters=5,
parameters_bounds=(-3.0, 3.0), mode='multiple',
popup=False, figure_size=(10, 8)):
r"""
Visualizes the shape models of the CLM object using the
menpo.visualize.widgets.visualize_shape_model widget.
`menpo.visualize.widgets.visualize_shape_model` widget.
Parameters
-----------
n_parameters : `int` or `list` of `int` or None, optional
The number of principal components to be used for the parameters
sliders.
If int, then the number of sliders per level is the minimum between
n_parameters and the number of active components per level.
If list of int, then a number of sliders is defined per level.
If None, all the active components per level will have a slider.
n_parameters : `int` or `list` of `int` or ``None``, optional
The number of shape principal components to be used for the
parameters sliders.
If `int`, then the number of sliders per level is the minimum
between `n_parameters` and the number of active components per
level.
If `list` of `int`, then a number of sliders is defined per level.
If ``None``, all the active components per level will have a slider.
parameters_bounds : (`float`, `float`), optional
The minimum and maximum bounds, in std units, for the sliders.
mode : 'single' or 'multiple', optional
If single, only a single slider is constructed along with a drop down
menu.
If multiple, a slider is constructed for each parameter.
popup : `boolean`, optional
If enabled, the widget will appear as a popup window.
mode : {``single``, ``multiple``}, optional
If ``'single'``, only a single slider is constructed along with a
drop down menu.
If ``'multiple'``, a slider is constructed for each parameter.
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
figure_size : (`int`, `int`), optional
The size of the plotted figures.
"""
from menpofit.visualize import visualize_shape_model
visualize_shape_model(self.shape_models, n_parameters=n_parameters,
parameters_bounds=parameters_bounds,
figure_size=(7, 7), mode=mode, popup=popup)
figure_size=figure_size, mode=mode, popup=popup)

def __str__(self):
from menpofit.base import name_of_callable
Expand Down
Loading

0 comments on commit e427b28

Please sign in to comment.