Apply Filter Parameters: check default values¶

Sometime could be useful to check the default values that would be set to filter parameters. In fact, some filter set default values depending, for example, on the input mesh of the filter, or on the entire MeshSet. This is useful especially for parameters that would depend on features of the mesh like number of vertices or faces, bounding box diagonal… PyMeshLab provides a MeshSet function that returns in a dictionary all the parameters of a filter and their default values that would be used if the filter would be applied in the current MeshSet.

This script can be executed by running the following command:

pytest --pyargs pymeshlab -k 'apply_filter_parameters_check_default_values'

tests/example_apply_filter_parameters_check_default_values.py

import pymeshlab


def example_apply_filter_parameters_check_default_values():
    # lines needed to run this specific example
    print('\n')
    from . import samples_common
    base_path = samples_common.samples_absolute_path()

    # create a new MeshSet
    ms = pymeshlab.MeshSet()

    ms.load_new_mesh(base_path + 'colored_airplane.ply')

    # returns a dictionary which binds, for each parameter (a string with its name) the
    # default value that would be used if the given filter would be applied at the current
    # status of the MeshSet (e.g. current selected mesh)
    default_params = ms.filter_parameter_values('per_vertex_quality_histogram')

    print(default_params['histmax'])