How to use the pyvista.core.filters.DataSetFilters function in pyvista

To help you get started, we’ve selected a few pyvista examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyvista / pyvista / pyvista / core / filters.py View on Github external
def outline(composite, generate_faces=False, nested=False):
        """Produces an outline of the full extent for the all blocks in this
        composite dataset.

        Parameters
        ----------
        generate_faces : bool, optional
            Generate solid faces for the box. This is off by default

        nested : bool, optional
            If True, these creates individual outlines for each nested dataset
        """
        if nested:
            return DataSetFilters.outline(composite, generate_faces=generate_faces)
        box = pyvista.Box(bounds=composite.bounds)
        return box.outline(generate_faces=generate_faces)
github pyvista / pyvista / pyvista / core / filters.py View on Github external
slice_orthogonal = DataSetFilters.slice_orthogonal


    slice_along_axis = DataSetFilters.slice_along_axis


    slice_along_line = DataSetFilters.slice_along_line


    wireframe = DataSetFilters.wireframe


    elevation = DataSetFilters.elevation


    compute_cell_sizes = DataSetFilters.compute_cell_sizes


    cell_centers = DataSetFilters.cell_centers


    cell_data_to_point_data = DataSetFilters.cell_data_to_point_data


    point_data_to_cell_data = DataSetFilters.point_data_to_cell_data


    triangulate = DataSetFilters.triangulate


    def outline(composite, generate_faces=False, nested=False):
        """Produces an outline of the full extent for the all blocks in this
github pyvista / pyvista / pyvista / core / filters.py View on Github external
return percent

        def _get_val(percent, dmin, dmax):
            """Get the value from a percentage of a range."""
            percent = _check_percent(percent)
            return dmin + float(percent) * (dmax - dmin)

        # Compute the values
        if isinstance(percent, collections.Iterable):
            # Get two values
            value = [_get_val(percent[0], dmin, dmax), _get_val(percent[1], dmin, dmax)]
        else:
            # Compute one value to threshold
            value = _get_val(percent, dmin, dmax)
        # Use the normal thresholding function on these values
        return DataSetFilters.threshold(dataset, value=value, scalars=scalars,
                                        invert=invert, continuous=continuous,
                                        preference=preference)
github pyvista / pyvista / pyvista / core / filters.py View on Github external
alg.AddInputData(block)
        alg.SetMergePoints(merge_points)
        alg.Update()
        return wrap(alg.GetOutputDataObject(0))


    clip = DataSetFilters.clip


    clip_box = DataSetFilters.clip_box


    slice = DataSetFilters.slice


    slice_orthogonal = DataSetFilters.slice_orthogonal


    slice_along_axis = DataSetFilters.slice_along_axis


    slice_along_line = DataSetFilters.slice_along_line


    wireframe = DataSetFilters.wireframe


    elevation = DataSetFilters.elevation


    compute_cell_sizes = DataSetFilters.compute_cell_sizes
github pyvista / pyvista / pyvista / core / filters.py View on Github external
def __add__(poly_data, mesh):
        """Merge these two meshes."""
        if not isinstance(mesh, vtk.vtkPolyData):
            return DataSetFilters.__add__(poly_data, mesh)
        return PolyDataFilters.boolean_add(poly_data, mesh)
github pyvista / pyvista / pyvista / core / filters.py View on Github external
wireframe = DataSetFilters.wireframe


    elevation = DataSetFilters.elevation


    compute_cell_sizes = DataSetFilters.compute_cell_sizes


    cell_centers = DataSetFilters.cell_centers


    cell_data_to_point_data = DataSetFilters.cell_data_to_point_data


    point_data_to_cell_data = DataSetFilters.point_data_to_cell_data


    triangulate = DataSetFilters.triangulate


    def outline(composite, generate_faces=False, nested=False):
        """Produce an outline of the full extent for the all blocks in this composite dataset.

        Parameters
        ----------
        generate_faces : bool, optional
            Generate solid faces for the box. This is off by default

        nested : bool, optional
            If True, these creates individual outlines for each nested dataset
github pyvista / pyvista / pyvista / core / filters.py View on Github external
def split_bodies(dataset, label=False):
        """Find, label, and split connected bodies/volumes. This splits
        different connected bodies into blocks in a MultiBlock dataset.

        Parameters
        ----------
        label : bool
            A flag on whether to keep the ID arrays given by the
            ``connectivity`` filter.
        """
        # Get the connectivity and label different bodies
        labeled = DataSetFilters.connectivity(dataset)
        classifier = labeled.cell_arrays['RegionId']
        bodies = pyvista.MultiBlock()
        for vid in np.unique(classifier):
            # Now extract it:
            b = labeled.threshold([vid-0.5, vid+0.5], scalars='RegionId')
            if not label:
                # strange behavior:
                # must use this method rather than deleting from the point_arrays
                # or else object is collected.
                b._remove_array(CELL_DATA_FIELD, 'RegionId')
                b._remove_array(POINT_DATA_FIELD, 'RegionId')
            bodies.append(b)

        return bodies
github pyvista / pyvista / pyvista / core / filters.py View on Github external
merge_points : bool, optional
            Merge coincidental points.

        """
        alg = vtk.vtkAppendFilter()
        for block in composite:
            alg.AddInputData(block)
        alg.SetMergePoints(merge_points)
        alg.Update()
        return wrap(alg.GetOutputDataObject(0))


    clip = DataSetFilters.clip


    clip_box = DataSetFilters.clip_box


    slice = DataSetFilters.slice


    slice_orthogonal = DataSetFilters.slice_orthogonal


    slice_along_axis = DataSetFilters.slice_along_axis


    slice_along_line = DataSetFilters.slice_along_line


    wireframe = DataSetFilters.wireframe
github pyvista / pyvista / pyvista / core / filters.py View on Github external
def ptc(dataset, pass_point_data=False):
        """Transform point data into cell data.

        Point data are specified per node and cell data specified within cells.
        Optionally, the input point data can be passed through to the output.

        An alias/shortcut for ``point_data_to_cell_data``.

        """
        return DataSetFilters.point_data_to_cell_data(dataset, pass_point_data=pass_point_data)
github pyvista / pyvista / pyvista / core / filters.py View on Github external
implicit function) or scalar value (if clipping with scalars).
            The default value is 0.0.

        inplace : bool, optional
            Updates mesh in-place while returning nothing.

        """
        if isinstance(normal, str):
            normal = NORMALS[normal.lower()]
        # find center of data if origin not specified
        if origin is None:
            origin = dataset.center
        # create the plane for clipping
        function = generate_plane(normal, origin)
        # run the clip
        result = DataSetFilters._clip_with_function(dataset, function,
                                                    invert=invert, value=value)
        if inplace:
            dataset.overwrite(result)
        else:
            return result