Two Laptop Bag*
The moose likes Java in General and the fly likes ImageIO issues? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "ImageIO issues?" Watch "ImageIO issues?" New topic
Author

ImageIO issues?

Mohammad Farhat
Ranch Hand

Joined: Nov 17, 2005
Posts: 51
Hi Guys,
Here it goes...
i have an applet which is supposed to read DICOM images. DICOM images is a format of images (like gifs and jpegs), except that it is for medical images, consisting of a header section containing information such as patient id, patient name, width, height, transfersyntax, and other header info.. in addition to the image bytes section, which contains either the image bytes in a raw format (bitmaps...) or compressed format (where the image bytes can for example be compressed in jpeg, jpeg2000 encodings).
the issue is the following, i am reading the header information properly, and i am able to read the image bytes correctly as well, and for handling image bytes which are encoded using jpeg2000 compression, i am relying on sun's ImageIO plugin. This was successful for most images, yet for some images it fails (don't know why)
as a small snippet of my code, what i am doing is telling the ImageIO to read from my stream and place the result in a BufferedImage
BufferedImage img = ImageIO.read(bainS);
where bainS is a ByteArrayInputStream, now this instruction doesn't fail at all, and i can get the correct width and height of the BufferedImage using img.getWidth() and img.getHeight(), yet under some cases, the img.getRGB(j,i) simply gives me an outofindexerror, even on elemnt (0,0)
so is ImageIO failing me on some compression types of jpeg2000?
Help is highly appreciated...ASAP
Thanks a lot guys
you rule
Mohammad
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
Instead of trying to roll your own DICOM routines, why not use a library that already exists? I'm not sure, though, if it supports the various subtypes you mention.


Ping & DNS - my free Android networking tools app
Mohammad Farhat
Ranch Hand

Joined: Nov 17, 2005
Posts: 51
Dear Ulf,
Thanks for the fast replry...
i wish there were already existing open source routines for reading DICOM-JPEG2000 images, unfortunately, under JAVA, there isn't. You can get libraries for reading DICOM-RAW images, but DICOM-JPEG2000 images, it's simply almost impossible to find (there was only these japanese guys at Nagoya Institute of Technology http://mars.elcom.nitech.ac.jp/dicom/ who implemented this approach, and whom i took to apply inside my applet)
other than that, you can find no ready to use apis.
Is there anything we can look for to know why is getRGB crashing ?
Best,
Mohammad
grover holzwarth
Greenhorn

Joined: Jan 19, 2006
Posts: 2
dear Mr Farhat: I just read your post here . In fact is quite difficult to implement a dicom viewer capable to read dicom jpeg 2000 images.

We have developped an activex control who does that, but unfortunately isn't in java. There are workarounds though. see this web site http:www.telemedicinadobrasil.com.br . Inside this demo site ther will be a demo - you can use user=demo pass=demo, in order to realize what kind of solution we have achieved.

Well, but this is not the answer you were waiting for.

By now we are developing exactly this kind of software- starting by a coder capable to convert a standard dicom image ( non compressed) to a dicom jpeg 2000. My question : Do you have this coder ? in any language, but preferably in java.

I hope we can change experiences since we are both working with exactly the same thing. This, perhaps, will accelerate the work of both of us.

Non comercial and even open-source . What do you think about it ?

Dr Grover Holzwarth MD
Neurosurgery
Hospital Florianopolis
Brazil
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ImageIO issues?
 
Similar Threads
Get image size
imageio bug?
tiff file - how to verify it and get image details?
how to load compressed tiff image formats with JIMI
Structure Size