Skip to main content

Function: getClosestImageId()

getClosestImageId(imageVolume, worldPos, viewPlaneNormal, options?): string | undefined

Given an image volume, a point in world space, and the view plane normal, it returns the closest imageId based on the specified options. If options.ignoreSpacing is true, it returns the imageId with the minimum distance along the view plane normal, regardless of voxel spacing. Otherwise, it returns the closest imageId within half voxel spacing along the normal.

Parameters

imageVolume: ImageVolume | object

The image volume or object containing direction, spacing, and imageIds.

worldPos: Point3

The position in the world coordinate system.

viewPlaneNormal: Point3

The normal vector of the viewport.

options?

Options object.

options.ignoreSpacing?: boolean

If true, ignore spacing and find the absolute closest imageId.

Returns

string | undefined

The closest imageId based on the criteria, or undefined if none found.

Defined in

packages/core/src/utilities/getClosestImageId.ts:24