GE Centricity Viewer DVDs of radiology images (PET / MRI) are saved in DICOM format and come with software for viewing the images. In order to use these images in other places, it may be necessary to convert them to a more standard format. I found one guide one sitepoint.com that covered the necessary steps, but I found that a number of details were missing in order to complete a successful installation on Mac OS X.
The following steps are what worked for me:
Prerequisites
Install Xcode from App Store
This is a prerequisite for compiling programs.
Install Ruby
Here’s a good guide:
See tutsplus.com
Install DICOM
Now install dicom support for ruby (in terminal):
$ gem install dicom
Install Homebrew
This is needed for the following two steps.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
See brew.sh
Install ImageMagick
The default install does not include jpeg 2000 support by default, which is needed to work with DICOM files, so you will need to specify the jp2 option when you install it:
$ brew install imagemagick --with-jp2
See tsai.it
Install pkg-config
This is a prerequisite for the next step.
$ brew install pkg-config
Install Rmagick Gem
You may need to adjust the paths to match the current version numbers.
$ sudo C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.9.1-10/include/ImageMagick-6/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.9.1-10/lib/pkgconfig/ gem install rmagick
Doing the conversion
Ruby conversion script
Create the following ruby program in a text editor and save it as dicom-convert.rb. This finds all matching files in the current directory and all subdirectories and converts each one to jpeg format. If the files have a .dcm file extension, use *.dcm, otherwise find a different wildcard (e.g. MRI*) that matches your files.
require 'dicom' include DICOM dcimfiles = File.join("**", “*.dcm") filenames = Dir.glob(dcimfiles) filenames.each do |filename| dcm = DObject.read(filename) dcm_image = dcm.image dcm_image.normalize.write(filename + ".jpg") end exit
Or if you wish to use the script manually on individual files, you can use:
require 'dicom' include DICOM dcm = DObject.read("MRI000001.dcm") dcm_image = dcm.image dcm_image.normalize.write("MRI000001.jpg") end exit
This is a useful resource if you need to customize the script further: ruby-doc.org
Running the script
Place the program in the root of your DICOM files directory, open terminal, change to that directory,and run the following command:
$ ruby dicom-convert.rb
This was based upon a guide written on Sitepoint.com; however, I found that additional steps were required to get it to work successfully. The sitepoint guide also includes instructions for Windows and Linux.
2 Comments
Add Yours →Hi how much will you charge to do this same conversion for me?
Hi Lynn, I’d recommend trying Espresso Ray, which is $3.99 on the App Store.
https://itunes.apple.com/us/app/espresso-ray/id590551201?mt=12