remote exe file

  • Hi,
    How to run remote file.exe or fils.vbs when conquest get patient data??



    i tray something like this, but doesn't work
    in dicom.ini
    [lua]
    source = dicomdir.lua


    in file dicom.lua
    os.execute("d:\\dicomserver\\dicomdir.exe")
    When I start dicom.lua from command line it's works.




    or mayby


    #[lua]
    #ImportConverter1 = Global.AutoRoutePipe = Data.AcessionNumber; print(Global.AutoRoutePipe)
    #EndAssociation = if Global.AutoRoutePipe~='' then servercommand('call dicomdir.vbs') end; Global.AutoRoutePipe=''


    hank's for any suggestions

  • I made something like this
    [lua]
    ImportConverter0 = Global.AutoRoutePipe = Data.AccessionNumber; print(Global.AutoRoutePipe)
    EndAssociation = if Global.AutoRoutePipe then system ('c:\\duplikator\\myown.exe') end;
    it work's
    but there is a little problem..... The myown.exe file starts so many times as many times incoming data come in.
    For example: If study has 10 images, the conquest starts myown.exe file ten times.


    I would like to corect my script in the way it will start only when all data from one study will come. (ex. the script will run only once after 10 images will come in.)


    Could you help me to correct the script?

  • Hi,


    you should use command "process series with" or "process study with", which wait for a programmed time until they fire. By the way, your solution should fire only one per connection, not once per image. For some senders that may be the same though.


    Marcel

  • I make somethink like this
    and it's works for me fine :D
    [lua]
    ImportConverter0 = Global.AutoRoutePipe = Data.AccessionNumber; print(Global.AutoRoutePipe)
    EndAssociation = sleep(10000);system ('c:\\duplikator\\dicomdir64.exe'); sleep(10000)

  • Dear Conquest users, dear Marcel,


    if you could give some more examples of how to call remote file, to get the feeling! Eg I wand to call remote python script to post-process the RTS file, deleting some strucutures. The system call should look smth like


    c:\python27\python <script.py> <RTS000.dcm> <options>


    I tried the ways described in this topic, but nothing works. Eg if I enter in dicom.ini:


    [lua]
    ImportConverter0 = lua "print('Hello!')"
    ImportConverter1 = process image by c:\\python27\\python.exe
    ImportConverter2 = Global.AutoRoutePipe = Data.AccessionNumber; print('Global.AutoRoutePipe=',Global.AutoRoutePipe)
    EndAssociation = if Global.AutoRoutePipe then system('echo bla') end;


    I get the following on the server side upon data recieve:


    [CONQUESTSRV1] Calling Application Title : "PINNCM1 "
    [CONQUESTSRV1] Called Application Title : "CONQUESTSRV1 "
    [CONQUESTSRV1] Application Context : "1.2.840.10008.3.1.1.1", PDU length: 28672
    [CONQUESTSRV1] Presentation Context 0 "1.2.840.10008.5.1.4.1.1.481.5" 1
    [CONQUESTSRV1] Presentation Context 1 "1.2.840.10008.5.1.4.1.1.481.3" 1
    [CONQUESTSRV1] Presentation Context 2 "1.2.840.10008.5.1.4.1.1.481.1" 1
    [CONQUESTSRV1] Presentation Context 3 "1.2.840.10008.5.1.4.1.1.481.2" 1
    [CONQUESTSRV1] Presentation Context 4 "1.2.840.10008.5.1.4.1.1.66.1" 1
    [CONQUESTSRV1] Presentation Context 5 "1.2.840.10008.5.1.4.1.1.481.8" 1
    [CONQUESTSRV1] *** lua run error [string "lua "print('Hello!')""]:1: attempt to call global 'lua' (a nil value) in 'lua "print('Hello!')"'
    [CONQUESTSRV1] *** lua syntax error [string "process image by c:\\python27\\python.exe"]:1: '=' expected near 'image' in 'process image by c:\\python27\\python.exe'
    [CONQUESTSRV1] Global.AutoRoutePipe= 0P10063657754000
    [CONQUESTSRV1] No image number
    [CONQUESTSRV1] Written file: J:\soft\conquest\dicomserver1417d\Data\2000130756\2.16.840.1.113669.2.931128.567473937.20151118104546.747216_0001_000000_14478399470013.dcm
    [CONQUESTSRV1] ***Failed to create process echo: 2
    [CONQUESTSRV1] UPACS THREAD 78: ENDED AT: Wed Nov 18 10:45:47 2015
    [CONQUESTSRV1] UPACS THREAD 78: TOTAL RUNNING TIME: 0 SECONDS


    Any help highly appreciated!


    Kostya



    Quote from marcelvanherk

    Hi,


    you should use command "process series with" or "process study with", which wait for a programmed time until they fire. By the way, your solution should fire only one per connection, not once per image. For some senders that may be the same though.


    Marcel

  • Hi,


    ImportConverter0 and 1 these are not native lua importconverters and should be in the main section of dicom.ini, e.g.,


    ImportConverter0 = lua "print('Hello!')"
    ImportConverter1 = process image by c:\\python27\\python.exe


    [lua]
    ImportConverter2 = Global.AutoRoutePipe = Data.AccessionNumber; print('Global.AutoRoutePipe=',Global.AutoRoutePipe)
    EndAssociation = if Global.AutoRoutePipe then system('echo bla') end;


    EndAssociation seems to work, but system() will only run an executable, which echo is not.


    Marcel

  • Thank you very much Marcel!


    How can I call a python script with parameters? Smth like:
    ImportConverter1 = process image by "c:\\python27\\python.exe <script> <parameters>" ?


    Eg as a system call


    c:\python27\python.exe j:\dicom\pydicom\del_rts.py <dicomfile>


    lists RT structures in <dicomfile>. When I do


    ImportConverter1 = process image by "c:\\python27\\python.exe j:\\dicom\\pydicom\\del_rts.py"


    I get:


    [CONQUESTSRV1] Importconverter1.0: queued process ima - (single object of 2000130756) to "c:\\python27\\python.exe j:\\dicom\\pydicom\\del_rts.py"


    How can I check whether the script is running? How can I see what the script outputs to the console ?


    Thank you!


    Kostya




  • Hi,


    "process xxx by" has a delay, default 5 minutes. This allows it to make sure a series or study has been completely received,


    if you want to run immediately, use "system"; this appends the DICOM object filename to the command.


    E.g,


    system "c:\\python27\\python.exe j:\\dicom\\pydicom\\del_rts.py %f"


    Unfortunately, you cannot show output of the process onto the console. This can only be done with Lua, which is built in into the server.
    Deleting structures is however currently not possible. I will fix this in the new release.


    Marcel

  • Hi Marcel, thank you!


    Something starts working. If I do e.g.


    ImportConverter1 = system "c:\python27\python.exe j:\dicom\pydicom\del_rts.py %f & ping 1.1.1.1 -n 1 -w 30000 > NUL"
    (ping to make it pause)


    see the output in fig. 1. The file does not yet exist on disk so the script cannot run.


    If I fource saving, e.g.


    ImportConverter1 = save to %f; system "c:\python27\python.exe j:\dicom\pydicom\del_rts.py %f & ping 1.1.1.1 -n 1 -w 10000 > NUL"


    than the script runs, see fig. 2, but the modified file is not registered in the database. The same thing if I do


    ImportConverter1 = process image by "c:\\python27\\python.exe j:\\dicom\\pydicom\\del_rts.py %f"


    It creates a process


    Importconverter1.0: queued process ima - (single object of 2000130756) to "c:\\python27\\python.exe j:\\dicom\\pydicom\\del_rts.py J:\soft\conquest\dicomserver1417d\Data\20001307562.16.840.1.113669.2.931128.567473937.20151203083001.937494_0001_000000_1449127805000d.dcm"


    But the file ...805000d.dcm never exists on disk, instead the incoming file is saved as ...805000e.dcm.


    Is it possible to circumvent this?


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!