Error openrem_qr.py - LookupError('Invalid tag (0008, 0050): unknown encoding: ISO 2022 IR 101'

33 views
Skip to first unread message

Alessandro Fracchetti

unread,
Jun 15, 2021, 7:56:11 AM6/15/21
to OpenREM
Dear All, OpenRem v0.10 on Ubuntu 20.04 with Orthanc as Dicom Server...

I am trying to retrieve RDSD data from PACS:

. /var/dose/veopenrem/bin/activate
python /var/dose/veopenrem/lib/python2.7/site-packages/openrem/scripts/openrem_qr.py 4 1 -ct -sd 2021-06-11 -tf 0001 -tt 2359 -sni "XXXX"


In openrem_qr.log:

[15/Jun/2021 08:57:56] INFO [remapp.netdicom.qrscu:1257] qrscu script called
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.qrscu:1277] Modalities are ['CT']
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.qrscu:1294] Single date: 2021-06-11
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.qrscu:1308] Time from: 0001
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.qrscu:1311] Time until: 2359
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.qrscu:1333] Stationname include terms are [u'xxxx']

In openrem.log
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.tools:40] Association response received
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.tools:117] Returning Success response from echo to 10.xxx.xx.xxx 104 xxxPACSxxx
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.tools:40] Association response received
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.tools:117] Returning Success response from echo to localhost 4006 XX_XXX_OPENREM
[15/Jun/2021 08:57:56] INFO [remapp.netdicom.tools:40] Association response received


In default.log
[2021-06-15 08:57:56,524: INFO/MainProcess] Received task: remapp.netdicom.qrscu.qrscu[066a55de-d540-44ec-ab47-ee318f5c4c10]
[2021-06-15 08:57:57,300: ERROR/MainProcess] Task remapp.netdicom.qrscu.qrscu[066a55de-d540-44ec-ab47-ee318f5c4c10] raised unexpected: LookupError('Invalid tag (0008, 0050): unknown encoding: ISO 2022 IR 101',)

Traceback (most recent call last):
  File "/var/dose/veopenrem/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/var/dose/veopenrem/lib/python2.7/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)

  File "remapp/netdicom/qrscu.py", line 908, in qrscu
    modalities_returned, modality_matching = _query_for_each_modality(all_mods, query, d, assoc)
  File "remapp/netdicom/qrscu.py", line 709, in _query_for_each_modality
    _query_study(assoc, d, query, query_id)
  File "remapp/netdicom/qrscu.py", line 622, in _query_study
    ss[1].decode()

  File "/var/dose/veopenrem/lib/python2.7/site-packages/dicom/dataset.py", line 145, in decode


I have tried to solve the problem modifying the file /var/dose/veopenrem/lib/python2.7/site-packages/dicom/charset.py   by adding : 'ISO 2022 IR 101': 'iso8859_2', but anyway it doesn't work.

Do you have any ideas?

Kind regards

Alessandro f

Ed McDonagh

unread,
Jun 15, 2021, 9:07:55 AM6/15/21
to Alessandro Fracchetti, OpenREM
Have you reviewed the docs at https://docs.openrem.org/en/0.10.0-docs/troubleencoding.html - ignoring the fact the talk about OpenREM 0.8 and earlier - the same applies to 0.10.

Hopefully there was a small error when you tried to do the same for just your encoding?

The other thing might be to come out of the burial environment and back in, in case the original version of charset.py was cached?

I hope that helps, let us know.

Kind regards

Ed



--
You received this message because you are subscribed to the Google Groups "OpenREM" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openrem+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openrem/3986fa61-506a-4e03-9e10-fb6e0956c86en%40googlegroups.com.

Alessandro Fracchetti

unread,
Jun 17, 2021, 6:49:29 AM6/17/21
to Ed McDonagh, OpenREM

I've just followed the instructions in https://docs.openrem.org/en/0.10.0-docs/troubleencoding.html , I tried to come out of the environment and back in, but all unsuccessfully

 

charset.py

-----------

 

[...]

 

# Map DICOM Specific Character Set to python equivalent

