material#
Module for creating various materials used in 3D rendering.
|
Material for VectorFieldActor. |
|
Material for VectorFieldActor. |
|
Material for VectorFieldActor. |
|
Initialize the Spherical Glyph Material. |
|
Initialize the Streamlines Material. |
|
Billboard material for creating quads that always face the camera. |
|
Material for GPU-generated streamtubes. |
|
Phong-lit material for billboard-based impostor spheres. |
|
Ensure opacity is between 0 and 1. |
|
Validate and modify color based on opacity and mode. |
VectorFieldThinLineMaterial#
- class fury.material.VectorFieldThinLineMaterial(cross_section, *, visibility=None, **kwargs)[source]#
Bases:
LineMaterialMaterial for VectorFieldActor.
- Parameters:
cross_section ({list, tuple, ndarray}) – A list or tuple or ndarray representing the cross section dimensions.
visibility ({list, tuple, ndarray}, optional) – A list or tuple or ndarray representing the visibility in the 3D. If None, the visibility will be set to (-1, -1, -1) to show the complete field.
**kwargs (dict) – Additional keyword arguments for the material.
- __init__(cross_section, *, visibility=None, **kwargs)[source]#
Initialize the VectorFieldMaterial.
- Parameters:
cross_section ({list, tuple, ndarray}) – A list or tuple or ndarray representing the cross section dimensions.
visibility ({list, tuple, ndarray}, optional) – A list or tuple or ndarray representing the visibility in the 3D. If None, the visibility will be set to (-1, -1, -1) to show the complete field.
**kwargs (dict) – Additional keyword arguments for the material.
- property cross_section#
Get the cross section of the vector field.
- Returns:
A list representing the cross section dimensions.
- Return type:
VectorFieldLineMaterial#
- class fury.material.VectorFieldLineMaterial(cross_section, *, visibility=None, **kwargs)[source]#
Bases:
VectorFieldThinLineMaterialMaterial for VectorFieldActor.
This class provides a way to distinguish the usage of right shader for creating a vector field.
- __init__(cross_section, *, visibility=None, **kwargs)#
Initialize the VectorFieldMaterial.
- Parameters:
cross_section ({list, tuple, ndarray}) – A list or tuple or ndarray representing the cross section dimensions.
visibility ({list, tuple, ndarray}, optional) – A list or tuple or ndarray representing the visibility in the 3D. If None, the visibility will be set to (-1, -1, -1) to show the complete field.
**kwargs (dict) – Additional keyword arguments for the material.
VectorFieldArrowMaterial#
- class fury.material.VectorFieldArrowMaterial(cross_section, *, visibility=None, **kwargs)[source]#
Bases:
VectorFieldThinLineMaterialMaterial for VectorFieldActor.
This class provides a way to distinguish the usage of right shader for creating a vector field.
- __init__(cross_section, *, visibility=None, **kwargs)#
Initialize the VectorFieldMaterial.
- Parameters:
cross_section ({list, tuple, ndarray}) – A list or tuple or ndarray representing the cross section dimensions.
visibility ({list, tuple, ndarray}, optional) – A list or tuple or ndarray representing the visibility in the 3D. If None, the visibility will be set to (-1, -1, -1) to show the complete field.
**kwargs (dict) – Additional keyword arguments for the material.
SphGlyphMaterial#
- class fury.material.SphGlyphMaterial(n_coeffs=-1, scale=1, shininess=30, emissive='#000', specular='#494949', **kwargs)[source]#
Bases:
MeshPhongMaterialInitialize the Spherical Glyph Material.
- Parameters:
n_coeffs (int, optional) – The maximum spherical harmonic degree.
scale (int, optional) – The scale factor.
shininess (int, optional) – The shininess factor.
emissive (str, optional) – The emissive color.
specular (str, optional) – The specular color.
**kwargs (dict) – Additional keyword arguments for the material.
- __init__(n_coeffs=-1, scale=1, shininess=30, emissive='#000', specular='#494949', **kwargs)[source]#
Initialize the Spherical Glyph Material.
- Parameters:
n_coeffs (int, optional) – The maximum spherical harmonic degree. This value will limit the number of spherical harmonic coefficients that can be used from the data. If -1, no limit is applied.
scale (int, optional) – The scale factor.
shininess (int, optional) – The shininess factor.
emissive (str, optional) – The emissive color.
specular (str, optional) – The specular color.
**kwargs (dict) – Additional keyword arguments for the material.
- property n_coeffs#
Get the maximum number of spherical harmonic coefficients.
- Returns:
The maximum number of spherical harmonic coefficients.
- Return type:
- uniform_type: ClassVar[dict[str, str]] = {'alpha_test': 'f4', 'ao_map_intensity': 'f4', 'clipping_planes': '0*4xf4', 'color': '4xf4', 'emissive_color': '4xf4', 'emissive_intensity': 'f4', 'light_map_intensity': 'f4', 'maprange': '2xf4', 'n_coeffs': 'i4', 'normal_scale': '2xf4', 'opacity': 'f4', 'reflectivity': 'f4', 'refraction_ratio': 'f4', 'scale': 'f4', 'shininess': 'f4', 'specular_color': '4xf4', 'wireframe': 'f4'}#
StreamlinesMaterial#
- class fury.material.StreamlinesMaterial(outline_thickness=0.0, outline_color=(0, 0, 0), roi_enabled=None, roi_dim=(0, 0, 0), **kwargs)[source]#
Bases:
LineMaterialInitialize the Streamlines Material.
- Parameters:
outline_thickness (float, optional) – The thickness of the outline.
outline_color (tuple, optional) – The color of the outline as an RGBA tuple.
roi_enabled (bool, optional) – Whether ROI culling is active. This is typically driven by the presence of an ROI mask on the actor.
roi_dim (tuple, optional) – 3D integer dimensions (nx, ny, nz) of a mask grid when a volumetric ROI is used in the shader.
**kwargs (dict) – Additional keyword arguments for the material.
- __init__(outline_thickness=0.0, outline_color=(0, 0, 0), roi_enabled=None, roi_dim=(0, 0, 0), **kwargs)[source]#
Initialize the Streamline Material.
- Parameters:
outline_thickness (float, optional) – The thickness of the outline.
outline_color (tuple, optional) – The color of the outline as an RGBA tuple.
roi_enabled (bool, optional) – Whether ROI culling is active. If None, ROI culling defaults to False until an ROI mask is attached by the actor.
roi_dim (tuple, optional) – 3D integer dimensions (nx, ny, nz) of a mask grid when a volumetric ROI is used in the shader.
**kwargs (dict) – Additional keyword arguments for the material.
- property outline_color#
Get the outline color.
- Returns:
The color of the outline as an RGBA tuple.
- Return type:
- property outline_thickness#
Get the outline thickness.
- Returns:
The thickness of the outline.
- Return type:
- property roi_dim#
ROI grid dimensions as (nx, ny, nz).
- Returns:
A tuple of three integers representing the ROI grid dimensions.
- Return type:
- property roi_enabled#
Return True when ROI-based culling is active.
- Returns:
True if ROI-based culling is enabled, False otherwise.
- Return type:
BillboardMaterial#
- class fury.material.BillboardMaterial(**kwargs)[source]#
Bases:
MeshBasicMaterialBillboard material for creating quads that always face the camera.
This material is designed to work with the BillboardShader to create rectangles that automatically rotate to face the camera while maintaining their 3D position.
- Parameters:
**kwargs (dict) – Additional keyword arguments forwarded to
MeshBasicMaterial.
StreamtubeMaterial#
BillboardSphereMaterial#
validate_opacity#
- fury.material.validate_opacity(opacity)[source]#
Ensure opacity is between 0 and 1.
- Parameters:
opacity (float) – Opacity value to validate.
- Returns:
Validated opacity value.
- Return type:
- Raises:
ValueError – If opacity is not between 0 and 1.
validate_color#
- fury.material.validate_color(color, opacity, mode)[source]#
Validate and modify color based on opacity and mode.
- Parameters:
- Returns:
Modified color tuple with opacity applied.
- Return type:
tuple or None
- Raises:
ValueError – If color is None when mode is ‘auto’ or if color has invalid length.