pyvista.examples.downloads.download_frog_tissue#

download_frog_tissue(load=True)[source]#

Download frog tissue dataset.

This dataset contains tissue segmentation labels for the frog dataset (see download_frog()).

Parameters:
loadbool, default: True

Load the dataset after downloading it when True. Set this to False and only the filename will be returned.

Returns:
pyvista.ImageData | str

DataSet or filename depending on load.

Examples

Load data

>>> import numpy as np
>>> import pyvista as pv
>>> from pyvista import examples
>>> data = examples.download_frog_tissue()

Plot tissue labels as a volume

First, define plotting parameters

>>> # Configure colors / color bar
>>> clim = data.get_data_range()  # Set color bar limits to match data
>>> cmap = 'glasbey'  # Use a categorical colormap
>>> categories = True  # Ensure n_colors matches number of labels
>>> opacity = (
...     'foreground'  # Make foreground opaque, background transparent
... )
>>> opacity_unit_distance = 1

Set plotting resolution to half the image’s spacing

>>> res = np.array(data.spacing) / 2

Define rendering parameters

>>> mapper = 'gpu'
>>> shade = True
>>> ambient = 0.3
>>> diffuse = 0.6
>>> specular = 0.5
>>> specular_power = 40

Make and show plot

>>> p = pv.Plotter()
>>> _ = p.add_volume(
...     data,
...     clim=clim,
...     ambient=ambient,
...     shade=shade,
...     diffuse=diffuse,
...     specular=specular,
...     specular_power=specular_power,
...     mapper=mapper,
...     opacity=opacity,
...     opacity_unit_distance=opacity_unit_distance,
...     categories=categories,
...     cmap=cmap,
...     resolution=res,
... )
>>> p.camera_position = 'yx'  # Set camera to provide a dorsal view
>>> p.show()
../../../_images/pyvista-examples-downloads-download_frog_tissue-1_00_00.png