Welcome to OpenREM’s documentation!¶

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.
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¶
- Linux – likely to be installed already
- Windows – https://www.python.org/downloads
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¶
(New for version 0.4.3)
- Linux - Follow the guide at http://www.rabbitmq.com/install-debian.html
- Windows - Follow the guide at http://www.rabbitmq.com/install-windows.html
For either install, just follow the defaults – no special configurations required.
Note
Before continuing, consider virtualenv
Install and configure OpenREM¶
Install latest beta version¶
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.
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¶
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¶
(New for version 0.4.3)
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
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
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¶
- Download the installer from http://www.enterprisedb.com/products-services-training/pgdownload#windows
- Download psycopg2 from http://www.lfd.uci.edu/~gohlke/pythonlibs/. Make sure it matches your python and Windows version.
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¶
(New for version 0.4.3)
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.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
- For PostgreSQL you can refer to Backing up a PostgreSQL database
- For a non-production SQLite3 database, simply make a copy of the database file
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
- For PostgreSQL you can refer to Backing up a PostgreSQL database
- For a non-production SQLite3 database, simply make a copy of the database file
Install version 0.5.0
- pip install openrem==0.5.0
Install RabbitMQ
- Linux - Follow the guide at http://www.rabbitmq.com/install-debian.html
- Windows - Follow the guide at http://www.rabbitmq.com/install-windows.html
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
- For PostgreSQL you can refer to Backing up a PostgreSQL database
- For a non-production SQLite3 database, simply make a copy of the database file
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
- For PostgreSQL you can refer to Backing up a PostgreSQL database
- For a non-production SQLite3 database, simply make a copy of the database file
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
Previous Release Notes and Change Log¶
Version history change log¶
OpenREM version history¶
0.5.1 (2015-03-??)¶
- #184 Documentation for 0.5.1
- #180 Rename all reverse lookups as a result of #62
- #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
0.4.2 (2014-04-15)¶
0.4.0 (2014-04-15)¶
Note
- #64 includes changes to the database schema and needs a user response - see version 0.4.0 release notes
- #65 includes changes to the settings file which require settings information to be copied and files moved/renamed - see version 0.4.0 release notes
- #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)¶
0.3.6 (2014-02-24)¶
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)¶
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)¶
- #12 Added this version history
- #11 Documentation is no longer included in the tar.gz install file – see http://openrem.trfd.org instead
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.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 remappWindows:
python C:\Python27\Lib\site-packages\openrem\manage.py convert_to_south remappUpgrading 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 remappWindows:
C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp C:\Python27\Lib\site-packages\openrem\manage.py migrate remappRestart 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 --insecureOtherwise 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 infoWindows:
cd C:\Python27\Lib\site-packages\openrem\ celery -A openremproject worker -l infoFor 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 remappWindows:
python C:\Python27\Lib\site-packages\openrem\manage.py convert_to_south remappUpgrading 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
- Linux - Follow the guide at http://www.rabbitmq.com/install-debian.html
- Windows - Follow the guide at http://www.rabbitmq.com/install-windows.html
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 remappWindows:
C:\Python27\Lib\site-packages\openrem\manage.py schemamigration --auto remapp C:\Python27\Lib\site-packages\openrem\manage.py migrate remappWeb 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 --insecureStart 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 infoWindows:
cd C:\Python27\Lib\site-packages\openrem\ celery -A openremproject worker -l infoFor 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¶
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: 3As 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.
- Generate a new secret key - http://www.miniwebtool.com/django-secret-key-generator/ is a suitable method of creating a new key.
- Copy the new key and use it to replace the default key in the local_settings.py file
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.
- Ed McDonagh
- David Platten
- Jonathan Cole
- Elly Castellano
- Laurence King
- Daniel Gordon
Importing data to OpenREM¶
Using the OpenREM web interface¶
Contents:
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:

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.

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:

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:

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.
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:

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
Contents
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:

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.


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.

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

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:

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:

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.
- remapp.extractors.rdsr.rdsr(rdsr_file)¶
Extract radiation dose related data from DICOM Radiation SR objects.
Parameters: filename (str.) – relative or absolute path to Radiation Dose Structured Report. - Tested with:
- CT: Siemens, Philips and GE RDSR, GE Enhanced SR.
- Fluoro: Siemens Artis Zee RDSR
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.
- remapp.extractors.mam.mam(mg_file)¶
Extract radiation dose structured report related data from mammography images
Parameters: filename (str.) – relative or absolute path to mammography DICOM image file. - Tested with:
- GE Senographe DS software versions ADS_43.10.1 and ADS_53.10.10 only.
- Limited testing: GE Senographe Essential
- Limited testing: Hologic Selenia
- Limited testing: Siemens Inspiration
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.
- remapp.extractors.dx.dx(dig_file)¶
Extract radiation dose structured report related data from DX radiographic images
Parameters: filename (str.) – relative or absolute path to DICOM DX radiographic image file. - Tested with:
- Nothing yet
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.
- remapp.extractors.ct_philips.ct_philips(philips_file)¶
Extract radiation dose structured report related data from Philips CT dose report images
Parameters: filename (str.) – relative or absolute path to Philips CT dose report DICOM image file. - Tested with:
- Philips Gemini TF PET-CT v2.3.0
- Brilliance BigBore v3.5.4.17001.
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.
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¶
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¶
Note
OpenREM does not currently include a DICOM Store SCP, ie you will need to install a DICOM store server in order to send RSDRs or other DICOM files from modalities.
If you have no preference, Conquest is recommended as a free, open source, scriptable DICOM server. Please note though that you will need to include the RSRD SOP in the dgatesop.lst file.