API Reference#
Vista3d NIM provides following API endpoints:
GET
: /v1/health/live - Check if service is alive (might not be ready yet)GET
: /v1/health/ready - Check if service is ready and model is ready for inferenceGET
: /v1/license - Return the license for the NIMGET
: /v1/vista3d/info - Fetch detailed information about the model such as version and labelsPOST
: /v1/vista3d/inference - Run Inference function of a model for segmenting and annotating human anatomies
Inference Request Payload#
The inference request payload is defined as follows:
"image"
: This field requires a valid URL that points to a 3D medical image in either NIfTI or NRRD format. The URL should be accessible and correctly formatted to ensure the image can be retrieved for processing. For example, a valid URL might look like:
https://assets.ngc.nvidia.com/products/api-catalog/vista3d/example-1.nii.gz
"Prompts
: This optional field allows users to provide specific prompts for running interactive annotation. The prompts are given in the form of a dictionary with two possible keys:"classes"
: A list of label names or indices that serve as class prompts. This list can contain strings (e.g., [“spleen”, “liver”]) or integers (e.g., [3, 1])."points"
: A dictionary where the keys are label names or indices, and the values are lists of tuples representing user click points. Each tuple contains three integers corresponding to the coordinates(x, y, z)
of a point. For example,{"spleen": [(123, 212, 151), (123, 212, 152)]}
.
"local_working_dir"
: This optional field allows users to provide a mounted volume for saving inference results. If the directory is/path/on/host/results/
, then in the inference request payload,local_working_dir
should be/path/in/container/results/
.
Here is an example of a complete payload:
{
"image": "https://assets.ngc.nvidia.com/products/api-catalog/vista3d/example-1.nii.gz",
"prompts": {"classes": ["spleen"], "points": {"spleen": [[123, 212, 151], [123, 212, 152]]}},
"local_working_dir": "/path/in/container/results/"
}
Inference Example#
To perform an inference request using the defined payload, you can use the following Python code:
import requests
base_url = 'http://localhost:8000/v1'
data = {
"image": "https://assets.ngc.nvidia.com/products/api-catalog/vista3d/example-1.nii.gz",
"prompts": {
"classes": ["spleen"],
"points": {"spleen": [(123, 212, 151), (123, 212, 152)]}
}
}
response = requests.post(f"{base_url}/vista3d/inference", json=data)
Please refer to getting-started.md for more examples.