Skip to content

Commit

Permalink
apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi committed Mar 15, 2023
1 parent 8324991 commit eed1d59
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
16 changes: 16 additions & 0 deletions packages/core/src/RenderingEngine/BaseVolumeViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ abstract class BaseVolumeViewport extends Viewport implements IVolumeViewport {
return false;
}

protected applyViewOrientation(
orientation: OrientationAxis | OrientationVectors
) {
const { viewPlaneNormal, viewUp } =
this._getOrientationVectors(orientation);
const camera = this.getVtkActiveCamera();
camera.setDirectionOfProjection(
-viewPlaneNormal[0],
-viewPlaneNormal[1],
-viewPlaneNormal[2]
);
camera.setViewUpFrom(viewUp);

this.resetCamera();
}

private initializeVolumeNewImageEventDispatcher(): void {
const volumeNewImageHandlerBound = volumeNewImageHandler.bind(this);
const volumeNewImageCleanUpBound = volumeNewImageCleanUp.bind(this);
Expand Down
12 changes: 1 addition & 11 deletions packages/core/src/RenderingEngine/VolumeViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,7 @@ class VolumeViewport extends BaseVolumeViewport {
// if the camera is set to be acquisition axis then we need to skip
// it for now until the volume is set
if (orientation && orientation !== OrientationAxis.ACQUISITION) {
const { viewPlaneNormal, viewUp } =
this._getOrientationVectors(orientation);
const camera = this.getVtkActiveCamera();
camera.setDirectionOfProjection(
-viewPlaneNormal[0],
-viewPlaneNormal[1],
-viewPlaneNormal[2]
);
camera.setViewUpFrom(viewUp);

this.resetCamera();
this.applyViewOrientation(orientation);
return;
}

Expand Down
12 changes: 1 addition & 11 deletions packages/core/src/RenderingEngine/VolumeViewport3D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@ class VolumeViewport3D extends BaseVolumeViewport {
}

if (orientation && orientation !== OrientationAxis.ACQUISITION) {
const { viewPlaneNormal, viewUp } =
this._getOrientationVectors(orientation);
const camera = this.getVtkActiveCamera();
camera.setDirectionOfProjection(
-viewPlaneNormal[0],
-viewPlaneNormal[1],
-viewPlaneNormal[2]
);
camera.setViewUpFrom(viewUp);

this.resetCamera();
this.applyViewOrientation(orientation);
}
}

Expand Down

0 comments on commit eed1d59

Please sign in to comment.