1.4.3 • Published 8 months ago

@itk-wasm/downsample v1.4.3

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

@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.
1.4.3

8 months ago

1.4.2

9 months ago

1.4.1

10 months ago

1.4.0

10 months ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago