Hi there!
We use Orthanc 1.9.1 to route studies from a fleet of mobile US and XR techs to a central location, and then on to various destinations.
Basically, each modality talks to a local (laptop/tablet) instance of Orthanc. The mobile instance uses a LUA script with five pre-established destinations based on a string in the SCP AE title called by the modality. The mobile Orthanc auto-routes using a peer-to-peer connection over cellular back to the central Orthanc server, which auto-routes the studies to the corresponding path of the five options via DICOM. This process works without issue.
In one particular case, the technicians need to send studies to two different destinations, let’s call them A and B. Originally I was auto-routing those with the central Orthanc server in the LUA script. But destination A will only accept J2K, and destination B cannot handle J2K. Right now we’re using the modality’s settings to send them twice, uncompressed for destination A (which is transcoded to J2K by the mobile Orthanc), and JPEG compressed for destination B (which is passed on as-is.)
What I want to do is be able to receive the J2K-encoded study at the central Orthanc server, and forward it on to destination A as-is, but transcode it to either JPEG or uncompressed for destination B.
I believe from what I’ve read that it would be possible to either adjust the config.json to make the specific DICOM server always send uncompressed, or put a REST API command in the LUA to transcode the study and then send that. I haven’t been able to figure out the exact syntax to do either of these things.
– LUA Auto-routing script for Central Orthanc Server
function OnStoredInstance(instanceId, tags, metadata, origin)
print('*—Routing instanceId: ', instanceId)
if origin[‘Username’] ~= nil then
– Extract the value of the “Username” tag
local UserNameVar = string.upper(origin[‘Username’])
– print(UserNameVar)
if string.find(UserNameVar, ‘_DCM1’) ~= nil then
– Send *_DCM1 studies to DestinationA.
– print(‘UserNameVar includes _DCM1’)
SendToModality(instanceId, ‘Destination_A’)
print(‘P2P-’, UserNameVar, ’ - Fwd>DestinationA.')
end
if string.find(UserNameVar, ‘_DCM2’) ~= nil then
– Send *_DCM2 studies to both DestinationB and DestinationA.
– print(‘UserNameVar includes _DCM2’)
SendToModality(instanceId, ‘DestinationB’)
SendToModality(instanceId, ‘Destination_A’)
print(‘P2P-’, UserNameVar, ’ - Fwd>DestinationA, Fwd>DestinationB.')
end
if string.find(UserNameVar, ‘_DCM3’) ~= nil then
– Send *_DCM3 studies to Destination_C.
– print(‘UserNameVar includes _DCM3’)
SendToModality(instanceId, ‘Destination_C’)
print(‘P2P-’, UserNameVar, ’ - Fwd>DestinationC.')
end
– if string.find(UserNameVar, ‘_DCM4’) ~= nil then
– – Send *_DCM4 studies to XXXDestination4.
– print(‘UserNameVar includes _DCM4’)
– SendToModality(instanceId, ‘XXXDestination4’)
– print(‘P2P-’, UserNameVar, ’ - Fwd>??.')
– end
if string.find(UserNameVar, ‘_DCM5’) ~= nil then
– Send *_DCM5 studies to Destination_E.
– print(‘UserNameVar includes _DCM5’)
SendToModality(instanceId, ‘Destination_E’)
print(‘P2P-’, UserNameVar, ’ - Fwd>DestinationE.')
end
– print(‘Username DICOM Routing End’)
end
if origin[‘CalledAet’] ~= nil then
– Skip processing rules if CalledAet is nil.
local CalledAETVar = string.upper(origin[‘CalledAet’])
– Extract the value of the “CalledAet” DICOM tag
– print(CalledAETVar)
if string.find(CalledAETVar, ‘_DCM1’) ~= nil then
– Send *_DCM1 studies to DestinationA.
– print(‘CalledAETVar includes _DCM1’)
SendToModality(instanceId, ‘Destination_A’)
print(‘DICOM-’, CalledAETVar, ’ - Fwd>DestinationA.')
end
if string.find(CalledAETVar, ‘_DCM2’) ~= nil then
– Send *_DCM2 studies to both DestinationB and DestinationA.
– print(‘CalledAETVar includes _DCM2’)
SendToModality(instanceId, ‘DestinationB’)
SendToModality(instanceId, ‘Destination_A’)
print(‘DICOM-’, CalledAETVar, ’ - Fwd>DestinationA, Fwd>DestinationB.')
end
if string.find(CalledAETVar, ‘_DCM3’) ~= nil then
– Send *_DCM3 studies to Destination_C.
– print(‘CalledAETVar includes _DCM3’)
SendToModality(instanceId, ‘Destination_C’)
print(‘DICOM-’, CalledAETVar, ’ - Fwd>DestinationC.')
end
– if string.find(CalledAETVar, ‘_DCM4’) ~= nil then
– – Send *_DCM4 studies to XXXDestination4.
– print(‘CalledAETVar includes _DCM4’)
– SendToModality(instanceId, ‘XXXDestination4’)
– print(‘DICOM-’, CalledAETVar, ’ - Fwd>??.')
– end
if string.find(CalledAETVar, ‘_DCM5’) ~= nil then
– Send *_DCM5 studies to Destination_E.
– print(‘CalledAETVar includes _DCM5’)
SendToModality(instanceId, ‘Destination_E’)
print(‘DICOM-’, CalledAETVar, ’ - Fwd>DestinationE.')
end
– print(‘AETitle DICOM Routing End’)
end
– This Delete is to keep Orthanc clean. Uncomment when not testing.
Delete(instanceId)
print(‘Done —*’)
end