Skip to main content

Visualize Geometry

Sethealth allows to load 3D models (geometry) into an existing workspace. Imagine, for example, viewing a custom implant model over a CT. Loading, generating and serializing geometries can be done through the geometry module.

Workspace#

Here the workspace has its own role too. A workspace contains a list of geometry models:

workspace.geometries

This array (initially empty), can be modified in order to append geometries into an existing workspace. UI components will then render the 3D model over the medical resource.

// Load medical data
const med = await sethealth.med.loadFromSource({
type: "nrrd",
input:
"https://public1-eu-sethealth.ams3.cdn.digitaloceanspaces.com/public/ankle.nrrd.gz",
});
if (med.error) {
console.error(med.error);
return;
}
const medHandler = med.value[0];
// Creating workspace from medical data
const workspace = await sethealth.workspace.create(medHandler);
// Load a geometry (from a .stl) file
const result = await sethealth.geometry.loadFromSource({
type: "stl",
input:
"https://public1-eu-sethealth.ams3.cdn.digitaloceanspaces.com/public/geometry/fibula.stl.gz",
});
if (result.error) {
console.error(result.error);
return;
}
// Append the geometry to the workspace
const geometries = result.value;
workspace.addGeomestries(...geometries);
this.setState({ workspace });

As shown here, the workspace is created with the MedHandler and then the Geometry is attached to workspace.geometries.

Render a Geometry#

The attached geometry can then be visualized with the component <set-view-geometry>.

<SetViewGeometry workspace={myWorkspace} />

The only required field is the workspace. For further information about this component, check out the component docs.