load_surface_leaf_bending#
- ktch.datasets.load_surface_leaf_bending(*, return_paths: bool = False, as_frame: bool = False, version: str | None = None, data_home: str | Path | None = None) Bunch[source]#
Load and return the synthetic 3D leaf bending surface dataset.
This dataset contains 3D surface meshes of synthetic wheat-like leaves with bending deformation, corresponding to the outline dataset
load_outline_leaf_bending(). Each specimen consists of a surface mesh and a disk parameterization mesh (unit disk, z=0), stored as OFF files.The data is downloaded from a remote server on first use and cached locally.
Specimens
60
Mesh format
OFF (Object File Format)
Mesh types
surface mesh + parameter mesh
Coordinate dimensionality
3
Total size
~77 MB (zip)
- Parameters:
- return_pathsbool, default=False
If True, return file paths to the OFF files instead of loading them as numpy arrays. Useful for large datasets or when using external mesh libraries such as meshio.
- as_framebool, default=False
If True, the metadata is returned as a pandas DataFrame. Otherwise, it is returned as a dict.
- versionstr, optional
The dataset version to load (e.g., “1”). If None, uses the default version for the current ktch release.
- data_homestr, Path, or None
Directory to cache downloaded files. If None, uses the OS cache directory (e.g.,
~/Library/Caches/ktch-datasetson macOS).
- Returns:
- data
Bunch Dictionary-like object, with the following attributes.
- verticeslist of ndarray of shape (n_vertices_i, 3)
Surface mesh vertex coordinates for each specimen. Only present when
return_paths=False.- faceslist of ndarray of shape (n_faces_i, 3)
Surface mesh triangle indices for each specimen. Only present when
return_paths=False.- param_verticeslist of ndarray of shape (n_vertices_i, 3)
Parameter mesh vertex coordinates (on the unit disk, z=0) for each specimen. Only present when
return_paths=False.- param_faceslist of ndarray of shape (n_faces_i, 3)
Parameter mesh triangle indices for each specimen. Only present when
return_paths=False.- surface_pathslist of str
Paths to the surface mesh OFF files. Only present when
return_paths=True.- param_pathslist of str
Paths to the parameter mesh OFF files. Only present when
return_paths=True.- metadict or DataFrame
Metadata containing bending parameters for each specimen. If
as_frame=True, returns a pandas DataFrame.- DESCRstr
The full description of the dataset.
- data_dirstr
Path to the directory containing the extracted data.
- versionstr
The version of the dataset that was loaded.
- data
Notes
This function requires the optional dependency
poochfor downloading the dataset. Install it using:pip install ktch[data]Mesh topologies (vertex and face counts) may vary across specimens.
Examples
>>> from ktch.datasets import load_surface_leaf_bending >>> data = load_surface_leaf_bending() >>> len(data.vertices) 60 >>> data.vertices[0].shape (8099, 3) >>> data.param_vertices[0][:3, :2] # unit-disk parameterization ...