Welcome to OpenREM’s documentation!

OpenREM logo

OpenREM is an opensource framework created for the purpose of radiation exposure monitoring. The software is capable of importing and displaying data from a wide variety of x-ray dose related sources, and then enables easy export of the data in a form that is suitable for further analysis by suitably qualified medical physics personnel.

Please see openrem.org for more details.

Contents:

Installation instructions

OpenREM can be installed with a single command; however, there are two prerequisites that need to be installed first – python and pip – and RabbitMQ needs to be installed for exports and patient size imports to work.

New to this version, NumPy needs to be installed if you want charts, and a specific version of PyNetDICOM needs to be installed for the DICOM C-Store function.

Once installed, there are a few configuration choices that need to be made, and finally a couple of services that need to be started. Then you are ready to go!

Install the prerequisites

Install Python 2.7.x

Add Python and the scripts folder to the path

Windows only – this is usually automatic in linux

Add the following to the end of the path environment variable (to see how to edit the environment variables, see http://www.computerhope.com/issues/ch000549.htm):

;C:\Python27\;C:\Python27\Scripts\

Setuptools and pip

Install setuptools and pip – for details go to http://www.pip-installer.org/en/latest/installing.html. The quick version is as follows:

Linux

Download the latest version using the same method as for Windows, or get the version in your package manager, for example:

sudo apt-get install python-pip

Windows

Download the installer script get-pip.py and save it locally – right click and Save link as... or equivalent.

Open a command window (Start menu, cmd.exe) and navigate to the place you saved the get‑pip.py file:

python get-pip.py
Quick check of python and pip

To check everything is installed correctly so far, type the following in a command window/shell. You should have the version number of pip returned to you:

pip -V

Install RabbitMQ

For either install, just follow the defaults – no special configurations required.

Note

Before continuing, consider virtualenv

Install NumPy

(New for version 0.6.0)

Numpy is required for charts. OpenREM will work without NumPy, but charts will not be displayed.

For linux:

sudo apt-get install python-numpy
# If using a virtualenv, you might need to also do:
pip install numpy

For Windows, there are various options:

  1. Download executable install file from SourceForge:

    • Download a pre-compiled Win32 .exe NumPy file from http://sourceforge.net/projects/numpy/files/NumPy/. You need to download the file that matches the Python version, which should be 2.7. At the time of writing the latest version was 1.9.2, and the filename to download was numpy-1.9.2-win32-superpack-python2.7.exe. The filename is truncated on SourceForge, so you may need to click on the i icon to see which is which. It’s usually the third superpack.
    • Run the downloaded binary file to install NumPy.
  2. Or download a pip installable wheel file:

    • Download NumPy from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy - numpy‑1.9.2+mkl‑cp27‑none‑win32.whl is likely to be the right version, unless you have 64bit Python installed, in which case use the numpy‑1.9.2+mkl‑cp27‑none‑win_amd64.whl version instead.

    • Install using pip:

      pip install numpy‑1.9.2+mkl‑cp27‑none‑win32.whl
      

Install pynetdicom

(New for version 0.6.0)

Pynetdicom is used for the new DICOM store SCP function that is available as a preview in this release. See DICOM Networking in OpenREM for details.

pip install https://bitbucket.org/edmcdonagh/pynetdicom/get/default.tar.gz#egg=pynetdicom-0.8.2b2

Install and configure OpenREM

pip install openrem

Will need ``sudo`` or equivalent if installing on linux without using a virtualenv

Configure

Locate install location

  • Linux: /usr/local/lib/python2.7/dist-packages/openrem/ or /usr/lib/python2.7/site-packages/openrem/
  • Windows: C:\Python27\Lib\site-packages\openrem\

There are two files that need renaming:

  • openremproject/local_settings.py.example to openremproject/local_settings.py
  • openremproject/wsgi.py.example to openremproject/wsgi.py

In the local_settings.py file, set the database details, the MEDIA_ROOT path, the secret key and the ALLOWED_HOSTS.

Note

Windows notepad will not recognise the Unix style line endings. Please use an editor such as Notepad++ or Notepad2 if you can, else use WordPad – on the View tab you may wish to set the Word wrap to ‘No wrap’

Database settings

For testing you can use the SQLite3 database

'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/ENTER/PATH/WHERE/DB/FILE/CAN/GO',
  • Linux example: 'NAME': '/home/user/openrem/openrem.db',
  • Windows example: 'NAME': 'C:/Users/myusername/Documents/OpenREM/openrem.db', Note use of forward slash in configuration files

For production use, see Database options below

Location setting for imports and exports

Csv and xlsx study information exports and patient size csv imports are written to disk at a location defined by MEDIA_ROOT.

The path set for MEDIA_ROOT is up to you, but the user that runs the webserver must have read/write access to the location specified because it is the webserver than reads and writes the files. In a debian linux, this is likely to be www-data for a production install. Remember to use forward slashes for the config file, even for Windows.

Linux example:

MEDIA_ROOT = "/var/openrem/media/"

Windows example:

MEDIA_ROOT = "C:/Users/myusername/Documents/OpenREM/media/"
Secret key

Generate a new secret key and replace the one in the local_settings.py file. You can use http://www.miniwebtool.com/django-secret-key-generator/ for this.

Allowed hosts

The ALLOWED_HOSTS needs to be defined, as the DEBUG mode is now set to False. This needs to contain the server name or IP address that will be used in the URL in the web browser. For example:

ALLOWED_HOSTS = [
    '192.168.56.102',
    '.doseserver.',
    'localhost',
]

A dot before a hostname allows for subdomains (eg www.doseserver), a dot after a hostname allows for FQDNs (eg doseserver.ad.trust.nhs.uk). Alternatively, a single '*' allows any host, but removes the security the feature gives you.

DICOM networking

See DICOM Networking in OpenREM

Create the database

Linux:

python /usr/local/lib/python2.7/dist-packages/openrem/manage.py syncdb

Windows:

python C:\Python27\Lib\site-packages\openrem\manage.py syncdb

Answer each question as it is asked, do setup a superuser. This username and password wil be used to log into the admin interface to create the usernames for using the web interface. See the Start using it! section below.

For production installs, convert to South

(What is south?)

Linux:

python /usr/local/lib/python2.7/dist-packages/openrem/manage.py convert_to_south remapp

Windows:

python C:\Python27\Lib\site-packages\openrem\manage.py convert_to_south remapp

Start all the services

Start test web server

Linux:

python /usr/local/lib/python2.7/dist-packages/openrem/manage.py runserver --insecure

Windows:

python C:\Python27\Lib\site-packages\openrem\manage.py runserver --insecure

If you are using a headless server and need to be able to see the web interface from another machine, use python /usr/lib/python2.7/dist-packages/openrem/manage.py runserver x.x.x.x:8000 --insecure (or Windows equivalent) replacing the x with the IP address of the server and 8000 with the port you wish to use.

Open the web addesss given, appending /openrem (http://localhost:8000/openrem)

Note

Why are we using the --insecure option? With DEBUG mode set to True the test web server would serve up the static files. In this release, DEBUG mode is set to False, which prevents the test web server serving those files. The --insecure option allows them to be served again.

Start the Celery task queue

Celery will have been automatically installed with OpenREM, and along with RabbitMQ allows for asynchronous task processing for imports and exports.

Note

The webserver and Celery both need to be able to read and write to the MEDIA_ROOT location. Therefore you might wish to consider starting Celery using the same user or group as the webserver, and setting the file permissions accordingly.

In a new shell:

Linux:

cd /usr/local/lib/python2.7/dist-packages/openrem/
celery -A openremproject worker -l info

Windows:

cd C:\Python27\Lib\site-packages\openrem\
celery -A openremproject worker -l info

For production use, see Daemonising Celery below

Preview feature: Start the DICOM Store SCP

See DICOM Networking in OpenREM

Start using it!

Add some data!

openrem_rdsr.py rdsrfile.dcm

Add some users (New in version 0.4.0)

  • Go to the admin interface (eg http://localhost:8000/admin) and log in with the user created when you created the database (syncdb)

  • Create some users and add them to the appropriate groups (if there are no groups, go to the OpenREM homepage and they should be created).

    • viewgroup can browse the data only
    • exportgroup can do as view group plus export data to a spreadsheet
    • admingroup can delete studies and import height and weight data in addition to anything the export group can do
  • Return to the OpenREM interface (eg http://localhost:8000/openrem) and log out of the superuser in the top right corner and log in again using one of the new users you have just created.

Further instructions

Database options

SQLite is great for getting things running quickly and testing if the setup works, but is really not recommended for production use on any scale. Therefore it is recommended to use a different database such as PostgreSQL or MySQL.

Here are instructions for installing PostgreSQL on linux and on Windows:

Installing PostgreSQL for OpenREM on Ubuntu linux
Install PostgreSQL and the python connector
  • sudo apt-get install postgresql
  • sudo apt-get build-dep python-psycopg2

The second command installed a lot of things, at least some of which are necessary for this to work!

If you are using a virtualenv, make sure you are in it and it is active (source bin/activate)

  • pip install psycopg2
Create a user for the database
  • sudo passwd postgres
  • Enter password, twice
  • sudo -u postgres createuser -P openrem_user
  • Enter password, twice
  • Superuser, No
  • Create databases, No
  • Create new roles, No
Optional: Specify the location for the database

You might like to do this if you want to put the database on an encrypted location

For this example, I’m going to assume all the OpenREM programs and data are in the folder /var/openrem/:

  • sudo /etc/init.d/postgresql stop
  • mkdir /var/openrem/database
  • sudo cp -aRv /var/lib/postgresql/9.1/main /var/openrem/database/
  • sudo nano /etc/postgresql/9.1/main/postgresql.conf
Change the line
  • data_directory = '/var/lib/postgresql/9.1/main' to
  • data_directory = '/var/openrem/database/main'
  • sudo /etc/init.d/postgresql start
Create the database
  • su postgres
  • psql template1
  • CREATE DATABASE openrem_db OWNER openrem_user ENCODING 'UTF8';
  • \q
  • exit
Change the security configuration

The default security settings are too restrictive to allow access to the database.

  • sudo nano /etc/postgresql/9.1/main/pg_hba.conf

  • Add the following line:
    • local openrem_db openrem_user md5
  • sudo /etc/init.d/postgresql restart

Configure OpenREM to use the database
Find and edit the settings file, eg
  • nano local/lib/python2.7/site-packages/openrem/openremproject/local_settings.py
Set the following (changing name, user and password as appropriate):
  • 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  • 'NAME': 'openrem_db',
  • 'USER': 'openremuser',
  • 'PASSWORD': 'openrem_pw',
Fire it up with OpenREM
  • python path/to/openrem/manage.py syncdb
  • python path/to/openrem/manage.py convert_to_south remapp
Installing PostgreSQL for OpenREM on Windows

Note

Author JA Cole

Get PostgreSQL and the python connector
Install PostgreSQL

Run the the postgresql installer. It will ask for a location. Ensure the “data” directory is not under “Program Files” as this can cause permissions errors. Enter a superuser password when prompted. Make sure you keep this safe as you will need it.

Create a user and database

Open pgAdmin III

  • Click on servers to expand
  • Double click on PostgreSQL 9.3
  • Enter your superuser password
  • Right click on “login roles” and choose “New login role”
  • Create the openremuser (or whatever you want your user to be called) and under definition add a password.
  • Click OK
  • Right click on databases and choose “New database”
  • Name the database (openremdb is fine) and assign the the owner to the user you just created.
Install psycopg2

Run the installer you downloaded for psycopg2 earlier.

Configure OpenREM to use the database
Find and edit the settings file (notepad works fine). The path depends on your python install, but could be something like:
  • C:\lib\python2.7\site-packages\openrem\openremproject\local_settings.py
Set the following (changing name, user and password as appropriate):
  • 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  • 'NAME': 'openrem_db',
  • 'USER': 'openremuser',
  • 'PASSWORD': 'openrem_pw',
Fire it up with OpenREM
  • python path/to/openrem/manage.py syncdb
  • python path/to/openrem/manage.py convert_to_south remapp
Fix ‘’ value too long for type character varying(50)’’ error

This error is caused by the django auth_permissions system not being able to cope with long names in the models.

  • Open pgAdmin III
  • Open Servers
  • Open databases
  • Open the openrem database
  • Open schemas
  • Open public
  • Open tables
  • right click on auth_permission
  • Select properties
  • Change ‘’name’’ to ‘’varying(100)’’ from ‘’varying(50)’‘

Then run python path/to/openrem/manage.py syncdb again.

Database migrations

South is a django application to manage database migrations. Using South means that future changes to the database model can be calculated and executed automatically with simple commands when OpenREM is upgraded.

Production webservers

Unlike the database, the production webserver can be left till later and can be changed again at any time.

For performance it is recommended that a production webserver is used instead of the inbuilt ‘runserver’. Popular choices would be either Apache or you can do as the cool kids do and use Gunicorn with nginx.

The django website has instructions and links to get you set up with Apache.

Daemonising Celery

In a production environment, Celery will need to start automatically and not depend on a particular user being logged in. Therefore, much like the webserver, it will need to be daemonised. For now, please refer to the instructions and links at http://celery.readthedocs.org/en/latest/tutorials/daemonizing.html.

Virtualenv and virtualenvwrapper

If the server is to be used for more than one python application, or you wish to be able to test different versions of OpenREM or do any development, it is highly recommended that you use virtualenv or maybe virtualenvwrapper

Virtualenv sets up an isolated python environment and is relatively easy to use.

If you do use virtualenv, all the paths referred to in the documentation will be changed to:

  • Linux: lib/python2.7/site-packages/openrem/
  • Windows: Lib\site-packages\openrem

In Windows, even when the virtualenv is activated you will need to call python and provide the full path to script in the Scripts folder. If you call the script (such as openrem_rdsr.py) without prefixing it with python, the system wide Python will be used instead. This doesn’t apply to Linux, where once activated, the scripts can be called without a python prefix from anywhere.

Release Notes v0.6.0

Headline changes

  • Charts
  • Preview of DICOM Store SCP functionality
  • Exports available to import into OpenSkin
  • Modalities with no data are hidden in the user interface
  • Mammography import compression force behaviour changed
  • Import of Toshiba planar RDSRs fixed

Changes for 0.6.2

Minor update due prevent new installs from installing a non-compatible version of django-filter. The link to OpenSkin has also been updated in the fluoroscopy detail page.

There is no advantage to updating to this version over 0.6.0

Release 0.6.1 was just a documentation only change to update the link to OpenSkin.

Preparing for the upgrade

Convert to South

Make sure you have converted your database to South before attempting an upgrade

Quick reminder of how, if you haven’t done it already

# Linux: Debian/Ubuntu and derivatives
python /usr/local/lib/python2.7/dist-packages/openrem/manage.py convert_to_south remapp
# Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
python /usr/local/lib/python2.7/site-packages/openrem/manage.py convert_to_south remapp

# Windows, assuming no virtualenv
python C:\Python27\Lib\site-packages\openrem\manage.py convert_to_south remapp

Additional installs

OpenREM requires two additional programs to be installed to enable the new features: Numpy for charts, and pynetdicom for the DICOM Store Service Class Provider. Note that the version of pynetdicom must be later than the current pypi release!

Install NumPy

For linux:

sudo apt-get install python-numpy
# If using a virtualenv, you might need to also do:
pip install numpy

For Windows, there are various options:

  1. Download executable install file from SourceForge:

    • Download a pre-compiled Win32 .exe NumPy file from http://sourceforge.net/projects/numpy/files/NumPy/. You need to download the file that matches the Python version, which should be 2.7. At the time of writing the latest version was 1.9.2, and the filename to download was numpy-1.9.2-win32-superpack-python2.7.exe. The filename is truncated on SourceForge, so you may need to click on the i icon to see which is which. It’s usually the third superpack.
    • Run the downloaded binary file to install NumPy.
  2. Or download a pip installable wheel file:

    • Download NumPy from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy - numpy‑1.9.2+mkl‑cp27‑none‑win32.whl is likely to be the right version, unless you have 64bit Python installed, in which case use the numpy‑1.9.2+mkl‑cp27‑none‑win_amd64.whl version instead.

    • Install using pip:

      pip install numpy‑1.9.2+mkl‑cp27‑none‑win32.whl
      
Install pynetdicom
pip install https://bitbucket.org/edmcdonagh/pynetdicom/get/default.tar.gz#egg=pynetdicom-0.8.2b2

Upgrading from versions prior to 0.5.1

You must upgrade to 0.5.1 first. Instructions for doing this can be found in the OpenREM Release Notes version 0.5.1.

Upgrading from version 0.5.1

  • Back up your database

  • The 0.6.0 upgrade must be made from a 0.5.1 (or later) database, and a schema migration is required:

pip install openrem==0.6.0

# Linux: Debian/Ubuntu and derivatives
python /usr/local/lib/python2.7/dist-packages/openrem/manage.py schemamigration --auto remapp
python /usr/local/lib/python2.7/dist-packages/openrem/manage.py migrate remapp
# Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
python /usr/local/lib/python2.7/site-packages/openrem/manage.py schemamigration --auto remapp
python /usr/local/lib/python2.7/site-packages/openrem/manage.py migrate remapp
# Windows:
python C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp
python C:\Python27\Lib\site-packages\openrem\manage.py migrate remapp
  • Restart the services

    • Restart the webserver
    • Restart Celery

Summary of new features

Charts

Release 0.6.0 has a range of charting options available for CT and radiographic data. These charts allow visualisation of trends and frequencies to inform surveys and monitor performance. For more information, please see Charts.

DICOM Store Service Class Provider

OpenREM can now act as the DICOM Store service, allowing direct sending of DICOM objects from modalities to OpenREM without needing to use Conquest or any other DICOM Store SCP. This feature is a preview as it hasn’t been extensively tested, but it is expected to work. For more information, please see DICOM Networking in OpenREM.

Exports for OpenSkin

Fluoroscopy studies can now be exported in a format suitable for importing into Jonathan Cole’s OpenSkin software. The export link is on the fluoroscopy study detail page. The software for creating the exposure incidence map can be downloaded from https://bitbucket.org/jacole/openskin/downloads (choose the zip file), and information about the project can be found on the OpenSkin wiki. The software allows the user to choose between a 2D phantom that would represent the dose to a film laying on the couch surface, or a simple 3D phantom made up of a cuboid and two semi-cylinders (these can be seen on the Phantom design section of the wiki). For both options the output is an image of the dose distribution in 2D, along with calculated peak skin dose information.

Automatic hiding of unused modality types

A fresh install of OpenREM will no longer show any of the four modality types in the tables or in the navigation bar at the top. As DICOM objects are ingested, the appropriate tables and navigation links are created.

Therefore a site that has no mammography for example will no longer have that table or navigation link in their interface.

Mammography import compression force change

Prior to version 0.6, the compression force extracted from the mammography image header was divided by ten before being stored in the database. This was because the primary author only had access to GE Senograph DS units, which store the compression force in dN, despite claiming using Newtons in the DICOM conformance statement.

The code now checks for the term senograph ds contained in the model name. If it matches, then the value is divided by ten. Otherwise, the value is stored without any further change. We know that later GE units, the GE Senograph Essential for example, and other manufacturer’s units store this value in N. If you have a case that acts like the Senograph DS, please let us know and we’ll try and cater for that.

If you have existing non-GE Senograph mammography data in your database, the compression force field for those studies is likely to be incorrect by a factor of ten (it will be too small). Studies imported after the upgrade will be correct. If this is a problem for you, please let us know and we’ll see about writing a script to correct the existing data.

Import of Toshiba Planar RDSRs fixed

Toshiba include Patient Orientation and Patient Orientation Modifier information in their cath lab RDSRs. The extractor code was deficient for this as the RDSRs previously used didn’t have this information. This has now been fixed. There might however be an issue with Station Name not being provided - it is not yet clear if this is a configuration issue.

Previous Release Notes and Change Log

Version history change log

OpenREM version history

0.6.2 (2016-01-27)
  • `#347`_ Django-filter v0.12 has minimum Django version of 1.8, fixed OpenREM 0.6.2 to max django-filter 0.11
  • `#341`_ Changed references to the OpenSkin repository for 0.6 series.
0.6.1 (2015-10-30
  • #303 Corrected name of Store SCP command in docs
0.6.0 (2015-05-14)
  • #227 Fixed import of RDSRs from Toshiba Cath Labs
  • #226 Charts: Updated Highcharts code and partially fixed issues with CTDIvol and DLP combined chart
  • #225 Charts: Added link from mAs and kVp histograms to associated data
  • #224 Charts: Added link from CTDIvol histograms to associated data
  • #221 Charts: Fixed issue where filters at acquisition event level were not adequately restricting the chart data
  • #219 Charts: Fixed issue where some charts showed data beyond the current filter
  • #217 Charts: Code optimised to speed up calculation time
  • #216 Fixed typo that prevented import of RSDR when DICOM store settings not present
  • #215 Charts: Fixed x-axis labels for mean dose over time charts
  • #214 Charts: Improved consistency of axis labels
  • #213 Fixed admin menu not working
  • #212 Charts: Created off-switch for charts
  • #210 OpenSkin exports documented
  • #209 Charts: Fixed server error when CT plots switched off and filter form submited
  • #208 Charts: Fixed blank chart plotting options when clicking on histogram tooltip link
  • #205 Charts: Fixed issue of histogram tooltip links to data not working
  • #204 Charts: Fixed issue of not being able to export with the charts features added
  • #203 Charts: Fixed display of HTML in plots issue
  • #202 Charts: Added mean CTDIvol to charts
  • #200 Charts: Now exclude Philips Ingenuity SPRs from plots
  • #196 Added comments and entrance exposure data to DX export
  • #195 Fixed error with no users on fresh install
  • #194 Added more robust extraction of series description from DX
  • #193 Charts: Fixed reset of filters when moving between pages
  • #192 Created RF export for OpenSkin
  • #191 Charts: Factored out the javascript from the filtered.html files
  • #190 Charts: Added time period configuration to dose over time plots
  • #189 Charts: Fixed plotting of mean doses over time when frequency not plotted
  • #187 Charts: Merged the charts work into the main develop branch
  • #186 Fixed duplicate data in DX exports
  • #179 Charts: Added kVp and mAs plots for DX
  • #177 Charts: Fixed issue with date ranges for DX mean dose over time charts
  • #176 Charts: Added link to filtered dataset from mean dose over time charts
  • #175 Charts: Allowed configuration of the time period for mean dose trend charts to improve performance
  • #174 Charts: Fixed number of decimal places for mean DLP values
  • #173 Charts: Fixed plot of mean DLP over time y-axis issue
  • #170 Charts: Added plot of mean dose over time
  • #169 Charts: Improved chart colours
  • #157 Charts: Added chart showing number of studies per day of the week, then hour in the day
  • #156 Charts: Fixed issue with some protocols not being displayed
  • #155 Charts: Added chart showing relative frequency of protocols and study types
  • #140 Charts: Added configuration options
  • #139 Charts: Link to filtered dataset from histogram chart
  • #138 Charts: Number of datapoints displayed on tooltip
  • #135 Mammography compression force now only divides by 10 if model contains senograph ds Change in behaviour
  • #133 Documented installation of NumPy, initially for charts
  • #41 Preview of DICOM Store SCP now available
  • #20 Modality sections are now suppressed until populated
0.5.1 (2015-03-12)
  • #184 Documentation for 0.5.1
  • #180 Rename all reverse lookups as a result of #62
  • #178 Added documentation regarding backing up and restoring PostgreSQL OpenREM databases
  • #172 Revert all changes made to database so #62 could take place first
  • #165 Extract height and weight from DX, height from RDSR, all if available
  • #161 Views and exports now look for accumulated data in the right table after changes in #159 and #160
  • #160 Created the data migration to move all the DX accumulated data from TID 10004 to TID 10007
  • #159 Modified the DX import to populate TID 10007 rather than TID 10004. RDSR RF already populates both
  • #158 Demo website created by DJ Platten: http://demo.openrem.org/openrem
  • #154 Various decimal fields are defined with too few decimal places - all have now been extended.
  • #153 Changed home page and modality pages to have whole row clickable and highlighted
  • #150 DJ Platten has added Conquest configuration information
  • #137 Carestream DX multiple filter thickness values in a DS VR now extracted correctly
  • #113 Fixed and improved recording of grid information for mammo and DX and RDSR import routines
  • #62 Refactored all model names to be less than 39 characters and be in CamelCase to allow database migrations and to come into line with PEP 8 naming conventions for classes.
0.5.0 (2014-11-19)
  • Pull request from DJ Platten: Improved display of DX data and improved export of DX data
  • #132 Fixed mammo export error that slipped in before the first beta
  • #130 Only creates ExposureInuAs from Exposure if Exposure exists now
  • #128 Updated some non-core documentation that didn’t have the new local_settings.py reference or the new openremproject folder name
  • #127 DX IOD studies with image view populated failed to export due to lack of conversion to string
  • #126 Documentation created for the radiographic functionality
  • #125 Fixes issue where Hologic tomo projection objects were dropped as they have the same event time as the 2D element
  • #123 Fixed issue where filters came through on export as lists rather than strings on some installs
  • #122 Exports of RF data should now be more useful when exporting to xlsx. Will need refinement in the future
  • #26 Extractors created for radiographic DICOM images. Contributed by DJ Platten
  • #25 Views and templates added for radiographic exposures - either from RDSRs or from images - see #26. Contributed by DJ Platten
  • #9 Import of *.dcm should now be available from Windows and Linux alike
0.4.3 (2014-10-01)
  • #119 Fixed issue where Celery didn’t work on Windows. Django project folder is now called openremproject instead of openrem
  • #117 Added Windows line endings to patient size import logs
  • #113 Fixed units spelling error in patient size import logs
  • #112 File system errors during imports and exports are now handled properly with tasks listed in error states on the summary pages
  • #111 Added abort function to patient size imports and study exports
  • #110 Converted exports to use the FileField handling for storage and access, plus modified folder structure.
  • #109 Added example MEDIA_ROOT path for Windows to the install docs
  • #108 Documented ownership issues between the webserver and Celery
  • #107 Documented process for upgrading to 0.4.2 before 0.4.3 for versions 0.3.9 or earlier
  • #106 Added the duration of export time to the exports table. Also added template formatting tag to convert seconds to natural time
  • #105 Fixed bug in Philips CT import where decimal.Decimal was not imported before being used in the age calculation
  • #104 Added documentation for the additional study export functions as a result of using Celery tasks in task #19 as well as documentation for the code
  • #103 Added documentation for using the web import of patient size information as well as the new code
  • #102 Improved handling of attempts to process patient size files that have been deleted for when users go back in the browser after the process is finished
  • #101 Set the security of the new patient size imports to prevent users below admin level from using it
  • #100 Logging information for patient size imports was being written to the database - changed to write to file
  • #99 Method for importing remapp from scripts and for setting the DJANGO_SETTINGS_MODULE made more robust so that it should work out of the box on Windows, debian derivatives and virtualenvs
  • #98 Versions 0.4.0 to 0.4.2 had a settings.py.new file to avoid overwriting settings files on upgrades; renaming this file was missing from the installation documentation for new installs
  • #97 Changed the name of the export views file from ajaxviews as ajax wasn’t used in the end
  • #96 Changed mammo and fluoro filters to use named fields to avoid needing to use the full database path
  • #93 Set the security of the new exports to prevent users below export level from creating or downloading exports
  • #92 Add NHSBSP specific mammography csv export from Jonathan Cole - with Celery
  • #91 Added documentation for Celery and RabbitMQ
  • #90 Added delete function for exports
  • #89 Added the Exports navigation item to all templates, limited to export or admin users
  • #88 Converted fluoroscopy objects to using the Celery task manager after starting with CT for #19
  • #87 Converted mammography objects to using the Celery task manager after starting with CT for #19
  • #86 Digital Breast Tomosynthesis systems have a projections object that for Hologic contains required dosimetry information
  • #85 Fix for bug introduced in #75 where adaption of ptsize import for procedure import broke ptsize imports
  • #74 ‘Time since last study’ is now correct when daylight saving time kicks in
  • #39 Debug mode now defaults to False
  • #21 Height and weight data can now be imported through forms in the web interface
  • #19 Exports are now sent to a task manager instead of locking up the web interface
Reopened issue
  • #9 Issue tracking import using *.dcm style wildcards reopened as Windows cmd.exe shell doesn’t do wildcard expansion, so this will need to be handled by OpenREM in a future version
0.4.2 (2014-04-15)
  • #83 Fix for bug introduced in #73 that prevents the import scripts from working.
0.4.1 (2014-04-15)
  • #82 Added instructions for adding users to the release notes
0.4.0 (2014-04-15)

Note

  • #80 Added docs for installing Apache with auto-start on Windows Server 2012. Contributed by JA Cole
  • #79 Updated README.rst instructions
  • #78 Moved upgrade documentation into the release notes page
  • #77 Removed docs builds from repository
  • #76 Fixed crash if exporting from development environment
  • #75 Fixed bug where requested procedure wasn’t being captured on one modality
  • #73 Made launch scripts and ptsizecsv2db more robust
  • #72 Moved the secret key into the local documentation and added instructions to change it to release notes and install instructions
  • #71 Added information about configuring users to the install documentation
  • #69 Added documentation about the new delete study function
  • #68 Now checks sequence code meaning and value exists before assigning them. Thanks to JA Cole
  • #67 Added ‘Contributing authors’ section of documentation
  • #66 Added ‘Release notes’ section of documentation, incuding this file
  • #65 Added new local_settings.py file for database settings and other local settings
  • #64 Fixed imports failing due to non-conforming strings that were too long
  • #63 The mammography import code stored the date of birth unnecessarily. Also now gets decimal_age from age field if necessary
  • #60 Removed extraneous colon from interface data field
  • #18 Studies can now be deleted from the web interface with the correct login
  • #16 Added user authentication with different levels of access
  • #9 Enable import of *.dcm
0.3.9 (2014-03-08)

Note

#51 includes changes to the database schema – make sure South is in use before upgrading. See http://docs.openrem.org/page/upgrade.html

  • #59 CSS stylesheet referenced particular fonts that are not in the distribution – references removed
  • #58 Export to xlsx more robust - limitation of 31 characters for sheet names now enforced
  • #57 Modified the docs slightly to include notice to convert to South before upgrading
  • #56 Corrected the mammography target and filter options added for issue #44
  • #53 Dates can now be selected from a date picker widget for filtering studies
  • #52 Split the date field into two so either, both or neither can be specified
  • #51 Remove import modifications from issue #28 and #43 now that exports are filtered in a better way after #48 and #49 changes.
  • #50 No longer necessary to apply a filter before exporting – docs changed to reflect this
  • #49 CSV exports changed to use the same filtering routine introduced for #48 to better handle missing attributes
  • #48 New feature – can now filter by patient age. Improved export to xlsx to better handle missing attributes
  • #47 Install was failing on pydicom – fixed upstream
0.3.8 (2014-03-05)
  • – File layout modified to conform to norms
  • #46 Updated documentation to reflect limited testing of mammo import on additional modalities
  • #45 mam.py was missing the licence header - fixed
  • #44 Added Tungsten, Silver and Aluminum to mammo target/filter strings to match – thanks to DJ Platten for strings
  • #43 Mammography and Philips CT import and export now more robust for images with missing information such as accession number and collimated field size
  • #42 Documentation updated to reflect #37
  • #37 Studies now sort by time and date
0.3.7 (2014-02-25)
  • #40 Restyled the filter section in the web interface and added a title to that section
  • #38 Column titles tidied up in Excel exports
  • #36 openrem_ptsizecsv output of log now depends on verbose flag
  • #35 Numbers no longer stored as text in Excel exports
0.3.6 (2014-02-24)
  • #34 Localised scripts that were on remote web servers in default Bootstrap code
  • #33 Documentation now exists for adding data via csv file
  • #24 Web interface has been upgraded to Bootstrap v3
  • #5 Web interface and export function now have some documentation with screenshots
0.3.5-rc2 (2014-02-17)
  • #32 Missing sys import bug prevented new patient size import from working
0.3.5 (2014-02-17)
  • – Prettified this document!
  • #31 Promoted patient size import from csv function to the scripts folder so it will install and can be called from the path
  • #30 Improved patient size import from csv to allow for arbitary column titles and study instance UID in addition to accession number.
  • #29 Corrected the docs URL in the readme
0.3.4-rc2 (2014-02-14)
  • #28 XLSX export crashed if any of the filter fields were missing. Now fills on import with ‘None’
  • #27 Use requested procedure description if requested procedure code description is missing
0.3.4 (2014-02-14)
  • – General improvements and addition of logo to docs
  • #23 Added Windows XP MySQL backup guide to docs
  • #22 Added running Conquest as a Windows XP service to docs
  • #15 Added version number and copyright information to xlsx exports
  • #14 Added version number to the web interface
  • #13 Improve the docs with respect to South database migrations
0.3.3-r2 (2014-02-04)
0.3.3 (2014-02-01)

Note

Installs of OpenREM earlier than 0.3.3 will break on upgrade if the scripts are called from other programs. For example openrem_rdsr is now called openrem_rdsr.py

  • – Added warning of upgrade breaking existing installs to docs
  • #10 Added .py suffix to the scripts to allow them to be executed on Windows (thanks to DJ Platten)
  • #8 Removed superfluous ‘/’ in base html file, harmless on linux, prevented Windows loading stylesheets (thanks to DJ Platten)
  • #7 Added windows and linux path examples for test SQLite database creation
  • #6 Corrected renaming of example files installation instruction (thanks to DJ Platten)
  • #4 Added some text to the documentation relating to importing files to OpenREM
  • #3 Corrected copyright notice in documentation
0.3.2 (2014-01-29)
  • Initial version uploaded to bitbucket.org

Release notes and upgrade instructions

Each release comes with specific upgrade instructions, so please follow the links below for the appropriate version.

Version specific information

OpenREM Release Notes version 0.5.1
Headline changes
  • Major database modification to remove table name length errors
  • Extended the field value lengths to better incorporate all possible values and decimal places
  • Improved import of grid and filter information from DX images
  • Improved DX summary and detail web pages
  • Any item in a row can now be clicked to move between the home and filtered pages
Upgrades: Convert to South

Always make sure you have converted your database to South before attempting an upgrade

Quick reminder of how, if you haven’t done it already

# Linux: Debian/Ubuntu and derivatives
python /usr/local/lib/python2.7/dist-packages/openrem/manage.py convert_to_south remapp
# Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
python /usr/local/lib/python2.7/site-packages/openrem/manage.py convert_to_south remapp

# Windows, assuming no virtualenv
python C:\Python27\Lib\site-packages\openrem\manage.py convert_to_south remapp
Upgrading from before 0.5.0
Upgrading from version 0.3.9 or earlier
  • Back up your database

  • pip install openrem==0.4.2

  • Migrate the schema

    # Linux: Debian/Ubuntu and derivatives
    python /usr/local/lib/python2.7/dist-packages/openrem/manage.py schemamigration --auto remapp
    # Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
    python /usr/local/lib/python2.7/site-packages/openrem/manage.py schemamigration --auto remapp
    # Windows:
    python C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp
    

    When South has considered the changes to the schema, you will see the following message:

    ? The field 'Observer_context.device_observer_name' does not have a default specified, yet is NOT NULL.
    ? Since you are making this field nullable, you MUST specify a default
    ? value to use for existing rows. Would you like to:
    ?  1. Quit now.
    ?  2. Specify a one-off value to use for existing columns now
    ?  3. Disable the backwards migration by raising an exception; you can edit the migration to fix it later
    ? Please select a choice: 3
    
    • As per the final line above, please select option 3, and then execute the migration:
    # Linux: Debian/Ubuntu and derivatives
    python /usr/local/lib/python2.7/dist-packages/openrem/manage.py migrate remapp
    # Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
    python /usr/local/lib/python2.7/site-packages/openrem/manage.py migrate remapp
    
    # Windows, assuming no virtualenv
    python C:\Python27\Lib\site-packages\openrem\manage.py migrate remapp
    
  • Create and populate the database settings in the new local_settings.py file

    The openrem/openrem folder can be found at:

    # Linux: Debian/Ubuntu and derivatives
    /usr/lib/python2.7/dist-packages/openrem/openrem
    # Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
    /usr/lib/python2.7/site-packages/openrem/openrem
    # Windows:
    C:\Python27\Lib\site-packages\openrem\openrem
    

    In the openrem/openrem folder, create a new file called local_settings.py and copy the contents of this link into a the file and save it. Alternatively, rename local_settings.py.example to local_settings.py - this is an older version of the file.

    Copy the database details from settings.py into local_settings.py

  • Change the secret key - you can use http://www.miniwebtool.com/django-secret-key-generator/ to generate a new one

  • Move the existing settings.py out of the python directories (delete or move somewhere as a backup)

  • Rename the settings.py.new to settings.py

  • Restart your webserver to check everything looks ok

  • Add some users

    • Go to the admin interface (eg http://localhost:8000/admin) and log in with the user created when you originally created the database (the manage.py syncdb command - Do you want to create a superuser)

    • Create some users and add them to the appropriate groups (if there are no groups, go to the OpenREM homepage and they should be there when you go back to admin).

      • viewgroup can browse the data only
      • exportgroup can do as view group plus export data to a spreadsheet, and will be able to import height and weight data in due course (See Issue #21)
      • admingroup can delete studies in addition to anything the export group can do
Upgrading from versions 0.4.0 - 0.4.2
  • Back up your database

  • Install version 0.5.0

    • pip install openrem==0.5.0
  • Install RabbitMQ

  • Move local_settings.py details from openrem to openremproject

    The inner openrem Django project folder has now been renamed openremproject The customised local_settings.py file and the wsgi.py file have remain in the old openrem folder. The openrem/openrem folder can be found as detailed in the upgrade from ‘0.3.9 or earlier’ instructions above, and the new openrem/openremproject folder is in the same place.

    • Move local_settings.py to openremproject. If you have kept the older local_settings file, you may like to instead rename the local_settings.py.example file instead, then transfer the database settings and change the secret key.
    • Set the path for MEDIA_ROOT. The webserver needs to be able to write to this location - it is where OpenREM will store export files etc so that they can be downloaded. For suggestions, see the main _install instructions.
    • Set ALLOWED_HOSTS. For details see the Django docs A '*' allows any host - see the Django docs for the risk of this.
  • Move wsgi.py from openrem to openremproject or rename wsgi.py.example in openremproject

    If you haven’t edited it, simply rename the new version in openremproject. Otherwise, move the old version and edit the following line as follows:

    # Old:
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openrem.settings")
    # New:
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openremproject.settings")
    
  • Tidying up - you should delete the old openrem folder - you might like to take a backup first!

  • Update web server configuration

    The configuration of the webserver will need to be updated to reflect the new location for the settings.py file and the wsgi.py file.

    If you are using the built-in test webserver, static files will no-longer be served unless you use the insecure option:

    python manage.py runserver x.x.x.x:8000 --insecure
    
  • Migrate the schema

    # Linux: Debian/Ubuntu and derivatives
    python /usr/local/lib/python2.7/dist-packages/openrem/manage.py schemamigration --auto remapp
    python /usr/local/lib/python2.7/dist-packages/openrem/manage.py migrate remapp
    # Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
    python /usr/local/lib/python2.7/site-packages/openrem/manage.py schemamigration --auto remapp
    python /usr/local/lib/python2.7/site-packages/openrem/manage.py migrate remapp
    # Windows:
    python C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp
    python C:\Python27\Lib\site-packages\openrem\manage.py migrate remapp
    

After restarting the webserver, you should now have OpenREM 0.5.0 up and running. If you wish to test export functionality at this stage, start the Celery task queue - instructions in the Installation instructions docs or at the end of this guide.

Now move to Upgrading from version 0.5.0.

Upgrading from version 0.4.3
  • Back up your database

  • The 0.5.1 upgrade must be made from a 0.5.0 database, so a schema migration is required:

    pip install openrem==0.5.0
    
        # Linux: Debian/Ubuntu and derivatives
        python /usr/local/lib/python2.7/dist-packages/openrem/manage.py schemamigration --auto remapp
        python /usr/local/lib/python2.7/dist-packages/openrem/manage.py migrate remapp
        # Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
        python /usr/local/lib/python2.7/site-packages/openrem/manage.py schemamigration --auto remapp
        python /usr/local/lib/python2.7/site-packages/openrem/manage.py migrate remapp
        # Windows:
        python C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp
        python C:\Python27\Lib\site-packages\openrem\manage.py migrate remapp
    
Upgrading from version 0.5.0
  • Back up your database

  • Install 0.5.1:

    pip install openrem==0.5.1
    
  • Find out how many migration files you have

    Method 1:

    Use a file browser or terminal to list the contents of the migrations folder, eg:

    # Linux: Debian/Ubuntu and derivatives
    ls /usr/local/lib/python2.7/dist-packages/openrem/remapp/migrations/
    # Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
    ls /usr/local/lib/python2.7/site-packages/openrem/remapp/migrations/
    # Windows (alternatively use the file browser):
    dir C:\Python27\Lib\site-packages\openrem\remapp\migrations\
    

    Method 2:

    Use the Django manage.py program to list the existing migrations:

    # Linux: Debian/Ubuntu and derivatives
    python /usr/local/lib/python2.7/dist-packages/openrem/manage.py migrate --list remapp
    # Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
    python /usr/local/lib/python2.7/site-packages/openrem/manage.py migrate --list remapp
    # Windows
    python C:\Python27\Lib\site-packages\openrem\manage.py migrate --list remapp
    

    The output should look something like this - there can be any number of existing migrations (though 0001_initial will always be present):

    remapp
    (*) 0001_initial
    (*) 0002_auto__chg_field_ct_accumulated_dose_data_ct_dose_length_product_total_
    (*) 0003_auto__chg_field_general_equipment_module_attributes_station_name
    (*) 0004_auto__chg_field_ct_radiation_dose_comment__chg_field_accumulated_proje
    (*) 0005_auto__add_exports__add_size_upload
    (*) 0006_auto__chg_field_exports_filename
    (*) 0007_auto__add_field_irradiation_event_xray_detector_data_relative_xray_exp
    ( ) 000x_051datamigration
    ( ) 000x_051schemamigration
    
  • Rename the two 051 migration files to follow on from the existing migrations, for example 0008_051schemamigration.py and 0009_051datamigration.py for the existing migrations above, or 0002_051schemamigration.py and 0003_051datamigration.py if the only migration is the initial migration. The 051schemamigration must come before the 051datamigration.

    If you are using linux, you might like to do it like this (from within the openrem folder):

    mv remapp/migrations/000{x,8}_051schemamigration.py
    mv remapp/migrations/000{x,9}_051datamigration.py
    
  • If you now re-run migrate --list remapp you should get a listing with the 051schemamigration and the 051datamigration listed at the end:

    remapp
     (*) 0001_initial
     (*) 0002_auto__chg_field_ct_accumulated_dose_data_ct_dose_length_product_total_
     (*) 0003_auto__chg_field_general_equipment_module_attributes_station_name
     (*) 0004_auto__chg_field_ct_radiation_dose_comment__chg_field_accumulated_proje
     (*) 0005_auto__add_exports__add_size_upload
     (*) 0006_auto__chg_field_exports_filename
     (*) 0007_auto__add_field_irradiation_event_xray_detector_data_relative_xray_exp
     ( ) 0008_051schemamigration
     ( ) 0009_051datamigration
    

    The star indicates that a migration has already been completed. If you have any that are not completed apart from the 051schemamigration and the 051datamigration then please resolve these first.

  • Now execute the migrations:

    # Linux: Debian/Ubuntu and derivatives
    python /usr/local/lib/python2.7/dist-packages/openrem/manage.py migrate remapp
    # Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
    python /usr/local/lib/python2.7/site-packages/openrem/manage.py migrate remapp
    # Windows
    python C:\Python27\Lib\site-packages\openrem\manage.py migrate remapp
    
Restart the web server

If you are using the built-in test web server (not for production use):

python manage.py runserver x.x.x.x:8000 --insecure

Otherwise restart using the command for your web server

Restart the Celery task queue

For testing, in a new shell:

# Linux: Debian/Ubuntu and derivatives
cd /usr/local/lib/python2.7/dist-packages/openrem/
# Linux: other distros. In a virtualenv replace all up to lib/ as appropriate
cd /usr/local/lib/python2.7/site-packages/openrem/
# Windows
cd C:\Python27\Lib\site-packages\openrem\

# All
celery -A openremproject worker -l info

For production use, see http://celery.readthedocs.org/en/latest/tutorials/daemonizing.html

OpenREM Release Notes version 0.5.0
Headline changes
  • Import, display and export of CR/DX data from image headers
  • Export of study data from fluoroscopy to xlsx files
  • Importing data from Windows using *.dcm style wildcards
  • Hologic tomography projection images are no longer excluded if part of a Combo exposure
Specific upgrade instructions

Always make sure you have converted your database to South before attempting an upgrade

Quick reminder of how, if you haven’t done it already:

Linux:

python /usr/local/lib/python2.7/dist-packages/openrem/manage.py convert_to_south remapp

Windows:

python C:\Python27\Lib\site-packages\openrem\manage.py convert_to_south remapp
Upgrading from versions before 0.4.3

If you are upgrading from 0.3.9 or earlier, you will need to upgrade to version 0.4.2 first. See the OpenREM Release Notes version 0.4.3.

If you are upgrading from 0.4.0 or later, the instructions in OpenREM Release Notes version 0.4.3 still need to be followed to install/setup RabbitMQ and Celery and to update the configuration files, but you can go straight to 0.5.0 rather than installing 0.4.3.

Upgrading from version 0.4.3
pip install openrem==0.5.0

(Will need sudo or equivalent if using linux without a virtualenv)

Database migration

Assuming no virtualenv

Linux:

python /usr/local/lib/python2.7/dist-packages/openrem/manage.py schemamigration --auto remapp
python /usr/local/lib/python2.7/dist-packages/openrem/manage.py migrate remapp

Windows:

C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp
C:\Python27\Lib\site-packages\openrem\manage.py migrate remapp
Restart the web server

If you are using the built-in test web server (not for production use):

python manage.py runserver x.x.x.x:8000 --insecure

Otherwise restart using the command for your web server

Restart the Celery task queue

For testing, in a new shell: (assuming no virtualenv)

Linux:

cd /usr/local/lib/python2.7/dist-packages/openrem/
celery -A openremproject worker -l info

Windows:

cd C:\Python27\Lib\site-packages\openrem\
celery -A openremproject worker -l info

For production use, see http://celery.readthedocs.org/en/latest/tutorials/daemonizing.html

OpenREM Release Notes version 0.4.3
Headline changes
  • Export of study information is now handled by a task queue - no more export time-outs.
  • Patient size information in csv files can now be uploaded and imported via a web interface.
  • Proprietary projection image object created by Hologic tomography units can now be interrogated for details of the tomosynthesis exam.
  • Settings.py now ships with its proper name, this will overwrite important local settings if upgrade is from 0.3.9 or earlier.
  • Time since last study is no longer wrong just because of daylight saving time!
  • Django release set to 1.6; OpenREM isn’t ready for Django 1.7 yet
  • The inner openrem Django project folder is now called openremproject to avoid import conflicts with Celery on Windows
  • DEBUG mode now defaults to False
Specific upgrade instructions

Always make sure you have converted your database to South before attempting an upgrade

Quick reminder of how, if you haven’t done it already:

Linux:

python /usr/local/lib/python2.7/dist-packages/openrem/manage.py convert_to_south remapp

Windows:

python C:\Python27\Lib\site-packages\openrem\manage.py convert_to_south remapp
Upgrading from 0.3.9 or earlier

It is essential that you upgrade to at least 0.4.0 first, then upgrade to 0.4.3. Otherwise the settings file will be overwritten and you will lose your database settings. There is also a trickier than usual database migration and instructions for setting up users. Fresh installs should start with the latest version.

Upgrade to version 0.4.2

pip install openrem==0.4.2

(Will need sudo or equivalent if using linux without a virtualenv)

Then follow the instructions in OpenREM Release Notes version 0.4.0 from migrating the database onwards, before coming back to these instructions.

Upgrading from 0.4.0 or above
Install OpenREM version 0.4.3
pip install openrem==0.4.3

(Will need sudo or equivalent if using linux without a virtualenv)

RabbitMQ

The message broker RabbitMQ needs to be installed to enable the export and upload features

Move and edit local_settings.py file and wsgi.py files

The inner openrem Django project folder has now been renamed openremproject to avoid import confusion that prevented Celery working on Windows.

When you upgrade, the local_settings.py file and the wsgi.py file will remain in the old openrem folder. Both need to be moved across to the openremproject folder, and edited as below.

The new and old folders will be found in:

  • Linux: /usr/local/lib/python2.7/dist-packages/openrem/
  • Linux with virtualenv: /home/myname/openrem/lib/python2.7/site-packages/openrem/
  • Windows: C:\Python27\Lib\site-packages\openrem\
Edit the local_settings.py file

The MEDIA_ROOT path needs to be defined. This is the place where the study exports will be stored for download and where the patient size information csv files will be stored temporarily whilst they are bing processed.

The path set for MEDIA_ROOT is up to you, but the user that runs the webserver must have read/write access to the location specified because it is the webserver than reads and writes the files. In a debian linux, this is likely to be www-data for a production install. Remember to use forward slashes in the config file, even for Windows.

Linux example:

MEDIA_ROOT = "/var/openrem/media/"

Windows example:

MEDIA_ROOT = "C:/Users/myusername/Documents/OpenREM/media/"

The ALLOWED_HOSTS needs to be defined, as the DEBUG mode is now set to False. This needs to contain the server name or IP address that will be used in the URL in the web browser. For example:

ALLOWED_HOSTS = [
    '192.168.56.102',
    '.doseserver.',
    'localhost',
]

A dot before a hostname allows for subdomains (eg www.doseserver), a dot after a hostname allows for FQDNs (eg doseserver.ad.trust.nhs.uk). Alternatively, a single '*' allows any host, but removes the security the feature gives you.

Edit the wsgi.py file with the new project folder name

If you aren’t using the wsgi.py file as part of your webserver setup, you might like to simply rename the wsgi.py.example file in the openremproject folder.

If you are using it, edit the line:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openrem.settings")

to read:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openremproject.settings")
Tidying up

Finally, you should delete the old openrem folder - you might like to take a backup first!

Database migration

Assuming no virtualenv

Linux:

python /usr/local/lib/python2.7/dist-packages/openrem/manage.py schemamigration --auto remapp
python /usr/local/lib/python2.7/dist-packages/openrem/manage.py migrate remapp

Windows:

C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp
C:\Python27\Lib\site-packages\openrem\manage.py migrate remapp
Web server

If you are using a production webserver, you will probably need to edit some of the configuration to reflect the change in location of settings.py, for example DJANGO_SETTINGS_MODULE = openremproject.settings, and then restart the web server. You may need to do something similar for the location of wsgi.py.

If you are using the built-in test web server (not for production use), then the static files will not be served unless you add --insecure to the command. This is one of the consequences of setting DEBUG to False:

python manage.py runserver x.x.x.x:8000 --insecure
Start the Celery task queue

Note

The webserver and Celery both need to be able to read and write to the MEDIA_ROOT location. Therefore you might wish to consider starting Celery using the same user or group as the webserver, and setting the file permissions accordingly.

For testing, in a new shell: (assuming no virtualenv)

Linux:

cd /usr/local/lib/python2.7/dist-packages/openrem/
celery -A openremproject worker -l info

Windows:

cd C:\Python27\Lib\site-packages\openrem\
celery -A openremproject worker -l info

For production use, see http://celery.readthedocs.org/en/latest/tutorials/daemonizing.html

OpenREM Release Notes version 0.4.2
Headline changes
  • This release fixes a major bug introduced in 0.4.0 regarding the import scripts.
Specific upgrade instructions
Upgrading from 0.3.9 or earlier

Follow the instructions in OpenREM Release Notes version 0.4.0

Upgrading from 0.4.0 or above

Move straight to version 0.4.3 and follow the instructions in OpenREM Release Notes version 0.4.3

OpenREM Release Notes version 0.4.1
Headline changes
  • This release is exacly the same as 0.4.1 bar some documentation corrections
Specific upgrade instructions

Please use the 0.4.0 release notes for upgrades from 0.3.9

OpenREM Release Notes version 0.4.0

OpenREM Release Notes version 0.4.0
Headline changes
  • User authentication has been added
  • Studies can be deleted from the web interface
  • Import scripts can now be passed a list of files, eg python openrem_rdsr.py *.dcm
  • Date of birth no longer retained for mammography (bug fix - correct behaviour already existed for other imports)
  • General bug fixes to enable import from wider range of sources
  • Improved user documentation
Specific upgrade instructions
  • pip install openrem==0.4.2 Go straight to 0.4.2

  • Migrate the database

    Warning

    A database migration is required that will need a choice to be made

    • Linux: python /usr/lib/python2.7/dist-packages/openrem/manage.py schemamigration --auto remapp
    • Windows: C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp

    When South has considered the changes to the schema, you will see the following message:

    ? The field 'Observer_context.device_observer_name' does not have a default specified, yet is NOT NULL.
    ? Since you are making this field nullable, you MUST specify a default
    ? value to use for existing rows. Would you like to:
    ?  1. Quit now.
    ?  2. Specify a one-off value to use for existing columns now
    ?  3. Disable the backwards migration by raising an exception; you can edit the migration to fix it later
    ? Please select a choice: 3
    

    As per the final line above, the correct choice is 3. The fields that are now nullable previously weren’t. Existing data in those fields will have a value, or those tables don’t exist in the current database. The problem scenario is if after the migration these tables are used and one of the new nullable fields is left as null, you will not be able to migrate back to the old database schema without error. This is not something that you will want to do, so this is ok.

    Do the migration:

    • Linux: python /usr/lib/python2.7/dist-packages/openrem/manage.py migrate remapp
    • Windows: C:\Python27\Lib\site-packages\openrem\manage.py migrate remapp
  • Update the settings files

    Warning

    The settings file has changed and will need to be manually edited.

    Changes need to be made to the settings.py file where the database details are stored. Normally upgrades don’t touch this file and the copy in the upgrade has a .example suffix. This upgrade and potentially future ones will need to change this file, so the format has been changed. The settings.py file will now be replaced each time the code is upgraded. In addition, there is a new local_settings.py file that contains things that are specific to your installation, such as the database settings.

    This upgrade will include a file called settings.py.new and the local_settings.py.example file. You will need to do the following:

    • Copy the database settings from your current settings.py file to the local_settings.py.example file and rename it to remove the .example. Both of these files are in the openrem/openrem directory, which will be somewhere like
      • Linux: /usr/lib/python2.7/dist-packages/openrem/openrem/
      • Windows: C:\Python27\Lib\site-packages\openrem\openrem\
    • Move the existing settings.py out of the python directories
    • Rename the settings.py.new to settings.py
  • Create a new secret key

    All versions of openrem ship with the same secret key. This key is used for web security checks, and should be unique (and secret) for each installation.

  • Restart your webserver

  • Add some users

    • Go to the admin interface (eg http://localhost:8000/admin) and log in with the user created when you originally created the database (manage.py syncdb)

    • Create some users and add them to the appropriate groups (if there are no groups, go to the OpenREM homepage and they should be created).

      • viewgroup can browse the data only
      • exportgroup can do as view group plus export data to a spreadsheet, and will be able to import height and weight data in due course (See Issue #21)
      • admingroup can delete studies in addition to anything the export group can do

Contributing authors

The following people have contributed to OpenREM - either with code, documentation or ideas.

Importing data to OpenREM

DICOM Networking in OpenREM

Functionality available

This is an initial preview release in 0.6.0, with the following features:

  • DICOM Store service class provider
  • DICOM objects are fed directly into appropriate routine for data extraction
  • Extraction jobs are handled by Celery
  • Configuration is via the local_settings.py file

Configuration

The following settings need to be in your local_settings.py file:

STORE_AET = "STOREOPENREM"
STORE_PORT = 8104
RM_DCM_NOMATCH = True
RM_DCM_RDSR = False
RM_DCM_MG = False
RM_DCM_DX = False
RM_DCM_CTPHIL = False

STORE_AET

This is the AET you use when configuring send nodes from your modalities.

Set this to your chosen value - any combination of letters and numbers up to 16 characters. No spaces or other characters allowed.

In the current implementation, the actual value is not actually important - the AET is not checked when a DICOM object is received.

STORE_PORT

This is the port you send DICOM objects to. The standard port for DICOM servers is port 104. However, on many operating systems starting a service on a port lower than 1025 requires additional privileges. That is why the suggested port is 8104.

Depending on your network setup you may have to configure the firewall accordingly.

RM_DCM_NOMATCH

When DICOM objects are received they are checked for suitability to have dose related data extracted using any of the current extraction routines.

If you want the DICOM object to be deleted if it can’t be used, set RM_DCM_NOMATCH to True. Otherwise set this to False.

Setting this to True is advisable as otherwise your disk can fill up very quickly if enture CT studies get sent through for example.

RM_DCM_RDSR, RM_DCM_MG, RM_DCM_DX and RM_DCM_CTPHIL

Set these to True to delete the DICOM objects once the dose related data had been extracted. Otherwise set them to False, and the DICOM objects will be stored in a folder called dicom_in in the MEDIA_ROOT folder.

The RDSR setting is for Radiation Dose Structured Reports (usually from CT or fluoroscopy), MG is for mammography images, DX is for radiography images and CTPHIL is for Philips CT dose screen images.

Setting these to True is advisable, especially for the images as again the disk can fill up quickly.

How to use the DICOM store service

Open a command window or shell:

openrem_store.py

You should see the following output, depending on your configuration:

starting AE... AET:STOREOPENREM, port:8104 done

Make sure that the Celery task manager is running, as all extraction jobs are passed to Celery.

Planned functionality for future releases

DICOM Store

  • Configuration will move to the database with a web interface
  • Web interface view of activity and logs

DICOM Query-Retrieve

  • Function to query retrieve the PACS or modality
  • Ad hoc or scheduled
  • Web interface for configuration, activating, monitoring success and logs

Charts

Charts of the currently filtered data can now be shown for CT and radiographic data. The user can configure which plots are shown using the Chart options on the CT and radiographic pages.

The charts are automatically updated to reflect any filters that the user applies to the data.

Chart options

OpenREM CT chart options screenshot

The first option, Plot charts?, determines whether any plots are shown. This also controls whether the data for the plots is calculated by OpenREM. Some plot data is slow to calculate when there is a large amount of data: some users may prefer to leave Plot charts? off for performance reasons. Plot charts? can be switched on and activated with a click of the submit button after the data has been filtered.

The user can switch off all chart plotting by clicking on the Switch charts off link in the User options menu in the navigation bar at the top of any OpenREM page. Clicking on this link takes the user back to the home page.

A user’s chart options can also be configured by an administrator via OpenREM’s user administration page.

Chart types

The available charts for CT data are as follows:

  • Bar chart of mean DLP and CTDIvol for each acquisition protocol:

    OpenREM chart of mean DLP and CTDI\ :sub:`vol` screenshot

    The tooltip of each bar shows the user the name of the protocol, the number of acquisitions of that type and also the mean DLP and/or CTDIvol value.

    Clicking on an individual bar takes the user to a histogram of DLP or CTDIvol for that protocol. The tooltip for each histogram bar shows the number of acquisitions. The DLP histogram tooltip also includes a link that will take the user to the list of studies that contain the acquisitions represented by that histogram bar:

    OpenREM histogram of acquisition DLP screenshot
  • Pie chart of the frequency of each acquisition protocol. Clicking on a segment of the pie chart takes the user to the list of studies that contain the acquisitions in that segment.

    OpenREM chart of acquisition frequency screenshot
  • Bar chart of mean DLP for each study name. Clicking on a bar takes the user to a histogram of DLP for that study name. Clicking on a histogram bar tooltip link takes the user to the list of studies that correspond to the data represented by that bar.

    OpenREM chart of mean study DLP screenshot
  • Pie chart of the frequency of each study name. Clicking on a segment of the pie chart takes the user to the list of studies that correspond to the data in that segment.

  • Pie chart showing the number of studies carried on each daty of the week:

    OpenREM pie chart of study workload per day of the week screenshot

    Clicking on a segment of the pie chart takes the user to a pie chart showing the studies for that weekday broken down per hour:

    OpenREM pie chart of study workload per hour in a day screenshot
  • Line chart showing the mean DLP of each study name over time. The time period per data point is chosen by the user in the Chart options. Note that selecting a short time period may result in long calculation times. The user can zoom in to the plot by clicking and dragging the mouse to select a date range. The user can also click on items in the chart legend to show or hide individual lines.

    OpenREM line chart of mean DLP per study type over time screenshot

The available charts for radiographic data are as follows:

  • Bar chart of mean DAP for each acquisition protocol. Clicking on a bar takes the user to a histogram of DAP for that protocol. Clicking on the tooltip link of a histogram bar takes the user to the list of studies that contain the acquisitions in the histogram bar.
  • Pie chart of the frequency of each acquisition protocol. Clicking on a segment of the pie chart takes the user to the list of studies that contain the acquisitions in that segment.
  • Bar chart of mean kVp for each acquisition protocol. Clicking on a bar takes the user to a histogram of kVp for that protocol. Clicking on the tooltip link of a histogram bar takes the user to the list of studies that contain the acquisitions in the histogram bar.
  • Bar chart of mean mAs for each acquisition protocol. Clicking on a bar takes the user to a histogram of mAs for that protocol. Clicking on the tooltip link of a histogram bar takes the user to the list of studies that contain the acquisitions in the histogram bar.
  • Pie chart showing the number of studies carried out per weekday. Clicking on a segment of the pie chart takes the user to a pie chart showing the studies for that weekday broken down per hour.
  • Line chart showing how the mean DAP of each acquisition protocol varies over time. The time period per data point can be chosen by the user in the Chart options. Note that selecting a short time period may result in long calculation times. The user can zoom in to the plot by clicking and dragging the mouse to select a date range. The user can also click on items in the legend to show or hide individual lines.

Exporting chart data

An image file of a chart can be saved using the menu in the top-right hand side of any of the charts. The same menu can be used to save the data used to plot a chart: the data can be downloaded in either csv or xls format.

Exporting study information

Exporting to csv and xlsx sheets

If you are logged in as a user in the exportgroup or the admingroup, the export links will be available near the top of the modality filter pages in the OpenREM interface. The following exports are currently available (version 0.5.0)

  • CT basic, single sheet csv
  • CT advanced, XLSX muliple-sheets
  • Fluoroscopy basic, single sheet csv
  • Mammography, single sheet csv
  • Mammography NHSBSP, single sheet csv designed to satisfy NHSPSB reporting
  • Radiographic, single sheet csv
  • Radiographic, XLSX multiple sheets

For CT and radiographic, the XLSX export has multiple sheets. The first sheet contains a summary of all the study descriptions, requested procedures and series protocol names contained in the export:

CT export front sheet

This information is useful for seeing what data is in the spreadsheet, and can also be used to prioritise which studies or protocols to analyse based on frequency.

The second sheet of the exported file lists all the studies, with each study taking one line and each series in the study displayed in the columns to the right.

CT export all data sheet

The remainder of the file has one sheet per series protocol name. Each series is listed one per line. If a single study has more than one series with the same protocol name, then the same study will appear on more than one line.

Clicking the link for an export redirects you to the Exports page, which you can also get to using the link at the top right of the navigation bar:

Exports list

Whilst an export is being processed, it will be listed in the first table at the top. The current status is displayed to indicate export progress. If an export gets stuck for whatever reason, you may be able to abort the process by clicking the ‘Abort’ button. However this does not always cause an active export to terminate - you may find it completes anyway!

Completed exports are then listed in the second table, with a link to download the csv or xlsx file.

When the export is no longer needed, it can be deleted from the server by ticking the delete checkbox and clicking the delete button at the bottom:

Deleting exports

Warning

Large exports have been killed by the operating system due to running out of memory - a 6500 CT exam xlsx export was killed after 3400 studies for example. This issue is being tracked as #116 and will hopefully be addressed in the next release. It is possible that if debug mode is turned off then memory will be managed better, but I also need to modify the xlsx export to make use of the memory optimisation mode in xlsxwriter.

Exporting studies to OpenSkin

Functionality available

This is a temporary solution for 0.6.0; future versions will have OpenSkin integrated into the web interface.

  • Fluoroscopy study export in a format suitable for OpenSkin
  • Currently OpenSkin must be downloaded and run independently

Instructions for OpenREM

Select the fluoroscopy study you wish to create the exposure incidence map for and go to the detail view. Then click on link to create the OpenSkin export:

Export from OpenREM to OpenSkin

Instructions for OpenSkin

Download the latest version as a zip file from https://bitbucket.org/openskin/openskin/downloads. At the time of release for OpenREM 0.6.0, the current OpenSkin release was 0.4, 26th March 2015. The application referred to here will only work on Windows. When OpenSkin is built into OpenREM, it will work on both Linux and Windows servers.

  • Extract the contents of the zip file into a folder on your computer and run the openSkin.exe executable

  • Choose a phantom type: 3D or flat. See Phantom design for details, but in summary:

    • Flat represents the exposure incidence if the X-rays had been delivered to a film placed flat on the couch
    • 3D represents the exposure incidence if the X-rays had been delivered to a phantom consisting of a cuboid with one semi-cylinder on each side
  • Select the source csv file - this should be the one exported from OpenREM

  • Select the output folder - this should already exist as it can’t be created in the dialogue

  • Wait! Depending on the number of events in the export and the power of your machine, this can take a few minutes

Two files will be produced - a textfile called skin_dose_results.txt and a small image called skin_dose_map.png

Results text file

It should look something like this:

File created    : 04/21/15 17:42:45
Data file       : C:/Users/[...]/exports-2015-04-21-OpenSkinExport20150421-162805246134.csv
Phantom         : 90.0x70.0 3d phantom
Peak dose (Gy)  :                  0.50844405521
Cells > 3 Gy    :                              0
Cells > 5 Gy    :                              0
Cells > 10 Gy   :                              0

The peak dose is the peak incident dose delivered to any one-cm-square area. If any of these 1 cm2 areas (referred to as cells) are above 3 Gy, then the number of cells in this category, or the two higher dose categories, are listed in the table accordingly.

Incidence map image file

The image file will be a small 70x90 px PNG image if you used the 3D phantom, or 150 x 50 px PNG if you used the 2D phantom. With both, the head end of the table is on the left.

The image is scaled so that black is 0 Gy and white is 10 Gy. For most studies, this results in an incidence map that is largely black! However, if you use GIMP or ImageJ or similar to increase the contrast, you will find that the required map is there.

A native and ‘colour equalised’ version of the same export are shown below:

OpenSkin incidence map, unscaled OpenSkin incidence map, scaled

Limitations

OpenSkin is yet to be validated independently - if this is something you want to do, please do go ahead and feed back your findings to Jonathan Cole at https://bitbucket.org/jacole/

OpenREM administration (deleting studies, importing patient size data)

Contents:

Deleting studies

New in 0.4.0

If you log in as a user that is in the admingroup, then an extra column is appended in the filtered view tables to allow studies to be deleted:

Deleting studies

Clicking on delete takes you to a confirmation page before the delete takes place.

Adding patient size information from csv using the web interface

New in 0.4.3

Uploading patient size data

If you log in as a user that is in the admingroup, then a menu is available at the right hand end of the navigation bar:

Admin import patient size data menu

The first option takes you to a page where you can upload a csv file containing details of the patient height and weight, plus either the accession number or the Study Instance UID.

Uploading CSV files containing patient size information Upload patient size csv file button

The csv file needs to have at least the required columns. Additional columns will be ignored. If your source of patient size data does not have either the height or the weight column, simply add a new empty column with just the title in the first row.

When you have selected the csv file, press the button to upload it.

Importing the size data to the database

On the next page select the column header that corresponds to each of the head, weight and ID fields. Also select whether the ID field is an Accession number or a Study UID:

When the column headers are selected, click the ‘Process the data’ button.

Selecting header information

The progress of the import is then reported on the patient size imports page:

Patient size importing

During the import, it is possible to abort the process by clicking the button seen in the image above. The log file is available from the completed table whether it completed or not - there is no indication that the import was aborted.

As soon as the import is complete, the source csv file is deleted from the server.

Reviewing previous imports

After an import is complete, it is listed in the completed import tasks table. You can also get to this page from the Admin menu:

Imports link

For each import, there is a link to the logfile, which looks something like this. With this import accession numbers weren’t available so the patient size information was matched to the study instance UID:

Size import logs

Deleting import logs

The completed import tasks table also has a delete check box against each record and a delete button at the bottom. The csv file originally imported has already been deleted - this delete function is to remove the record of the import and the log file associated with it from the database/disk.

Documentation for the OpenREM code

Contents:

DICOM import modules

RDSR module

Ultimately this should be the only module required as it deals with all Radiation Dose Structured Reports. Currently this has only been tested on CT and fluoroscopy structured reports, but it also has the logic for mammography structured reports if they start to appear.

Mammography module

Mammography is interesting in that all the information required for dose audit is contained in the image header, including patient ‘size’, ie thickness. However the disadvantage over an RSDR is the requirement to process each individual image rather than a single report for the study, which would also capture any rejected images.

CR and DR module

In practice this is only useful for DR modalities, but most of them use the CR IOD instead of the DX one, so both are catered for. This module makes use of the image headers much like the mammography module.

CT non-standard modules

Initially only Philips CT dose report images are catered for. These have all the information that could be derived from the images also held in the DICOM header information, making harvesting relatively easy.

Non-DICOM import modules

Patient height and weight csv import module

This module enables a csv file to be parsed and the height and weight information extracted and added to existing studies in the OpenREM database. An example may be a csv extract from a RIS or EPR system.

There needs to be a common unique identifier for the exam - currently this is limited to accession number or study instance UID.

remapp.extractors.ptsizecsv2db.csv2db(*args, **kwargs)

Import patient height and weight data from csv RIS exports. Can be called from openrem_ptsizecsv.py script

Parameters:
  • --si-uid (bool) – Use Study Instance UID instead of Accession Number. Short form -s.
  • csvfile (str) – relative or absolute path to csv file
  • id (str) – Accession number column header or header if -u or –si-uid is set. Quote if necessary.
  • height (str) – Patient height column header. Create if necessary, quote if necessary.
  • weight (str) – Patient weight column header. Create if necessary, quote if necessary.

Example:

openrem_ptsizecsv.py -s MyRISExport.csv StudyInstanceUID HEIGHT weight
(task)remapp.extractors.ptsizecsv2db.websizeimport

Export from database

Multi-sheet Microsoft Excel XLSX exports

This export has a summary sheet of all the requested and performed protocols and the series protocols. The next sheet has all studies on, one study per line, with the series stretching off to the right. The remaining sheets are specific to each series protocol, in alphabetical order, with one series per line. If one study has three series with the same protocol name, each one has a line of its own.

(task)remapp.exports.xlsx.ctxlsx(filterdict)

Export filtered CT database data to multi-sheet Microsoft XSLX files.

Parameters:filterdict (HTTP get) – Query parameters from the CT filtered page URL.
(task)remapp.exports.dx_export.dxxlsx(filterdict)

Export filtered DX and CR database data to multi-sheet Microsoft XSLX files.

Parameters:filterdict (HTTP get) – Query parameters from the DX and CR filtered page URL.

Single sheet CSV exports

(task)remapp.exports.exportcsv.exportFL2excel(filterdict)

Export filtered fluoro database data to a single-sheet CSV file.

Parameters:request (HTTP get) – Query parameters from the fluoro filtered page URL.
(task)remapp.exports.exportcsv.exportCT2excel(filterdict)

Export filtered CT database data to a single-sheet CSV file.

Parameters:request (HTTP get) – Query parameters from the CT filtered page URL.
(task)remapp.exports.exportcsv.exportMG2excel(filterdict)

Export filtered mammography database data to a single-sheet CSV file.

Parameters:request (HTTP get) – Query parameters from the mammo filtered page URL.
(task)remapp.exports.dx_export.exportDX2excel(filterdict)

Export filtered DX database data to a single-sheet CSV file.

Parameters:request (HTTP get) – Query parameters from the DX filtered page URL.
Specialised csv exports - NHSBSP formatted mammography export
(task)remapp.exports.mg_csv_nhsbsp.mg_csv_nhsbsp(filterdict)

Export filtered mammography database data to a NHSBSP formatted single-sheet CSV file.

Parameters:filterdict (dict) – Dictionary of query parameters from the mammo filtered page URL.
Returns:None - file is saved to disk and location is stored in database

Tools and helper modules

OpenREM settings

Administrative module to define the name of the project and to add it to the Python path

remapp.extractors.openrem_settings.add_project_to_path()

Add project to path, assuming this file is within project

Get values

Tiny modules to reduce repetition in the main code when extracting information from DICOM headers using pydicom.

remapp.tools.get_values.get_value_kw(tag, dataset)

Get DICOM value by keyword reference.

Parameters:
  • keyword (str.) – DICOM keyword, no spaces or plural as per dictionary.
  • dataset (dataset) – The DICOM dataset containing the tag.
Returns:

str. – value

remapp.tools.get_values.get_value_num(tag, dataset)

Get DICOM value by tag group and element number.

Always use get_value_kw by preference for readability. This module can be required when reading private elements.

Parameters:
  • tag (hex) – DICOM group and element number as a single hexadecimal number (prefix 0x).
  • dataset (dataset) – The DICOM dataset containing the tag.
Returns:

str. – value

remapp.tools.get_values.get_seq_code_value(sequence, dataset)

From a DICOM sequence, get the code value.

Parameters:
  • sequence (DICOM keyword, no spaces or plural as per dictionary.) – DICOM sequence name.
  • dataset (DICOM dataset) – The DICOM dataset containing the sequence.
Returns:

int. – code value

remapp.tools.get_values.get_seq_code_meaning(sequence, dataset)

From a DICOM sequence, get the code meaning.

Parameters:
  • sequence (DICOM keyword, no spaces or plural as per dictionary.) – DICOM sequence name.
  • dataset (DICOM dataset) – The DICOM dataset containing the sequence.
Returns:

str. – code meaning

remapp.tools.get_values.get_or_create_cid(codevalue, codemeaning)

Create a code_value code_meaning pair entry in the ContextID table if it doesn’t already exist.

Parameters:
  • codevalue (int.) – Code value as defined in the DICOM standard part 16
  • codemeaning – Code meaning as defined in the DICOM standard part 16
Returns:

ContextID entry for code value passed

Check if UID exists

Small module to check if UID already exists in the database.

remapp.tools.check_uid.check_uid(uid, level='Study')

Check if UID already exists in database.

Parameters:uid (str.) – Study UID.
Returns:1 if it does exist, 0 otherwise

DICOM time and date values

Module to convert betweeen DICOM and Python dates and times.

remapp.tools.dcmdatetime.get_date(tag, dataset)

Get DICOM date string and return Python date.

Parameters:
  • tag (str.) – DICOM keyword, no spaces or plural as per dictionary.
  • dataset (dataset) – The DICOM dataset containing the tag.
Returns:

Python date value

remapp.tools.dcmdatetime.get_time(tag, dataset)

Get DICOM time string and return Python time.

Parameters:
  • tag (str.) – DICOM keyword, no spaces or plural as per dictionary.
  • dataset (dataset) – The DICOM dataset containing the tag.
Returns:

python time value

remapp.tools.dcmdatetime.get_date_time(tag, dataset)

Get DICOM date time string and return Python date time.

Parameters:
  • tag (str.) – DICOM keyword, no spaces or plural as per dictionary.
  • dataset (dataset) – The DICOM dataset containing the tag.
Returns:

Python date time value

remapp.tools.dcmdatetime.make_date(dicomdate)

Given a DICOM date, return a Python date.

Parameters:dicomdate (str.) – DICOM style date.
Returns:Python date value
remapp.tools.dcmdatetime.make_time(dicomtime)

Given a DICOM time, return a Python time.

Parameters:dicomdate (str.) – DICOM style time.
Returns:Python time value
remapp.tools.dcmdatetime.make_date_time(dicomdatetime)

Given a DICOM date time, return a Python date time.

Parameters:dicomdate (str.) – DICOM style date time.
Returns:Python date time value

Test for QA or other non-patient related studies

remapp.tools.not_patient_indicators.get_not_pt(dataset)

Looks for indications that a study might be a test or QA study.

Some values that might indicate a study was for QA or similar purposes are not recorded in the database, for example patient name. Therefore this module attempts to find such indications and creates an xml style string that can be recorded in the database.

Parameters:dataset (dataset) – The DICOM dataset.
Returns:str. – xml style string if any trigger values are found.

Models

Filtering code

Views

Export Views

Forms

class remapp.forms.SizeUploadForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.util.ErrorList'>, label_suffix=None, empty_permitted=False)

Form for patient size csv file upload

class remapp.forms.SizeHeadersForm(my_choice=None, **kwargs)

Form for csv column header patient size imports through the web interface

Indices and tables

Indices and tables