Skip to content

Commit

Permalink
fix: resetCamera and annotations for flipped viewports (cornerstonejs…
Browse files Browse the repository at this point in the history
…#278)

* fix: remove applyTx since flip is not on actor anymore

* fix: make annotations appear on flipeed viewports

* fix: reset camera for flipped viewports

* fix build

* fix test

* fix: tests

* fix build
  • Loading branch information
sedghi authored and NeilMacPhee committed Nov 22, 2022
1 parent 1514c71 commit fe828bf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
1 change: 0 additions & 1 deletion common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ declare namespace CONSTANTS {
export {
colormapsData as CPU_COLORMAPS,
RENDERING_DEFAULTS,
mprCameraValues as MPR_CAMERA_VALUES,
EPSILON
}
}
Expand Down
21 changes: 20 additions & 1 deletion packages/core/src/RenderingEngine/VolumeViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,31 @@ import type {
} from '../types';
import type { ViewportInput } from '../types/IViewport';
import type IVolumeViewport from '../types/IVolumeViewport';
import { RENDERING_DEFAULTS, MPR_CAMERA_VALUES, EPSILON } from '../constants';
import { RENDERING_DEFAULTS, EPSILON } from '../constants';
import { Events, BlendModes, OrientationAxis } from '../enums';
import eventTarget from '../eventTarget';
import type { vtkSlabCamera as vtkSlabCameraType } from './vtkClasses/vtkSlabCamera';
import { imageIdToURI, triggerEvent } from '../utilities';
import { VoiModifiedEventDetail } from '../types/EventTypes';
import deepFreeze from '../utilities/deepFreeze';

const ORIENTATION = {
axial: {
viewPlaneNormal: <Point3>[0, 0, -1],
viewUp: <Point3>[0, -1, 0],
},
sagittal: {
viewPlaneNormal: <Point3>[1, 0, 0],
viewUp: <Point3>[0, 0, 1],
},
coronal: {
viewPlaneNormal: <Point3>[0, 1, 0],
viewUp: <Point3>[0, 0, 1],
},
};

// Note: Object.freeze is only shallow, so we need to deepFreeze
deepFreeze(ORIENTATION);

/**
* An object representing a VolumeViewport. VolumeViewports are used to render
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import CPU_COLORMAPS from './cpuColormaps';
import RENDERING_DEFAULTS from './rendering';
import EPSILON from './epsilon';
import MPR_CAMERA_VALUES from './mprCameraValues';

export { CPU_COLORMAPS, RENDERING_DEFAULTS, MPR_CAMERA_VALUES, EPSILON };
export { CPU_COLORMAPS, RENDERING_DEFAULTS, EPSILON };

0 comments on commit fe828bf

Please sign in to comment.