5.4.0 • Published 9 months ago
@itk-wasm/compare-images v5.4.0
@itk-wasm/compare-images
Compare images with a tolerance for regression testing.
Installation
npm install @itk-wasm/compare-imagesUsage
Browser interface
Import:
import {
compareImages,
setPipelinesBaseUrl,
getPipelinesBaseUrl,
} from "@itk-wasm/compare-images"compareImages
Compare images with a tolerance for regression testing.
async function compareImages(
testImage: Image,
options: CompareImagesOptions = { baselineImages: [] as Image[], }
) : Promise<CompareImagesResult>| Parameter | Type | Description |
|---|---|---|
testImage | Image | The input test image |
CompareImagesOptions interface:
| Property | Type | Description |
|---|---|---|
baselineImages | Image[] | Baseline images compare against |
differenceThreshold | number | Intensity difference for pixels to be considered different. |
radiusTolerance | number | Radius of the neighborhood around a pixel to search for similar intensity values. |
numberOfPixelsTolerance | number | Number of pixels that can be different before the test fails. |
ignoreBoundaryPixels | boolean | Ignore boundary pixels. Useful when resampling may have introduced difference pixel values along the image edge. |
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. |
CompareImagesResult interface:
| Property | Type | Description |
|---|---|---|
metrics | JsonCompatible | Metrics for the baseline with the fewest number of pixels outside the tolerances. |
differenceImage | Image | Absolute difference image |
differenceUchar2dImage | Image | Unsigned char, 2D difference image for rendering |
webWorker | Worker | WebWorker used for computation. |
setPipelinesBaseUrl
Set base URL for WebAssembly assets when vendored.
function setPipelinesBaseUrl(
baseUrl: string | URL
) : voidgetPipelinesBaseUrl
Get base URL for WebAssembly assets when vendored.
function getPipelinesBaseUrl() : string | URLNode interface
Import:
import {
compareImagesNode,
} from "@itk-wasm/compare-images"compareImagesNode
Compare images with a tolerance for regression testing.
async function compareImagesNode(
testImage: Image,
options: CompareImagesOptions = { baselineImages: [] as Image[], }
) : Promise<CompareImagesNodeResult>| Parameter | Type | Description |
|---|---|---|
testImage | Image | The input test image |
CompareImagesNodeOptions interface:
| Property | Type | Description |
|---|---|---|
baselineImages | Image[] | Baseline images compare against |
differenceThreshold | number | Intensity difference for pixels to be considered different. |
radiusTolerance | number | Radius of the neighborhood around a pixel to search for similar intensity values. |
numberOfPixelsTolerance | number | Number of pixels that can be different before the test fails. |
ignoreBoundaryPixels | boolean | Ignore boundary pixels. Useful when resampling may have introduced difference pixel values along the image edge. |
CompareImagesNodeResult interface:
| Property | Type | Description |
|---|---|---|
metrics | JsonCompatible | Metrics for the baseline with the fewest number of pixels outside the tolerances. |
differenceImage | Image | Absolute difference image |
differenceUchar2dImage | Image | Unsigned char, 2D difference image for rendering |
5.4.0
9 months ago
5.3.1
10 months ago
5.3.0
10 months ago
5.2.3
1 year ago
5.2.2
1 year ago
5.2.1
1 year ago
5.2.0
1 year ago
5.1.1
1 year ago
5.1.0
1 year ago
5.0.2
2 years ago
5.0.1
2 years ago
5.0.0
2 years ago
4.0.2
2 years ago
4.0.1
2 years ago
4.0.0
2 years ago
3.0.1
2 years ago
3.0.0
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago