Skip to content

Commit

Permalink
Set StackViewport.initialViewUp in the constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Boccanfuso committed Jan 23, 2023
1 parent 9f1ce66 commit 264ae3d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ class StackViewport extends Viewport implements IStackViewport {
renderer.setActiveCamera(camera);

const viewPlaneNormal = <Point3>[0, 0, -1];
const viewUp = <Point3>[0, -1, 0];
this.initialViewUp = <Point3>[0, -1, 0];

camera.setDirectionOfProjection(
-viewPlaneNormal[0],
-viewPlaneNormal[1],
-viewPlaneNormal[2]
);
camera.setViewUp(...viewUp);
camera.setViewUp(...this.initialViewUp);
camera.setParallelProjection(true);
camera.setThicknessFromFocalPoint(0.1);
// @ts-ignore: vtkjs incorrect typing
Expand Down Expand Up @@ -1889,14 +1889,13 @@ class StackViewport extends Viewport implements IStackViewport {
// Todo: we need to make the rotation a camera properties so that
// we can reset it there, right now it is not possible to reset the rotation
// without this
if (this.initialViewUp) {
// We do not know the ordering of various flips and rotations that have been applied, so just start like we were at the beginning.
this.setCamera({
flipHorizontal: false,
flipVertical: false,
viewUp: this.initialViewUp,
});
}

// We do not know the ordering of various flips and rotations that have been applied, so just start like we were at the beginning.
this.setCamera({
flipHorizontal: false,
flipVertical: false,
viewUp: this.initialViewUp,
});

// For stack Viewport we since we have only one slice
// it should be enough to reset the camera to the center of the image
Expand Down

0 comments on commit 264ae3d

Please sign in to comment.