Posts by qcor

    OK... this is embarrassing. :oops:

    Data.ModalitiesInStudy='CT' is totally working... no idea what I was doing wrong. I must have misspelled it I guess :( That's what you get for messing with the code late at night.


    so it's even simpler now:

    Now I wonder how would it look like if I wanted lets say 2 modalities.. sth like ("CT" or "MR"). ModalitiesInStudy is defined as 1..n so I guess it should be possible to pass more than one at once. Can I pass a list/table somehow?

    This is completely new to me so I'm just guessing here... but maybe sth like Data.ModalitiesInStudy={'CT','MR'} ?? (<- this is not working, I checked)

    Just curious. Fortunately I need only 1 modality limit per AET.


    As for the errors I'm getting those 2 right at the start. (attached)

    Hello again


    ad 1)

    After some experimenting I actually got it working with the QueryConverter (not QueryResultConverter!)


    in dicom.ini I have this:

    Code
    [Lua]
    QueryConverter0 = dofile('queryFilter.lua')


    and in the queryFilter.lua I have this:



    And it's actually working as intended. Now, no matter what modality was in the query, the client will get only CTs as a result. It may ask for MR but will always get CT in return - exactly what I wanted.


    One thing I don't understand is why Data:SetVR(0x0008, 0x0061,"CT") is working while Data.Modality='CT' nor Data.StudyModality='CT' nor Data.ModalitiesInStudy='CT' is not working. I guess none of those 'user-friendly' field names are correct but I have no idea cause I can't find any list of those.


    ad 4)

    I'm unable to run this exe. It throws 2 access violation errors right away even if 'run as admin'

    1)

    99% of queries from this station will be sth like this:

    studydate==today, everything_else==any


    All I want to do is to force the modality filter on it, so in short I want it to become:

    studydate==today, modality=CT, everything_else==any


    I see QueryResultConverter0 is iterating thru all the results so (like you said) it would be enough to throw out all non-CT results... but how? How can I access the result modality (cause Data.Modality and StudyModality is still nil)? and How can I 'skip' this particular result if modality != CT


    4)

    No it doesn't. Logging to file makes the problem go away so I guess it's a socket-related problem like you suspected.

    Hi Marcel


    Thank you for your help.


    1)

    I tried it and it *almost* works.

    QueryConverter seems to work just fine but I think sth is wrong with the Data.Modality field.


    My query is asking for PatiendID='1234' and Modality='CT' (query from aet='qc_efilm')


    If I do something like this it's working as intended (I'm asking for id 1234 and getting patient with id 4321 as a result):

    if Association.Calling=='qc_efilm' then Data.PatientID='4321' end


    however if I do sth like this I'm still getting CT, not PX:

    if Association.Calling=='qc_efilm' then Data.Modality='PX' end


    So it looked to me like Data.Modality was not the right field... so I tried Data.StudyModality but it also did not work :(

    While debugging I tried to print Data.PatientID, Data.Modality, Data.StudyModality - I got 1234, nil, nil in return.


    I'm new to lua and have no idea how could print out whole Data structure. I thought it might be a table but it's not... so I'm stuck. Is there a full list of Data.xxxx fields somewhere?

    I looked thru the files and I'm pretty sure the 'StudyModality' is the right answer here.. no idea why it's nil :(


    2)

    work on incoming data

    aaahhh.. ok. This explains everything. OK, in that case I'll try the custom lua script solution.


    3)

    :( I'm using dgate for over 10 years and this is the only thing I'm missing... so close to perfection :D


    4)

    I'm pretty sure this was introduced with the 1.5 version. I just didn't report it earlier cause I had a per-release version of 1.5 so I just assumed it was due to some debug stuff running in the background or sth. Then I upgraded to the current version (1.5.0b) and it's still happening. Before that I had 1.4.19 but honestly I'm not sure about the letter.. I *think* d. So probably between 1419d and 150


    Yes it does unfreeze, then it's working for few seconds, then freezes again etc etc etc

    Hi


    I've accumulated few questions and problems over the past few years. I'd appreciate any help.


    1)

    I'd like to limit the query results based on the calling AET.

    For example - if calling AET ='XX' then replace modality of the query with 'CT'. In other words I'd like station XX to be able to see ONLY CTs no matter how broad the initial query was.


    Reading thru the manual I'm pretty sure it can be done using QueryConverter0 (or maybe RetrieveConverter0 ?) using %c in place of calling AET but that's all I've got :( There is no example in the manual unfortunately.


    2)

    I'd like one dicom node to be a 'dedicated forwarding node'. It's the only one visible the the outside world and it's only job is to do all the routing based on few dicom tags.

    Routing part is easy but I have problems deleting stuff. This node should keep the study only until it has been forwarded, then delete it. (which may take days, cause external nodes may be offline)


    I thought it would be as simple as sth like that:

    ExportConverter0 = ifequal "%V0032,1033", "example"; forward to SomeDicomNode; destroy;


    Unfortunately it's not that simple.. I get this:

    ***Exportconverter0: Spawning 'destroy' failed (argv=\\archiwum\1.3.12.2.1107.5.1.4.54058.30000021020206553043700016703.dcm)


    Not sure what I'm doing wrong here :(


    3)

    Is there some kind of a more 'robust' GUI which allows us to edit stuff like dicom tags or delete study? It's quite frequent that I have to change some tags in a study. Right now I'm using DicomBrowser (tool from Washington University) and it works fine but I'm looking for something better


    4)

    Using 1.5.0.b I'm getting some serious gui freezes every few seconds. (tested on 2 different PCs win2003 and win2012, same behavior)

    Service is working properly but gui becomes completely unresponsive (as in 'this program is not responding'). I *think* it's influenced by how much is going on (log scrolling) but tbh I'm not sure.


    Best Regards

    Patryk

    sure

    1) 1.4.17d

    2) hard to see cause there is a lot going on but I think this was the root cause (I've cut some lines cause there was a study incoming at the same time):

    Code
    20190722 09:36:34 UPACS THREAD 8967: STARTED AT: Mon Jul 22 09:36:34 2019
    20190722 09:36:34 Calling Application Title : "MRC25702 "
    20190722 09:36:34 Called Application Title : "ARPACS1 "
    20190722 09:36:34 Application Context : "1.2.840.10008.3.1.1.1", PDU length: 528378
    20190722 09:36:34 Presentation Context 0 "1.2.840.10008.5.1.4.1.2.1.1" 1
    20190722 09:36:34 (PatientRootQuery) search level: PATIENT
    20190722 09:36:36 *** ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
    20190722 09:36:36 *** ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
    20190722 09:36:36 *** ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

    I also looked at the database log and it turns out it was the empty query (or rather a query with no filters). It was going for few hours before I caught it... was already at letter 'j' :)


    Here is the query which started it all:


    Code
    2019-07-22 09:36:36 127.0.0.1(4345)LOG: duration: 1531.999 ms statement: SELECT DISTINCT DICOMPatients.PatientNam, DICOMPatients.PatientID, DICOMPatients.PatientSex FROM DICOMPatients WHERE DICOMPatients.PatientNam LIKE E'%' and DICOMPatients.PatientID LIKE E'%' ORDER BY (DICOMPatients.PatientNam)


    As you can see - no filters... so it basically asked for ALL 180.000 patients, and then the problems started cause it started asking about each and every one of them with this query:


    Quote

    SELECT DISTINCT COUNT(1) FROM DICOMStudies WHERE DICOMStudies.PatientNam = E'Jan^Kowalski' and DICOMStudies.PatientID = E'123456789101' and DICOMStudies.Sex = E'M' ORDER BY (DICOMStudies.PatientNam)

    producing error each time since this is not a valid query.


    Putting aside the stupid part (lack of filters) this query should still return a valid answer - the number of studies the patient had. It's just that the query itself is wrong

    Finally I had some free time to pinpoint exactly why certain dicom viewers seem much faster than others when it comes to query response times.

    I'm talking about the most common type of query like 'show me everything from yesterday/today', which in our case, means about 200-250 results (per day).


    Now the problem: some viewers (like Efilm) query results are almost instant. On others (like Radiant or the one from Agfa, I can't remember its name right now) it takes about 10seconds to see the results.


    I took a closer look and realized it all boils down to a single difference in the queries - image count. Efilm for example does NOT ask for the number of images up front. Only after user clicks (selects) a certain study - only then there is a query about all kinds of details (image numbers,series etc) regarding this, and only this, one study. This is fast.. barely noticeable.


    On the other hand, the other viewers want to know everything up front. Including the number of images in every single study listed.


    Here is an example step by step. First - the general query:

    SQL
    SELECT DISTINCT DICOMStudies.StudyDate, DICOMStudies.StudyTime, DICOMStudies.AccessionN, DICOMStudies.StudyModal, DICOMStudies.ReferPhysi, DICOMStudies.StudyDescr, DICOMStudies.PatientNam, DICOMStudies.PatientID, DICOMStudies.PatientBir, DICOMStudies.PatientSex, DICOMStudies.StudyInsta, DICOMStudies.StudyID FROM DICOMStudies
    WHERE DICOMStudies.StudyDate >= E'20190715' and DICOMStudies.StudyDate <= E'20190715' ORDER BY (DICOMStudies.PatientNam)


    This one takes about 200ms. No problems here since this is a very infrequent query so 200ms sounds acceptable.

    Efilm stops here and shows results. In other cases this is followed by a bunch of additional queries like this one:

    SQL
    SELECT DISTINCT COUNT(1) FROM DICOMImages, DICOMSeries, DICOMStudies WHERE DICOMStudies.StudyDate = E'20190703' and DICOMStudies.StudyTime = E'082206.312000' and DICOMStudies.AccessionN = E'320634-2019' and (DICOMStudies.StudyModal = E'CT' or DICOMStudies.StudyModal LIKE E'CT\\\\%' or DICOMStudies.StudyModal LIKE E'%\\\\CT\\\\%' or DICOMStudies.StudyModal LIKE E'%\\\\CT') and DICOMStudies.ReferPhysi = E'John Smith' and DICOMStudies.StudyDescr = E'Head^HeadStd (Adult)' and UPPER(DICOMStudies.PatientNam) = E'PATRYK^KMIEC' and DICOMStudies.PatientID = E'111111111' and DICOMStudies.PatientBir = E'19570101' and DICOMStudies.PatientSex = E'M' and DICOMStudies.StudyInsta = E'1.2.826.0.1.3680043.2.1326.17.632826.1.2034153.12.936083' and DICOMStudies.StudyID = E'-1' and DICOMSeries.StudyInsta = DICOMStudies.StudyInsta and DICOMImages.SeriesInst = DICOMSeries.SeriesInst

    This looks complicated but it's just an study image count. This one takes somewhere between 15 to 25ms. Now you might think this is fast but remember we have to do this for EACH study which means (in our case) *200-250. This means, lets say, 220 separate queries, each taking say 20ms so it sums up to about 4.5sec. From real life testing I know this number is closer to 6-7sec probably due to network overhead/latencies/query processing by viewer or some combination of the above.

    It might not be that long of a wait, but it is certainly long enough that doctors whine about it.


    Honestly I'm not sure how to solve this.I can't force all software engeneers to change their query so it wouldn't include the image count... and I can't speed up the query cause it's already pretty fast.

    The only solution I could think of is to have this number stored as a variable (part of study properties?), so we woudn't have to count images each time someone asks.


    Would that be possible? Or maybe there is another solution I missed?


    Patryk

    Hi


    We just started using new MRI machine today and my db and pacs log is being flooded with this error:

    Code
    ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

    it is caused by this statement (postgres):


    SQL
    SELECT DISTINCT COUNT(1) FROM DICOMStudies WHERE DICOMStudies.PatientNam = E'Jan^Kowalski' and DICOMStudies.PatientID = E'123456789101' and DICOMStudies.Sex = E'M' ORDER BY (DICOMStudies.PatientNam)


    Any idea how to fix this?


    Patryk

    I made a quick vid showing how it reacts to 'safe' and 'crash' dcm


    https://www.dropbox.com/s/ayk6…05-30%2023-42-30.mp4?dl=0


    sorry for low quality but I wanted to keep the recording small.

    It's the whole process from starting the service, then dropping safe.dcm into incoming (shown in the log) and then dropping crash.dcm... service just stops and wont start until I remove the crash.dcm from the incoming folder.

    I forgot to mention (not sure if relevant) but this is being run as a service.

    Crash is totally silent. No mention of it in the dgate log. The service just dies and the only mention of this is in the system log

    Code
    The DICOMARCH service terminated with the following error: Access is denied.


    I just tested this using debug 4 in the gui and this is what I get:

    Code
    [DICOMARCH] 9999,0300 24 LO ConquestConsoleText "set debug level from GUI"
    [DICOMARCH] 9999,0400 12 LO ConquestConsoleComma "debuglevel:4"
    [DICOMARCH] set debug level from GUI
    [DICOMARCH] JPEG compress started.
    [DICOMARCH] Debug[CompressJPEG]: H = 512, W = 512, Bits = 1 in 1, Components = 1, Frames = 275
    [DICOMARCH] JPEG Lossless
    [DICOMARCH] , H = 512, W = 512, Bits = 8 in 8, Frames = 275
    *** Restarted dead server after error 7
    [DICOMARCH] Stopped zip and cleanup thread
    [DICOMARCH] User interface test: local server is running!

    setting debug to 4, then dropping file in the 'incoming' then 3 lines and it dies and restarts after few sec

    (I have to remove the file from incoming otherwise the service won't even start - throws 'access denied' and dies)

    Hi


    I have a problem with dgate crashing upon receiving a 'SEG' type modality files. Typical study processed by Syngo contains few 'CT' series, few 'SR', and few 'SEG'.

    From what I understand those 'SEG' files are some internal Syngovia files - I'm not even sure they are a proper dicom files to be honest.


    Normally doctors are sending only 'ct' series to pacs, leaving out all others. However sometimes they miss-click or forget to uncheck those extra series so Syngo is trying to send all of them to pacs.

    The problem is that this is totally crashing dgate64. There is nothing is the log but I looked only into standard log, I may try to set debug to 4 and force a crash again if you'd like.

    System log however shows app crash as:

    Code
    The DICOMARCH service terminated with the following error:
    Access is denied.

    Strange.. cause dgate is running just fine otherwise so I have no idea what is it talking about.. access to what?


    oh and also maybe this will help you:

    I also tried to send the same 'SEG' file to older dgate server (this one is still running on 1.4.17d) and this one did not crash probably because it was caught by importconverter:


    converter definition:

    Code
    ImportConverter0 = ifequal "%m", "SR"; destroy;


    No idea why it was caught by 'SR' filter :/... I'm pretty sure it's 'SEG' not 'SR' (at least Syngo shows it as 'SEG' not 'SR')

    I tried to add same filter to my 1.5.0 but with no effect.. it crashed.


    I'd like to send you a sample of this SEG file but I have no idea how to extract it from Syngo.. Efilm is not accepting it. I may try to remove the SR filter from the old server and see what will happen. Maybe it'll be able write it to hdd.

    After much googling yesterday I came up with exactly same answer - this seems to be an OS problem and most popular fix is to set/change those registry values:


    Code
    Get-Item 'HKLM:\System\CurrentControlSet\Services\Tcpip\Parameters' | New-ItemProperty -Name MaxUserPort -Value 65534 -Force | Out-Null
    Get-Item 'HKLM:\System\CurrentControlSet\Services\Tcpip\Parameters' | New-ItemProperty -Name TcpTimedWaitDelay -Value 30 -Force | Out-Null
    Get-Item 'HKLM:\System\CurrentControlSet\Services\Tcpip\Parameters' | New-ItemProperty -Name TcpNumConnections -Value 16777214 -Force | Out-Null
    Get-Item 'HKLM:\System\CurrentControlSet\Services\Tcpip\Parameters' | New-ItemProperty -Name TcpMaxDataRetransmissions -Value 5 -Force | Out-Null

    This was my goto solution. Right now I'm waiting for to problem to occur - I want to catch this while it's happening and see which application is causing this (I expect few thousands open ports or sth like that). After that I'll implement those registry changes and see if it helps.

    I will let you know.


    [edit] unfortunately issue hasn't appeared in past few days so I'm unable to confirm the cause nor test the solution. I'll update this post again if it'll happen again in the future.

    It looks like this is just a coincidence and has nothing to do with the 1.4.x -> 1.5.0 migration.

    From what I understand this is an error related to the OS running out (hitting the user limit?) of ports (sockets?).

    This would explain why the error is showing up and disappearing 'randomly' without my intervention.

    Probably one of the applications going crazy.. hard to say. I'll try to catch it while it's happening and try to confirm this.


    So the bottom line is that it's probably not your fault :)


    [edit] I wonder why it's not happening when receiving images. Just on incoming queries. I guess the receiver is always bound to one static port while incoming queries try to open new port to send the response? Does it make sense? It would explain everything...