Skip to main content

Function: formatInteractivePayload()

formatInteractivePayload(input, image, mask?): FormData

Defined in: src/formatting/interactive.ts:51

Formats interactive segmentation request data into multipart/form-data.

Parameters

input

TInteractiveImeasureInput

Interactive metadata and click history.

image

Int16Array

Cropped CT voxel data as Int16Array, flattened in x-fastest (Fortran/column-major) order.

mask?

Uint8Array

Optional previous-step cropped binary mask (0/1) aligned to the same crop and shape as image.

Returns

FormData

FormData containing metadata, image, and optional mask.

Remarks

For refinements, passing the previous mask improves stability and helps preserve previous intent.

Example

const payload = formatInteractivePayload(
{
id,
clicks: interactionHistory,
...worldMeta,
...cropMeta,
},
croppedImageInt16,
previousMaskBinary
);