New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@itk-wasm/htj2k

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@itk-wasm/htj2k

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

latest
Source
npmnpm
Version
2.3.1
Version published
Maintainers
2
Created
Source

@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

Keywords

itk

FAQs

Package last updated on 11 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts