I am looking for a way to setup an existing Orthanc instance to auto-route incoming Dicom studies from modalities connected to it, based on “institutionName”, for example, and COPY, not delete the studies to other modalities connected to it.
I have the example from docs:
function OnStoredInstance(instanceId, tags, metadata) – Extract the value of the “PatientName” DICOM tag local patientName = string.lower(tags[‘PatientName’]) if string.find(patientName, ‘david’) ~= nil then – Only route patients whose name contains “David” Delete(SendToModality(instanceId, ‘sample’)) else – Delete the patients that are not called “David” Delete(instanceId) end end
But it extracts the patient name, not the institute name, has only one condition (I want it to decide to what modality to send the study to) and it also, it deletes the study from the server as it routes it to other modality.
Don’t hesitate to experiment lua scripting by yourself. The sample script you provided only requires minimal modifications.
function OnStoredInstance(instanceId, tags, metadata)
– Extract the value of the “PatientName” DICOM tag
local patientName = string.lower(tags[‘PatientName’])
if string.find(patientName, ‘david’) ~= nil then
– Only route patients whose name contains “David”
Delete(SendToModality(instanceId, ‘sample’))
else
– Delete the patients that are not called “David”
Delete(instanceId)
end
end
function OnStoredInstance(instanceId, tags, metadata)
– Extract the value of the “PatientName” DICOM tag
local institution = string.lower(tags[‘InstitutionName’])
if string.find(institution, ‘AAA’) ~= nil then
– Route instances for institution AAA
SendToModality(instanceId, ‘modality-a’)
elseif string.find(institution, ‘BBB’) ~= nil then
– Route instances for institution BBB
SendToModality(instanceId, ‘modality-b’)
else
– do nothing
end
end