USD Anatomy Tools
Specialized tools for anatomical structure handling in USD.
Module Reference
This module contains the USDAnatomyTools class, which is used to enhance the anatomy meshes in a USD file.
Extensibility
The default OmniSurface look for each anatomy group/organ lives in the
module-level DEFAULT_RENDER_PARAMS dict. A new segmenter that
introduces a new group (e.g. "brain", "tumor") can register a
matching look in one of three ways:
Globally, before instantiating any
USDAnatomyTools:from physiomotion4d.usd_anatomy_tools import DEFAULT_RENDER_PARAMS DEFAULT_RENDER_PARAMS["brain"] = {"name": "Brain", ...}
Every subsequent
USDAnatomyToolsinstance picks up the new entry.Per-instance, after construction:
tools = USDAnatomyTools(stage) tools.render_params["brain"] = {"name": "Brain", ...}
By subclassing, overriding
__init__to populateself.render_paramswith project-specific defaults.
Group lookup falls back to render_params["other"] when a group has no
registered entry, so any group present in the segmenter’s
physiomotion4d.AnatomyTaxonomy will still render something.
- class physiomotion4d.usd_anatomy_tools.USDAnatomyTools(stage, log_level=20)[source]
Apply OmniSurface materials to anatomy mesh prims in a USD stage.
The instance attribute
render_paramsis initialized from the module-levelDEFAULT_RENDER_PARAMS(deep copy per instance, so in-place edits stay local). See the module docstring for how to add new groups/organs.- __init__(stage, log_level=20)[source]
Initialize USDAnatomyTools.
- Parameters:
stage (
Any) – USD stage to work with. May beNonewhen the instance is only used for color look-ups (e.g. viaget_anatomy_diffuse_color()).log_level (
int|str) – Logging level (default: logging.INFO).
- get_anatomy_types()[source]
Return list of registered render-param keys (groups + organ overrides).
- get_anatomy_diffuse_color(anatomy_type)[source]
Return the diffuse reflection RGB color for the given group/organ.
This accessor does not require a USD stage and may be called on an instance created with
stage=Nonepurely for color look-up purposes.
- apply_anatomy_material_to_mesh(mesh_path, anatomy_type)[source]
Apply an anatomic OmniSurface material to a single mesh prim by type.
- Parameters:
mesh_path (
str) – USD path to the mesh prim (e.g. “/World/Meshes/MyMesh”).anatomy_type (
str) – A registered render-params key (group or organ override). Seeget_anatomy_types().
- Raises:
ValueError – If mesh_path is invalid or anatomy_type is not registered.
- Return type:
- apply_anatomy_material_to_prim(prim, material_params)[source]
Corrected material application with Omniverse-specific fixes
- Return type:
- enhance_meshes(segmentator)[source]
Apply per-organ OmniSurface materials to every matching mesh prim.
Walks the segmenter’s
AnatomyTaxonomyand applies a material to each mesh prim whose leaf name matches an organ name in any group. An organ-level entry inrender_params(e.g."liver","spleen","kidney_left") takes precedence over the entry for the containing group.Anatomy grouping is performed upstream by ConvertVTKToUSD, which writes labeled prims under
/World/{basename}/{type}/{label_name}. This method only needs to apply materials; it does not move prims.
Navigation