I have written a Ruby script “dicom_info.rb”, and when I try running
it, I get the following error. Why is that? And, how can it get
solved?
C:\Users\Abder-Rahman\Desktop\Research\dicom>ruby dicom_info.rb
Fantomas is 070Y
And, this is the DICOM image
dicom_info.rb:22:in display': unable to open X server
’ (Magick::ImageMagickEr
ror)
from dicom_info.rb:22
from dicom_info.rb:10:in `each_index’
from dicom_info.rb:10
This is the “dicom_info,rb” script:
require “rubygems”
require “dicom”
require “RMagick”
dicom_files = Array.new
Dir["./dcm_files/*.dcm"].each do |dcm|
dicom_files << dcm
end
dicom_files.each_index do |i|
dcm = DICOM::DObject.new(dicom_files[i])
Retrieve patient name value
patient_name = dcm.value(“0010,0010”)
patient_age = dcm.value(“0010,1010”)
print patient_name
print " "
print "is "
print patient_age
puts
puts “And, this is the DICOM image”
dicom_image = dcm.get_image_magick
dicom_image.display
end
Thanks.
On Mon, Sep 06, 2010 at 12:42:11PM +0900, Abder-Rahman A. wrote:
I have written a Ruby script “dicom_info.rb”, and when I try running
it, I get the following error. Why is that? And, how can it get
solved?
C:\Users\Abder-Rahman\Desktop\Research\dicom>ruby dicom_info.rb
So I’m guessing you’re running some version of ruby under some version
of
windows.
dicom_info.rb:22:in `display’: unable to open X server
Well, do you have an X server? For example, are you running under
cygwin?
It would be much more helpful if you could give the full context of
where
you’re running this.
- What O/S and version you’re running under
- What ruby version you’re running under, and where you got it from or
how you installed it (e.g. one-click installer, which version?)
- What versions of relevant library/ies
Thanks a lot Brian.
This is more information on my environment:
OS —> Windows Vista Home Edition
Ruby version —> ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
I installed this version of Ruby using RubyInstaller for Windows
I just didn’t understand those questions:
-
Well, do you have an X server? For example, are you running under
cygwin?
-
What versions of relevant library/ies
So, do you suggest installing “cygwin”?
you suggest installing “cygwin”?
You won’t be able to run this line:
“dicom_image.display”
without X installed. It’ll be an uphill battle, either way, in windows.
On Mon, Sep 06, 2010 at 11:55:32PM +0900, Abder-Rahman A. wrote:
I installed this version of Ruby using RubyInstaller for Windows
http://www.rubyinstaller.org/
I just didn’t understand those questions:
- Well, do you have an X server? For example, are you running under
cygwin?
An X server is the way that a Unix system talks to a graphical display.
If
you’ve got code which expects to talk to an X server, then it’ll fail if
you
don’t have one.
I’m pretty sure you get one with cygwin; I’d be surprised if the
RubyInstaller comes with one. However I’m not a Windows user, I just
occasionally look over people’s shoulders 
I have downloaded Cygwin, but still getting the following error:
C:\Users\Abder-Rahman\Desktop\Research\dicom>ruby dicom_info.rb
Fantomas is 070Y
And, this is the DICOM image
dicom_info.rb:22:in display': unable to open X server
’ @
display.c/DisplayIma
ges/1654 (Magick::ImageMagickError)
from dicom_info.rb:22
from dicom_info.rb:10:in `each_index’
from dicom_info.rb:10
Why is that? Is there a workaround for this?
Abder-Rahman A. wrote:
I have downloaded Cygwin, but still getting the following error:
C:\Users\Abder-Rahman\Desktop\Research\dicom>ruby dicom_info.rb
Fantomas is 070Y
And, this is the DICOM image
dicom_info.rb:22:in display': unable to open X server
’ @
display.c/DisplayIma
ges/1654 (Magick::ImageMagickError)
from dicom_info.rb:22
from dicom_info.rb:10:in `each_index’
from dicom_info.rb:10
Why is that? Is there a workaround for this?
are you using cygwin ruby? do you have cygwin X package installed?
Roger P. wrote:
you suggest installing “cygwin”?
You won’t be able to run this line:
“dicom_image.display”
without X installed. It’ll be an uphill battle, either way, in windows.
Got what you mean @Roger, so I’ll go with installing Cygwin.
Thanks.
Roger P. wrote:
are you using cygwin ruby? do you have cygwin X package installed?
And have you started a cygwin shell and typed “startx” ?
Thanks for your replies.
@Roger, is there “Cygwin Ruby”? Is it different from “Cygwin”?
@Brian, no really I didn’t do that, just new to this. So, “startx” has
to be run then if I need to use X Window? Got what you mean.
Hi Ali,
On 07.09.2010 12:30, Abder-Rahman A. wrote:
I have started started a Cygwin shell and typed “startx”, but got the
following:
bash: startx: command not found
First Google result searching for “cygwin startx”:
http://x.cygwin.com/docs/ug/using.html
Looks useful to me, mention you need to install the xinit package (and
probably others … ), etc.
HTH
Brian C. wrote:
Roger P. wrote:
are you using cygwin ruby? do you have cygwin X package installed?
And have you started a cygwin shell and typed “startx” ?
I have started started a Cygwin shell and typed “startx”, but got the
following:
bash: startx: command not found
Any ideas?
Thanks.
@Markus. Thanks for your reply.
I have installed “xinit”.
Now, when I want to run “startx”, I get the following:
Abder-Rahman@Abder-Rahman-PC ~
$ startx
xauth: creating new authority file /home/Abder-Rahman/.serverauth.1188
xinit: Resource temporarily unavailable (errno 11): Another X server
instance is running on DISPLAY :0
Why is that?
Thanks.
Hi Ali,
On 08.09.2010 08:06, Abder-Rahman A. wrote:
Why is that?
The error message indicated that “another X server instance is running”,
have you checked that?
Accidentally I installed cygwin with X today and it worked out of the
box (W7 Pro x64).
HTH
Markus F. wrote:
Hi Ali,
On 08.09.2010 08:06, Abder-Rahman A. wrote:
Why is that?
The error message indicated that “another X server instance is running”,
have you checked that?
Accidentally I installed cygwin with X today and it worked out of the
box (W7 Pro x64).
HTH
Yes, I checked that and didn’t notice any other instance running.
Maybe I’m missing something.
I’m trying to do CTRL-ALT-DELETE at Windows Vista to check what programs
are running but seems there to be a problem.
Thanks.