LinkunGao / copper3d_visualisation

A 3d visualisation package base on threejs. Provides: Dicom loader, Nrrd Segmentation Tools, GltfExport, Create vtk animation functions.
https://linkungao.github.io/copper3d_visualisation/
Apache License 2.0
31 stars 1 forks source link
copper3d dicomloader nrrdtools visualization

copper3d

NPM Package Read the Docs Copper3d Examples NRRD_Segmentation_Tool example MedTech Heart example

A 3d visualisation package base on threejs provides multiple scenes and Nrrd image load funtion.

Documentation:

https://copper3d-visualisation.readthedocs.io/en/latest/

Previous versions

Old: https://www.npmjs.com/package/copper3d_visualisation Very old: https://www.npmjs.com/package/gltfloader-plugin-test

Example

Pick model with Gltfloader

Copper3d_examples

Useage

import * as Copper from "copper3d";
import { getCurrentInstance, onMounted } from "vue";
let refs = null;
let appRenderer;
onMounted(() => {
  let { $refs } = (getCurrentInstance() as any).proxy;
  refs = $refs;
  const bg: HTMLDivElement = refs.classfy;
  appRenderer = new Copper.copperRenderer(bg);
  const scene = appRenderer.getCurrentScene();
  scene.createDemoMesh();
  appRenderer.animate();
});
appRenderer = new Copper.copperRenderer(bg, { guiOpen: true });
import * as Copper from "copper3d";
import { getCurrentInstance, onMounted } from "vue";

let refs = null;
let appRenderer;
onMounted(() => {
  let { $refs } = (getCurrentInstance() as any).proxy;
  refs = $refs;
  const bg: HTMLDivElement = refs.classfy;
  appRenderer = new Copper.copperRenderer(bg);
  appRenderer.animate();
  loadModel("/Healthy.glb", "health");
});

function loadModel(url, name) {
  let scene1 = appRenderer.getSceneByName(name);
  if (scene1 == undefined) {
    const scene1 = appRenderer.createScene(name);
    appRenderer.setCurrentScene(scene1);
    scene1.loadViewUrl("/noInfarct_view.json");
    scene1.loadGltf(url);
  } else {
    appRenderer.setCurrentScene(scene1);
  }
}

Viewdata Structure

 CameraViewPoint {
  nearPlane: number = 0.1;
  farPlane: number = 2000.0;
  eyePosition: Array<number> = [0.0, 0.0, 0.0];
  targetPosition: Array<number> = [0.0, 0.0, 0.0];
  upVector: Array<number> = [0.0, 1.0, 0.0];
}

Acknowledgements

Special thanks to Duke University dataset provides these awsome MRI data!!!