python_encoding = {

 

    # default character set for DICOM

    '': 'iso8859',

 

    # alias for latin_1 too (iso_ir_6 exists as an alias to 'ascii')

    'ISO_IR 6': 'iso8859',

    'ISO_IR 13': 'shift_jis',

 

    # these also have iso_ir_1XX aliases in python 2.7

    'ISO_IR 100': 'latin_1',

    'ISO_IR 101': 'iso8859_2',

    'ISO_IR 109': 'iso8859_3',

    'ISO_IR 110': 'iso8859_4',

    'ISO_IR 126': 'iso_ir_126',  # Greek

    'ISO_IR 127': 'iso_ir_127',  # Arabic

    'ISO_IR 138': 'iso_ir_138',  # Hebrew

    'ISO_IR 144': 'iso_ir_144',  # Russian

    'ISO_IR 148': 'iso_ir_148',  # Turkish

    'ISO_IR 166': 'iso_ir_166',  # Thai

    'ISO 2022 IR 6': 'iso8859',  # alias for latin_1 too

    'ISO 2022 IR 13': 'shift_jis',

    'ISO 2022 IR 87': 'iso2022_jp',

    'ISO 2022 IR 100': 'latin_1',

    'ISO 2022 IR 101': 'iso8859_2',

    'ISO 2022 IR 109': 'iso8859_3',

    'ISO 2022 IR 110': 'iso8859_4',

    'ISO 2022 IR 126': 'iso_ir_126',

    'ISO 2022 IR 127': 'iso_ir_127',

    'ISO 2022 IR 138': 'iso_ir_138',

    'ISO 2022 IR 144': 'iso_ir_144',

    'ISO 2022 IR 148': 'iso_ir_148',

    'ISO 2022 IR 149': 'euc_kr',  # needs cleanup via clean_escseq()

    'ISO 2022 IR 159': 'iso-2022-jp',

    'ISO 2022 IR 166': 'iso_ir_166',

    'ISO 2022 IR 58': 'iso_ir_58',

    'ISO_IR 192': 'UTF8',  # from Chinese example, 2008 PS3.5 Annex J p1-4

    'GB18030': 'GB18030',

    'ISO 2022 GBK': 'GBK',  # from DICOM correction CP1234

    'ISO 2022 58': 'GB2312',  # from DICOM correction CP1234

    'GBK': 'GBK',  # from DICOM correction CP1234

}

 

default_encoding = "iso8859"

 

[....]

 

 

Kind regards

 

Alessandro f.

Ed McDonagh

unread,
Jun 21, 2021, 4:09:28 PM6/21/21
to Alessandro Fracchetti, OpenREM
Sorry for the delay in replying. I am slightly at a loss as to what is going on though.

Can you please show me the following, or compare your output to mine? I wonder if there were any issues with how the charset file was changed?

me@myhost:~$ . /var/dose/veopenrem/bin/activate
(veopenrem) me@myhost:~$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> from dicom import charset
>>> charset
<module 'dicom.charset' from '/var/dose/veopenrem/local/lib/python2.7/site-packages/dicom/charset.pyc'>

>>> charset.python_encoding
{'': 'iso8859', 'ISO 2022 IR 87': 'iso2022_jp', 'GB18030': 'GB18030', 'ISO 2022 IR 127': 'iso_ir_127', 'ISO_IR 144': 'iso_ir_144', 'ISO 2022 IR 100': 'latin_1', 'ISO 2022 IR 101': 'iso8859_2', 'ISO_IR 148': 'iso_ir_148', 'ISO 2022 IR 110': 'iso8859_4', 'ISO 2022 IR 126': 'iso_ir_126', 'ISO_IR 110': 'iso8859_4', 'GBK': 'GBK', 'ISO 2022 IR 109': 'iso8859_3', 'ISO_IR 100': 'latin_1', 'ISO_IR 101': 'iso8859_2', 'ISO 2022 IR 58': 'iso_ir_58', 'ISO_IR 138': 'iso_ir_138', 'ISO_IR 109': 'iso8859_3', 'ISO 2022 IR 13': 'shift_jis', 'ISO_IR 6': 'iso8859', 'ISO 2022 IR 166': 'iso_ir_166', 'ISO_IR 192': 'UTF8', 'ISO 2022 IR 138': 'iso_ir_138', 'ISO 2022 IR 6': 'iso8859', 'ISO 2022 58': 'GB2312', 'ISO_IR 13': 'shift_jis', 'ISO_IR 166': 'iso_ir_166', 'ISO 2022 IR 148': 'iso_ir_148', 'ISO 2022 IR 149': 'euc_kr', 'ISO 2022 IR 159': 'iso-2022-jp', 'ISO_IR 126': 'iso_ir_126', 'ISO 2022 GBK': 'GBK', 'ISO 2022 IR 144': 'iso_ir_144', 'ISO_IR 127': 'iso_ir_127'}
>>> charset.python_encoding['ISO 2022 IR 101']
'iso8859_2'



