ReceivedInstanceFilter() write file

Hello All,

Is there a way to write incoming dicom file to a temporary folder when it does not meet certain criteria?

The following example shows how to inspect incoming dicom tags but I don’t know how to write incoming dicom file to a temp disk space when not accepting in Orthanc.

function ReceivedInstanceFilter(dicom, origin, info)
– Only allow incoming MR images
if dicom.Modality == ‘CT’ then
return true
else
return false
end
end

Thanks,
Ric

Hello,

The “ReceivedInstanceFilter()” does not provide access to the raw DICOM file (only to a JSON-like summary of it).

You could implement this by external script (e.g. in Python) that monitors the “/change” URI in the REST API and that calls DELETE on “/instances/{…}”:
https://book.orthanc-server.com/users/rest.html

You could also implement this by a server-side Python script, which is much more expressive than Lua (look for “orthanc.ChangeType.NEW_INSTANCE”):
https://book.orthanc-server.com/plugins/python.html

Sébastien-