• Quoting is tricky.

    To list studies that would be:

    dgate64 "--lua:q=DicomObject:new();q.PatientID=[[106019]];q.StudyInstanceUID=[[]];a=dicomquery([[CONQUESTSRV1]], [[STUDY]], q); local s=tempfile([[.txt]]) local f=io.open(s, [[wb]]) f:write(a:Serialize(true, true)) returnfile=s f:close();"

    prints

    [{"TransferSyntaxUID":"1.2.840.10008.1.2","QueryRetrieveLevel":"STUDY","PatientI

    D":"106019","StudyInstanceUID":"1.3.46.670589.11.0.0.11.4.2.0.734.5.5972.2018110

    911462251288"}]

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

  • Thank you, I just sent you a new email with informations to use and test the API

  • How could I get more informations of the study with lua script, such as StudyDate,StudyModal,PatientNam,PatientID,StudyInsta,PatientBir ?

  • I just create a lua file testecq.lua with:

    When I execute I get no results. What am I missing here?

    Code
    F:\Programas\AppProg\dicomserver150c>dgate64.exe --dofile:testcq.lua
    There is no response to console 

    I also tried something as next into 'testcq.lua' without success:

    Edited 4 times, last by jweste (July 15, 2022 at 1:46 AM).

  • Hi,

    This runs lua in this dgate - prints to console but no access to server resources

    dgate64 "--dolua:print(1)"

    This runs lua in this server - prints to server status

    dgate64 "--lua:print(1)"


    My example prints to console from server:

    dgate64 "--lua:q=DicomObject:new();q.PatientID=[[106019]];q.StudyInstanceUID=[[]];a=dicomquery([[CONQUESTSRV1]], [[STUDY]], q); local s=tempfile([[.txt]]) local f=io.open(s, [[wb]]) f:write(a:Serialize(true, true)) returnfile=s f:close();"

    so you can put this in a file file.lua and say:

    dgate64 "--lua:dofile([[file.lua]])"

    file.lua

    Code
    q=DicomObject:new();
    q.PatientID=[[106019]];
    q.StudyInstanceUID=[[]]; -- add other items you would like to query like this
    a=dicomquery([[CONQUESTSRV1]], [[STUDY]], q); 
    local s=tempfile([[.txt]]) 
    local f=io.open(s, [[wb]]) 
    f:write(a:Serialize(true, true)) 
    returnfile=s 
    f:close();

    Marcel

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

    Edited once, last by marcelvanherk (July 15, 2022 at 8:09 AM).

  • Your second sample could run:

    If you run it with dgate64 "--dolua:dofile([[testcq.lua]])". However elements like 9999,0800 are defined at the image level, so this requires an image query.

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

  • Your second sample could run:

    If you run it with dgate64 "--dolua:dofile([[testcq.lua]])". However elements like 9999,0800 are defined at the image level, so this requires an image query.


    Hi, Marcel

    Sorry, but I still have an error.

    Another question:: How can I know the name of all columns(fields) returning from dicomquery before?

    I searched in the docs, but I didn´t find.

    To make a loop to print the result, I need to know that column names.

    I get an error:

    Code
    F:\Programas\AppProg\dicomserver150c>dgate64 "--dolua:dofile([[testecq.lua]])"
    *** lua run error testecq.lua:25: attempt to index field '?' (a nil value) in 'dofile([[testecq.lua]])'
  • If you change line 8 to:

    Code
    local r = dicomquery(ae, level, q2):Serialize(true, true);

    you should get json data.

    Marcel

    Hi, Marcel

    This is the lua script as you said:

    When I run, I get now a new error:

    Code
    F:\Programas\AppProg\dicomserver150c>dgate64 "--dolua:dofile([[testecq.lua]])"
    *** lua run error testecq.lua:24: attempt to get length of global 'b' (a nil value) in 'dofile([[testecq.lua]])'
  • is CONQUESTSRV1 right?

    Yes, It its.

    Here is the conquest logs when after I run the command:

  • post the current code?

    Here is:

  • This works!

    Marcel van Herk is developer of the Conquest DICOM server together with Lambert Zijp.

Participate now!

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