unable to open X server `' (Magick::ImageMagickError)

  • Thread starter Abder-Rahman Ali
  • Start date
A

Abder-Rahman Ali

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)
# 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.
 
B

Brian Candler

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
 
A

Abder-Rahman Ali

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
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?

* What versions of relevant library/ies
 
B

Brian Candler

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 :)
 
R

Roger Pack

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

Abder-Rahman Ali

Roger said:
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.
 
A

Abder-Rahman Ali

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?
 
R

Roger Pack

Abder-Rahman Ali said:
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?
 
A

Abder-Rahman Ali

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

Abder-Rahman Ali

Brian said:
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.
 
A

Abder-Rahman Ali

@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.
 
M

Markus Fischer

Hi Ali,

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?

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
 
A

Abder-Rahman Ali

Markus said:
Hi Ali,


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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,616
Members
45,304
Latest member
CalmwellCBDIngredients

Latest Threads

Top