From b77d57ce81daa42bf024a6209216d0d9f9d96414 Mon Sep 17 00:00:00 2001 From: Steve Pieper Date: Mon, 6 May 2024 16:35:34 -0400 Subject: [PATCH 1/5] fix(vtkseg): fix part10 parsing --- examples/vtkDisplay/index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/vtkDisplay/index.html b/examples/vtkDisplay/index.html index 4fcd242e..ee21e7a1 100644 --- a/examples/vtkDisplay/index.html +++ b/examples/vtkDisplay/index.html @@ -451,7 +451,12 @@

Volume:

// a vtkVolume (actor) ready to render // function part10ToVolumeActor(part10) { - + part10 = typeof part10 == "Array" ? part10[0] : part10; + if (typeof part10 != "ArrayBuffer") { + console.error("Invalid part10 binary retrieved", part10); + return; + } + dataset = DICOMZero.datasetFromArrayBuffer(part10); const scalarArray = vtk.Common.Core.vtkDataArray.newInstance({ From b5c8dcb2713434ecb37c6721945b7b0997530a72 Mon Sep 17 00:00:00 2001 From: Steve Pieper Date: Mon, 6 May 2024 16:42:11 -0400 Subject: [PATCH 2/5] fix(syntax): fix type checking for Array and ArrayBuffer --- examples/vtkDisplay/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/vtkDisplay/index.html b/examples/vtkDisplay/index.html index ee21e7a1..3244d879 100644 --- a/examples/vtkDisplay/index.html +++ b/examples/vtkDisplay/index.html @@ -451,8 +451,8 @@

Volume:

// a vtkVolume (actor) ready to render // function part10ToVolumeActor(part10) { - part10 = typeof part10 == "Array" ? part10[0] : part10; - if (typeof part10 != "ArrayBuffer") { + part10 = Array.isArray(part10) ? part10[0] : part10; + if (!ArrayBuffer.isView(part10) { console.error("Invalid part10 binary retrieved", part10); return; } From d2e2371319fb0b10f0c69ab2b2096aec1e4c0c61 Mon Sep 17 00:00:00 2001 From: Steve Pieper Date: Mon, 6 May 2024 16:45:02 -0400 Subject: [PATCH 3/5] fix(typo): fix for type check syntax --- examples/vtkDisplay/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vtkDisplay/index.html b/examples/vtkDisplay/index.html index 3244d879..cef98d9a 100644 --- a/examples/vtkDisplay/index.html +++ b/examples/vtkDisplay/index.html @@ -452,7 +452,7 @@

Volume:

// function part10ToVolumeActor(part10) { part10 = Array.isArray(part10) ? part10[0] : part10; - if (!ArrayBuffer.isView(part10) { + if (!ArrayBuffer.isView(part10)) { console.error("Invalid part10 binary retrieved", part10); return; } From 8524ebe4c9d80fb385a1057447af53cf85c2b8b0 Mon Sep 17 00:00:00 2001 From: Steve Pieper Date: Mon, 6 May 2024 16:51:17 -0400 Subject: [PATCH 4/5] fix(typecheck): review check for ArrayBuffer Apparently there's not a good easy way to check for something being an ArrayBuffer (isView returns false). Since it's an error condition anyway let it error out somewhere else. --- examples/vtkDisplay/index.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/vtkDisplay/index.html b/examples/vtkDisplay/index.html index cef98d9a..452a4c1d 100644 --- a/examples/vtkDisplay/index.html +++ b/examples/vtkDisplay/index.html @@ -452,10 +452,6 @@

Volume:

// function part10ToVolumeActor(part10) { part10 = Array.isArray(part10) ? part10[0] : part10; - if (!ArrayBuffer.isView(part10)) { - console.error("Invalid part10 binary retrieved", part10); - return; - } dataset = DICOMZero.datasetFromArrayBuffer(part10); From 00708b0ecc23593fdb5c4ab85de73110ef5d0810 Mon Sep 17 00:00:00 2001 From: Steve Pieper Date: Mon, 6 May 2024 16:54:57 -0400 Subject: [PATCH 5/5] fix(seg): need to apply same fix to seg --- examples/vtkDisplay/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vtkDisplay/index.html b/examples/vtkDisplay/index.html index 452a4c1d..31389dcc 100644 --- a/examples/vtkDisplay/index.html +++ b/examples/vtkDisplay/index.html @@ -481,7 +481,7 @@

Volume:

} function part10ToSEGVolumeActors(part10) { - + part10 = Array.isArray(part10) ? part10[0] : part10; dataset = DICOMZero.datasetFromArrayBuffer(part10); if (dataset.SegmentSequence.constructor.name !== "Array") { dataset.SegmentSequence = [dataset.SegmentSequence];