UNPKG

@itk-wasm/image-io

Version:

Input and output for scientific and medical image file formats.

779 lines (595 loc) 179 kB
# @itk-wasm/image-io [![npm version](https://badge.fury.io/js/@itk-wasm%2Fimage-io.svg)](https://www.npmjs.com/package/@itk-wasm/image-io) > Input and output for scientific and medical image file formats. [💻 **Live API Demo** ✨](https://insightsoftwareconsortium.github.io/ITK-Wasm/image-io/ts/app/ ':include :type=iframe width=100% height=800px') [🕮 **Documentation** 📚](https://insightsoftwareconsortium.github.io/ITK-Wasm/image-io/ts/docs/) ## Installation ```sh npm install @itk-wasm/image-io ``` ## Usage ### Browser interface Import: ```js 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.* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts 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* ```ts async function jpegWriteImage( image: Image, serializedImage: string, options: JpegWriteImageOptions = {} ) : Promise<JpegWriteImageResult> ``` | Parameter | Type | Description | | :---------------: | :------: | :------------------------------------------ | | `image` | *Image* | Input image |