Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2003

Tip: Looking for answers? Try searching our database.

How to display 16 bit data with pseudo colormaps in java

Thread view: 
Ana - 23 Aug 2003 18:50 GMT
Dear all,

I am trying to display 8 bit and 16 bit medical gray images. I would like to use a
pseudo color map using the IndexColorModel facilities in Java. The methods related to
the IndexColorModel expects the colormap to be passed in three 256 long
arrays (one for R, one for G, and B). This works well when dealing with the
8 bits images but not for 16 bits.

How can I display the 16 bits images using pseudo colormaps? I have routines that
will generate RGB colormap of any length, but the IndexColorModel only
supports 256 long colormaps. How do I get around this?

Thanks,
Ana
Roedy Green - 23 Aug 2003 19:20 GMT
>How can I display the 16 bits images using pseudo colormaps? I have routines that
>will generate RGB colormap of any length, but the IndexColorModel only
>supports 256 long colormaps. How do I get around this?

Roll your own IndexColorMap that uses 16 bits.  You can cannibalise
the code and just change a  few "byte"s to "short" or "char".

That might not work, depending on how IndexColorMap actually works.

It could work two ways:

1. tell the video hardware about the colour map and feed the video
hardware an 8-bit image.

2. convert the image to a 32-bits per pixel ARGB.

If the first, 16 bit won't work because it is unlikely there is
hardware support of 16 bit colourmaps. If the second, it is relatively
trivial.

In either case, I would be happy to write you a 16 bit version for $50
US.

.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Marco Schmidt - 23 Aug 2003 22:29 GMT
Ana:

>I am trying to display 8 bit and 16 bit medical gray images. I would like to use a
>pseudo color map using the IndexColorModel facilities in Java. The methods related to
>the IndexColorModel expects the colormap to be passed in three 256 long
>arrays (one for R, one for G, and B). This works well when dealing with the
>8 bits images but not for 16 bits.

Why not simply convert your grayscale images to 32 bit ARGB int values
which can then be put into a normal BufferedImage?

How are you planning to map an input gray value to color, i.e., what
formula or function do you use to determine the color for a given gray
input value?

Regards,
Marco
Signature

Please reply in the newsgroup, not by email!
Java programming tips: http://jiu.sourceforge.net/javatips.html
Other Java pages: http://www.geocities.com/marcoschmidt.geo/java.html

Roedy Green - 24 Aug 2003 01:09 GMT
>How are you planning to map an input gray value to color, i.e., what
>formula or function do you use to determine the color for a given gray
>input value?

One function you might find useful is computed by the WaveLength
class.  You convert levels of gray to frequencies of the rainbow.
See http://mindprod.com/products.html#WAVELENGTH

A typical function might convert Infrared values into varying degrees
of warmness in the colours.  Maybe you want to experiment with various
functions to map the gray into hue, saturation and brightness.

You have 16 bits of info, and only 8 bits of R G B. So if you want to
maintain detail, you might want to map in more than one dimension.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Ana - 24 Aug 2003 07:42 GMT
> You have 16 bits of info, and only 8 bits of R G B. So if you want to
> maintain detail, you might want to map in more than one dimension.

Thanks again Roedy, so I see what you are suggesting. Unfortunatly, it is
not something that I want to do though. It is important for me to keep the
details of the images (16 bits) and it is not an option to bring it down
to 8 bits (RGBA for a total of 32 bits).

So is the conclusion that if I need to display any gray image data in
pseudo color, I need to convert the images to RGBA and hence loose some
image details (in going from 16 bits to 8)...I hope that is not the case.

Regards,
Ana
Ana - 24 Aug 2003 07:50 GMT
> Ana:
>
[quoted text clipped - 13 lines]
> Regards,
> Marco

Thanks Marco,

The problem that I am having is that I would like to keep the 16 bits of
information in the images. Going to 32 bit ARGB means that I would have to
downsample the pixels to 8 bits. This is unfortunatly is not an option.

As for generating the colormaps, I will be using some that are part of the
matlab (ex. hot, rainbow, etc).

Thanks,
Ana
--


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.