Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
DMIAOCHEN committed Nov 22, 2022
2 parents 4913e99 + a923b68 commit bce55b9
Show file tree
Hide file tree
Showing 21 changed files with 238 additions and 36 deletions.
4 changes: 4 additions & 0 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,8 @@ interface IViewport {
// (undocumented)
id: string;
// (undocumented)
isDisabled: boolean;
// (undocumented)
options: ViewportInputOptions;
// (undocumented)
removeAllActors(): void;
Expand Down Expand Up @@ -2042,6 +2044,8 @@ export class Viewport implements IViewport {
// (undocumented)
protected initialCamera: ICamera;
// (undocumented)
isDisabled: boolean;
// (undocumented)
_isInBounds(point: Point3, bounds: number[]): boolean;
// (undocumented)
options: ViewportInputOptions;
Expand Down
1 change: 1 addition & 0 deletions common/reviews/api/streaming-image-volume-loader.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ interface IViewport {
getRenderingEngine(): any;
getZoom(): number;
id: string;
isDisabled: boolean;
options: ViewportInputOptions;
removeAllActors(): void;
render(): void;
Expand Down
1 change: 1 addition & 0 deletions common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,7 @@ interface IViewport {
getRenderingEngine(): any;
getZoom(): number;
id: string;
isDisabled: boolean;
options: ViewportInputOptions;
removeAllActors(): void;
render(): void;
Expand Down
44 changes: 44 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,50 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.21.4](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/core@0.21.3...@cornerstonejs/core@0.21.4) (2022-11-21)


### Bug Fixes

* annotation rendering engine on viewport removal ([#303](https://github.com/cornerstonejs/cornerstone3D-beta/issues/303)) ([aeb205e](https://github.com/cornerstonejs/cornerstone3D-beta/commit/aeb205e56e0d2068258c278863aa3d7447331a43))





## [0.21.3](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/core@0.21.2...@cornerstonejs/core@0.21.3) (2022-11-19)


### Bug Fixes

* don't reset display pipeline when spacing is missing ([#301](https://github.com/cornerstonejs/cornerstone3D-beta/issues/301)) ([e12fcf3](https://github.com/cornerstonejs/cornerstone3D-beta/commit/e12fcf3c361db0f927fd5fdd448686fef8893b36))





## [0.21.2](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/core@0.21.1...@cornerstonejs/core@0.21.2) (2022-11-18)


### Bug Fixes

* **worldToImage:** Not throw out of bounds in worldToImage ([#302](https://github.com/cornerstonejs/cornerstone3D-beta/issues/302)) ([ffb20f7](https://github.com/cornerstonejs/cornerstone3D-beta/commit/ffb20f715c768b8f590b103cd18acc2bc2068adf))





## [0.21.1](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/core@0.21.0...@cornerstonejs/core@0.21.1) (2022-11-17)


### Bug Fixes

* adjust canvas, not only off screen renderer on resize ([#279](https://github.com/cornerstonejs/cornerstone3D-beta/issues/279)) ([1959ac7](https://github.com/cornerstonejs/cornerstone3D-beta/commit/1959ac7866305510855753f054678eac95e9c015))





# [0.21.0](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/core@0.20.0...@cornerstonejs/core@0.21.0) (2022-11-11)


Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cornerstonejs/core",
"version": "0.21.0",
"version": "0.21.4",
"description": "",
"main": "dist/umd/index.js",
"types": "dist/esm/index.d.ts",
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/RenderingEngine/RenderingEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class RenderingEngine implements IRenderingEngine {

// 5. Remove the requested viewport from the rendering engine
this._removeViewport(viewportId);
viewport.isDisabled = true;

// 6. Avoid rendering for the disabled viewport
this._needsRender.delete(viewportId);
Expand Down Expand Up @@ -577,6 +578,12 @@ class RenderingEngine implements IRenderingEngine {

// 3. Reset viewport cameras
vtkDrivenViewports.forEach((vp: IStackViewport | IVolumeViewport) => {
const canvas = getOrCreateCanvas(vp.element);
const rect = canvas.getBoundingClientRect();
const devicePixelRatio = window.devicePixelRatio || 1;
canvas.width = rect.width * devicePixelRatio;
canvas.height = rect.height * devicePixelRatio;

const prevCamera = vp.getCamera();
vp.resetCamera();

Expand Down
21 changes: 10 additions & 11 deletions packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1310,17 +1310,16 @@ class StackViewport extends Viewport implements IStackViewport {
const columnCosines = direction.slice(3, 6);

// using spacing, size, and direction only for now
if (
xSpacing !== image.rowPixelSpacing ||
ySpacing !== image.columnPixelSpacing ||
xVoxels !== image.columns ||
yVoxels !== image.rows ||
!isEqual(imagePlaneModule.rowCosines, <Point3>rowCosines) ||
!isEqual(imagePlaneModule.columnCosines, <Point3>columnCosines)
) {
return false;
}
return true;
return (
(xSpacing === image.rowPixelSpacing ||
(image.rowPixelSpacing === null && xSpacing === 1.0)) &&
(ySpacing === image.columnPixelSpacing ||
(image.columnPixelSpacing === null && ySpacing === 1.0)) &&
xVoxels === image.columns &&
yVoxels === image.rows &&
isEqual(imagePlaneModule.rowCosines, <Point3>rowCosines) &&
isEqual(imagePlaneModule.columnCosines, <Point3>columnCosines)
);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/RenderingEngine/Viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Viewport implements IViewport {
protected flipHorizontal = false;
protected flipVertical = false;
protected rotation = 0;
public isDisabled: boolean;

/** sx of viewport on the offscreen canvas */
sx: number;
Expand Down Expand Up @@ -95,6 +96,7 @@ class Viewport implements IViewport {
? props.defaultOptions.suppressEvents
: false;
this.options = _cloneDeep(props.defaultOptions);
this.isDisabled = false;
}

getFrameOfReferenceUID: () => string;
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/RenderingEngine/VolumeViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ class VolumeViewport extends Viewport implements IVolumeViewport {
const volumeNewImageCleanUpBound = volumeNewImageCleanUp.bind(this);

function volumeNewImageHandler(cameraEvent) {
const { viewportId } = cameraEvent.detail;

if (viewportId !== this.id || this.isDisabled) {
return;
}

const viewportImageData = this.getImageData();

if (!viewportImageData) {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/types/IViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ interface IViewport {
options: ViewportInputOptions;
/** Suppress events */
suppressEvents: boolean;
/** if the viewport has been disabled */
isDisabled: boolean;
/** frameOfReferenceUID the viewport's default actor is rendering */
getFrameOfReferenceUID: () => string;
/** method to convert canvas to world coordinates */
Expand Down
11 changes: 0 additions & 11 deletions packages/core/src/utilities/worldToImageCoords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@ function worldToImageCoords(
columnDistance / columnPixelSpacing,
];

if (
imageCoords[0] < 0 ||
imageCoords[0] >= columns ||
imageCoords[1] < 0 ||
imageCoords[1] >= rows
) {
throw new Error(
`The image coordinates are outside of the image, imageCoords: ${imageCoords}`
);
}

return imageCoords as Point2;
}

Expand Down
32 changes: 32 additions & 0 deletions packages/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.7.7](https://github.com/cornerstonejs/cornerstone3D-beta/compare/docs@0.7.6...docs@0.7.7) (2022-11-21)

**Note:** Version bump only for package docs





## [0.7.6](https://github.com/cornerstonejs/cornerstone3D-beta/compare/docs@0.7.5...docs@0.7.6) (2022-11-19)

**Note:** Version bump only for package docs





## [0.7.5](https://github.com/cornerstonejs/cornerstone3D-beta/compare/docs@0.7.4...docs@0.7.5) (2022-11-18)

**Note:** Version bump only for package docs





## [0.7.4](https://github.com/cornerstonejs/cornerstone3D-beta/compare/docs@0.7.3...docs@0.7.4) (2022-11-17)

**Note:** Version bump only for package docs





## [0.7.3](https://github.com/cornerstonejs/cornerstone3D-beta/compare/docs@0.7.2...docs@0.7.3) (2022-11-16)

**Note:** Version bump only for package docs
Expand Down
8 changes: 4 additions & 4 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docs",
"version": "0.7.3",
"version": "0.7.7",
"private": true,
"repository": "https://github.com/cornerstonejs/cornerstone3D-beta",
"scripts": {
Expand Down Expand Up @@ -28,9 +28,9 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@cornerstonejs/core": "^0.21.0",
"@cornerstonejs/streaming-image-volume-loader": "^0.6.1",
"@cornerstonejs/tools": "^0.29.2",
"@cornerstonejs/core": "^0.21.4",
"@cornerstonejs/streaming-image-volume-loader": "^0.6.5",
"@cornerstonejs/tools": "^0.29.6",
"@docusaurus/core": "2.0.0-rc.1",
"@docusaurus/module-type-aliases": "2.0.0-rc.1",
"@docusaurus/preset-classic": "2.0.0-rc.1",
Expand Down
32 changes: 32 additions & 0 deletions packages/streaming-image-volume-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,38 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.6.5](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/streaming-image-volume-loader@0.6.4...@cornerstonejs/streaming-image-volume-loader@0.6.5) (2022-11-21)

**Note:** Version bump only for package @cornerstonejs/streaming-image-volume-loader





## [0.6.4](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/streaming-image-volume-loader@0.6.3...@cornerstonejs/streaming-image-volume-loader@0.6.4) (2022-11-19)

**Note:** Version bump only for package @cornerstonejs/streaming-image-volume-loader





## [0.6.3](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/streaming-image-volume-loader@0.6.2...@cornerstonejs/streaming-image-volume-loader@0.6.3) (2022-11-18)

**Note:** Version bump only for package @cornerstonejs/streaming-image-volume-loader





## [0.6.2](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/streaming-image-volume-loader@0.6.1...@cornerstonejs/streaming-image-volume-loader@0.6.2) (2022-11-17)

**Note:** Version bump only for package @cornerstonejs/streaming-image-volume-loader





## [0.6.1](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/streaming-image-volume-loader@0.6.0...@cornerstonejs/streaming-image-volume-loader@0.6.1) (2022-11-11)

**Note:** Version bump only for package @cornerstonejs/streaming-image-volume-loader
Expand Down
4 changes: 2 additions & 2 deletions packages/streaming-image-volume-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cornerstonejs/streaming-image-volume-loader",
"version": "0.6.1",
"version": "0.6.5",
"description": "",
"main": "dist/umd/index.js",
"types": "dist/esm/index.d.ts",
Expand All @@ -26,7 +26,7 @@
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
},
"dependencies": {
"@cornerstonejs/core": "^0.21.0",
"@cornerstonejs/core": "^0.21.4",
"cornerstone-wado-image-loader": "^4.2.1"
},
"peerDependencies": {
Expand Down
35 changes: 35 additions & 0 deletions packages/tools/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,41 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.29.6](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/tools@0.29.5...@cornerstonejs/tools@0.29.6) (2022-11-21)


### Bug Fixes

* annotation rendering engine on viewport removal ([#303](https://github.com/cornerstonejs/cornerstone3D-beta/issues/303)) ([aeb205e](https://github.com/cornerstonejs/cornerstone3D-beta/commit/aeb205e56e0d2068258c278863aa3d7447331a43))





## [0.29.5](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/tools@0.29.4...@cornerstonejs/tools@0.29.5) (2022-11-19)

**Note:** Version bump only for package @cornerstonejs/tools





## [0.29.4](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/tools@0.29.3...@cornerstonejs/tools@0.29.4) (2022-11-18)

**Note:** Version bump only for package @cornerstonejs/tools





## [0.29.3](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/tools@0.29.2...@cornerstonejs/tools@0.29.3) (2022-11-17)

**Note:** Version bump only for package @cornerstonejs/tools





## [0.29.2](https://github.com/cornerstonejs/cornerstone3D-beta/compare/@cornerstonejs/tools@0.29.1...@cornerstonejs/tools@0.29.2) (2022-11-16)


Expand Down
4 changes: 2 additions & 2 deletions packages/tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cornerstonejs/tools",
"version": "0.29.2",
"version": "0.29.6",
"description": "Cornerstone3D Tools",
"main": "dist/umd/index.js",
"types": "dist/esm/index.d.ts",
Expand All @@ -26,7 +26,7 @@
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
},
"dependencies": {
"@cornerstonejs/core": "^0.21.0",
"@cornerstonejs/core": "^0.21.4",
"lodash.clonedeep": "4.5.0",
"lodash.get": "^4.4.2"
},
Expand Down
Loading

0 comments on commit bce55b9

Please sign in to comment.