🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@itk-wasm/downsample

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@itk-wasm/downsample

Pipelines for downsampling images.

1.6.0
Source
npm
Version published
Maintainers
0
Created
Source

@itk-wasm/downsample

npm version

Pipelines for downsampling images.

💻 Live API Demo

🕮 Documentation 📚

Installation

npm install @itk-wasm/downsample

Usage

Browser interface

Import:

import {
  downsampleBinShrink,
  downsampleLabelImage,
  downsampleSigma,
  downsample,
  gaussianKernelRadius,
  setPipelinesBaseUrl,
  getPipelinesBaseUrl,
} from "@itk-wasm/downsample"

downsampleBinShrink

Apply local averaging and subsample the input image.

async function downsampleBinShrink(
  input: Image,
  options: DownsampleBinShrinkOptions = { shrinkFactors: [] as number[], }
) : Promise<DownsampleBinShrinkResult>
ParameterTypeDescription
inputImageInput image

DownsampleBinShrinkOptions interface:

PropertyTypeDescription
shrinkFactorsnumber[]Shrink factors
informationOnlybooleanGenerate output image information only. Do not process pixels.
webWorkernull or Worker or booleanWebWorker 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.
noCopybooleanWhen SharedArrayBuffer's are not available, do not copy inputs.

DownsampleBinShrinkResult interface:

PropertyTypeDescription
downsampledImageOutput downsampled image
webWorkerWorkerWebWorker used for computation.

downsampleLabelImage

Apply a smoothing anti-alias filter and subsample the input image.

async function downsampleLabelImage(
  input: Image,
  options: DownsampleLabelImageOptions = { shrinkFactors: [] as number[], }
) : Promise<DownsampleLabelImageResult>
ParameterTypeDescription
inputImageInput image

DownsampleLabelImageOptions interface:

PropertyTypeDescription
shrinkFactorsnumber[]Shrink factors
cropRadiusnumber[]Optional crop radius in pixel units.
webWorkernull or Worker or booleanWebWorker 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.
noCopybooleanWhen SharedArrayBuffer's are not available, do not copy inputs.

DownsampleLabelImageResult interface:

PropertyTypeDescription
downsampledImageOutput downsampled image
webWorkerWorkerWebWorker used for computation.

downsampleSigma

Compute gaussian kernel sigma values in pixel units for downsampling.

async function downsampleSigma(
  options: DownsampleSigmaOptions = { shrinkFactors: [] as number[], }
) : Promise<DownsampleSigmaResult>
ParameterTypeDescription

DownsampleSigmaOptions interface:

PropertyTypeDescription
shrinkFactorsnumber[]Shrink factors
webWorkernull or Worker or booleanWebWorker 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.
noCopybooleanWhen SharedArrayBuffer's are not available, do not copy inputs.

DownsampleSigmaResult interface:

PropertyTypeDescription
sigmaJsonCompatibleOutput sigmas in pixel units.
webWorkerWorkerWebWorker used for computation.

downsample

Apply a smoothing anti-alias filter and subsample the input image.

async function downsample(
  input: Image,
  options: DownsampleOptions = { shrinkFactors: [] as number[], }
) : Promise<DownsampleResult>
ParameterTypeDescription
inputImageInput image

DownsampleOptions interface:

PropertyTypeDescription
shrinkFactorsnumber[]Shrink factors
cropRadiusnumber[]Optional crop radius in pixel units.
webWorkernull or Worker or booleanWebWorker 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.
noCopybooleanWhen SharedArrayBuffer's are not available, do not copy inputs.

DownsampleResult interface:

PropertyTypeDescription
downsampledImageOutput downsampled image
webWorkerWorkerWebWorker used for computation.

gaussianKernelRadius

Radius in pixels required for effective discrete gaussian filtering.

async function gaussianKernelRadius(
  options: GaussianKernelRadiusOptions = { size: [] as number[], sigma: [{}, ], }
) : Promise<GaussianKernelRadiusResult>
ParameterTypeDescription

GaussianKernelRadiusOptions interface:

PropertyTypeDescription
sizenumber[]Size in pixels
sigmanumber[]Sigma in pixel units
maxKernelWidthnumberMaximum kernel width in pixels.
maxKernelErrornumberMaximum kernel error.
webWorkernull or Worker or booleanWebWorker 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.
noCopybooleanWhen SharedArrayBuffer's are not available, do not copy inputs.

GaussianKernelRadiusResult interface:

PropertyTypeDescription
radiusJsonCompatibleOutput kernel radius.
webWorkerWorkerWebWorker used for computation.

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

Node interface

Import:

import {
  downsampleBinShrinkNode,
  downsampleLabelImageNode,
  downsampleSigmaNode,
  downsampleNode,
  gaussianKernelRadiusNode,
} from "@itk-wasm/downsample"

downsampleBinShrinkNode

Apply local averaging and subsample the input image.

async function downsampleBinShrinkNode(
  input: Image,
  options: DownsampleBinShrinkNodeOptions = { shrinkFactors: [] as number[], }
) : Promise<DownsampleBinShrinkNodeResult>
ParameterTypeDescription
inputImageInput image

DownsampleBinShrinkNodeOptions interface:

PropertyTypeDescription
shrinkFactorsnumber[]Shrink factors
informationOnlybooleanGenerate output image information only. Do not process pixels.

DownsampleBinShrinkNodeResult interface:

PropertyTypeDescription
downsampledImageOutput downsampled image

downsampleLabelImageNode

Apply a smoothing anti-alias filter and subsample the input image.

async function downsampleLabelImageNode(
  input: Image,
  options: DownsampleLabelImageNodeOptions = { shrinkFactors: [] as number[], }
) : Promise<DownsampleLabelImageNodeResult>
ParameterTypeDescription
inputImageInput image

DownsampleLabelImageNodeOptions interface:

PropertyTypeDescription
shrinkFactorsnumber[]Shrink factors
cropRadiusnumber[]Optional crop radius in pixel units.

DownsampleLabelImageNodeResult interface:

PropertyTypeDescription
downsampledImageOutput downsampled image

downsampleSigmaNode

Compute gaussian kernel sigma values in pixel units for downsampling.

async function downsampleSigmaNode(
  options: DownsampleSigmaNodeOptions = { shrinkFactors: [] as number[], }
) : Promise<DownsampleSigmaNodeResult>
ParameterTypeDescription

DownsampleSigmaNodeOptions interface:

PropertyTypeDescription
shrinkFactorsnumber[]Shrink factors

DownsampleSigmaNodeResult interface:

PropertyTypeDescription
sigmaJsonCompatibleOutput sigmas in pixel units.

downsampleNode

Apply a smoothing anti-alias filter and subsample the input image.

async function downsampleNode(
  input: Image,
  options: DownsampleNodeOptions = { shrinkFactors: [] as number[], }
) : Promise<DownsampleNodeResult>
ParameterTypeDescription
inputImageInput image

DownsampleNodeOptions interface:

PropertyTypeDescription
shrinkFactorsnumber[]Shrink factors
cropRadiusnumber[]Optional crop radius in pixel units.

DownsampleNodeResult interface:

PropertyTypeDescription
downsampledImageOutput downsampled image

gaussianKernelRadiusNode

Radius in pixels required for effective discrete gaussian filtering.

async function gaussianKernelRadiusNode(
  options: GaussianKernelRadiusNodeOptions = { size: [] as number[], sigma: [{}, ], }
) : Promise<GaussianKernelRadiusNodeResult>
ParameterTypeDescription

GaussianKernelRadiusNodeOptions interface:

PropertyTypeDescription
sizenumber[]Size in pixels
sigmanumber[]Sigma in pixel units
maxKernelWidthnumberMaximum kernel width in pixels.
maxKernelErrornumberMaximum kernel error.

GaussianKernelRadiusNodeResult interface:

PropertyTypeDescription
radiusJsonCompatibleOutput kernel radius.

Keywords

itk

FAQs

Package last updated on 24 Feb 2025

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