Node.js Input/Output¶
These Input/Output (IO) functions can be used from within a Node.js application or library on a workstation or server. They will read from and write to directories on the local filesystem.
Similar to the web browser API, most of these functions return a Promise.
readLocalFile
¶
readLocalFile(filePath: string): Promise<Image | Mesh>
Read an image or mesh from a file on the local filesystem.
writeLocalFile
¶
writeLocalFile(imageOrMesh: Image | Mesh, filePath: string, useCompression: boolean = false):
Promise<null>
Write an image to a file on the local filesystem with Node.js.
readImageLocalFile
¶
readImageLocalFile(filePath: string):
Promise<Image>
Read an image from a file on the local filesystem.
readImageLocalDICOMFileSeries
¶
readImageLocalDICOMFileSeries(filePaths, singleSortedSeries: boolean = false):
Promise<Image>
Read an image from a series of DICOM files on the local filesystem.
If the files are known to be from a single, sorted series, the last argument can be set to true for performance.
writeImageLocalFile
¶
writeImageLocalFile(image: Image, filePath: string, useCompression: boolean):
null
Write an image to a file on the local filesystem with Node.js.
image:
Image
instance to writefilePath: path to the file on the local filesystem
useCompression: compress the pixel data when possible
readMeshLocalFile
¶
readMeshLocalFile(filePath: string):
Promise<Mesh>
Read a mesh from a file on the local filesystem.
writeMeshLocalFile
¶
writeMeshLocalFile(Mesh, filePath: string, { useCompression?: boolean, binaryFileType?: boolean }):
null
Write a mesh to a file on the local filesystem with Node.js.
mesh:
Mesh
instance to writefilePath: path to the file on the local filesystem
useCompression: compress the pixel data when possible
binaryFileType: write in a binary as opposed to a ascii format, if possible