Skip to content

Commit

Permalink
Issue #3 tidy up urls and intialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson318 committed May 4, 2022
1 parent 792fa1a commit d0cc0e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ camera.setParallelScale(100)
camera.setClippingRange(300, 1500)
renderer.setActiveCamera(camera)

veinactor(url, handleActor)
tumouractor0(url, handleActor)
tumouractor1(url, handleActor)

// some downlighting
setupLights(url, renderer)

// ----------------------------------------------------------------------------
// Use OpenGL as the backend to view the all this
// ----------------------------------------------------------------------------
Expand All @@ -59,12 +52,11 @@ openglRenderWindow.setContainer(container)
// Capture size of the video window and set it to the renderWindow
// ----------------------------------------------------------------------------
const background = document.getElementById('background')
let width = 800
let height = 600
if (background !== null) {
[width, height] = background.getBoundingClientRect()
const dims = background.getBoundingClientRect()
openglRenderWindow.setSize(dims.width, dims.height)
console.log(dims)
}
openglRenderWindow.setSize(width, height)

// ----------------------------------------------------------------------------
// Setup an interactor to handle mouse events
Expand All @@ -83,13 +75,20 @@ if (container !== null) {

interactor.setInteractorStyle(vtkInteractorStyleTrackballCamera.newInstance())

veinactor(url, handleActor)
tumouractor0(url, handleActor)
tumouractor1(url, handleActor)

// some downlighting
setupLights(url, renderer)

function handleActor (error, actor) {
if (error) console.error('Download error!', error)
else {
renderer.addActor(actor)
// I don't know why but we seem to need to invoke an interactor event to get
// it to redraw automatically. Just calling render doesn't do it.
// openglRenderWindow.render()
interactor.invokeLeftButtonPress(0, 0)
if (interactor !== null) interactor.invokeLeftButtonPress(0, 0)
}
};
2 changes: 1 addition & 1 deletion src/sksAnatomy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper.js'
import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor.js'
import vtkXMLPolyDataReader from '@kitware/vtk.js/IO/XML/XMLPolyDataReader.js'

const path = 'https://github.com/SciKit-Surgery/luminance_study/blob/master/dist/assets/vtp/'
const path = 'https://raw.githubusercontent.com/SciKit-Surgery/luminance_study/master/dist/assets/'
export function coneactor () {
const coneSource = vtkConeSource.newInstance({ height: 1.0 })

Expand Down

0 comments on commit d0cc0e5

Please sign in to comment.