dusunax / dicom-and-three-js-viewer

๐Ÿฉป great viewer for dcm & ply file
3 stars 0 forks source link

ERROR: SharedArrayBuffer is NOT supported in your browser. #3

Closed dusunax closed 1 year ago

dusunax commented 1 year ago

ISSUE _ 230604~

๐Ÿ“Œ not able to render volumetric images with Cornerstone3D


SharedArrayBuffer updates in Android Chrome 88 and Desktop Chrome 92

dusunax commented 1 year ago

from cornerstonejs docs

https://www.cornerstonejs.org/docs/getting-started/scope/#browser-support

image

Cornerstone3D uses the HTML5 canvas element and WebGL 2.0 GPU rendering to render images which is supported by all modern browsers. Advanced features such as volume streaming which uses SharedArrayBuffer to create a shared memory is not supported in all >browsers. The following browsers are supported:

Chrome > 68
Firefox > 79
Edge > 79

If you are using an older browser, or don't have any graphics cards, your device might not be able to render volumetric images with Cornerstone3D. However, you can still render stack images using the CPU fallback that we have implemented in Cornerstone3D for such scenarios.

IMPORTANT SharedArrayBuffer requires cross-origin-isolation in the browsers. This means that you cannot use it in a browser that is not cross-origin isolated. Read More

updated chrome

image

์—๋Ÿฌ ํ™•์ธํ•˜๊ธฐ

image

[kor] what is cross-origin-isolation?๐Ÿค”

cross-origin-isolation (๋™์ผ ์ถœ์ฒ˜ ์ •์ฑ…) & Cross-origin isolation (๊ต์ฐจ ์ถœ์ฒ˜ ๊ฒฉ๋ฆฌ)์„ ๋น„๊ต

Cross-origin isolation๊ณผ Same-Origin Policy๋Š” ์›น ๋ณด์•ˆ์„ ๊ฐ•ํ™”ํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”์ปค๋‹ˆ์ฆ˜์œผ๋กœ, ๋‹ค๋ฅธ ์ถœ์ฒ˜(Origin) ๊ฐ„์˜ ์ƒํ˜ธ์ž‘์šฉ์„ ์ œํ•œํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋‘˜์€ ๋ชฉ์ ๊ณผ ๋™์ž‘ ๋ฐฉ์‹์—์„œ ์ฐจ์ด๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

Same-Origin Policy (๋™์ผ ์ถœ์ฒ˜ ์ •์ฑ…):

Cross-origin isolation (๊ต์ฐจ ์ถœ์ฒ˜ ๊ฒฉ๋ฆฌ):

SharedArrayBuffer

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements

const buffer = new SharedArrayBuffer(16);
console.log(buffer);

=> ์—๋Ÿฌ

image

SharedArrayBuffer is only available to pages that are cross-origin isolated. So you need to host your own server with Cross-Origin-Embedder-Policy: require-corp and Cross-Origin-Opener-Policy: same-origin headers.

๋ ˆํผ๋Ÿฐ์Šค

https://github.com/ffmpegwasm/ffmpeg.wasm/issues/263
https://create-react-app.dev/docs/proxying-api-requests-in-development/#configuring-the-proxy-manually
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements
https://www.cornerstonejs.org/docs/getting-started/scope/#browser-support

//server
https://github.com/ffmpegwasm/ffmpeg.wasm/issues/263#issuecomment-1148387248
https://create-react-app.dev/docs/proxying-api-requests-in-development/#configuring-the-proxy-manually
dusunax commented 1 year ago

ํ”„๋กœ์ ํŠธ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ์˜ cross-origin-isolation

ํ”„๋กœ์ ํŠธ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ cross-origin-isolation์„ ๊ตฌํ˜„ํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ฅผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์„œ๋ฒ„ ๊ตฌ์„ฑ

cross-origin-isolation์„ ํ™œ์„ฑํ™”ํ•˜๊ธฐ ์œ„ํ•ด ๋ฐฑ์—”๋“œ ์„œ๋ฒ„์—์„œ Cross-Origin-Opener-Policy ํ—ค๋”๋ฅผ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ํ—ค๋”๋Š” ์›น ํŽ˜์ด์ง€๊ฐ€ cross-origin-isolation์„ ํ™œ์„ฑํ™”ํ•˜๋„๋ก ์ง€์‹œํ•ฉ๋‹ˆ๋‹ค. ๋ฐฑ์—”๋“œ ์„œ๋ฒ„์˜ ๊ตฌ์ฒด์ ์ธ ์„ค์ • ๋ฐฉ๋ฒ•์€ ์‚ฌ์šฉํ•˜๋Š” ์›น ์„œ๋ฒ„์— ๋”ฐ๋ผ ๋‹ค๋ฅผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์›น ํŽ˜์ด์ง€ ์„ค์ •

cross-origin-isolation์„ ์‚ฌ์šฉํ•˜๋ ค๋Š” ์›น ํŽ˜์ด์ง€์˜ ํƒœ๊ทธ ๋‚ด์— ๋‹ค์Œ ๋ฉ”ํƒ€ ํƒœ๊ทธ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค:

<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin">

์œ„์˜ ์˜ˆ์‹œ๋Š” "same-origin"์„ ์‚ฌ์šฉํ•˜์—ฌ ์›น ํŽ˜์ด์ง€๋ฅผ ์ž์‹ ์˜ ์ถœ์ฒ˜์—์„œ ๋กœ๋“œ๋œ ๋ฆฌ์†Œ์Šค์™€๋งŒ ์ƒํ˜ธ์ž‘์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์ง€์‹œํ•ฉ๋‹ˆ๋‹ค. ์ด๋Š” cross-origin-isolation์„ ํ™œ์„ฑํ™”์‹œํ‚ค๋Š” ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ ๋‹ค๋ฅธ ์ •์ฑ…์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด "same-origin" ๋Œ€์‹  ๋‹ค๋ฅธ ๊ฐ’์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

SharedArrayBuffer ์‚ฌ์šฉ

cross-origin-isolation์„ ํ™œ์„ฑํ™”ํ•œ ํ›„์—๋Š” SharedArrayBuffer๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. SharedArrayBuffer๋Š” ์—ฌ๋Ÿฌ ์Šค๋ ˆ๋“œ ๊ฐ„์— ๋ฐ์ดํ„ฐ๋ฅผ ๊ณต์œ ํ•˜๊ธฐ ์œ„ํ•œ ๊ธฐ๋Šฅ์ด๋ฏ€๋กœ, ์ด์ œ๋ถ€ํ„ฐ ํ•ด๋‹น ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜์—ฌ ์›น ํŽ˜์ด์ง€์—์„œ ์›ํ•˜๋Š” ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์œ„์˜ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ผ ํ”„๋กœ์ ํŠธ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ cross-origin-isolation์„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด SharedArrayBuffer๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์Šค๋ ˆ๋“œ ๊ฐ„์˜ ๋ฐ์ดํ„ฐ ๊ณต์œ ๋ฅผ ์•ˆ์ „ํ•˜๊ฒŒ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

dusunax commented 1 year ago

230621 ์—…๋ฐ์ดํŠธ

ํ•ด๋‹น ์ž‘์—…์€ Python ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๋Œ€์ฒด๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Python ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