Detalhes do pacote

@itk-wasm/image-io

InsightSoftwareConsortium5.8kApache-2.01.6.0

Input and output for scientific and medical image file formats.

itk, wasm, webassembly, wasi

readme (leia-me)

@itk-wasm/image-io

npm version

Input and output for scientific and medical image file formats.

💻 Live API Demo

🕮 Documentation 📚

Installation

npm install @itk-wasm/image-io

Usage

Browser interface

Import:

import {
  readImage,
  writeImage,
  bioRadReadImage,
  bioRadWriteImage,
  bmpReadImage,
  bmpWriteImage,
  fdfReadImage,
  fdfWriteImage,
  gdcmReadImage,
  gdcmWriteImage,
  geAdwReadImage,
  geAdwWriteImage,
  ge4ReadImage,
  ge4WriteImage,
  ge5ReadImage,
  ge5WriteImage,
  giplReadImage,
  giplWriteImage,
  hdf5ReadImage,
  hdf5WriteImage,
  jpegReadImage,
  jpegWriteImage,
  lsmReadImage,
  lsmWriteImage,
  metaReadImage,
  metaWriteImage,
  mghReadImage,
  mghWriteImage,
  mincReadImage,
  mincWriteImage,
  mrcReadImage,
  mrcWriteImage,
  niftiReadImage,
  niftiWriteImage,
  nrrdReadImage,
  nrrdWriteImage,
  pngReadImage,
  pngWriteImage,
  scancoReadImage,
  scancoWriteImage,
  tiffReadImage,
  tiffWriteImage,
  vtkReadImage,
  vtkWriteImage,
  wasmReadImage,
  wasmWriteImage,
  wasmZstdReadImage,
  wasmZstdWriteImage,
  setPipelinesBaseUrl,
  getPipelinesBaseUrl,
} from "@itk-wasm/image-io"

readImage

Read an image file format and convert it to an itk-wasm Image.

async function readImage(
  serializedImage: File | BinaryFile,
  options: ReadImageOptions = {}
) : Promise<ReadImageResult>
Parameter Type Description
serializedImage File or BinaryFile Input image serialized in the file format.

ReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
componentType typeof IntTypes or typeof FloatTypes Component type, from itk-wasm IntTypes, FloatTypes, for the output pixel components. Defaults to the input component type.
pixelType typeof PixelTypes Pixel type, from itk-wasm PixelTypes, for the output pixels. Defaults to the input pixel type.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

ReadImageResult interface:

Property Type Description
webWorker Worker WebWorker used for computation
image Image Output image

writeImage

Write an itk-wasm Image converted to an image file format

async function writeImage(
  image: Image,
  serializedImage: string,
  options: WriteImageOptions = {}
) : Promise<WriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

WriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
mimeType string Mime type of the output image file.
componentType typeof IntTypes or typeof FloatTypes Component type, from itk-wasm IntTypes, FloatTypes, for the output pixel components. Defaults to the input component type.
pixelType typeof PixelTypes Pixel type, from itk-wasm PixelTypes, for the output pixels. Defaults to the input pixel type.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

WriteImageResult interface:

Property Type Description
webWorker Worker WebWorker used for computation
serializedImage BinaryFile Output image serialized in the file format.

bioRadReadImage

Read an image file format and convert it to the itk-wasm file format

async function bioRadReadImage(
  serializedImage: File | BinaryFile,
  options: BioRadReadImageOptions = {}
) : Promise<BioRadReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

BioRadReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

BioRadReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

bioRadWriteImage

Write an itk-wasm file format converted to an image file format

async function bioRadWriteImage(
  image: Image,
  serializedImage: string,
  options: BioRadWriteImageOptions = {}
) : Promise<BioRadWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

BioRadWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

BioRadWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

bmpReadImage

Read an image file format and convert it to the itk-wasm file format

async function bmpReadImage(
  serializedImage: File | BinaryFile,
  options: BmpReadImageOptions = {}
) : Promise<BmpReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

BmpReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

BmpReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

bmpWriteImage

Write an itk-wasm file format converted to an image file format

async function bmpWriteImage(
  image: Image,
  serializedImage: string,
  options: BmpWriteImageOptions = {}
) : Promise<BmpWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

BmpWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

BmpWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

fdfReadImage

Read an image file format and convert it to the itk-wasm file format

async function fdfReadImage(
  serializedImage: File | BinaryFile,
  options: FdfReadImageOptions = {}
) : Promise<FdfReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

FdfReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

FdfReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

fdfWriteImage

Write an itk-wasm file format converted to an image file format

async function fdfWriteImage(
  image: Image,
  serializedImage: string,
  options: FdfWriteImageOptions = {}
) : Promise<FdfWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

FdfWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

FdfWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

gdcmReadImage

Read an image file format and convert it to the itk-wasm file format

async function gdcmReadImage(
  serializedImage: File | BinaryFile,
  options: GdcmReadImageOptions = {}
) : Promise<GdcmReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

GdcmReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

GdcmReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

gdcmWriteImage

Write an itk-wasm file format converted to an image file format

async function gdcmWriteImage(
  image: Image,
  serializedImage: string,
  options: GdcmWriteImageOptions = {}
) : Promise<GdcmWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

GdcmWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

GdcmWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

geAdwReadImage

Read an image file format and convert it to the itk-wasm file format

async function geAdwReadImage(
  serializedImage: File | BinaryFile,
  options: GeAdwReadImageOptions = {}
) : Promise<GeAdwReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

GeAdwReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

GeAdwReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

geAdwWriteImage

Write an itk-wasm file format converted to an image file format

async function geAdwWriteImage(
  image: Image,
  serializedImage: string,
  options: GeAdwWriteImageOptions = {}
) : Promise<GeAdwWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

GeAdwWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

GeAdwWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

ge4ReadImage

Read an image file format and convert it to the itk-wasm file format

async function ge4ReadImage(
  serializedImage: File | BinaryFile,
  options: Ge4ReadImageOptions = {}
) : Promise<Ge4ReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

Ge4ReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

Ge4ReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

ge4WriteImage

Write an itk-wasm file format converted to an image file format

async function ge4WriteImage(
  image: Image,
  serializedImage: string,
  options: Ge4WriteImageOptions = {}
) : Promise<Ge4WriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

Ge4WriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

Ge4WriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

ge5ReadImage

Read an image file format and convert it to the itk-wasm file format

async function ge5ReadImage(
  serializedImage: File | BinaryFile,
  options: Ge5ReadImageOptions = {}
) : Promise<Ge5ReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

Ge5ReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

Ge5ReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

ge5WriteImage

Write an itk-wasm file format converted to an image file format

async function ge5WriteImage(
  image: Image,
  serializedImage: string,
  options: Ge5WriteImageOptions = {}
) : Promise<Ge5WriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

Ge5WriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

Ge5WriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

giplReadImage

Read an image file format and convert it to the itk-wasm file format

async function giplReadImage(
  serializedImage: File | BinaryFile,
  options: GiplReadImageOptions = {}
) : Promise<GiplReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

GiplReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

GiplReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

giplWriteImage

Write an itk-wasm file format converted to an image file format

async function giplWriteImage(
  image: Image,
  serializedImage: string,
  options: GiplWriteImageOptions = {}
) : Promise<GiplWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

GiplWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

GiplWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

hdf5ReadImage

Read an image file format and convert it to the itk-wasm file format

async function hdf5ReadImage(
  serializedImage: File | BinaryFile,
  options: Hdf5ReadImageOptions = {}
) : Promise<Hdf5ReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

Hdf5ReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

Hdf5ReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

hdf5WriteImage

Write an itk-wasm file format converted to an image file format

async function hdf5WriteImage(
  image: Image,
  serializedImage: string,
  options: Hdf5WriteImageOptions = {}
) : Promise<Hdf5WriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

Hdf5WriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

Hdf5WriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

jpegReadImage

Read an image file format and convert it to the itk-wasm file format

async function jpegReadImage(
  serializedImage: File | BinaryFile,
  options: JpegReadImageOptions = {}
) : Promise<JpegReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

JpegReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

JpegReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

jpegWriteImage

Write an itk-wasm file format converted to an image file format

async function jpegWriteImage(
  image: Image,
  serializedImage: string,
  options: JpegWriteImageOptions = {}
) : Promise<JpegWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

JpegWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

JpegWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

lsmReadImage

Read an image file format and convert it to the itk-wasm file format

async function lsmReadImage(
  serializedImage: File | BinaryFile,
  options: LsmReadImageOptions = {}
) : Promise<LsmReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

LsmReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

LsmReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

lsmWriteImage

Write an itk-wasm file format converted to an image file format

async function lsmWriteImage(
  image: Image,
  serializedImage: string,
  options: LsmWriteImageOptions = {}
) : Promise<LsmWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

LsmWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

LsmWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

metaReadImage

Read an image file format and convert it to the itk-wasm file format

async function metaReadImage(
  serializedImage: File | BinaryFile,
  options: MetaReadImageOptions = {}
) : Promise<MetaReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

MetaReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

MetaReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

metaWriteImage

Write an itk-wasm file format converted to an image file format

async function metaWriteImage(
  image: Image,
  serializedImage: string,
  options: MetaWriteImageOptions = {}
) : Promise<MetaWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

MetaWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

MetaWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input could be written. If false, the output image is not valid.
serializedImage BinaryFile Output image serialized in the file format.
webWorker Worker WebWorker used for computation.

mghReadImage

Read an image file format and convert it to the itk-wasm file format

async function mghReadImage(
  serializedImage: File | BinaryFile,
  options: MghReadImageOptions = {}
) : Promise<MghReadImageResult>
Parameter Type Description
serializedImage *File BinaryFile* Input image serialized in the file format

MghReadImageOptions interface:

Property Type Description
informationOnly boolean Only read image metadata -- do not read pixel data.
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

MghReadImageResult interface:

Property Type Description
couldRead JsonCompatible Whether the input could be read. If false, the output image is not valid.
image Image Output image
webWorker Worker WebWorker used for computation.

mghWriteImage

Write an itk-wasm file format converted to an image file format

async function mghWriteImage(
  image: Image,
  serializedImage: string,
  options: MghWriteImageOptions = {}
) : Promise<MghWriteImageResult>
Parameter Type Description
image Image Input image
serializedImage string Output image serialized in the file format.

MghWriteImageOptions interface:

Property Type Description
informationOnly boolean Only write image metadata -- do not write pixel data.
useCompression boolean Use compression in the written file
webWorker null or Worker or boolean WebWorker for computation. Set to null to create a new worker. Or, pass an existing worker. Or, set to false to run in the current thread / worker.
noCopy boolean When SharedArrayBuffer's are not available, do not copy inputs.

MghWriteImageResult interface:

Property Type Description
couldWrite JsonCompatible Whether the input