Retrieving numpy array of an instance using lua

Hi,

The image_response is actually a sequence of bytes even if lua says it is a string. To include a sequence of bytes into a json payload, you must encode it in base64.

An alternative is to modify your Fast API to receive the sequence of bytes with the numpy array as the payload and get the instance_id in the API route. That would give something like this (disclaimer: not tested)

function OnStoredInstance(instanceId, tags, metadata, origin)
local numpy = RestApiGet(‘/instances/’ … instanceId … ‘/numpy’)

local response = HttpPost(“http://127.0.0.1:5000/orthanc/” … instanceId, numpy)

print(“Response” …response)
end