dicom display struggles

29 views
Skip to first unread message

Aaron Schmitz

unread,
Feb 15, 2012, 10:31:16 AM2/15/12
to ruby-dicom
hello,

i would like to build a dicom html viewer in rails. first of all: what
do you think is the best way? how should i start?
other question: how can i display a dicom in ruby? i've got the object
but since rmagick doesnt exist or doesnt work for rails 3.1,
obj.image.display doesnt work!! please help. thank you

Christoffer Lervåg

unread,
Feb 15, 2012, 11:05:11 AM2/15/12
to ruby-...@googlegroups.com
Hello Aaron

Since the web browsers don't know how to display a dicom file, you have to convert your dicom image to a format recognized by the web browser. The easiest way is to extract the image as an RMagick object (obj.image) and save it as either a jpg or png file (image.write("img.jpg")). This can be done at the time that the dicom file is uploaded to your database, or alternatively, when the request to view the dicom file's view is made. Make sure that you keep track of where the image file is saved, so you will be able to load it in your rails view. In the view file, you simply display it as you would a normal jpg image.

Regards,
Chris

Aaron Schmitz

unread,
Mar 23, 2012, 3:58:20 AM3/23/12
to ruby-dicom
thank you, chris!

i got everything working but i had problems with rmagick since it's a
very old gem and not working on every windows machine.
i used irfanview to convert the files via batch.

just wanted to share

regards,

aaron

Christoffer Lervåg

unread,
Mar 23, 2012, 4:52:18 AM3/23/12
to ruby-...@googlegroups.com
That's great, Aaron.

As you point out, the RMagick gem is not maintained anymore, which is
a pity (and a bit suprising), considering how popular it is as a Ruby
gem.

Frustrated by this, I therefore implemented support for the
mini_magick gem to replace the RMagick gem in ruby-dicom some time
ago. The mini_magick gem, unlike RMagick, is dead simple to install on
any system. So for those having trouble with RMagick, it is worth
trying out mini_magick instead, and then specify this gem as the image
processor for the DICOM library.

Regards,
Chris

Reply all
Reply to author
Forward
0 new messages