Alessandro Fracchetti

unread,
Jun 22, 2021, 2:38:34 AM6/22/21
to OpenREM
Dear Ed, this is my output:

-------------------------------------------------------------------------------------
openrem@sfs-rdsr:~$ . /var/dose/veopenrem/bin/activate
(veopenrem) openrem@sfs-rdsr:~$ python
Python 2.7.18 (default, Mar  8 2021, 13:02:45)
[GCC 9.3.0] on linux2

>>> from dicom import charset
>>> charset
<module 'dicom.charset' from '/var/dose/veopenrem/lib/python2.7/site-packages/dicom/charset.pyc'>

>>> charset.python_encoding
{'': 'iso8859', 'ISO 2022 IR 87': 'iso2022_jp', 'GB18030': 'GB18030', 'ISO 2022 IR 127': 'iso_ir_127', 'ISO_IR 144': 'iso_ir_144', 'ISO 2022 IR 100': 'latin_1', 'ISO 2022 IR 101': 'iso8859_2', 'ISO_IR 148': 'iso_ir_148', 'ISO 2022 IR 110': 'iso8859_4', 'ISO 2022 IR 126': 'iso_ir_126', 'ISO_IR 110': 'iso8859_4', 'GBK': 'GBK', 'ISO 2022 IR 109': 'iso8859_3', 'ISO_IR 100': 'latin_1', 'ISO_IR 101': 'iso8859_2', 'ISO 2022 IR 58': 'iso_ir_58', 'ISO_IR 138': 'iso_ir_138', 'ISO_IR 109': 'iso8859_3', 'ISO 2022 IR 13': 'shift_jis', 'ISO_IR 6': 'iso8859', 'ISO 2022 IR 166': 'iso_ir_166', 'ISO_IR 192': 'UTF8', 'ISO 2022 IR 138': 'iso_ir_138', 'ISO 2022 IR 6': 'iso8859', 'ISO 2022 58': 'GB2312', 'ISO_IR 13': 'shift_jis', 'ISO_IR 166': 'iso_ir_166', 'ISO 2022 IR 148': 'iso_ir_148', 'ISO 2022 IR 149': 'euc_kr', 'ISO 2022 IR 159': 'iso-2022-jp', 'ISO_IR 126': 'iso_ir_126', 'ISO 2022 GBK': 'GBK', 'ISO 2022 IR 144': 'iso_ir_144', 'ISO_IR 127': 'iso_ir_127'}
>>>
>>> charset.python_encoding['ISO 2022 IR 101']
'iso8859_2'
---------------------------------------------------------------------------------------

Thanks for your help.

Alessandro f.

Ed McDonagh

unread,
Jun 22, 2021, 3:42:04 AM6/22/21
to Alessandro Fracchetti, OpenREM
Did you restart Celery after you changed the charset.py file Alessandro?

Kind regards

Ed

Alessandro Fracchetti

unread,
Jun 22, 2021, 4:23:25 AM6/22/21
to OpenREM
No... now when restarting celery, I no longer have the error!!!

Thanks for your support!
Best regards,
 Alessandro f.

Ed McDonagh

unread,
Jun 22, 2021, 4:59:00 AM6/22/21
to Alessandro Fracchetti, OpenREM
Thank goodness! Sorry I forgot to ask that question at the start! 

Celery imports all the modules when it starts, and doesn't re-read them again until it next starts. As the task in question is an asynchronous Celery job, we didn't see the changes that had been made until it was next started.

Reply all
Reply to author
Forward
0 new messages