Skip to content

Commit

Permalink
fix(growcut): memory limit issue (#1672)
Browse files Browse the repository at this point in the history
* try this

* example info
  • Loading branch information
sedghi authored Dec 4, 2024
1 parent 5d6fbf0 commit 2516e64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Types } from '@cornerstonejs/core';
import shaderCode from './growCutShader';

const GB = 1024 * 1024 * 1024;
const WEBGPU_MEMORY_LIMIT = 2 * GB;
const WEBGPU_MEMORY_LIMIT = 1.99 * GB;

const DEFAULT_GROWCUT_OPTIONS = {
windowSize: 3,
Expand Down Expand Up @@ -149,7 +149,7 @@ async function runGrowCut(
maxBufferSize: WEBGPU_MEMORY_LIMIT,
};

const adapter = await navigator.gpu.requestAdapter();
const adapter = await navigator.gpu?.requestAdapter();
const device = await adapter.requestDevice({ requiredLimits });
const BUFFER_SIZE = volumePixelData.byteLength;

Expand Down
4 changes: 4 additions & 0 deletions utils/ExampleRunner/example-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@
"wholeBodySegment": {
"name": "Whole Body Segment tool",
"description": "Demonstrates how to segment the whole body of a region selected by the user that is processed in the gpu"
},
"SAMClientSide": {
"name": "Segmentation AI Assistance",
"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 2516e64

Please sign in to comment.