IMAGE level query with different results

  • Hi,


    I'm working on a LUA script that i would like to use for cleaning the conquest database once a day.
    For that I will loop through all the images from an IMAGE level query result and delete those images.
    But the query doesn't work as expected on my test server while the same query does work on a conquest server on my local workstation.


    I found out that the difference in database configuration (local workstation: 'dbase' and test server: 'ms sql server') causes the different results.


    Using this query:

    Code
    server = servercommand('get_param:MyACRNema')y = DicomObject:new()y.QueryRetrieveLevel = 'SERIES'y.Modality = 'CT' y.PatientName = ''y.PatientID = ''y.SeriesInstanceUID = ''z = dicomquery(server, 'SERIES', y);print("Nr of series:", #z)for i = 0, #z-1 do w = DicomObject:new() w.QueryRetrieveLevel = 'IMAGE' w.SeriesInstanceUID = z[i].SeriesInstanceUID w.Modality = '' w.PatientID = '' x = dicomquery(server, 'IMAGE', w) print("Patient: " .. x.PatientID, "Modality: " .. x.Modality, "Nr of images: " .. #x)end


    On my local workstation results in (with dbase):

    Code
    "Nr of series:" 3"Patient: 0000001" "Modality: CT" "Nr of images: 132""Patient: 0000002" "Modality: CT" "Nr of images: 132""Patient: 0000003" "Modality: CT" "Nr of images: 132"


    and on the test server (with sql server):

    Code
    "Nr of series:" 3
    "Patient: 0000001" "Modality: CT" "Nr of images: 1"
    "Patient: 0000002" "Modality: CT" "Nr of images: 1"
    "Patient: 0000003" "Modality: CT" "Nr of images: 1"


    Is this familiar behavior and is there a work around?


    Kind regards.
    Dave

  • Hi Dave,


    The query is UNIQUE, i.e., all returned records are the same. Also query SOPInstanceUID then the difference dissapears.


    Also look at function dicomdelete() it can delete entire series etc in one call.


    Marcel

  • Hi Marcel,


    It works! Thanks!
    Now I can delete all CT slices, except the first, like so:

    Code
    server = servercommand('get_param:MyACRNema')w = DicomObject:new()w.QueryRetrieveLevel = 'IMAGE'w.SOPInstanceUID = ''w.Modality = 'CT'w.PatientID = ''w.InstanceNumber = ''w.SeriesDate = ''x = dicomquery(server, 'IMAGE', w)print("total nr of images:", #x)for i = 0, #x-1 do if x[i].InstanceNumber ~= '0' then dicomdelete(x[i]) -- delete all slices except the first one endend


    Is there a way to filter out the first slice in the query DicomObject btw?
    for example, using the w.InstanceNumber ~= '0' in:

    Code
    w = DicomObject:new()
    w.QueryRetrieveLevel = 'IMAGE'
    w.SOPInstanceUID = ''
    w.Modality = 'CT'
    w.InstanceNumber ~= '0'
    dicomdelete(w)


    Dave

  • Hi Dave,


    no, the dicomquery, dicommove and dicomdelete functions use the same standard DICOM query function that has:


    substring matching,
    multiple values matching for UIDs
    and data-range possibilities.


    There is no NOT.


    Marcel

Participate now!

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