lua script assistance.

All,

I was hoping to get some assistance with my forward script. Just to provide a little background. I currently have three Orthanc servers running, all are setup as simple DICOM routers. I recently built one on newer and more powerful architecture and I want to consolidate all three of these older servers into the ONE new server. However, my roadblock is that each of them have different forward scripts.

Here’s what I am hoping to accomplish:

  1. I would like my SR to go to three locations (Location 1, Location 2, and Location 3).
  2. I would like my Mammos to go to Locations (Location 4 Location 5, and Location 6).
  3. I would like the individual series of CT exams (Series 1, 2, 501, and 502) to go to Location 1 as well. Additionally, for the CTs, I only want those three series and nothing else, the rest can be purged out.
    I would like it so that a MG never ends up on Locations 1-3, or the remnants of the CT go to Location 4.

Please forgive my scripting, alas I am a noob, but I am actively learning to get better. I am sure I can accomplish the above in a few lines. But, this is what I need help with. The most effective way to accomplish this. See below.

Any assistance is greatly appreciated.

function OnStoredInstance(instanceId, tags, metadata, origin)
if tags[‘Modality’] == ‘SR’ then
SendToModality(instanceId, ‘Location1’)
SendToModality(instanceId, ‘Location2’)
SendToModality(instanceId, ‘Location3’)

end

if tags[‘Modality’] == ‘MG’ then
SendToModality(instanceId, ‘Location4’)
SendToModality(instanceId, ‘Location5’)
SendToModality(instanceId, ‘Location6’)

end

if tags[‘SeriesDescription’] == ‘Patient Protocol’ then
SendToModality(instanceId, ‘Location1’)

end

if tags[‘Modality’] == “CT” then
if tags[‘SeriesNumber’] == ‘1’ then
SendToModality(instanceId, ‘Location1’)

end

if tags[‘SeriesNumber’] == ‘2’ then
SendToModality(instanceId, ‘Location1’)

end
end

I think this is what you want. Just copy the CT and series code for each series you want. There are fancier ways to do it but this is probably the easiest for you to use and remember going foward.

function OnStoredInstance(instanceId, tags, metadata, origin)
if tags[‘Modality’] == ‘SR’ then
SendToModality(instanceId, ‘Location1’)
SendToModality(instanceId, ‘Location2’)
SendToModality(instanceId, ‘Location3’)
end

if tags[‘Modality’] == ‘MG’ then
SendToModality(instanceId, ‘Location4’)
SendToModality(instanceId, ‘Location5’)
SendToModality(instanceId, ‘Location6’)
end

if tags[‘Modality’] == “CT” and tags[‘SeriesNumber’] == ‘1’ then
SendToModality(instanceId, ‘Location1’)
end

if tags[‘Modality’] == “CT” and tags[‘SeriesNumber’] == ‘2’ then
SendToModality(instanceId, ‘Location1’)
end
end

Thanks Bryan. I will give this a shot!