Query/Retrieve Problems with GUI on new Query node

  • Hi Marcel/All,


    Sorry but I'm possibly missing something simple, I seem to have an issue with a new node I have recently set up.


    I have recently convinced our PAC's system here to set up a Q/R node for us to query and retrieve images from. They have since set up our Conquest system as a node set up for Q/R.


    So I have added their PAC's node details to my ConQuest server.


    Then when I try to query the node with a PatientID value, I'm getting an error. I've tried restarting service/PC mmultiple times but still the same result.


    Then I have installed ZeroBrane application and manually used the query.lua script and it was successful and reported back that a patient exists for that PatientID and there are 4 different studies.


    The log of the error I get when I submit the query from the GUI is:

    Code
    [RTPHYSICS] 0000,0002 18 UI AffectedSOPClassUID "1.2.840.10008.1.1"
    [RTPHYSICS] 0000,0100 2 US CommandField 48
    [RTPHYSICS] 0000,0110 2 US MessageID 7
    [RTPHYSICS] 0000,0800 2 US DataSetType 257
    [RTPHYSICS] 0002,0010 17 UI TransferSyntaxUID "1.2.840.10008.1.2"
    [RTPHYSICS] 9999,0400 1038 LO ConquestConsoleComma "lua:local first=true; local ae=[[UHGEIPROD]];local level=[[PATIENT]];local q={QueryRetrieveLevel=[[PATIENT]],PatientID=[[0381930]],PatientName=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s="
    [RTPHYSICS] *** lua run error [string "local first=true; local ae=[[UHGEIPROD]];lo..."]:1: attempt to concatenate field '?' (a table value) in 'local first=true; local ae=[[UHGEIPROD]];local level=[[PATIENT]];local q={QueryRetrieveLevel=[[PATIENT]],PatientID=[[0381930]],PatientName=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s=tempfile("txt") f=io.open(s, "wb");if r2==nil then f:write("no connection with "..ae.."\n") returnfile=s f:close() return end; local r = loadstring("return "..r2:Serialize())();r[1].QueryRetrieveLevel=nil; r[1].TransferSyntaxUID=nil; local keys={} for k,v in pairs(r[1]) do keys[#keys+1]=k end; table.sort(keys, function(a, b) return string.sub(a, 1, 7)<string.sub(b, 1, 7) end); if first then for k,v in ipairs(keys) do f:write(v.." ") end f:write("\n") end if first then f:write("---------------------------------------------------------------------------------------------------------------------------------------------------------------\n") end for k,v in ipairs(r) do for k2,v2 in ipairs(keys) do f:write("["..v[v2].."] ") end f:write("\n") end returnfile=s f:close();'

    Also see attached screenshots of what I'm seeing.


    Any suggestions anyone on how to get this working via the GUI or more importantly the Web Application?


    Thanks

    John

  • Hi Marcel,


    No luck I'm afraid. Here is the log each time:


    STUDY:

    Code
    [RTPHYSICS] 0000,0002     18 UI AffectedSOPClassUID    "1.2.840.10008.1.1"
    [RTPHYSICS] 0000,0100      2 US CommandField           48
    [RTPHYSICS] 0000,0110      2 US MessageID              7
    [RTPHYSICS] 0000,0800      2 US DataSetType            257
    [RTPHYSICS] 0002,0010     17 UI TransferSyntaxUID      "1.2.840.10008.1.2"
    [RTPHYSICS] 9999,0400   1050 LO ConquestConsoleComma   "lua:local first=true; local ae=[[UHGEIPROD]];local level=[[STUDY]];local q={QueryRetrieveLevel=[[STUDY]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q"
    [RTPHYSICS] *** lua run error [string "local first=true; local ae=[[UHGEIPROD]];lo..."]:1: attempt to concatenate field '?' (a table value) in 'local first=true; local ae=[[UHGEIPROD]];local level=[[STUDY]];local q={QueryRetrieveLevel=[[STUDY]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s=tempfile("txt") f=io.open(s, "wb");if r2==nil then f:write("no connection with "..ae.."\n") returnfile=s f:close() return end; local r = loadstring("return "..r2:Serialize())();r[1].QueryRetrieveLevel=nil; r[1].TransferSyntaxUID=nil; local keys={} for k,v in pairs(r[1]) do keys[#keys+1]=k end; table.sort(keys, function(a, b) return string.sub(a, 1, 7)<string.sub(b, 1, 7) end); if first then for k,v in ipairs(keys) do f:write(v.."    ") end f:write("\n") end if first then f:write("---------------------------------------------------------------------------------------------------------------------------------------------------------------\n") end for k,v in ipairs(r) do   for k2,v2 in ipairs(keys) do f:write("["..v[v2].."]    ") end f:write("\n") end returnfile=s f:close();'

    SERIES:

    Code
    [RTPHYSICS] 0000,0002     18 UI AffectedSOPClassUID    "1.2.840.10008.1.1"
    [RTPHYSICS] 0000,0100      2 US CommandField           48
    [RTPHYSICS] 0000,0110      2 US MessageID              7
    [RTPHYSICS] 0000,0800      2 US DataSetType            257
    [RTPHYSICS] 0002,0010     17 UI TransferSyntaxUID      "1.2.840.10008.1.2"
    [RTPHYSICS] 9999,0400   1106 LO ConquestConsoleComma   "lua:local first=true; local ae=[[UHGEIPROD]];local level=[[SERIES]];local q={QueryRetrieveLevel=[[SERIES]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],SeriesNumber=[[]],SeriesDescription=[[]],Modality=[[]],};local q2=DicomObject:new(); for k,v in"
    [RTPHYSICS] *** lua run error [string "local first=true; local ae=[[UHGEIPROD]];lo..."]:1: attempt to call a nil value in 'local first=true; local ae=[[UHGEIPROD]];local level=[[SERIES]];local q={QueryRetrieveLevel=[[SERIES]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],SeriesNumber=[[]],SeriesDescription=[[]],Modality=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s=tempfile("txt") f=io.open(s, "wb");if r2==nil then f:write("no connection with "..ae.."\n") returnfile=s f:close() return end; local r = loadstring("return "..r2:Serialize())();r[1].QueryRetrieveLevel=nil; r[1].TransferSyntaxUID=nil; local keys={} for k,v in pairs(r[1]) do keys[#keys+1]=k end; table.sort(keys, function(a, b) return string.sub(a, 1, 7)<string.sub(b, 1, 7) end); if first then for k,v in ipairs(keys) do f:write(v.."    ") end f:write("\n") end if first then f:write("---------------------------------------------------------------------------------------------------------------------------------------------------------------\n") end for k,v in ipairs(r) do   for k2,v2 in ipairs(keys) do f:write("["..v[v2].."]    ") end f:write("\n") end returnfile=s f:close();'
    Code
    IMAGE:
    [RTPHYSICS] 0000,0002     18 UI AffectedSOPClassUID    "1.2.840.10008.1.1"
    [RTPHYSICS] 0000,0100      2 US CommandField           48
    [RTPHYSICS] 0000,0110      2 US MessageID              7
    [RTPHYSICS] 0000,0800      2 US DataSetType            257
    [RTPHYSICS] 0002,0010     17 UI TransferSyntaxUID      "1.2.840.10008.1.2"
    [RTPHYSICS] 9999,0400   1144 LO ConquestConsoleComma   "lua:local first=true; local ae=[[UHGEIPROD]];local level=[[IMAGE]];local q={QueryRetrieveLevel=[[IMAGE]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],SeriesNumber=[[]],SeriesDescription=[[]],Modality=[[]],InstanceNumber=[[]],SOPInstanceUID=[[]],};"
    [RTPHYSICS] *** lua run error [string "local first=true; local ae=[[UHGEIPROD]];lo..."]:1: attempt to call a nil value in 'local first=true; local ae=[[UHGEIPROD]];local level=[[IMAGE]];local q={QueryRetrieveLevel=[[IMAGE]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],SeriesNumber=[[]],SeriesDescription=[[]],Modality=[[]],InstanceNumber=[[]],SOPInstanceUID=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s=tempfile("txt") f=io.open(s, "wb");if r2==nil then f:write("no connection with "..ae.."\n") returnfile=s f:close() return end; local r = loadstring("return "..r2:Serialize())();r[1].QueryRetrieveLevel=nil; r[1].TransferSyntaxUID=nil; local keys={} for k,v in pairs(r[1]) do keys[#keys+1]=k end; table.sort(keys, function(a, b) return string.sub(a, 1, 7)<string.sub(b, 1, 7) end); if first then for k,v in ipairs(keys) do f:write(v.."    ") end f:write("\n") end if first then f:write("---------------------------------------------------------------------------------------------------------------------------------------------------------------\n") end for k,v in ipairs(r) do   for k2,v2 in ipairs(keys) do f:write("["..v[v2].."]    ") end f:write("\n") end returnfile=s f:close();'


    PATIENT PatientStudyOnly:

    Code
    [RTPHYSICS] 0000,0002     18 UI AffectedSOPClassUID    "1.2.840.10008.1.1"
    [RTPHYSICS] 0000,0100      2 US CommandField           48
    [RTPHYSICS] 0000,0110      2 US MessageID              7
    [RTPHYSICS] 0000,0800      2 US DataSetType            257
    [RTPHYSICS] 0002,0010     17 UI TransferSyntaxUID      "1.2.840.10008.1.2"
    [RTPHYSICS] 9999,0400   1040 LO ConquestConsoleComma   "lua:local first=true; local ae=[[UHGEIPROD]];local level=[[PATIENTP]];local q={QueryRetrieveLevel=[[PATIENTP]],PatientID=[[0381930]],PatientName=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local "
    [RTPHYSICS] *** lua run error [string "local first=true; local ae=[[UHGEIPROD]];lo..."]:1: attempt to concatenate field '?' (a table value) in 'local first=true; local ae=[[UHGEIPROD]];local level=[[PATIENTP]];local q={QueryRetrieveLevel=[[PATIENTP]],PatientID=[[0381930]],PatientName=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s=tempfile("txt") f=io.open(s, "wb");if r2==nil then f:write("no connection with "..ae.."\n") returnfile=s f:close() return end; local r = loadstring("return "..r2:Serialize())();r[1].QueryRetrieveLevel=nil; r[1].TransferSyntaxUID=nil; local keys={} for k,v in pairs(r[1]) do keys[#keys+1]=k end; table.sort(keys, function(a, b) return string.sub(a, 1, 7)<string.sub(b, 1, 7) end); if first then for k,v in ipairs(keys) do f:write(v.."    ") end f:write("\n") end if first then f:write("---------------------------------------------------------------------------------------------------------------------------------------------------------------\n") end for k,v in ipairs(r) do   for k2,v2 in ipairs(keys) do f:write("["..v[v2].."]    ") end f:write("\n") end returnfile=s f:close();'

    STUDY PatientStudyOnly:

    Code
    [RTPHYSICS] 0000,0002     18 UI AffectedSOPClassUID    "1.2.840.10008.1.1"
    [RTPHYSICS] 0000,0100      2 US CommandField           48
    [RTPHYSICS] 0000,0110      2 US MessageID              7
    [RTPHYSICS] 0000,0800      2 US DataSetType            257
    [RTPHYSICS] 0002,0010     17 UI TransferSyntaxUID      "1.2.840.10008.1.2"
    [RTPHYSICS] 9999,0400   1052 LO ConquestConsoleComma   "lua:local first=true; local ae=[[UHGEIPROD]];local level=[[STUDYP]];local q={QueryRetrieveLevel=[[STUDYP]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level,"
    [RTPHYSICS] *** lua run error [string "local first=true; local ae=[[UHGEIPROD]];lo..."]:1: attempt to concatenate field '?' (a table value) in 'local first=true; local ae=[[UHGEIPROD]];local level=[[STUDYP]];local q={QueryRetrieveLevel=[[STUDYP]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s=tempfile("txt") f=io.open(s, "wb");if r2==nil then f:write("no connection with "..ae.."\n") returnfile=s f:close() return end; local r = loadstring("return "..r2:Serialize())();r[1].QueryRetrieveLevel=nil; r[1].TransferSyntaxUID=nil; local keys={} for k,v in pairs(r[1]) do keys[#keys+1]=k end; table.sort(keys, function(a, b) return string.sub(a, 1, 7)<string.sub(b, 1, 7) end); if first then for k,v in ipairs(keys) do f:write(v.."    ") end f:write("\n") end if first then f:write("---------------------------------------------------------------------------------------------------------------------------------------------------------------\n") end for k,v in ipairs(r) do   for k2,v2 in ipairs(keys) do f:write("["..v[v2].."]    ") end f:write("\n") end returnfile=s f:close();'


    Initially I thought it might have been PACS setup was incorrect but I can ECHO no problem and Query from ZeroBrane works.


    John

  • Hi,


    Can you copy the code from the error message in ZBS and test what goes wrong?


    Code
    local first=true; local ae=[[UHGEIPROD]];local level=[[STUDY]];local q={QueryRetrieveLevel=[[STUDY]],PatientID=[[0381930]],PatientName=[[]],StudyDate=[[]],};local q2=DicomObject:new(); for k,v in pairs(q) do q2[k]=v end;local r2=dicomquery(ae, level, q2);local s=tempfile("txt") f=io.open(s, "wb");if r2==nil then f:write("no connection with "..ae.."\n") returnfile=s f:close() return end; local r = loadstring("return "..r2:Serialize())();r[1].QueryRetrieveLevel=nil; r[1].TransferSyntaxUID=nil; local keys={} for k,v in pairs(r[1]) do keys[#keys+1]=k end; table.sort(keys, function(a, b) return string.sub(a, 1, 7)<string.sub(b, 1, 7) end); if first then for k,v in ipairs(keys) do f:write(v.."    ") end f:write("\n") end if first then f:write("---------------------------------------------------------------------------------------------------------------------------------------------------------------\n") end for k,v in ipairs(r) do   for k2,v2 in ipairs(keys) do f:write("["..v[v2].."]    ") end f:write("\n") end returnfile=s f:close();


    Split it over lines to be able to step through.


    Marcel

  • Hi Marcel,


    Thanks for the suggestion, I didn't think of that at all!


    Apologies but I'm pretty new to lua and coding in general but here's how I split it up. Same error occurs. I simplified things by querying PatientID and STUDYDATE so I get back 1 result only. It's gets to line 18 (highlighted in red below) and that's where it has issues with the "r" and "keys" arrays. So possibly our PAC's is not sending back a standard format?


    Here is the code I used in ZBS and also see attached image of my watch window and output with error.


    Thanks very much for getting the time to look at this,


    John

  • Ah,


    without being asked, it returns a sequence query result, that it cannot print.


    Can you modify line 13 as follows:


    local keys={} for k,v in pairs(r[1]) do if type(v)~='table' then keys[#keys+1]=k end end


    and try again?


    Marcel

  • Hi Marcel,


    Yes that works if I update line 13 with your suggestion.


    That would be great to update GUI if possible. Would that then fix the Web application too?


    When I try search same patient in Web Application I don't get any results/errors, see attached window. Let me know if there is further testing you would like me to try.


    Thanks very much,


    John

  • For the web application, you have to look into the lua files in the cgi-bin/newweb folder, your example is in liststudies. The easiest way to debug that is to add print statements, the output would go into the HTML. I cannot quickly guess where it goes wrong.


    Good thing is you can fix the web app yourself, just modify the lua files!

  • Hi Marcel,


    That updated seems GUI file works perfect to query the PACs system so this is great thanks! That was a very fast fix!


    However...my next problem is when I try to copy that query to destination (my ConQuest server), it fails with "***dicommove: remote DICOM error" so I wonder is there a chance that PAC's might have forgot to tick the "retrieve" box when setting up? Or else, would you have any other suggestions to test retrieve capabilities? Is there a similar retrieve .lua script to test?


    I will try a debug the Web application myself and let you know. This might take me a while!


    John

  • Hi Marcel,


    Is it possible to use the DGATE command in command line to do a simple query and then try retrieve a study?


    I see in the manual for a query to find a patient study it is:

    Code
    dgate --studyfinder:srv|str|fmt|file


    So I've been trying use this but I'm failing and not too sure what to put in for "fmt" of "file" parameters


    I'm using:

    Code
    dagte64.exe --studyfinder:UHGEIPROD|0381930|fmt|file

    but I'm getting nothing back.


    Then can I use --movestudy option to try and move patient?


    Thanks for your help,

    John

  • Hi John,


    this stuyfinder command is likely to fail the same way. Why not try a move from lua?


    AE = 'CONQUESTSRV1';

    b=newdicomobject();

    b.PatientName = 'HEAD EXP2';

    b.QueryRetrieveLevel = 'STUDY';

    dicommove('CONQUESTSRV1', AE, b);

  • Thanks Marcel, I have tried dicommove from ZBS with the following code:



    That Patient study is found successfully but it is still having issues retrieving image with the following output:



    I will log a call with PAC's here and make sure everything is set up correctly on their side.


    Fingers crossed!


    Thanks for your help,


    John

Participate now!

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