Auto routing with OnStableStudy

345 views
Skip to first unread message

Jason McDonald

unread,
Oct 16, 2019, 11:28:09 AM10/16/19
to Orthanc Users
Hello,
    I've been using Orthanc as an auto-router to cloud storage as well as a local back-up for 4 years now. I would like to be able to route the incoming studies in one block instead of instance-by-instance. I have been trying to convert my existing auto-route Lua using onStableStudy instead of onStoredInstance but have not been successful. Also, I use the origin parameter for parsing certain studies and see that it isn't listed as a parameter in the onStoredInstance documentation (at least that I can find).



here is my current auto-routing code, if it helps:

function OnStoredInstance(instanceId, tags, metadata, origin)

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


  --Do not send out exams received from MIM (192.168.6.41)  
   if origin['RemoteIp'] ~= '192.168.6.41' then
     print('onStoredInstance function has been called')
     SendToModality(instanceId, '03-MIMCLOUD')
     print(patientName..' image sent to Mim')
     SendToModality(instanceId, '08-RADIUS')
     print(patientName..' image sent to Radius')
     SendToModality(instanceId, '09-MIM-CD')
     print(patientName..' image sent to Front Desk Archive')
   end
  

  --Only route CT SCANS to MEDICVISION 
 if origin['RemoteIp'] == '192.168.6.10' then
   print('CT scan found')
      SendToModality(instanceId, '13-MEDICVISION')
   print('CT image sent to MEDICVISION')
 end
  
  Thanks for any help!
Jason McDonald 

 
   print('SendToModality has been executed')
end

Alain Mazy

unread,
Oct 21, 2019, 3:01:24 AM10/21/19
to Jason McDonald, Orthanc Users
Hi,

I think there's no origin at the study level because multiple instances from the same study could originate from multiple sources (i.e a few series from the modality and a few series from the radiology workstation).

I would advise you to define a new metadata "my-origin".
In the OnStoredInstance, get the origin of the instance and attach it as the "my-origin" of the study.
In the OnStableStudy, read the "my-origin" metadata from the study to perform your auto-routing.

Best,

Alain

--
You received this message because you are subscribed to the Google Groups "Orthanc Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orthanc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orthanc-users/f1ec798f-9044-4a2a-836a-1a3df6385bd4%40googlegroups.com.


--

Alain Mazy / Software Developer
a...@osimis.io / +32 494 31 67 27

Osimis

OSIMIS S.A. 
Quai Banning 6BE-4000 Liège 
www.osimis.io

Twitter LinkedIn


Emil Pacurar

unread,
Apr 23, 2020, 8:26:16 PM4/23/20
to Orthanc Users
I was about to ask how to get the origin from OnStableStudy. I think this is the way to do it. Do you have a sample code doing this?
Also when you say "In the OnStoredInstance, get the origin of the instance and attach it as the "my-origin" of the study." this will insert the origin in the study for each dicom received. I think will be wise, if you know the whole study is received from one modality, to do this operation one time, at first dicom received from the study.
I need to know the origin of a study as I will do some processing on the study data then I need to know where to send back the results. 
To unsubscribe from this group and stop receiving emails from it, send an email to orthan...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages