problem getting conquest to process the dicom into OpenREM

164 views
Skip to first unread message

fozz...@gmail.com

unread,
Sep 11, 2017, 7:47:02 AM9/11/17
to OpenREM

Hi has anybody got any Ideas?  This is a first time install of OpenREM with Conquest on Ubuntu

Following the installation manual and I’m extremely impressed by the detail.   

 

I have come up against a problem and can’t for the life of me understand what’s happening.  I am using KPACS to send Philips CT Dicom files to Conquest which is then failing to process the files into OpenREM


  • By commenting out the “destroy”  command   from  /etc/conquest-dicom-server/dicom.ini file
  •  And commenting out “rm ${philipsim}” from /etc/conquest-dicom-servers/openrem-ctphilips.sh

I can see the files in /var/lib/conquest-dicom-server/incoming, this is telling me that  dicom.ini and openrem-ctphilips.sh are being called okay.


I can then process the files into OpenREM manually by


  • “/etc/conquest-dicom-server/openrem-ctphilips.sh /var/lib/conquest-dicom-server/incoming/1.2.840.113704.7.1.1.2164.1504531002.502.dcm”

It looks to me as though openrem-ctphilips.sh is failing to call /usr/local/lib/python2.7/dist-packages/openrem/scripts/openrem_ctphilips.py when conquest is calling open-ctphilips.sh


 Looks like a security problem but not sure? 

 

Any help appreciated.


regards


Paul Foster

Ed McDonagh

unread,
Sep 11, 2017, 8:00:11 AM9/11/17
to fozz...@gmail.com, OpenREM
Hi Paul.

Can you share the lines from the bottom of your dicom.ini file and the contents of your openrem-ctphilips.sh file please? Also, the MAG0 location in dicom.ini.

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+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/openrem.
For more options, visit https://groups.google.com/d/optout.

fozz...@gmail.com

unread,
Sep 11, 2017, 11:06:33 AM9/11/17
to OpenREM

Many thanks Ed.  


The Dicom.ini file, I have only included the  Philips importconverter with MAG0


# Philips CT

ImportConverter5  = ifequal "%V0008,0016","1.2.840.10008.5.1.4.1.1.7"; {save to /var/lib/conquest-dicom-server/incoming/%o.dcm; system /etc/conquest-dicom-server/openrem-ctphilips.sh /var/lib/conquest-dicom-server/incoming/%o.dcm;}


#MAG0 details

 #Configuration of disk(s) to store images

MAGDeviceThreshhold      = 0

MAGDevices               = 1

MAGDevice0               = /var/lib/conquest-dicom-server/MAG0/

 

 

 

 

/etc/conquest-dicom-server/openrem-ctphilips.sh

 

#!/bin/sh

#usage:./openrem-ctphilips.sh  file path and name

 

philipsim="$1"

 

#setup the python virtual environment - we are not using commented out

#./var/dose/venv/bin/active

 

openrem_ctphilips.py ${philipsim}

 

#rm ${philipsim} commented out for testing

 

Regards


Paul Foster

Ed McDonagh

unread,
Sep 11, 2017, 5:46:29 PM9/11/17
to fozz...@gmail.com, OpenREM
Which user is conquest running as, and what are the permission settings on the shell script?

--

fozz...@gmail.com

unread,
Sep 12, 2017, 4:42:19 AM9/12/17
to OpenREM
Thanks again Ed.


  The Conquest service is running as user _conquest as can be seen below

      clip from dgate's  init.d

      
                          PATH=/sbin:/usr/sbin:/bin:/usr/bin
                          ETCDIR=/etc/$PACKAGE
                          LOGDIR=/var/log/$PACKAGE
                          USER=_conquest
                          GROUP=_conquest
                          NAME=dgate
                          DAEMON=/usr/bin/$NAME # Introduce the server's location here

  and ps -ef
                         _conque+  1488     1  0 Sep11 ?        00:00:09 /usr/bin/dgate -^/var/log/conque


The dgate.log shows that the ImportConverter has run but only shows the  "save", I'm not sure what this is telling me as i'm not sure if it shows all actions

                       on Sep 11 16:04:57 2017 Importconverter5.1 executes: save to /var/lib/conquest-
                                            dicom-server/incoming/1.2.840.113704.7.1.1.2164.1504531002.502.dcm
                        Mon Sep 11 16:04:57 2017 Importconverter6.0: destroyed received image


Many thanks 

Regards

Paul Foster




On Monday, September 11, 2017 at 12:47:02 PM UTC+1, fozz...@gmail.com wrote:

Ed McDonagh

unread,
Sep 12, 2017, 7:40:25 AM9/12/17
to fozz...@gmail.com, OpenREM
Hello again

I was wondering if the _conquest user has execute permissions on the /etc/conquest-dicom-server/openrem-ctphilips.sh file? If that file is owned by your user and group, and the permissions for that file do not have execute set for 'all users', then the _conquest user will not be able to run the file.

If the ownership is as I have suggested, then the file permission needs to be 5 (read and execute) or 7 (read, write and execute) in the last number of the permissions, eg 775. If it isn't, try running: 
sudo chmod a+x /etc/conquest-dicom-server/openrem-ctphilips.sh

This will add execute permission to [a]ll categories. To add it to just 'all users' (though I don't see why you would), you would use o+x, standing for [o]ther.

Ed

--

fozz...@gmail.com

unread,
Sep 12, 2017, 7:56:23 AM9/12/17
to OpenREM
Thanks again Ed.

      I have gone back and check as you suggest but all looks okay :-(

         -r--r--   1 _conquest _conquest   7812 Apr  5  2016 dicom.sql
-rwxr-xr-x   1 _conquest openrem      240 Sep 11 11:18 openrem-ctphilips.sh*
-rwxr-xr-x   1 _conquest openrem      203 Sep 11 09:49 openrem-dx.sh*
-rwxr-xr-x   1 _conquest openrem      210 Sep 11 09:50 openrem-mg.sh*
-rwxr-xr-x   1 _conquest openrem      209 Sep 11 09:50 openrem-rdsr.sh*

while playing around to get this working i also added openrem, www-data, _conquest to the openrem group.

I have another look later today, I'm sure its a security problem.

Regards

Paul Foster



On Monday, September 11, 2017 at 12:47:02 PM UTC+1, fozz...@gmail.com wrote:

Ed McDonagh

unread,
Sep 12, 2017, 8:08:43 AM9/12/17
to fozz...@gmail.com, OpenREM
What about the ownership and permissions for the openrem_ctphilips.py file ('which openrem_ctphilips.py' to make sure you are looking at the right file)

--

fozz...@gmail.com

unread,
Sep 18, 2017, 7:01:25 AM9/18/17
to OpenREM
Many thanks again Ed.


   Sorry its been a while.   Python is looking in  /usr/local/bin I have changed the permissions and had a good dig around but cant find whats going on

   penrem@ONC-OPENREM1:/usr/local/bin$ ll
total 88
drwxr-xr-x  2 root      root    4096 Sep  8 09:07 ./
drwxr-xr-x 10 root      root    4096 Aug  1 12:17 ../
-rwxr-xr-x  1 _conquest openrem  216 Sep  8 09:06 celery*
-rwxr-xr-x  1 _conquest openrem  265 Sep  8 09:07 django-admin*
-rwxr-xr-x  1 _conquest openrem  124 Sep  8 09:07 django-admin.py*
-rw-r--r--  1 _conquest openrem  305 Sep  8 09:06 django-admin.pyc
-rwxrwxrwx  1 _conquest openrem  640 Sep  8 09:07 openrem_ctphilips.py*
-rw-rw-rw-  1 _conquest openrem  867 Sep  8 09:07 openrem_ctphilips.pyc
-rwxr-xr-x  1 _conquest openrem  557 Sep  8 09:07 openrem_dx.py*
-rw-rw-rw-  1 _conquest openrem  788 Sep  8 09:07 openrem_dx.pyc
-rwxr-xr-x  1 _conquest openrem  612 Sep  8 09:07 openrem_mg.py*
-rw-rw-rw-  1 _conquest openrem  842 Sep  8 09:07 openrem_mg.pyc
-rwxr-xr-x  1 _conquest openrem  468 Sep  8 09:07 openrem_ptsizecsv.py*
-rw-rw-rw-  1 _conquest openrem  655 Sep  8 09:07 openrem_ptsizecsv.pyc
-rwxr-xr-x  1 _conquest openrem  304 Sep  8 09:07 openrem_qr.py*
-rw-rw-rw-  1 _conquest openrem  484 Sep  8 09:07 openrem_qr.pyc
-rwxr-xr-x  1 _conquest openrem  642 Sep  8 09:07 openrem_rdsr.py*
-rw-rw-rw-  1 _conquest openrem  875 Sep  8 09:07 openrem_rdsr.pyc
-rwxr-xr-x  1 _conquest openrem  597 Sep  8 09:07 openrem_store.py*
-rw-rw-rw-  1 _conquest openrem  832 Sep  8 09:07 openrem_store.pyc
-rwxr-xr-x  1 _conquest openrem 1952 Sep  8 09:06 vba_extract.py*
-rw-r--r--  1 _conquest openrem 1347 Sep  8 09:06 vba_extract.pyc

Does this look right?  

Regards

Paul


On Monday, September 11, 2017 at 12:47:02 PM UTC+1, fozz...@gmail.com wrote:

Ed McDonagh

unread,
Sep 18, 2017, 5:45:40 PM9/18/17
to fozz...@gmail.com, OpenREM
It looks ok to me Paul.

Can you switch user to _conquest (sudo -s -u _conquest) and try to run /usr/local/bin/openrem_ctphilips.py

Also, can you show me the contents of /usr/local/bin/openrem_ctphilips.py

Ed

--

fozz...@gmail.com

unread,
Sep 20, 2017, 5:01:28 AM9/20/17
to OpenREM
Thanks Ed,

    I have done as you have suggested and change all the file and dir permission to a=rwx for the /usr/local/lib/python2.7/dist-packages/openrem,  /usr/local/lib/python2.7/dist-packages/celery and /usr/local/lib I have also changed the owner to _conquest 

There are errors from 
_conquest@ONC-OPENREM1:/$ /usr/local/bin/openrem_ctphilips.py /var/lib/conquest-dicom-server/incoming/1.2.840.113704.7.1.1.1232.1504604798.257.dcm 


traceback (most recent call last):
  File "/usr/local/bin/openrem_ctphilips.py", line 23, in <module>
    ct_philips(filename)
  File "/usr/local/lib/python2.7/dist-packages/celery/local.py", line 191, in __call__
    return self._get_current_object()(*a, **kw)
  File "/usr/local/lib/python2.7/dist-packages/celery/app/task.py", line 380, in __call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/openrem/remapp/extractors/ct_philips.py", line 340, in ct_philips
    import dicom
ImportError: No module named dicom



Where is the dicom module?  Do I need to set the permission on the file containing this module?

Everything works as it should for the openrem user but not the _conquest user :-(.

Many thanks
Regards


Paul

On Monday, September 11, 2017 at 12:47:02 PM UTC+1, fozz...@gmail.com wrote:

Ed McDonagh

unread,
Sep 20, 2017, 8:00:08 AM9/20/17
to fozz...@gmail.com, OpenREM
Hmmm. dicom will be in  "/usr/local/lib/python2.7/dist-packages/dicom/". The import error suggests that there might be a path problem?

But that doesn't make sense to me. You can obviously run python from both users (you might want to just check!), which would mean that "/usr/bin" will be on each user's path. And I don't think that the python path would be user specific!

To make sure, for both users, launch python in a shell ("python"), then try "import dicom" and "import sys" followed by "sys.path" and see if there are any differences.




--

Ed McDonagh

unread,
Sep 20, 2017, 8:00:28 AM9/20/17
to fozz...@gmail.com, OpenREM
Sorry, sys.path()

fozz...@gmail.com

unread,
Sep 20, 2017, 11:09:31 AM9/20/17
to OpenREM
Thanks Ed,

  Looks like the _conquest user is not able to import dicom and has '/home/openrem/.local/lib/python2.7/site-packages' missing from the Path as can been seen below

_conquest@ONC-OPENREM1:/$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dicom
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named dicom
>>> import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',                               '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>>> 

compared to

openrem@ONC-OPENREM1:/$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dicom
>>> import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/openrem/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']


Could this be because Conquest was installed after OpenREM?

Im not sure how to correct this any guidance will be appreciated?

Regards

Paul Foster


On Monday, September 11, 2017 at 12:47:02 PM UTC+1, fozz...@gmail.com wrote:

fozz...@gmail.com

unread,
Sep 20, 2017, 11:23:33 AM9/20/17
to OpenREM
Having another dig around there is no /home/_conquest should there be after a Conquest install?  I don't there needs to be.

Ed you previously  suggested Dicom was here "/usr/local/lib/python2.7/dist-packages/dicom/" 

but for my install its here "/home/openrem/.local/lib/python2.7/site-packages/dicom" with a bunch of other Python related stuff

When I get a chance I'll make a copy here "/usr/local/lib/python2.7/dist-packages/dicom/" 

Regards

Paul


On Monday, September 11, 2017 at 12:47:02 PM UTC+1, fozz...@gmail.com wrote:

Ed McDonagh

unread,
Sep 20, 2017, 11:59:02 AM9/20/17
to fozz...@gmail.com, OpenREM
I think you have found the problem. You have installed the python packages without using sudo (and therefore are in your home directory, not in /usr/lib/python2.7) and without using a virtualenv.

I would want to do one or the other - either install using sudo so the packages are central, or better install a virtualenv and activate that. To create a virtualenv, simply create a folder, for example /var/lib/openrem/venv and then use the command virtualenv /var/lib/openrem/venv

You can then activate the venv in your current shell by using the command ".  /var/lib/openrem/venv/bin/activate" and install netdicom and openrem as usual. The example conquest scripts also have the virtualenv activation in I think.

The _conquest user deliberately doesn't have a home directory.

--
Reply all
Reply to author
Forward
0 new messages