view Database/Lua/AutoroutingConditional.lua @ 660:2f6686a3cd16 default tip

conditional test
author Alain Mazy <am@orthanc.team>
date Mon, 24 Jun 2024 18:32:13 +0200
parents 525a2f57ec94
children
line wrap: on
line source

function OnStoredInstance(instanceId, tags, metadata, origin)
   -- The "origin" is only available since Orthanc 0.9.4
   PrintRecursive(origin)

   -- Extract the value of the "PatientName" DICOM tag
   local patientName = string.lower(tags['PatientName'])

   if string.find(patientName, 'knee') ~= nil then
      -- Only send patients whose name contains "Knee"
      Delete(SendToModality(instanceId, 'orthanctest'))

   else
      -- Delete the patients that are not called "Knee"
      Delete(instanceId)
   end
end