Skip to content

Commit

Permalink
fix(StackViewport): Add metadata checks in methods and update example…
Browse files Browse the repository at this point in the history
… info (#1660)
  • Loading branch information
sedghi authored Dec 3, 2024
1 parent d5c8036 commit cf29c45
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
File renamed without changes.
9 changes: 9 additions & 0 deletions packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ class StackViewport extends Viewport {
private getImageDataCPU(): CPUIImageData | undefined {
const { metadata } = this._cpuFallbackEnabledElement;

if (!metadata) {
return;
}

const spacing = metadata.spacing;
const csImage = this.csImage;
return {
Expand Down Expand Up @@ -942,6 +946,11 @@ class StackViewport extends Viewport {

private getCameraCPU(): Partial<ICamera> {
const { metadata, viewport } = this._cpuFallbackEnabledElement;

if (!metadata) {
return {};
}

const { direction } = metadata;

// focalPoint and position of CPU camera is just a placeholder since
Expand Down
4 changes: 2 additions & 2 deletions utils/ExampleRunner/example-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@
"name": "sculptorTool Tool",
"description": "Demonstrates how to have similar brush tool effects on the contour"
},
"segmentationAI": {
"SAMClientSide": {
"name": "Segmentation AI Assistance",
"description": "Demonstrates how to use AI/ML assistance tools for segmentation creation"
"description": "Demonstrates how to use AI assistance tools for segmentation creation using onnx runtime on the client side"
}
},
"tools-advanced": {
Expand Down

0 comments on commit cf29c45

Please sign in to comment.