Skip to content

Commit

Permalink
feat(image-io): bindgen updates for output files
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Oct 4, 2023
1 parent 138f178 commit fa0ce80
Show file tree
Hide file tree
Showing 157 changed files with 392 additions and 407 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/compare-images/typescript/src/vector-magnitude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/dicom/typescript/src/structured-report-to-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/dicom/typescript/src/structured-report-to-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 2 additions & 1 deletion packages/image-io/typescript/src/bio-rad-read-image-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/image-io/typescript/src/bio-rad-read-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ interface BioRadWriteImageNodeResult {
couldWrite: JsonCompatible

/** Output image serialized in the file format. */
serializedImage: string

}

export default BioRadWriteImageNodeResult
8 changes: 4 additions & 4 deletions packages/image-io/typescript/src/bio-rad-write-image-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ 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<BioRadWriteImageNodeResult>} - result object
*/
async function bioRadWriteImageNode(
image: Image,
serializedImage: string,
options: BioRadWriteImageOptions = {}
) : Promise<BioRadWriteImageNodeResult> {

const mountDirs: Set<string> = new Set()

const desiredOutputs: Array<PipelineOutput> = [
{ type: InterfaceTypes.JsonCompatible },
{ type: InterfaceTypes.BinaryFile },
]

const inputs: Array<PipelineInput> = [
Expand All @@ -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))

Expand All @@ -74,7 +75,6 @@ async function bioRadWriteImageNode(

const result = {
couldWrite: outputs[0].data as JsonCompatible,
serializedImage: outputs[1].data as string,
}
return result
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions packages/image-io/typescript/src/bio-rad-write-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ 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<BioRadWriteImageResult>} - result object
*/
async function bioRadWriteImage(
webWorker: null | Worker,
image: Image,
serializedImage: string,
options: BioRadWriteImageOptions = {}
) : Promise<BioRadWriteImageResult> {

const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath
const desiredOutputs: Array<PipelineOutput> = [
{ type: InterfaceTypes.JsonCompatible },
{ type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }},
{ type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }},
]

const inputs: Array<PipelineInput> = [
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion packages/image-io/typescript/src/bmp-read-image-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/image-io/typescript/src/bmp-read-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ interface BmpWriteImageNodeResult {
couldWrite: JsonCompatible

/** Output image serialized in the file format. */
serializedImage: string

}

export default BmpWriteImageNodeResult
8 changes: 4 additions & 4 deletions packages/image-io/typescript/src/bmp-write-image-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ 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<BmpWriteImageNodeResult>} - result object
*/
async function bmpWriteImageNode(
image: Image,
serializedImage: string,
options: BmpWriteImageOptions = {}
) : Promise<BmpWriteImageNodeResult> {

const mountDirs: Set<string> = new Set()

const desiredOutputs: Array<PipelineOutput> = [
{ type: InterfaceTypes.JsonCompatible },
{ type: InterfaceTypes.BinaryFile },
]

const inputs: Array<PipelineInput> = [
Expand All @@ -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))

Expand All @@ -74,7 +75,6 @@ async function bmpWriteImageNode(

const result = {
couldWrite: outputs[0].data as JsonCompatible,
serializedImage: outputs[1].data as string,
}
return result
}
Expand Down
3 changes: 0 additions & 3 deletions packages/image-io/typescript/src/bmp-write-image-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions packages/image-io/typescript/src/bmp-write-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ 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<BmpWriteImageResult>} - result object
*/
async function bmpWriteImage(
webWorker: null | Worker,
image: Image,
serializedImage: string,
options: BmpWriteImageOptions = {}
) : Promise<BmpWriteImageResult> {

const serializedImagePath = typeof options.serializedImagePath === 'undefined' ? 'serializedImage' : options.serializedImagePath
const desiredOutputs: Array<PipelineOutput> = [
{ type: InterfaceTypes.JsonCompatible },
{ type: InterfaceTypes.BinaryFile, data: { path: serializedImagePath, data: new Uint8Array() }},
{ type: InterfaceTypes.BinaryFile, data: { path: serializedImage, data: new Uint8Array() }},
]

const inputs: Array<PipelineInput> = [
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion packages/image-io/typescript/src/fdf-read-image-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading

0 comments on commit fa0ce80

Please sign in to comment.