2.1.0 • Published 6 months ago

@itk-wasm/htj2k v2.1.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

@itk-wasm/htj2k

npm version

Wasm-SIMD accelerated decoding and encoding of High-throughput JPEG2000 (HTJ2K) images.

👨‍💻 Live API Demo

🕮 Documentation 📚

Installation

npm install @itk-wasm/htj2k

Usage

Browser interface

Import:

import {
  decode,
  encode,
  setPipelinesBaseUrl,
  getPipelinesBaseUrl,
  setPipelineWorkerUrl,
  getPipelineWorkerUrl,
} from "@itk-wasm/htj2k"

decode

Decode a High Throughput JPEG2000 codestream and generate an ITK Image

async function decode(
  webWorker: null | Worker,
  codestream: Uint8Array,
  options: DecodeOptions = {}
) : Promise<DecodeResult>
ParameterTypeDescription
codestreamUint8ArrayInput HTJ2K codestream

DecodeOptions interface:

PropertyTypeDescription
decompositionLevelnumberDecomposition level to decode. 0 is the highest resolution.
informationOnlybooleanOnly read metadata for the image but do not decode the pixel data.

DecodeResult interface:

PropertyTypeDescription
webWorkerWorkerWebWorker used for computation
imageImageOutput image

encode

Encode an ITK Image into a High Throughput JPEG2000 codestream

async function encode(
  webWorker: null | Worker,
  image: Image,
  options: EncodeOptions = {}
) : Promise<EncodeResult>
ParameterTypeDescription
imageImageInput image

EncodeOptions interface:

PropertyTypeDescription
decompositionsnumberNumber of wavelet decompositions
notReversiblebooleanLossy and not reversible, i.e. not lossless, encoding
quantizationStepnumberQuantization step size for lossy compression. Ignored unless not reversible is enabled.
progressionOrdernumberProgression order. 0 = LRCP, 1 = RLCP, 2 = RPCL, 3 = PCRL, 4 = CPRL
tileSizenumber[]Tile size
tileOffsetnumber[]Tile offset
blockDimensionsnumber[]Block dimensions

EncodeResult interface:

PropertyTypeDescription
webWorkerWorkerWebWorker used for computation
outputUint8ArrayOutput binary HTJ2K codestream

setPipelinesBaseUrl

Set base URL for WebAssembly assets when vendored.

function setPipelinesBaseUrl(
  baseUrl: string | URL
) : void

getPipelinesBaseUrl

Get base URL for WebAssembly assets when vendored.

function getPipelinesBaseUrl() : string | URL

setPipelineWorkerUrl

Set base URL for the itk-wasm pipeline worker script when vendored.

function setPipelineWorkerUrl(
  baseUrl: string | URL
) : void

getPipelineWorkerUrl

Get base URL for the itk-wasm pipeline worker script when vendored.

function getPipelineWorkerUrl() : string | URL

Node interface

Import:

import {
  decodeNode,
  encodeNode,
  setPipelinesBaseUrl,
  getPipelinesBaseUrl,
  setPipelineWorkerUrl,
  getPipelineWorkerUrl,
} from "@itk-wasm/htj2k"

decodeNode

Decode a High Throughput JPEG2000 codestream and generate an ITK Image

async function decodeNode(
  codestream: Uint8Array,
  options: DecodeOptions = {}
) : Promise<DecodeNodeResult>
ParameterTypeDescription
codestreamUint8ArrayInput HTJ2K codestream

DecodeNodeOptions interface:

PropertyTypeDescription
decompositionLevelnumberDecomposition level to decode. 0 is the highest resolution.
informationOnlybooleanOnly read metadata for the image but do not decode the pixel data.

DecodeNodeResult interface:

PropertyTypeDescription
imageImageOutput image

encodeNode

Encode an ITK Image into a High Throughput JPEG2000 codestream

async function encodeNode(
  image: Image,
  options: EncodeOptions = {}
) : Promise<EncodeNodeResult>
ParameterTypeDescription
imageImageInput image

EncodeNodeOptions interface:

PropertyTypeDescription
decompositionsnumberNumber of wavelet decompositions
notReversiblebooleanLossy and not reversible, i.e. not lossless, encoding
quantizationStepnumberQuantization step size for lossy compression. Ignored unless not reversible is enabled.
progressionOrdernumberProgression order. 0 = LRCP, 1 = RLCP, 2 = RPCL, 3 = PCRL, 4 = CPRL
tileSizenumber[]Tile size
tileOffsetnumber[]Tile offset
blockDimensionsnumber[]Block dimensions

EncodeNodeResult interface:

PropertyTypeDescription
outputUint8ArrayOutput binary HTJ2K codestream
2.1.0

6 months ago

2.0.0

6 months ago

1.1.4

7 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.0

9 months ago