Manipulating (deleting) nested dicom tags in WorkListQueryConverter0

  • Hi,


    I'm looking to delete some very specific dicom tags from the mwl queries that come in from the modalities. I'm hoping to do this on conquest in order to avoid having to reconfigure lots of modalities. However I'm having problems figuring out how to set some nested fields to nil (delete them).


    The fields I want to delete are:

    • 0040,0011
    • 0040,1001
    • 0040,0010

    Here's what I've tried in dicom.ini:


    Code
    # Add a filter of the calling AETitle to all incoming queries, also remove DICOMWorkList.SchedPSLoc
    QueryConverter0 = Data["0040,0001"] = Association.Calling; Data["0040,0011"] = nil; Data["0040,1001"] = nil; Data["0040,0010"] = nil
    RetrieveConverter0 = Data["0040,0001"] = Association.Calling; Data["0040,0011"] = nil; Data["0040,1001"] = nil; Data["0040,0010"] = nil
    workListQueryConverter0 = Data["0040,0001"] = Association.Calling; Data["0040,0011"] = nil; Data["0040,1001"] = nil; Data["0040,0010"] = nil


    The first bit is to add a new filter for the Scheduled Station AE Title by AETitle, this is working fine. However the other bits don't, I suspect it's because these are nested but I can't figure out the syntax for nested dicom tags.


    I've found info here and found some examples on this forum on how to set the data but couldn't find an example using the fields I want to manipulate.


    Any suggestions or pointers would be very welcome, thanks in advance!

  • Something else I've tried:


    Code
    [lua]
    # Add a filter of the calling AETitle to all incoming queries, also remove DICOMWorkList.SchedPSLoc
    QueryConverter0 = Data["0040,0001"] = Association.Calling; Data.ScheduledProcedureStepSequence[0].ScheduledProcedureStepLocation = nil; Data.ScheduledProcedureStepSequence[0].ScheduledStationName = nil
    RetrieveConverter0 = Data["0040,0001"] = Association.Calling; Data.ScheduledProcedureStepSequence[0].ScheduledProcedureStepLocation = nil; Data.ScheduledProcedureStepSequence[0].ScheduledStationName = nil
    WorkListQueryConverter0 = Data["0040,0001"] = Association.Calling; Data.ScheduledProcedureStepSequence[0].ScheduledProcedureStepLocation = nil; Data.ScheduledProcedureStepSequence[0].ScheduledStationName = nil

    But this results in an error:

    Code
    *** lua run error [string "Data["0040,0001"] = Association.Calling; Da..."]:1: attempt to index field 'ScheduledProcedureStepSequence' (a nil value) in 'Data["0040,0001"] = Association.Calling; Data.ScheduledProcedureStepSequence[0].ScheduledProcedureStepLocation = nil; Data.ScheduledProcedureStepSequence[0].ScheduledStationName = nil'
  • Here's a log when the query comes in:


    I'm aiming to ignore (delete from the query) the DICOMWorkList.SchedPSLoc and DICOMWorkList.SchedStati fields before conquest checks it's database.

  • Hi,


    just tried this on some data:


    Data.ReferencedStudySequence[0].ReferencedSOPClassUID=nil

    print(Data.ReferencedStudySequence[0].ReferencedSOPClassUID)


    this prints nil.


    However, your script is 'unsafe' because Data.ScheduledProcedureStepSequence may be nil. Is that what is happening?


    Try:


    Code
    QueryConverter0 = Data["0040,0001"] = Association.Calling; if Data.ScheduledProcedureStepSequence then Data.ScheduledProcedureStepSequence[0].ScheduledProcedureStepLocation = nil; Data.ScheduledProcedureStepSequence[0].ScheduledStationName = nil end


    or


    Code
    QueryConverter0 = if Data.ScheduledProcedureStepSequence then Data.ScheduledProcedureStepSequence = nil end

    to delete the whole sequence


    Marcel

  • Hi Marcel!


    That worked, thank you!


    My next step will be to move this into a lua script instead of inline in dicom.ini so that I can loop over all children in the node, as at the moment this will only ignore the first in the sequence ([0]), but won't ignore a second or third element in the request. Ad edge case but worth covering.


    However I'm still a little unsure how to figure out what the name of the keys are in lua, especially when it's a nested. To illustrate with "0040,0001" as an example.


    Knowing that the tag is 0040,0001 I can look it up and find something like this, which tells me that this key is nested within Scheduled Procedure Step Sequence (nested meaning I'll have to index it using "[0]" or else loop over it) and is called Scheduled Station AE Title. However the name is with spaces here, so should I guess that the name in conquest will be the same as there but without spaces, "ScheduledProcedureStepSequence" and "ScheduledStationAETitle" in this case? Is that the right approach? Or do you recommend any other documentation to look these up or debug the actual contents of a Data object?


    Thanks again!

Participate now!

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