From fa0ce80a22ff850be094e6ff4ec7b14d5c8eaec9 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 3 Oct 2023 20:39:43 -0400 Subject: [PATCH] feat(image-io): bindgen updates for output files --- .../typescript/src/vector-magnitude-node.ts | 2 +- .../typescript/src/vector-magnitude.ts | 2 +- .../typescript/src/compress-stringify-node.ts | 2 +- .../typescript/src/compress-stringify.ts | 2 +- .../src/parse-string-decompress-node.ts | 2 +- .../typescript/src/parse-string-decompress.ts | 2 +- .../apply-presentation-state-to-image-node.ts | 6 +- .../src/apply-presentation-state-to-image.ts | 4 +- .../src/read-dicom-encapsulated-pdf-node.ts | 3 +- .../src/read-dicom-encapsulated-pdf.ts | 2 +- .../src/structured-report-to-html-node.ts | 3 +- .../src/structured-report-to-html.ts | 2 +- .../src/structured-report-to-text-node.ts | 3 +- .../src/structured-report-to-text.ts | 2 +- .../typescript/src/bio-rad-read-image-node.ts | 3 +- .../typescript/src/bio-rad-read-image.ts | 2 +- .../src/bio-rad-write-image-node-result.ts | 2 - .../src/bio-rad-write-image-node.ts | 8 +- .../src/bio-rad-write-image-options.ts | 3 - .../typescript/src/bio-rad-write-image.ts | 9 +- .../typescript/src/bmp-read-image-node.ts | 3 +- .../image-io/typescript/src/bmp-read-image.ts | 2 +- .../src/bmp-write-image-node-result.ts | 2 - .../typescript/src/bmp-write-image-node.ts | 8 +- .../typescript/src/bmp-write-image-options.ts | 3 - .../typescript/src/bmp-write-image.ts | 9 +- .../typescript/src/fdf-read-image-node.ts | 3 +- .../image-io/typescript/src/fdf-read-image.ts | 2 +- .../src/fdf-write-image-node-result.ts | 2 - .../typescript/src/fdf-write-image-node.ts | 8 +- .../typescript/src/fdf-write-image-options.ts | 3 - .../typescript/src/fdf-write-image.ts | 9 +- .../typescript/src/gdcm-read-image-node.ts | 3 +- .../typescript/src/gdcm-read-image.ts | 2 +- .../src/gdcm-write-image-node-result.ts | 2 - .../typescript/src/gdcm-write-image-node.ts | 8 +- .../src/gdcm-write-image-options.ts | 3 - .../typescript/src/gdcm-write-image.ts | 9 +- .../typescript/src/ge-adw-read-image-node.ts | 3 +- .../typescript/src/ge-adw-read-image.ts | 2 +- .../src/ge-adw-write-image-node-result.ts | 2 - .../typescript/src/ge-adw-write-image-node.ts | 8 +- .../src/ge-adw-write-image-options.ts | 3 - .../typescript/src/ge-adw-write-image.ts | 9 +- .../typescript/src/ge4-read-image-node.ts | 3 +- .../image-io/typescript/src/ge4-read-image.ts | 2 +- .../src/ge4-write-image-node-result.ts | 2 - .../typescript/src/ge4-write-image-node.ts | 8 +- .../typescript/src/ge4-write-image-options.ts | 3 - .../typescript/src/ge4-write-image.ts | 9 +- .../typescript/src/ge5-read-image-node.ts | 3 +- .../image-io/typescript/src/ge5-read-image.ts | 2 +- .../src/ge5-write-image-node-result.ts | 2 - .../typescript/src/ge5-write-image-node.ts | 8 +- .../typescript/src/ge5-write-image-options.ts | 3 - .../typescript/src/ge5-write-image.ts | 9 +- .../typescript/src/gipl-read-image-node.ts | 3 +- .../typescript/src/gipl-read-image.ts | 2 +- .../src/gipl-write-image-node-result.ts | 2 - .../typescript/src/gipl-write-image-node.ts | 8 +- .../src/gipl-write-image-options.ts | 3 - .../typescript/src/gipl-write-image.ts | 9 +- .../typescript/src/hdf5-read-image-node.ts | 3 +- .../typescript/src/hdf5-read-image.ts | 2 +- .../src/hdf5-write-image-node-result.ts | 2 - .../typescript/src/hdf5-write-image-node.ts | 8 +- .../src/hdf5-write-image-options.ts | 3 - .../typescript/src/hdf5-write-image.ts | 9 +- .../image-io/typescript/src/index-node.ts | 3 + packages/image-io/typescript/src/index.ts | 4 + .../typescript/src/jpeg-read-image-node.ts | 3 +- .../typescript/src/jpeg-read-image.ts | 2 +- .../src/jpeg-write-image-node-result.ts | 2 - .../typescript/src/jpeg-write-image-node.ts | 8 +- .../src/jpeg-write-image-options.ts | 3 - .../typescript/src/jpeg-write-image.ts | 9 +- .../typescript/src/lsm-read-image-node.ts | 3 +- .../image-io/typescript/src/lsm-read-image.ts | 2 +- .../src/lsm-write-image-node-result.ts | 2 - .../typescript/src/lsm-write-image-node.ts | 8 +- .../typescript/src/lsm-write-image-options.ts | 3 - .../typescript/src/lsm-write-image.ts | 9 +- .../typescript/src/meta-read-image-node.ts | 3 +- .../typescript/src/meta-read-image.ts | 2 +- .../src/meta-write-image-node-result.ts | 2 - .../typescript/src/meta-write-image-node.ts | 8 +- .../src/meta-write-image-options.ts | 3 - .../typescript/src/meta-write-image.ts | 9 +- .../typescript/src/mgh-read-image-node.ts | 3 +- .../image-io/typescript/src/mgh-read-image.ts | 2 +- .../src/mgh-write-image-node-result.ts | 2 - .../typescript/src/mgh-write-image-node.ts | 8 +- .../typescript/src/mgh-write-image-options.ts | 3 - .../typescript/src/mgh-write-image.ts | 9 +- .../typescript/src/minc-read-image-node.ts | 3 +- .../typescript/src/minc-read-image.ts | 2 +- .../src/minc-write-image-node-result.ts | 2 - .../typescript/src/minc-write-image-node.ts | 8 +- .../src/minc-write-image-options.ts | 3 - .../typescript/src/minc-write-image.ts | 9 +- .../typescript/src/mrc-read-image-node.ts | 3 +- .../image-io/typescript/src/mrc-read-image.ts | 2 +- .../src/mrc-write-image-node-result.ts | 2 - .../typescript/src/mrc-write-image-node.ts | 8 +- .../typescript/src/mrc-write-image-options.ts | 3 - .../typescript/src/mrc-write-image.ts | 9 +- .../typescript/src/nifti-read-image-node.ts | 3 +- .../typescript/src/nifti-read-image.ts | 2 +- .../src/nifti-write-image-node-result.ts | 2 - .../typescript/src/nifti-write-image-node.ts | 8 +- .../src/nifti-write-image-options.ts | 3 - .../typescript/src/nifti-write-image.ts | 9 +- .../typescript/src/nrrd-read-image-node.ts | 3 +- .../typescript/src/nrrd-read-image.ts | 2 +- .../src/nrrd-write-image-node-result.ts | 2 - .../typescript/src/nrrd-write-image-node.ts | 8 +- .../src/nrrd-write-image-options.ts | 3 - .../typescript/src/nrrd-write-image.ts | 9 +- .../typescript/src/png-read-image-node.ts | 3 +- .../image-io/typescript/src/png-read-image.ts | 2 +- .../src/png-write-image-node-result.ts | 2 - .../typescript/src/png-write-image-node.ts | 8 +- .../typescript/src/png-write-image-options.ts | 3 - .../typescript/src/png-write-image.ts | 9 +- .../typescript/src/scanco-read-image-node.ts | 3 +- .../typescript/src/scanco-read-image.ts | 2 +- .../src/scanco-write-image-node-result.ts | 2 - .../typescript/src/scanco-write-image-node.ts | 8 +- .../src/scanco-write-image-options.ts | 3 - .../typescript/src/scanco-write-image.ts | 9 +- .../typescript/src/tiff-read-image-node.ts | 3 +- .../typescript/src/tiff-read-image.ts | 2 +- .../src/tiff-write-image-node-result.ts | 2 - .../typescript/src/tiff-write-image-node.ts | 8 +- .../src/tiff-write-image-options.ts | 3 - .../typescript/src/tiff-write-image.ts | 9 +- .../typescript/src/vtk-read-image-node.ts | 3 +- .../image-io/typescript/src/vtk-read-image.ts | 2 +- .../src/vtk-write-image-node-result.ts | 2 - .../typescript/src/vtk-write-image-node.ts | 8 +- .../typescript/src/vtk-write-image-options.ts | 3 - .../typescript/src/vtk-write-image.ts | 9 +- .../typescript/src/wasm-read-image-node.ts | 3 +- .../typescript/src/wasm-read-image.ts | 2 +- .../src/wasm-write-image-node-result.ts | 2 - .../typescript/src/wasm-write-image-node.ts | 8 +- .../src/wasm-write-image-options.ts | 3 - .../typescript/src/wasm-write-image.ts | 9 +- .../src/wasm-zstd-read-image-node.ts | 3 +- .../typescript/src/wasm-zstd-read-image.ts | 2 +- .../src/wasm-zstd-write-image-node-result.ts | 2 - .../src/wasm-zstd-write-image-node.ts | 8 +- .../src/wasm-zstd-write-image-options.ts | 3 - .../typescript/src/wasm-zstd-write-image.ts | 9 +- .../test/browser/demo-app/index.html | 115 +++++++++++------- .../typescript/test/browser/demo-app/index.ts | 8 ++ .../test/browser/demo-app/utilities.js | 11 ++ 157 files changed, 392 insertions(+), 407 deletions(-) diff --git a/packages/compare-images/typescript/src/vector-magnitude-node.ts b/packages/compare-images/typescript/src/vector-magnitude-node.ts index 2af2d542b..de3c2f309 100644 --- a/packages/compare-images/typescript/src/vector-magnitude-node.ts +++ b/packages/compare-images/typescript/src/vector-magnitude-node.ts @@ -36,7 +36,7 @@ async function vectorMagnitudeNode( const args = [] // Inputs const vectorImageName = '0' - args.push(vectorImageName as string) + args.push(vectorImageName) // Outputs const magnitudeImageName = '0' diff --git a/packages/compare-images/typescript/src/vector-magnitude.ts b/packages/compare-images/typescript/src/vector-magnitude.ts index b4748fa7b..d553a74e2 100644 --- a/packages/compare-images/typescript/src/vector-magnitude.ts +++ b/packages/compare-images/typescript/src/vector-magnitude.ts @@ -38,7 +38,7 @@ async function vectorMagnitude( const args = [] // Inputs const vectorImageName = '0' - args.push(vectorImageName as string) + args.push(vectorImageName) // Outputs const magnitudeImageName = '0' diff --git a/packages/compress-stringify/typescript/src/compress-stringify-node.ts b/packages/compress-stringify/typescript/src/compress-stringify-node.ts index 2de89a8b1..bc4e981fc 100644 --- a/packages/compress-stringify/typescript/src/compress-stringify-node.ts +++ b/packages/compress-stringify/typescript/src/compress-stringify-node.ts @@ -38,7 +38,7 @@ async function compressStringifyNode( const args = [] // Inputs const inputName = '0' - args.push(inputName as string) + args.push(inputName) // Outputs const outputName = '0' diff --git a/packages/compress-stringify/typescript/src/compress-stringify.ts b/packages/compress-stringify/typescript/src/compress-stringify.ts index a60ac0dbb..849a5bd35 100644 --- a/packages/compress-stringify/typescript/src/compress-stringify.ts +++ b/packages/compress-stringify/typescript/src/compress-stringify.ts @@ -40,7 +40,7 @@ async function compressStringify( const args = [] // Inputs const inputName = '0' - args.push(inputName as string) + args.push(inputName) // Outputs const outputName = '0' diff --git a/packages/compress-stringify/typescript/src/parse-string-decompress-node.ts b/packages/compress-stringify/typescript/src/parse-string-decompress-node.ts index b18719d19..bc1170e83 100644 --- a/packages/compress-stringify/typescript/src/parse-string-decompress-node.ts +++ b/packages/compress-stringify/typescript/src/parse-string-decompress-node.ts @@ -38,7 +38,7 @@ async function parseStringDecompressNode( const args = [] // Inputs const inputName = '0' - args.push(inputName as string) + args.push(inputName) // Outputs const outputName = '0' diff --git a/packages/compress-stringify/typescript/src/parse-string-decompress.ts b/packages/compress-stringify/typescript/src/parse-string-decompress.ts index 4d928b15b..08f195f73 100644 --- a/packages/compress-stringify/typescript/src/parse-string-decompress.ts +++ b/packages/compress-stringify/typescript/src/parse-string-decompress.ts @@ -40,7 +40,7 @@ async function parseStringDecompress( const args = [] // Inputs const inputName = '0' - args.push(inputName as string) + args.push(inputName) // Outputs const outputName = '0' diff --git a/packages/dicom/typescript/src/apply-presentation-state-to-image-node.ts b/packages/dicom/typescript/src/apply-presentation-state-to-image-node.ts index 2c4649c27..c00f4cf35 100644 --- a/packages/dicom/typescript/src/apply-presentation-state-to-image-node.ts +++ b/packages/dicom/typescript/src/apply-presentation-state-to-image-node.ts @@ -45,10 +45,12 @@ async function applyPresentationStateToImageNode( const args = [] // Inputs const imageInName = imageIn - args.push(imageInName as string) + args.push(imageInName) + mountDirs.add(path.dirname(imageInName)) const presentationStateFileName = presentationStateFile - args.push(presentationStateFileName as string) + args.push(presentationStateFileName) + mountDirs.add(path.dirname(presentationStateFileName)) // Outputs const presentationStateOutStreamName = '0' diff --git a/packages/dicom/typescript/src/apply-presentation-state-to-image.ts b/packages/dicom/typescript/src/apply-presentation-state-to-image.ts index d05caef1d..5c28165c7 100644 --- a/packages/dicom/typescript/src/apply-presentation-state-to-image.ts +++ b/packages/dicom/typescript/src/apply-presentation-state-to-image.ts @@ -56,10 +56,10 @@ async function applyPresentationStateToImage( const args = [] // Inputs const imageInName = (imageInFile as BinaryFile).path - args.push(imageInName as string) + args.push(imageInName) const presentationStateFileName = (presentationStateFileFile as BinaryFile).path - args.push(presentationStateFileName as string) + args.push(presentationStateFileName) // Outputs const presentationStateOutStreamName = '0' diff --git a/packages/dicom/typescript/src/read-dicom-encapsulated-pdf-node.ts b/packages/dicom/typescript/src/read-dicom-encapsulated-pdf-node.ts index cbbf03508..e60ec3145 100644 --- a/packages/dicom/typescript/src/read-dicom-encapsulated-pdf-node.ts +++ b/packages/dicom/typescript/src/read-dicom-encapsulated-pdf-node.ts @@ -40,7 +40,8 @@ async function readDicomEncapsulatedPdfNode( const args = [] // Inputs const dicomFileName = dicomFile - args.push(dicomFileName as string) + args.push(dicomFileName) + mountDirs.add(path.dirname(dicomFileName)) // Outputs const pdfBinaryOutputName = '0' diff --git a/packages/dicom/typescript/src/read-dicom-encapsulated-pdf.ts b/packages/dicom/typescript/src/read-dicom-encapsulated-pdf.ts index 72ee1c4a1..d16ed44a0 100644 --- a/packages/dicom/typescript/src/read-dicom-encapsulated-pdf.ts +++ b/packages/dicom/typescript/src/read-dicom-encapsulated-pdf.ts @@ -46,7 +46,7 @@ async function readDicomEncapsulatedPdf( const args = [] // Inputs const dicomFileName = (dicomFileFile as BinaryFile).path - args.push(dicomFileName as string) + args.push(dicomFileName) // Outputs const pdfBinaryOutputName = '0' diff --git a/packages/dicom/typescript/src/structured-report-to-html-node.ts b/packages/dicom/typescript/src/structured-report-to-html-node.ts index 44603d164..63975ae07 100644 --- a/packages/dicom/typescript/src/structured-report-to-html-node.ts +++ b/packages/dicom/typescript/src/structured-report-to-html-node.ts @@ -40,7 +40,8 @@ async function structuredReportToHtmlNode( const args = [] // Inputs const dicomFileName = dicomFile - args.push(dicomFileName as string) + args.push(dicomFileName) + mountDirs.add(path.dirname(dicomFileName)) // Outputs const outputTextName = '0' diff --git a/packages/dicom/typescript/src/structured-report-to-html.ts b/packages/dicom/typescript/src/structured-report-to-html.ts index eeb5191a4..e4c57f609 100644 --- a/packages/dicom/typescript/src/structured-report-to-html.ts +++ b/packages/dicom/typescript/src/structured-report-to-html.ts @@ -47,7 +47,7 @@ async function structuredReportToHtml( const args = [] // Inputs const dicomFileName = (dicomFileFile as BinaryFile).path - args.push(dicomFileName as string) + args.push(dicomFileName) // Outputs const outputTextName = '0' diff --git a/packages/dicom/typescript/src/structured-report-to-text-node.ts b/packages/dicom/typescript/src/structured-report-to-text-node.ts index a6e9c2cc9..956a28008 100644 --- a/packages/dicom/typescript/src/structured-report-to-text-node.ts +++ b/packages/dicom/typescript/src/structured-report-to-text-node.ts @@ -40,7 +40,8 @@ async function structuredReportToTextNode( const args = [] // Inputs const dicomFileName = dicomFile - args.push(dicomFileName as string) + args.push(dicomFileName) + mountDirs.add(path.dirname(dicomFileName)) // Outputs const outputTextName = '0' diff --git a/packages/dicom/typescript/src/structured-report-to-text.ts b/packages/dicom/typescript/src/structured-report-to-text.ts index 95dabc39b..3ede8e2db 100644 --- a/packages/dicom/typescript/src/structured-report-to-text.ts +++ b/packages/dicom/typescript/src/structured-report-to-text.ts @@ -46,7 +46,7 @@ async function structuredReportToText( const args = [] // Inputs const dicomFileName = (dicomFileFile as BinaryFile).path - args.push(dicomFileName as string) + args.push(dicomFileName) // Outputs const outputTextName = '0' diff --git a/packages/image-io/typescript/src/bio-rad-read-image-node.ts b/packages/image-io/typescript/src/bio-rad-read-image-node.ts index ca54a5467..388f61ed5 100644 --- a/packages/image-io/typescript/src/bio-rad-read-image-node.ts +++ b/packages/image-io/typescript/src/bio-rad-read-image-node.ts @@ -42,7 +42,8 @@ async function bioRadReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/bio-rad-read-image.ts b/packages/image-io/typescript/src/bio-rad-read-image.ts index 5f6f39205..48c89dbbf 100644 --- a/packages/image-io/typescript/src/bio-rad-read-image.ts +++ b/packages/image-io/typescript/src/bio-rad-read-image.ts @@ -48,7 +48,7 @@ async function bioRadReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/bio-rad-write-image-node-result.ts b/packages/image-io/typescript/src/bio-rad-write-image-node-result.ts index 914560f49..982994f59 100644 --- a/packages/image-io/typescript/src/bio-rad-write-image-node-result.ts +++ b/packages/image-io/typescript/src/bio-rad-write-image-node-result.ts @@ -7,8 +7,6 @@ interface BioRadWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default BioRadWriteImageNodeResult diff --git a/packages/image-io/typescript/src/bio-rad-write-image-node.ts b/packages/image-io/typescript/src/bio-rad-write-image-node.ts index 14515844e..dc1e3eacf 100644 --- a/packages/image-io/typescript/src/bio-rad-write-image-node.ts +++ b/packages/image-io/typescript/src/bio-rad-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {BioRadWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function bioRadWriteImageNode( image: Image, + serializedImage: string, options: BioRadWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function bioRadWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function bioRadWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function bioRadWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/bio-rad-write-image-options.ts b/packages/image-io/typescript/src/bio-rad-write-image-options.ts index 077dba93c..bbde5a8ae 100644 --- a/packages/image-io/typescript/src/bio-rad-write-image-options.ts +++ b/packages/image-io/typescript/src/bio-rad-write-image-options.ts @@ -7,9 +7,6 @@ interface BioRadWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default BioRadWriteImageOptions diff --git a/packages/image-io/typescript/src/bio-rad-write-image.ts b/packages/image-io/typescript/src/bio-rad-write-image.ts index 3e814a899..d3b328503 100644 --- a/packages/image-io/typescript/src/bio-rad-write-image.ts +++ b/packages/image-io/typescript/src/bio-rad-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {BioRadWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function bioRadWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: BioRadWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function bioRadWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/bmp-read-image-node.ts b/packages/image-io/typescript/src/bmp-read-image-node.ts index f508d74a8..58b1058a1 100644 --- a/packages/image-io/typescript/src/bmp-read-image-node.ts +++ b/packages/image-io/typescript/src/bmp-read-image-node.ts @@ -42,7 +42,8 @@ async function bmpReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/bmp-read-image.ts b/packages/image-io/typescript/src/bmp-read-image.ts index b772696ce..5f12d3acd 100644 --- a/packages/image-io/typescript/src/bmp-read-image.ts +++ b/packages/image-io/typescript/src/bmp-read-image.ts @@ -48,7 +48,7 @@ async function bmpReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/bmp-write-image-node-result.ts b/packages/image-io/typescript/src/bmp-write-image-node-result.ts index ed2175a36..4335eb6f7 100644 --- a/packages/image-io/typescript/src/bmp-write-image-node-result.ts +++ b/packages/image-io/typescript/src/bmp-write-image-node-result.ts @@ -7,8 +7,6 @@ interface BmpWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default BmpWriteImageNodeResult diff --git a/packages/image-io/typescript/src/bmp-write-image-node.ts b/packages/image-io/typescript/src/bmp-write-image-node.ts index 9201e85cf..97e3a2ed8 100644 --- a/packages/image-io/typescript/src/bmp-write-image-node.ts +++ b/packages/image-io/typescript/src/bmp-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {BmpWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function bmpWriteImageNode( image: Image, + serializedImage: string, options: BmpWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function bmpWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function bmpWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function bmpWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/bmp-write-image-options.ts b/packages/image-io/typescript/src/bmp-write-image-options.ts index d7f284644..b3391db44 100644 --- a/packages/image-io/typescript/src/bmp-write-image-options.ts +++ b/packages/image-io/typescript/src/bmp-write-image-options.ts @@ -7,9 +7,6 @@ interface BmpWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default BmpWriteImageOptions diff --git a/packages/image-io/typescript/src/bmp-write-image.ts b/packages/image-io/typescript/src/bmp-write-image.ts index d5cc29ba7..cad094398 100644 --- a/packages/image-io/typescript/src/bmp-write-image.ts +++ b/packages/image-io/typescript/src/bmp-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {BmpWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function bmpWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: BmpWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function bmpWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/fdf-read-image-node.ts b/packages/image-io/typescript/src/fdf-read-image-node.ts index c2778aeda..b0e29c264 100644 --- a/packages/image-io/typescript/src/fdf-read-image-node.ts +++ b/packages/image-io/typescript/src/fdf-read-image-node.ts @@ -42,7 +42,8 @@ async function fdfReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/fdf-read-image.ts b/packages/image-io/typescript/src/fdf-read-image.ts index 3795feaa2..b24f05b92 100644 --- a/packages/image-io/typescript/src/fdf-read-image.ts +++ b/packages/image-io/typescript/src/fdf-read-image.ts @@ -48,7 +48,7 @@ async function fdfReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/fdf-write-image-node-result.ts b/packages/image-io/typescript/src/fdf-write-image-node-result.ts index 84d08461f..5881a591d 100644 --- a/packages/image-io/typescript/src/fdf-write-image-node-result.ts +++ b/packages/image-io/typescript/src/fdf-write-image-node-result.ts @@ -7,8 +7,6 @@ interface FdfWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default FdfWriteImageNodeResult diff --git a/packages/image-io/typescript/src/fdf-write-image-node.ts b/packages/image-io/typescript/src/fdf-write-image-node.ts index 5bbdeaaa4..2b3e29e2b 100644 --- a/packages/image-io/typescript/src/fdf-write-image-node.ts +++ b/packages/image-io/typescript/src/fdf-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {FdfWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function fdfWriteImageNode( image: Image, + serializedImage: string, options: FdfWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function fdfWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function fdfWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function fdfWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/fdf-write-image-options.ts b/packages/image-io/typescript/src/fdf-write-image-options.ts index 11ec3a740..2e8c05494 100644 --- a/packages/image-io/typescript/src/fdf-write-image-options.ts +++ b/packages/image-io/typescript/src/fdf-write-image-options.ts @@ -7,9 +7,6 @@ interface FdfWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default FdfWriteImageOptions diff --git a/packages/image-io/typescript/src/fdf-write-image.ts b/packages/image-io/typescript/src/fdf-write-image.ts index b27c9ab52..6a8c26761 100644 --- a/packages/image-io/typescript/src/fdf-write-image.ts +++ b/packages/image-io/typescript/src/fdf-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {FdfWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function fdfWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: FdfWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function fdfWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/gdcm-read-image-node.ts b/packages/image-io/typescript/src/gdcm-read-image-node.ts index bed913c85..9bae10958 100644 --- a/packages/image-io/typescript/src/gdcm-read-image-node.ts +++ b/packages/image-io/typescript/src/gdcm-read-image-node.ts @@ -42,7 +42,8 @@ async function gdcmReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/gdcm-read-image.ts b/packages/image-io/typescript/src/gdcm-read-image.ts index f454a4cee..02f612760 100644 --- a/packages/image-io/typescript/src/gdcm-read-image.ts +++ b/packages/image-io/typescript/src/gdcm-read-image.ts @@ -48,7 +48,7 @@ async function gdcmReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/gdcm-write-image-node-result.ts b/packages/image-io/typescript/src/gdcm-write-image-node-result.ts index 30400e6c0..bfeebb182 100644 --- a/packages/image-io/typescript/src/gdcm-write-image-node-result.ts +++ b/packages/image-io/typescript/src/gdcm-write-image-node-result.ts @@ -7,8 +7,6 @@ interface GdcmWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default GdcmWriteImageNodeResult diff --git a/packages/image-io/typescript/src/gdcm-write-image-node.ts b/packages/image-io/typescript/src/gdcm-write-image-node.ts index 8f704b575..66e4ed0aa 100644 --- a/packages/image-io/typescript/src/gdcm-write-image-node.ts +++ b/packages/image-io/typescript/src/gdcm-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {GdcmWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function gdcmWriteImageNode( image: Image, + serializedImage: string, options: GdcmWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function gdcmWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function gdcmWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function gdcmWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/gdcm-write-image-options.ts b/packages/image-io/typescript/src/gdcm-write-image-options.ts index dd1114d87..b86fb750d 100644 --- a/packages/image-io/typescript/src/gdcm-write-image-options.ts +++ b/packages/image-io/typescript/src/gdcm-write-image-options.ts @@ -7,9 +7,6 @@ interface GdcmWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default GdcmWriteImageOptions diff --git a/packages/image-io/typescript/src/gdcm-write-image.ts b/packages/image-io/typescript/src/gdcm-write-image.ts index 7e522f6dd..d80db8210 100644 --- a/packages/image-io/typescript/src/gdcm-write-image.ts +++ b/packages/image-io/typescript/src/gdcm-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {GdcmWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function gdcmWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: GdcmWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function gdcmWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/ge-adw-read-image-node.ts b/packages/image-io/typescript/src/ge-adw-read-image-node.ts index 56074fc71..ac902d8fd 100644 --- a/packages/image-io/typescript/src/ge-adw-read-image-node.ts +++ b/packages/image-io/typescript/src/ge-adw-read-image-node.ts @@ -42,7 +42,8 @@ async function geAdwReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/ge-adw-read-image.ts b/packages/image-io/typescript/src/ge-adw-read-image.ts index e4a97df21..0db9a1b7d 100644 --- a/packages/image-io/typescript/src/ge-adw-read-image.ts +++ b/packages/image-io/typescript/src/ge-adw-read-image.ts @@ -48,7 +48,7 @@ async function geAdwReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/ge-adw-write-image-node-result.ts b/packages/image-io/typescript/src/ge-adw-write-image-node-result.ts index f493ea3f6..b6d87c070 100644 --- a/packages/image-io/typescript/src/ge-adw-write-image-node-result.ts +++ b/packages/image-io/typescript/src/ge-adw-write-image-node-result.ts @@ -7,8 +7,6 @@ interface GeAdwWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default GeAdwWriteImageNodeResult diff --git a/packages/image-io/typescript/src/ge-adw-write-image-node.ts b/packages/image-io/typescript/src/ge-adw-write-image-node.ts index 20951b304..b00648fa8 100644 --- a/packages/image-io/typescript/src/ge-adw-write-image-node.ts +++ b/packages/image-io/typescript/src/ge-adw-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {GeAdwWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function geAdwWriteImageNode( image: Image, + serializedImage: string, options: GeAdwWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function geAdwWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function geAdwWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function geAdwWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/ge-adw-write-image-options.ts b/packages/image-io/typescript/src/ge-adw-write-image-options.ts index e00dffaa8..8908e20ce 100644 --- a/packages/image-io/typescript/src/ge-adw-write-image-options.ts +++ b/packages/image-io/typescript/src/ge-adw-write-image-options.ts @@ -7,9 +7,6 @@ interface GeAdwWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default GeAdwWriteImageOptions diff --git a/packages/image-io/typescript/src/ge-adw-write-image.ts b/packages/image-io/typescript/src/ge-adw-write-image.ts index 0f62d3257..f7fab252e 100644 --- a/packages/image-io/typescript/src/ge-adw-write-image.ts +++ b/packages/image-io/typescript/src/ge-adw-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {GeAdwWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function geAdwWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: GeAdwWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function geAdwWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/ge4-read-image-node.ts b/packages/image-io/typescript/src/ge4-read-image-node.ts index 746616899..792c3901a 100644 --- a/packages/image-io/typescript/src/ge4-read-image-node.ts +++ b/packages/image-io/typescript/src/ge4-read-image-node.ts @@ -42,7 +42,8 @@ async function ge4ReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/ge4-read-image.ts b/packages/image-io/typescript/src/ge4-read-image.ts index a38de94d0..47bde3542 100644 --- a/packages/image-io/typescript/src/ge4-read-image.ts +++ b/packages/image-io/typescript/src/ge4-read-image.ts @@ -48,7 +48,7 @@ async function ge4ReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/ge4-write-image-node-result.ts b/packages/image-io/typescript/src/ge4-write-image-node-result.ts index 7ec848c13..4f2c71607 100644 --- a/packages/image-io/typescript/src/ge4-write-image-node-result.ts +++ b/packages/image-io/typescript/src/ge4-write-image-node-result.ts @@ -7,8 +7,6 @@ interface Ge4WriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default Ge4WriteImageNodeResult diff --git a/packages/image-io/typescript/src/ge4-write-image-node.ts b/packages/image-io/typescript/src/ge4-write-image-node.ts index 1bdf59d2e..df6243e7c 100644 --- a/packages/image-io/typescript/src/ge4-write-image-node.ts +++ b/packages/image-io/typescript/src/ge4-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {Ge4WriteImageOptions} options - options object * * @returns {Promise} - result object */ async function ge4WriteImageNode( image: Image, + serializedImage: string, options: Ge4WriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function ge4WriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function ge4WriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function ge4WriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/ge4-write-image-options.ts b/packages/image-io/typescript/src/ge4-write-image-options.ts index ae4540862..399a6afe4 100644 --- a/packages/image-io/typescript/src/ge4-write-image-options.ts +++ b/packages/image-io/typescript/src/ge4-write-image-options.ts @@ -7,9 +7,6 @@ interface Ge4WriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default Ge4WriteImageOptions diff --git a/packages/image-io/typescript/src/ge4-write-image.ts b/packages/image-io/typescript/src/ge4-write-image.ts index 58bb879b8..ebff80ed1 100644 --- a/packages/image-io/typescript/src/ge4-write-image.ts +++ b/packages/image-io/typescript/src/ge4-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {Ge4WriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function ge4WriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: Ge4WriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function ge4WriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/ge5-read-image-node.ts b/packages/image-io/typescript/src/ge5-read-image-node.ts index 38ee7c887..e8697ebf8 100644 --- a/packages/image-io/typescript/src/ge5-read-image-node.ts +++ b/packages/image-io/typescript/src/ge5-read-image-node.ts @@ -42,7 +42,8 @@ async function ge5ReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/ge5-read-image.ts b/packages/image-io/typescript/src/ge5-read-image.ts index a551fe9e3..d4c9cb04e 100644 --- a/packages/image-io/typescript/src/ge5-read-image.ts +++ b/packages/image-io/typescript/src/ge5-read-image.ts @@ -48,7 +48,7 @@ async function ge5ReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/ge5-write-image-node-result.ts b/packages/image-io/typescript/src/ge5-write-image-node-result.ts index de786e29f..0a4a1f7c5 100644 --- a/packages/image-io/typescript/src/ge5-write-image-node-result.ts +++ b/packages/image-io/typescript/src/ge5-write-image-node-result.ts @@ -7,8 +7,6 @@ interface Ge5WriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default Ge5WriteImageNodeResult diff --git a/packages/image-io/typescript/src/ge5-write-image-node.ts b/packages/image-io/typescript/src/ge5-write-image-node.ts index 9a66e99e0..0427c740d 100644 --- a/packages/image-io/typescript/src/ge5-write-image-node.ts +++ b/packages/image-io/typescript/src/ge5-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {Ge5WriteImageOptions} options - options object * * @returns {Promise} - result object */ async function ge5WriteImageNode( image: Image, + serializedImage: string, options: Ge5WriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function ge5WriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function ge5WriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function ge5WriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/ge5-write-image-options.ts b/packages/image-io/typescript/src/ge5-write-image-options.ts index 175a0318d..68aaa3542 100644 --- a/packages/image-io/typescript/src/ge5-write-image-options.ts +++ b/packages/image-io/typescript/src/ge5-write-image-options.ts @@ -7,9 +7,6 @@ interface Ge5WriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default Ge5WriteImageOptions diff --git a/packages/image-io/typescript/src/ge5-write-image.ts b/packages/image-io/typescript/src/ge5-write-image.ts index 03610e00d..bd8e52215 100644 --- a/packages/image-io/typescript/src/ge5-write-image.ts +++ b/packages/image-io/typescript/src/ge5-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {Ge5WriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function ge5WriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: Ge5WriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function ge5WriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/gipl-read-image-node.ts b/packages/image-io/typescript/src/gipl-read-image-node.ts index 3cd6525b1..38b312794 100644 --- a/packages/image-io/typescript/src/gipl-read-image-node.ts +++ b/packages/image-io/typescript/src/gipl-read-image-node.ts @@ -42,7 +42,8 @@ async function giplReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/gipl-read-image.ts b/packages/image-io/typescript/src/gipl-read-image.ts index f143981c7..5bc245d5b 100644 --- a/packages/image-io/typescript/src/gipl-read-image.ts +++ b/packages/image-io/typescript/src/gipl-read-image.ts @@ -48,7 +48,7 @@ async function giplReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/gipl-write-image-node-result.ts b/packages/image-io/typescript/src/gipl-write-image-node-result.ts index 946ab6db1..035ab7353 100644 --- a/packages/image-io/typescript/src/gipl-write-image-node-result.ts +++ b/packages/image-io/typescript/src/gipl-write-image-node-result.ts @@ -7,8 +7,6 @@ interface GiplWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default GiplWriteImageNodeResult diff --git a/packages/image-io/typescript/src/gipl-write-image-node.ts b/packages/image-io/typescript/src/gipl-write-image-node.ts index a00e803b5..202c6b35b 100644 --- a/packages/image-io/typescript/src/gipl-write-image-node.ts +++ b/packages/image-io/typescript/src/gipl-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {GiplWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function giplWriteImageNode( image: Image, + serializedImage: string, options: GiplWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function giplWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function giplWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function giplWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/gipl-write-image-options.ts b/packages/image-io/typescript/src/gipl-write-image-options.ts index ec06a2549..dee02209b 100644 --- a/packages/image-io/typescript/src/gipl-write-image-options.ts +++ b/packages/image-io/typescript/src/gipl-write-image-options.ts @@ -7,9 +7,6 @@ interface GiplWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default GiplWriteImageOptions diff --git a/packages/image-io/typescript/src/gipl-write-image.ts b/packages/image-io/typescript/src/gipl-write-image.ts index 616bc82b3..d6ee8f4b8 100644 --- a/packages/image-io/typescript/src/gipl-write-image.ts +++ b/packages/image-io/typescript/src/gipl-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {GiplWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function giplWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: GiplWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function giplWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/hdf5-read-image-node.ts b/packages/image-io/typescript/src/hdf5-read-image-node.ts index 2d5a29963..8428ea621 100644 --- a/packages/image-io/typescript/src/hdf5-read-image-node.ts +++ b/packages/image-io/typescript/src/hdf5-read-image-node.ts @@ -42,7 +42,8 @@ async function hdf5ReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/hdf5-read-image.ts b/packages/image-io/typescript/src/hdf5-read-image.ts index 150cbc236..c9b59d051 100644 --- a/packages/image-io/typescript/src/hdf5-read-image.ts +++ b/packages/image-io/typescript/src/hdf5-read-image.ts @@ -48,7 +48,7 @@ async function hdf5ReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/hdf5-write-image-node-result.ts b/packages/image-io/typescript/src/hdf5-write-image-node-result.ts index 34fb0f108..83b66b4ae 100644 --- a/packages/image-io/typescript/src/hdf5-write-image-node-result.ts +++ b/packages/image-io/typescript/src/hdf5-write-image-node-result.ts @@ -7,8 +7,6 @@ interface Hdf5WriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default Hdf5WriteImageNodeResult diff --git a/packages/image-io/typescript/src/hdf5-write-image-node.ts b/packages/image-io/typescript/src/hdf5-write-image-node.ts index 1ee4fbb08..281ecfbd4 100644 --- a/packages/image-io/typescript/src/hdf5-write-image-node.ts +++ b/packages/image-io/typescript/src/hdf5-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {Hdf5WriteImageOptions} options - options object * * @returns {Promise} - result object */ async function hdf5WriteImageNode( image: Image, + serializedImage: string, options: Hdf5WriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function hdf5WriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function hdf5WriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function hdf5WriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/hdf5-write-image-options.ts b/packages/image-io/typescript/src/hdf5-write-image-options.ts index 5590d825e..09eee03c4 100644 --- a/packages/image-io/typescript/src/hdf5-write-image-options.ts +++ b/packages/image-io/typescript/src/hdf5-write-image-options.ts @@ -7,9 +7,6 @@ interface Hdf5WriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default Hdf5WriteImageOptions diff --git a/packages/image-io/typescript/src/hdf5-write-image.ts b/packages/image-io/typescript/src/hdf5-write-image.ts index 97ca85298..ee22d384a 100644 --- a/packages/image-io/typescript/src/hdf5-write-image.ts +++ b/packages/image-io/typescript/src/hdf5-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {Hdf5WriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function hdf5WriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: Hdf5WriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function hdf5WriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/index-node.ts b/packages/image-io/typescript/src/index-node.ts index 59b246026..fccd96948 100644 --- a/packages/image-io/typescript/src/index-node.ts +++ b/packages/image-io/typescript/src/index-node.ts @@ -460,3 +460,6 @@ export type { WasmZstdWriteImageOptions } import wasmZstdWriteImageNode from './wasm-zstd-write-image-node.js' export { wasmZstdWriteImageNode } + +export type { JsonCompatible } from 'itk-wasm' +export type { Image } from 'itk-wasm' diff --git a/packages/image-io/typescript/src/index.ts b/packages/image-io/typescript/src/index.ts index 33ad4be39..4bc4e1ed1 100644 --- a/packages/image-io/typescript/src/index.ts +++ b/packages/image-io/typescript/src/index.ts @@ -462,3 +462,7 @@ export type { WasmZstdWriteImageOptions } import wasmZstdWriteImage from './wasm-zstd-write-image.js' export { wasmZstdWriteImage } + +export type { BinaryFile } from 'itk-wasm' +export type { JsonCompatible } from 'itk-wasm' +export type { Image } from 'itk-wasm' diff --git a/packages/image-io/typescript/src/jpeg-read-image-node.ts b/packages/image-io/typescript/src/jpeg-read-image-node.ts index 5c2857939..c7151468c 100644 --- a/packages/image-io/typescript/src/jpeg-read-image-node.ts +++ b/packages/image-io/typescript/src/jpeg-read-image-node.ts @@ -42,7 +42,8 @@ async function jpegReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/jpeg-read-image.ts b/packages/image-io/typescript/src/jpeg-read-image.ts index b61a629a4..278d8dfc2 100644 --- a/packages/image-io/typescript/src/jpeg-read-image.ts +++ b/packages/image-io/typescript/src/jpeg-read-image.ts @@ -48,7 +48,7 @@ async function jpegReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/jpeg-write-image-node-result.ts b/packages/image-io/typescript/src/jpeg-write-image-node-result.ts index c2477c569..1d30536b3 100644 --- a/packages/image-io/typescript/src/jpeg-write-image-node-result.ts +++ b/packages/image-io/typescript/src/jpeg-write-image-node-result.ts @@ -7,8 +7,6 @@ interface JpegWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default JpegWriteImageNodeResult diff --git a/packages/image-io/typescript/src/jpeg-write-image-node.ts b/packages/image-io/typescript/src/jpeg-write-image-node.ts index 53bd694db..03d7caca7 100644 --- a/packages/image-io/typescript/src/jpeg-write-image-node.ts +++ b/packages/image-io/typescript/src/jpeg-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {JpegWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function jpegWriteImageNode( image: Image, + serializedImage: string, options: JpegWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function jpegWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function jpegWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function jpegWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/jpeg-write-image-options.ts b/packages/image-io/typescript/src/jpeg-write-image-options.ts index ab333d8e3..c72fc9af3 100644 --- a/packages/image-io/typescript/src/jpeg-write-image-options.ts +++ b/packages/image-io/typescript/src/jpeg-write-image-options.ts @@ -7,9 +7,6 @@ interface JpegWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default JpegWriteImageOptions diff --git a/packages/image-io/typescript/src/jpeg-write-image.ts b/packages/image-io/typescript/src/jpeg-write-image.ts index 4e4260524..aac5972e1 100644 --- a/packages/image-io/typescript/src/jpeg-write-image.ts +++ b/packages/image-io/typescript/src/jpeg-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {JpegWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function jpegWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: JpegWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function jpegWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/lsm-read-image-node.ts b/packages/image-io/typescript/src/lsm-read-image-node.ts index 127114032..67fbb20b5 100644 --- a/packages/image-io/typescript/src/lsm-read-image-node.ts +++ b/packages/image-io/typescript/src/lsm-read-image-node.ts @@ -42,7 +42,8 @@ async function lsmReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/lsm-read-image.ts b/packages/image-io/typescript/src/lsm-read-image.ts index 37394e063..40aff0f25 100644 --- a/packages/image-io/typescript/src/lsm-read-image.ts +++ b/packages/image-io/typescript/src/lsm-read-image.ts @@ -48,7 +48,7 @@ async function lsmReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/lsm-write-image-node-result.ts b/packages/image-io/typescript/src/lsm-write-image-node-result.ts index 4043176fb..2512645d6 100644 --- a/packages/image-io/typescript/src/lsm-write-image-node-result.ts +++ b/packages/image-io/typescript/src/lsm-write-image-node-result.ts @@ -7,8 +7,6 @@ interface LsmWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default LsmWriteImageNodeResult diff --git a/packages/image-io/typescript/src/lsm-write-image-node.ts b/packages/image-io/typescript/src/lsm-write-image-node.ts index fd8146fb0..42c0e672d 100644 --- a/packages/image-io/typescript/src/lsm-write-image-node.ts +++ b/packages/image-io/typescript/src/lsm-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {LsmWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function lsmWriteImageNode( image: Image, + serializedImage: string, options: LsmWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function lsmWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function lsmWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function lsmWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/lsm-write-image-options.ts b/packages/image-io/typescript/src/lsm-write-image-options.ts index 4be48bb85..35066d8bd 100644 --- a/packages/image-io/typescript/src/lsm-write-image-options.ts +++ b/packages/image-io/typescript/src/lsm-write-image-options.ts @@ -7,9 +7,6 @@ interface LsmWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default LsmWriteImageOptions diff --git a/packages/image-io/typescript/src/lsm-write-image.ts b/packages/image-io/typescript/src/lsm-write-image.ts index 06fdc00c8..9af55ce25 100644 --- a/packages/image-io/typescript/src/lsm-write-image.ts +++ b/packages/image-io/typescript/src/lsm-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {LsmWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function lsmWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: LsmWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function lsmWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/meta-read-image-node.ts b/packages/image-io/typescript/src/meta-read-image-node.ts index 1a6522520..4af379a34 100644 --- a/packages/image-io/typescript/src/meta-read-image-node.ts +++ b/packages/image-io/typescript/src/meta-read-image-node.ts @@ -42,7 +42,8 @@ async function metaReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/meta-read-image.ts b/packages/image-io/typescript/src/meta-read-image.ts index 3165afc0b..d7f675839 100644 --- a/packages/image-io/typescript/src/meta-read-image.ts +++ b/packages/image-io/typescript/src/meta-read-image.ts @@ -48,7 +48,7 @@ async function metaReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/meta-write-image-node-result.ts b/packages/image-io/typescript/src/meta-write-image-node-result.ts index 6055d9194..4d421f08d 100644 --- a/packages/image-io/typescript/src/meta-write-image-node-result.ts +++ b/packages/image-io/typescript/src/meta-write-image-node-result.ts @@ -7,8 +7,6 @@ interface MetaWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default MetaWriteImageNodeResult diff --git a/packages/image-io/typescript/src/meta-write-image-node.ts b/packages/image-io/typescript/src/meta-write-image-node.ts index 4b15394e1..2f5bafe1d 100644 --- a/packages/image-io/typescript/src/meta-write-image-node.ts +++ b/packages/image-io/typescript/src/meta-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {MetaWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function metaWriteImageNode( image: Image, + serializedImage: string, options: MetaWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function metaWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function metaWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function metaWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/meta-write-image-options.ts b/packages/image-io/typescript/src/meta-write-image-options.ts index 5a353d5c1..4d0a420af 100644 --- a/packages/image-io/typescript/src/meta-write-image-options.ts +++ b/packages/image-io/typescript/src/meta-write-image-options.ts @@ -7,9 +7,6 @@ interface MetaWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default MetaWriteImageOptions diff --git a/packages/image-io/typescript/src/meta-write-image.ts b/packages/image-io/typescript/src/meta-write-image.ts index 867c65a3b..f94ee14e8 100644 --- a/packages/image-io/typescript/src/meta-write-image.ts +++ b/packages/image-io/typescript/src/meta-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {MetaWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function metaWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: MetaWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function metaWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/mgh-read-image-node.ts b/packages/image-io/typescript/src/mgh-read-image-node.ts index fd01a50ff..dc3e25742 100644 --- a/packages/image-io/typescript/src/mgh-read-image-node.ts +++ b/packages/image-io/typescript/src/mgh-read-image-node.ts @@ -42,7 +42,8 @@ async function mghReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/mgh-read-image.ts b/packages/image-io/typescript/src/mgh-read-image.ts index feb34c547..658819b3c 100644 --- a/packages/image-io/typescript/src/mgh-read-image.ts +++ b/packages/image-io/typescript/src/mgh-read-image.ts @@ -48,7 +48,7 @@ async function mghReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/mgh-write-image-node-result.ts b/packages/image-io/typescript/src/mgh-write-image-node-result.ts index 440ca73f9..79c559840 100644 --- a/packages/image-io/typescript/src/mgh-write-image-node-result.ts +++ b/packages/image-io/typescript/src/mgh-write-image-node-result.ts @@ -7,8 +7,6 @@ interface MghWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default MghWriteImageNodeResult diff --git a/packages/image-io/typescript/src/mgh-write-image-node.ts b/packages/image-io/typescript/src/mgh-write-image-node.ts index c28f72ff1..3c9c4b64d 100644 --- a/packages/image-io/typescript/src/mgh-write-image-node.ts +++ b/packages/image-io/typescript/src/mgh-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {MghWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function mghWriteImageNode( image: Image, + serializedImage: string, options: MghWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function mghWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function mghWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function mghWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/mgh-write-image-options.ts b/packages/image-io/typescript/src/mgh-write-image-options.ts index 28ee6b8bc..7dc635d10 100644 --- a/packages/image-io/typescript/src/mgh-write-image-options.ts +++ b/packages/image-io/typescript/src/mgh-write-image-options.ts @@ -7,9 +7,6 @@ interface MghWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default MghWriteImageOptions diff --git a/packages/image-io/typescript/src/mgh-write-image.ts b/packages/image-io/typescript/src/mgh-write-image.ts index d688ac45d..d2767d011 100644 --- a/packages/image-io/typescript/src/mgh-write-image.ts +++ b/packages/image-io/typescript/src/mgh-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {MghWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function mghWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: MghWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function mghWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/minc-read-image-node.ts b/packages/image-io/typescript/src/minc-read-image-node.ts index 3a9ec89c8..238f78448 100644 --- a/packages/image-io/typescript/src/minc-read-image-node.ts +++ b/packages/image-io/typescript/src/minc-read-image-node.ts @@ -42,7 +42,8 @@ async function mincReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/minc-read-image.ts b/packages/image-io/typescript/src/minc-read-image.ts index d9f6f377e..71c735909 100644 --- a/packages/image-io/typescript/src/minc-read-image.ts +++ b/packages/image-io/typescript/src/minc-read-image.ts @@ -48,7 +48,7 @@ async function mincReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/minc-write-image-node-result.ts b/packages/image-io/typescript/src/minc-write-image-node-result.ts index 9391f8a79..de7455054 100644 --- a/packages/image-io/typescript/src/minc-write-image-node-result.ts +++ b/packages/image-io/typescript/src/minc-write-image-node-result.ts @@ -7,8 +7,6 @@ interface MincWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default MincWriteImageNodeResult diff --git a/packages/image-io/typescript/src/minc-write-image-node.ts b/packages/image-io/typescript/src/minc-write-image-node.ts index 69abca712..564dceba8 100644 --- a/packages/image-io/typescript/src/minc-write-image-node.ts +++ b/packages/image-io/typescript/src/minc-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {MincWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function mincWriteImageNode( image: Image, + serializedImage: string, options: MincWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function mincWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function mincWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function mincWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/minc-write-image-options.ts b/packages/image-io/typescript/src/minc-write-image-options.ts index 82c533b8a..004b859f4 100644 --- a/packages/image-io/typescript/src/minc-write-image-options.ts +++ b/packages/image-io/typescript/src/minc-write-image-options.ts @@ -7,9 +7,6 @@ interface MincWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default MincWriteImageOptions diff --git a/packages/image-io/typescript/src/minc-write-image.ts b/packages/image-io/typescript/src/minc-write-image.ts index 6a7ef7062..df58d9ec3 100644 --- a/packages/image-io/typescript/src/minc-write-image.ts +++ b/packages/image-io/typescript/src/minc-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {MincWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function mincWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: MincWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function mincWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/mrc-read-image-node.ts b/packages/image-io/typescript/src/mrc-read-image-node.ts index bec47f6aa..55cefcae7 100644 --- a/packages/image-io/typescript/src/mrc-read-image-node.ts +++ b/packages/image-io/typescript/src/mrc-read-image-node.ts @@ -42,7 +42,8 @@ async function mrcReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/mrc-read-image.ts b/packages/image-io/typescript/src/mrc-read-image.ts index 8c8448ea1..feea33246 100644 --- a/packages/image-io/typescript/src/mrc-read-image.ts +++ b/packages/image-io/typescript/src/mrc-read-image.ts @@ -48,7 +48,7 @@ async function mrcReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/mrc-write-image-node-result.ts b/packages/image-io/typescript/src/mrc-write-image-node-result.ts index b70ba9e16..ec1af29ee 100644 --- a/packages/image-io/typescript/src/mrc-write-image-node-result.ts +++ b/packages/image-io/typescript/src/mrc-write-image-node-result.ts @@ -7,8 +7,6 @@ interface MrcWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default MrcWriteImageNodeResult diff --git a/packages/image-io/typescript/src/mrc-write-image-node.ts b/packages/image-io/typescript/src/mrc-write-image-node.ts index 1c7412c27..e39ddf454 100644 --- a/packages/image-io/typescript/src/mrc-write-image-node.ts +++ b/packages/image-io/typescript/src/mrc-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {MrcWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function mrcWriteImageNode( image: Image, + serializedImage: string, options: MrcWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function mrcWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function mrcWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function mrcWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/mrc-write-image-options.ts b/packages/image-io/typescript/src/mrc-write-image-options.ts index 41b5e7ad7..8c1676103 100644 --- a/packages/image-io/typescript/src/mrc-write-image-options.ts +++ b/packages/image-io/typescript/src/mrc-write-image-options.ts @@ -7,9 +7,6 @@ interface MrcWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default MrcWriteImageOptions diff --git a/packages/image-io/typescript/src/mrc-write-image.ts b/packages/image-io/typescript/src/mrc-write-image.ts index e86d07071..0f9693383 100644 --- a/packages/image-io/typescript/src/mrc-write-image.ts +++ b/packages/image-io/typescript/src/mrc-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {MrcWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function mrcWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: MrcWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function mrcWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/nifti-read-image-node.ts b/packages/image-io/typescript/src/nifti-read-image-node.ts index 2dc8028a5..ca17a0b99 100644 --- a/packages/image-io/typescript/src/nifti-read-image-node.ts +++ b/packages/image-io/typescript/src/nifti-read-image-node.ts @@ -42,7 +42,8 @@ async function niftiReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/nifti-read-image.ts b/packages/image-io/typescript/src/nifti-read-image.ts index ddc7507da..6df831400 100644 --- a/packages/image-io/typescript/src/nifti-read-image.ts +++ b/packages/image-io/typescript/src/nifti-read-image.ts @@ -48,7 +48,7 @@ async function niftiReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/nifti-write-image-node-result.ts b/packages/image-io/typescript/src/nifti-write-image-node-result.ts index 2e6a1c8da..9b2824588 100644 --- a/packages/image-io/typescript/src/nifti-write-image-node-result.ts +++ b/packages/image-io/typescript/src/nifti-write-image-node-result.ts @@ -7,8 +7,6 @@ interface NiftiWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default NiftiWriteImageNodeResult diff --git a/packages/image-io/typescript/src/nifti-write-image-node.ts b/packages/image-io/typescript/src/nifti-write-image-node.ts index e19c3e984..bc0a5a7a4 100644 --- a/packages/image-io/typescript/src/nifti-write-image-node.ts +++ b/packages/image-io/typescript/src/nifti-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {NiftiWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function niftiWriteImageNode( image: Image, + serializedImage: string, options: NiftiWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function niftiWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function niftiWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function niftiWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/nifti-write-image-options.ts b/packages/image-io/typescript/src/nifti-write-image-options.ts index 3c3177041..26e0091db 100644 --- a/packages/image-io/typescript/src/nifti-write-image-options.ts +++ b/packages/image-io/typescript/src/nifti-write-image-options.ts @@ -7,9 +7,6 @@ interface NiftiWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default NiftiWriteImageOptions diff --git a/packages/image-io/typescript/src/nifti-write-image.ts b/packages/image-io/typescript/src/nifti-write-image.ts index 17a20f25b..7a7e6e262 100644 --- a/packages/image-io/typescript/src/nifti-write-image.ts +++ b/packages/image-io/typescript/src/nifti-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {NiftiWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function niftiWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: NiftiWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function niftiWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/nrrd-read-image-node.ts b/packages/image-io/typescript/src/nrrd-read-image-node.ts index fc5567944..f22c3f36e 100644 --- a/packages/image-io/typescript/src/nrrd-read-image-node.ts +++ b/packages/image-io/typescript/src/nrrd-read-image-node.ts @@ -42,7 +42,8 @@ async function nrrdReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/nrrd-read-image.ts b/packages/image-io/typescript/src/nrrd-read-image.ts index da5fcb67f..177ff7b3f 100644 --- a/packages/image-io/typescript/src/nrrd-read-image.ts +++ b/packages/image-io/typescript/src/nrrd-read-image.ts @@ -48,7 +48,7 @@ async function nrrdReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/nrrd-write-image-node-result.ts b/packages/image-io/typescript/src/nrrd-write-image-node-result.ts index 9fb8b00f8..ed9ec6a11 100644 --- a/packages/image-io/typescript/src/nrrd-write-image-node-result.ts +++ b/packages/image-io/typescript/src/nrrd-write-image-node-result.ts @@ -7,8 +7,6 @@ interface NrrdWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default NrrdWriteImageNodeResult diff --git a/packages/image-io/typescript/src/nrrd-write-image-node.ts b/packages/image-io/typescript/src/nrrd-write-image-node.ts index a4a562290..dfdb38379 100644 --- a/packages/image-io/typescript/src/nrrd-write-image-node.ts +++ b/packages/image-io/typescript/src/nrrd-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {NrrdWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function nrrdWriteImageNode( image: Image, + serializedImage: string, options: NrrdWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function nrrdWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function nrrdWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function nrrdWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/nrrd-write-image-options.ts b/packages/image-io/typescript/src/nrrd-write-image-options.ts index 3a47b4544..7319344cd 100644 --- a/packages/image-io/typescript/src/nrrd-write-image-options.ts +++ b/packages/image-io/typescript/src/nrrd-write-image-options.ts @@ -7,9 +7,6 @@ interface NrrdWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default NrrdWriteImageOptions diff --git a/packages/image-io/typescript/src/nrrd-write-image.ts b/packages/image-io/typescript/src/nrrd-write-image.ts index 790f5ed31..7e40d90b3 100644 --- a/packages/image-io/typescript/src/nrrd-write-image.ts +++ b/packages/image-io/typescript/src/nrrd-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {NrrdWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function nrrdWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: NrrdWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function nrrdWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/png-read-image-node.ts b/packages/image-io/typescript/src/png-read-image-node.ts index 06a4ee447..0af7b2b8f 100644 --- a/packages/image-io/typescript/src/png-read-image-node.ts +++ b/packages/image-io/typescript/src/png-read-image-node.ts @@ -42,7 +42,8 @@ async function pngReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/png-read-image.ts b/packages/image-io/typescript/src/png-read-image.ts index 96cbb5e6e..c36041950 100644 --- a/packages/image-io/typescript/src/png-read-image.ts +++ b/packages/image-io/typescript/src/png-read-image.ts @@ -48,7 +48,7 @@ async function pngReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/png-write-image-node-result.ts b/packages/image-io/typescript/src/png-write-image-node-result.ts index c61ac6ac1..dc4eac7f7 100644 --- a/packages/image-io/typescript/src/png-write-image-node-result.ts +++ b/packages/image-io/typescript/src/png-write-image-node-result.ts @@ -7,8 +7,6 @@ interface PngWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default PngWriteImageNodeResult diff --git a/packages/image-io/typescript/src/png-write-image-node.ts b/packages/image-io/typescript/src/png-write-image-node.ts index 4a35762d2..80c927f43 100644 --- a/packages/image-io/typescript/src/png-write-image-node.ts +++ b/packages/image-io/typescript/src/png-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {PngWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function pngWriteImageNode( image: Image, + serializedImage: string, options: PngWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function pngWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function pngWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function pngWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/png-write-image-options.ts b/packages/image-io/typescript/src/png-write-image-options.ts index a3ce9e40a..927d93954 100644 --- a/packages/image-io/typescript/src/png-write-image-options.ts +++ b/packages/image-io/typescript/src/png-write-image-options.ts @@ -7,9 +7,6 @@ interface PngWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default PngWriteImageOptions diff --git a/packages/image-io/typescript/src/png-write-image.ts b/packages/image-io/typescript/src/png-write-image.ts index e2aee5a54..f7d94d681 100644 --- a/packages/image-io/typescript/src/png-write-image.ts +++ b/packages/image-io/typescript/src/png-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {PngWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function pngWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: PngWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function pngWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/scanco-read-image-node.ts b/packages/image-io/typescript/src/scanco-read-image-node.ts index d823dbb69..fa8f46504 100644 --- a/packages/image-io/typescript/src/scanco-read-image-node.ts +++ b/packages/image-io/typescript/src/scanco-read-image-node.ts @@ -42,7 +42,8 @@ async function scancoReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/scanco-read-image.ts b/packages/image-io/typescript/src/scanco-read-image.ts index 6dee3885b..cfec7d768 100644 --- a/packages/image-io/typescript/src/scanco-read-image.ts +++ b/packages/image-io/typescript/src/scanco-read-image.ts @@ -48,7 +48,7 @@ async function scancoReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/scanco-write-image-node-result.ts b/packages/image-io/typescript/src/scanco-write-image-node-result.ts index fb8e4c0bf..5bbeb4c3a 100644 --- a/packages/image-io/typescript/src/scanco-write-image-node-result.ts +++ b/packages/image-io/typescript/src/scanco-write-image-node-result.ts @@ -7,8 +7,6 @@ interface ScancoWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default ScancoWriteImageNodeResult diff --git a/packages/image-io/typescript/src/scanco-write-image-node.ts b/packages/image-io/typescript/src/scanco-write-image-node.ts index eac038a17..45b3f7604 100644 --- a/packages/image-io/typescript/src/scanco-write-image-node.ts +++ b/packages/image-io/typescript/src/scanco-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {ScancoWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function scancoWriteImageNode( image: Image, + serializedImage: string, options: ScancoWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function scancoWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function scancoWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function scancoWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/scanco-write-image-options.ts b/packages/image-io/typescript/src/scanco-write-image-options.ts index 9bbf54da8..6744d4052 100644 --- a/packages/image-io/typescript/src/scanco-write-image-options.ts +++ b/packages/image-io/typescript/src/scanco-write-image-options.ts @@ -7,9 +7,6 @@ interface ScancoWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default ScancoWriteImageOptions diff --git a/packages/image-io/typescript/src/scanco-write-image.ts b/packages/image-io/typescript/src/scanco-write-image.ts index 40e3808aa..bb11b89dd 100644 --- a/packages/image-io/typescript/src/scanco-write-image.ts +++ b/packages/image-io/typescript/src/scanco-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {ScancoWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function scancoWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: ScancoWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function scancoWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/tiff-read-image-node.ts b/packages/image-io/typescript/src/tiff-read-image-node.ts index 3847bb700..44265070c 100644 --- a/packages/image-io/typescript/src/tiff-read-image-node.ts +++ b/packages/image-io/typescript/src/tiff-read-image-node.ts @@ -42,7 +42,8 @@ async function tiffReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/tiff-read-image.ts b/packages/image-io/typescript/src/tiff-read-image.ts index aac358ea7..edca84e53 100644 --- a/packages/image-io/typescript/src/tiff-read-image.ts +++ b/packages/image-io/typescript/src/tiff-read-image.ts @@ -48,7 +48,7 @@ async function tiffReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/tiff-write-image-node-result.ts b/packages/image-io/typescript/src/tiff-write-image-node-result.ts index 48502a8c9..2cb5e6d73 100644 --- a/packages/image-io/typescript/src/tiff-write-image-node-result.ts +++ b/packages/image-io/typescript/src/tiff-write-image-node-result.ts @@ -7,8 +7,6 @@ interface TiffWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default TiffWriteImageNodeResult diff --git a/packages/image-io/typescript/src/tiff-write-image-node.ts b/packages/image-io/typescript/src/tiff-write-image-node.ts index 0e7017a1f..8052dd793 100644 --- a/packages/image-io/typescript/src/tiff-write-image-node.ts +++ b/packages/image-io/typescript/src/tiff-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {TiffWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function tiffWriteImageNode( image: Image, + serializedImage: string, options: TiffWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function tiffWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function tiffWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function tiffWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/tiff-write-image-options.ts b/packages/image-io/typescript/src/tiff-write-image-options.ts index ea49bc1f2..9a273702f 100644 --- a/packages/image-io/typescript/src/tiff-write-image-options.ts +++ b/packages/image-io/typescript/src/tiff-write-image-options.ts @@ -7,9 +7,6 @@ interface TiffWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default TiffWriteImageOptions diff --git a/packages/image-io/typescript/src/tiff-write-image.ts b/packages/image-io/typescript/src/tiff-write-image.ts index 6d3534291..0be270dcf 100644 --- a/packages/image-io/typescript/src/tiff-write-image.ts +++ b/packages/image-io/typescript/src/tiff-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {TiffWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function tiffWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: TiffWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function tiffWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/vtk-read-image-node.ts b/packages/image-io/typescript/src/vtk-read-image-node.ts index 1e4dc4c8e..fa1c1cf1d 100644 --- a/packages/image-io/typescript/src/vtk-read-image-node.ts +++ b/packages/image-io/typescript/src/vtk-read-image-node.ts @@ -42,7 +42,8 @@ async function vtkReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/vtk-read-image.ts b/packages/image-io/typescript/src/vtk-read-image.ts index 1e805682d..dff00aa08 100644 --- a/packages/image-io/typescript/src/vtk-read-image.ts +++ b/packages/image-io/typescript/src/vtk-read-image.ts @@ -48,7 +48,7 @@ async function vtkReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/vtk-write-image-node-result.ts b/packages/image-io/typescript/src/vtk-write-image-node-result.ts index d2da1ba08..85cee83c9 100644 --- a/packages/image-io/typescript/src/vtk-write-image-node-result.ts +++ b/packages/image-io/typescript/src/vtk-write-image-node-result.ts @@ -7,8 +7,6 @@ interface VtkWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default VtkWriteImageNodeResult diff --git a/packages/image-io/typescript/src/vtk-write-image-node.ts b/packages/image-io/typescript/src/vtk-write-image-node.ts index 2712fb34a..633753104 100644 --- a/packages/image-io/typescript/src/vtk-write-image-node.ts +++ b/packages/image-io/typescript/src/vtk-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {VtkWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function vtkWriteImageNode( image: Image, + serializedImage: string, options: VtkWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function vtkWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function vtkWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function vtkWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/vtk-write-image-options.ts b/packages/image-io/typescript/src/vtk-write-image-options.ts index cf7786ee6..db387d6aa 100644 --- a/packages/image-io/typescript/src/vtk-write-image-options.ts +++ b/packages/image-io/typescript/src/vtk-write-image-options.ts @@ -7,9 +7,6 @@ interface VtkWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default VtkWriteImageOptions diff --git a/packages/image-io/typescript/src/vtk-write-image.ts b/packages/image-io/typescript/src/vtk-write-image.ts index 9ad5c920d..f29a24e38 100644 --- a/packages/image-io/typescript/src/vtk-write-image.ts +++ b/packages/image-io/typescript/src/vtk-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {VtkWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function vtkWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: VtkWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function vtkWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/wasm-read-image-node.ts b/packages/image-io/typescript/src/wasm-read-image-node.ts index f92d358ec..09cc7cc42 100644 --- a/packages/image-io/typescript/src/wasm-read-image-node.ts +++ b/packages/image-io/typescript/src/wasm-read-image-node.ts @@ -42,7 +42,8 @@ async function wasmReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/wasm-read-image.ts b/packages/image-io/typescript/src/wasm-read-image.ts index 8ea448ba5..8f3e201bb 100644 --- a/packages/image-io/typescript/src/wasm-read-image.ts +++ b/packages/image-io/typescript/src/wasm-read-image.ts @@ -48,7 +48,7 @@ async function wasmReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/wasm-write-image-node-result.ts b/packages/image-io/typescript/src/wasm-write-image-node-result.ts index e52ab548c..5475f2c0c 100644 --- a/packages/image-io/typescript/src/wasm-write-image-node-result.ts +++ b/packages/image-io/typescript/src/wasm-write-image-node-result.ts @@ -7,8 +7,6 @@ interface WasmWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default WasmWriteImageNodeResult diff --git a/packages/image-io/typescript/src/wasm-write-image-node.ts b/packages/image-io/typescript/src/wasm-write-image-node.ts index ccd90e6a4..38719bdc8 100644 --- a/packages/image-io/typescript/src/wasm-write-image-node.ts +++ b/packages/image-io/typescript/src/wasm-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {WasmWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function wasmWriteImageNode( image: Image, + serializedImage: string, options: WasmWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function wasmWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function wasmWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function wasmWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/wasm-write-image-options.ts b/packages/image-io/typescript/src/wasm-write-image-options.ts index 61a6fc555..d5aedcf8c 100644 --- a/packages/image-io/typescript/src/wasm-write-image-options.ts +++ b/packages/image-io/typescript/src/wasm-write-image-options.ts @@ -7,9 +7,6 @@ interface WasmWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default WasmWriteImageOptions diff --git a/packages/image-io/typescript/src/wasm-write-image.ts b/packages/image-io/typescript/src/wasm-write-image.ts index cd5e83261..381554fe9 100644 --- a/packages/image-io/typescript/src/wasm-write-image.ts +++ b/packages/image-io/typescript/src/wasm-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {WasmWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function wasmWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: WasmWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function wasmWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/src/wasm-zstd-read-image-node.ts b/packages/image-io/typescript/src/wasm-zstd-read-image-node.ts index 234e7f2cb..3f2e2ab94 100644 --- a/packages/image-io/typescript/src/wasm-zstd-read-image-node.ts +++ b/packages/image-io/typescript/src/wasm-zstd-read-image-node.ts @@ -42,7 +42,8 @@ async function wasmZstdReadImageNode( const args = [] // Inputs const serializedImageName = serializedImage - args.push(serializedImageName as string) + args.push(serializedImageName) + mountDirs.add(path.dirname(serializedImageName)) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/wasm-zstd-read-image.ts b/packages/image-io/typescript/src/wasm-zstd-read-image.ts index 4f6e66a7d..46480a0b7 100644 --- a/packages/image-io/typescript/src/wasm-zstd-read-image.ts +++ b/packages/image-io/typescript/src/wasm-zstd-read-image.ts @@ -48,7 +48,7 @@ async function wasmZstdReadImage( const args = [] // Inputs const serializedImageName = (serializedImageFile as BinaryFile).path - args.push(serializedImageName as string) + args.push(serializedImageName) // Outputs const couldReadName = '0' diff --git a/packages/image-io/typescript/src/wasm-zstd-write-image-node-result.ts b/packages/image-io/typescript/src/wasm-zstd-write-image-node-result.ts index aed376ade..9cb5f9d14 100644 --- a/packages/image-io/typescript/src/wasm-zstd-write-image-node-result.ts +++ b/packages/image-io/typescript/src/wasm-zstd-write-image-node-result.ts @@ -7,8 +7,6 @@ interface WasmZstdWriteImageNodeResult { couldWrite: JsonCompatible /** Output image serialized in the file format. */ - serializedImage: string - } export default WasmZstdWriteImageNodeResult diff --git a/packages/image-io/typescript/src/wasm-zstd-write-image-node.ts b/packages/image-io/typescript/src/wasm-zstd-write-image-node.ts index f9e47d7f6..9cec6bee4 100644 --- a/packages/image-io/typescript/src/wasm-zstd-write-image-node.ts +++ b/packages/image-io/typescript/src/wasm-zstd-write-image-node.ts @@ -19,12 +19,14 @@ import path from 'path' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {WasmZstdWriteImageOptions} options - options object * * @returns {Promise} - result object */ async function wasmZstdWriteImageNode( image: Image, + serializedImage: string, options: WasmZstdWriteImageOptions = {} ) : Promise { @@ -32,7 +34,6 @@ async function wasmZstdWriteImageNode( const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile }, ] const inputs: Array = [ @@ -42,13 +43,13 @@ async function wasmZstdWriteImageNode( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) mountDirs.add(path.dirname(serializedImageName)) @@ -74,7 +75,6 @@ async function wasmZstdWriteImageNode( const result = { couldWrite: outputs[0].data as JsonCompatible, - serializedImage: outputs[1].data as string, } return result } diff --git a/packages/image-io/typescript/src/wasm-zstd-write-image-options.ts b/packages/image-io/typescript/src/wasm-zstd-write-image-options.ts index 84480fae3..2d633a9f6 100644 --- a/packages/image-io/typescript/src/wasm-zstd-write-image-options.ts +++ b/packages/image-io/typescript/src/wasm-zstd-write-image-options.ts @@ -7,9 +7,6 @@ interface WasmZstdWriteImageOptions { /** Use compression in the written file */ useCompression?: boolean - /** Output image serialized in the file format. path */ - serializedImagePath?: string - } export default WasmZstdWriteImageOptions diff --git a/packages/image-io/typescript/src/wasm-zstd-write-image.ts b/packages/image-io/typescript/src/wasm-zstd-write-image.ts index b68ccd3df..16ec2130f 100644 --- a/packages/image-io/typescript/src/wasm-zstd-write-image.ts +++ b/packages/image-io/typescript/src/wasm-zstd-write-image.ts @@ -21,6 +21,7 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' * Write an itk-wasm file format converted to an image file format * * @param {Image} image - Input image + * @param {string} serializedImage - Output image serialized in the file format. * @param {WasmZstdWriteImageOptions} options - options object * * @returns {Promise} - result object @@ -28,13 +29,13 @@ import { getPipelineWorkerUrl } from './pipeline-worker-url.js' async function wasmZstdWriteImage( webWorker: null | Worker, image: Image, + serializedImage: string, options: WasmZstdWriteImageOptions = {} ) : Promise { - const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath const desiredOutputs: Array = [ { type: InterfaceTypes.JsonCompatible }, - { type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }}, + { type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }}, ] const inputs: Array = [ @@ -44,13 +45,13 @@ async function wasmZstdWriteImage( const args = [] // Inputs const imageName = '0' - args.push(imageName as string) + args.push(imageName) // Outputs const couldWriteName = '0' args.push(couldWriteName) - const serializedImageName = serializedImagePath + const serializedImageName = serializedImage args.push(serializedImageName) // Options diff --git a/packages/image-io/typescript/test/browser/demo-app/index.html b/packages/image-io/typescript/test/browser/demo-app/index.html index 582d4f30f..630d4ecb4 100644 --- a/packages/image-io/typescript/test/browser/demo-app/index.html +++ b/packages/image-io/typescript/test/browser/demo-app/index.html @@ -117,7 +117,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -170,8 +170,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -200,7 +201,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -253,8 +254,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -283,7 +285,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -336,8 +338,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -366,7 +369,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -419,8 +422,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -449,7 +453,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -502,8 +506,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -532,7 +537,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -585,8 +590,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -615,7 +621,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -668,8 +674,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -698,7 +705,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -751,8 +758,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -781,7 +789,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -834,8 +842,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -864,7 +873,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -917,8 +926,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -947,7 +957,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1000,8 +1010,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1030,7 +1041,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1083,8 +1094,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1113,7 +1125,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1166,8 +1178,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1196,7 +1209,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1249,8 +1262,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1279,7 +1293,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1332,8 +1346,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1362,7 +1377,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1415,8 +1430,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1445,7 +1461,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1498,8 +1514,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1528,7 +1545,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1581,8 +1598,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1611,7 +1629,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1664,8 +1682,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1694,7 +1713,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1747,8 +1766,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1777,7 +1797,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1830,8 +1850,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1860,7 +1881,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1913,8 +1934,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

@@ -1943,7 +1965,7 @@

👨‍💻 Live API Demo ✨

informationOnly - Only read image metadata -- do not read pixel data.

-
Load sample inputs +
Load sample inputs Run

@@ -1996,8 +2018,9 @@

👨‍💻 Live API Demo ✨



useCompression - Use compression in the written file

+ -
Load sample inputs +
Load sample inputs Run

diff --git a/packages/image-io/typescript/test/browser/demo-app/index.ts b/packages/image-io/typescript/test/browser/demo-app/index.ts index 7cef8f43f..7fb013194 100644 --- a/packages/image-io/typescript/test/browser/demo-app/index.ts +++ b/packages/image-io/typescript/test/browser/demo-app/index.ts @@ -8,6 +8,14 @@ imageIo.setPipelinesBaseUrl(pipelinesBaseUrl) const pipelineWorkerUrl: string | URL | null = new URL('/web-workers/pipeline.worker.js', document.location.origin).href imageIo.setPipelineWorkerUrl(pipelineWorkerUrl) + +const params = new URLSearchParams(window.location.search) +if (!params.has('functionName')) { + params.set('functionName', 'bioRadReadImage') + const url = new URL(document.location) + url.search = params + window.history.replaceState({ functionName: 'bioRadReadImage' }, '', url) +} import './bio-rad-read-image-controller.js' import './bio-rad-write-image-controller.js' import './bmp-read-image-controller.js' diff --git a/packages/image-io/typescript/test/browser/demo-app/utilities.js b/packages/image-io/typescript/test/browser/demo-app/utilities.js index 0820648ce..c31e4c305 100644 --- a/packages/image-io/typescript/test/browser/demo-app/utilities.js +++ b/packages/image-io/typescript/test/browser/demo-app/utilities.js @@ -79,3 +79,14 @@ function enableInputs(inputId) { }) } globalThis.enableInputs = enableInputs + +function applyInputParsedJson(inputElement, modelMap, parameterName) { + try { + const parsedJson = JSON.parse(inputElement.value) + modelMap.set(parameterName, parsedJson) + inputElement.setCustomValidity('') + } catch (error) { + inputElement.setCustomValidity(error.message) + } +} +globalThis.applyInputParsedJson = applyInputParsedJson