I need to convert a DICOM file (.dcm) in a jpeg2000 format, someone has a code snippet that perform this operation?
I found in the web only a way for the dcm to jpeg conversion (the first answer to that question: How to convert dicom file to jpg conversion), but that doesn't work for me.
Thanks in advice for te help and sorry for my not perfect english.
The best tool I encountered when doing image conversion is ImageMagick (http://www.imagemagick.org/), which supports Dicom as input and JPEG-2000 as output.
I also have used dcm4che for this purpose (it has the advantage to be a purely Java solution), but the JPEG-2000 encoder had a memory leak - so if you have to do it for lots of images, it might be a problem (recent version might be fixed though).
Related
Dear Stackoverflowers,
Outputting an Excel spreadsheet with images is a requirement of a project I'm doing. I've done a little research and found the following (perhaps incorrect) consensus :
various python libs for creating excels sheets work well
it is possible to insert images (but only in bmp)
the "internal format" of images used in excel files, is complicated, which may be why there is no 3rd party library support for inserting normal formats like jpeg.
I don't want to use or convert to bmp. Why? BMP are not compressed well, and these will be big sheets, so I want to mitigate the size impact of images (1 per row) as much as possible.
My ideal answer comes from someone who has actually done this. The method suggested can be in Java,Ruby,Python,(but not .NET) or some other creative way of doing it.
I'm really hoping someone out there has a solution, as I anticipate this could be a tricky area (similar in complexity to playing around with PDFs, perhaps).
The Perl module Excel::Writer::XLSX can insert JPEG, PNG, and BMP images into a new Excel workbook.
I am currently porting it to a Python module called XlsxWriter and the inset_image() function is near the top of the TODO list.
Update: As of version 0.1.6 of XlsxWriter it is now possible to a add PNG/JPEG images. See the example in the documentation.
As said in the comment above, Apache POI can solve your problem.
I did a little research and this example should be useful Apache POI Excel Insert an Image
I have developed a software which will convert tiff to jpg and then read jpg file, however this software only work when there is a simple writing on the jpg file (means simple English font) but I want to read cursive fonts so any one help me to get out of this. I have tried so much and yet I cannot find any kind of hint for this so please help..I don't understand which library I used? so help me for reading image which having cursive writing.
thanking you
vipul chauhan
Sounds like you want to do OCR on a cursive font document. If you mean handwriting, I'd give up immediately (a very difficult problem in general). If it IS a specific font that you posses (or at least you can create a database of pictures of each letter of that font) then you can try to use an existing OCR library that can be trained with a new font.
For example: Tesseract-OCR or OCRopus. Also try googling "java ocr train" or so.
I'm facing a problem while parsing a PDF with Jpedal.
While reading the wordlist from the Jpedal, I get garbled characters in the wordslist. This also happens when using OCR, and when I copy the text from PDF and paste in Word or a simple text editor. What I understand is this PDF was generated by Quartz PDF context on MAC OS X 10.6.4, which is used to compress the file size, but iseasily viewable on PDF viewers. I searched for any Java API supporting for decoding this kind of PDF but was unsuccessful. I'm looking for any application or Java API which I can use to decode it; must be usable on a Linux machine.
Hye everybody
I'm posting a possible solution for problem. Here is link describing how quartz parse the pdf and of course which need to be implemented in code cause till now I didn't found any readymade API for it and I believe that stackoverflow is all about taking initiative and do and answer the questions which not been done or asked before.
regards
Rituraj
I am looking for a 100% Java solution for encoding software generated images into an AVI stream together with an uncompressed audio track.
At the moment I am using JMF, but its size and installation problems make it a bad solution for my purpose.
While it does not support audio, I created an MJPEG AVI Java class some years ago. You basically just tell it the resolution of your output video, along with the frame rate, then you just keep adding images to it. When you are done, you tell it to finish and it'll close out the AVI. It is based off of the Microsoft documentation on AVI, RIFF, and BITMAP file formats.
Other than not supporting audio, the only real problem is it implements the version of the AVI format limited to 2GB per file. While the class will write out a much larger file, I am uncertain that any players or video editors would be able to read it.
The way I've used this code in the past, is to generate an MJPEG AVI for processing in a video editor (adding audio, etc. in the editor). It helped me with automating some tedious slide show generation. Not sure if this code will help you, as is, but it might help if you are trying to roll your own solution. MJPEGGenerator.java is available if you are interested!
You can use JMF, see this nice example.
There is a nice blog entry here:
http://www.randelshofer.ch/blog/2008/08/writing-avi-videos-in-pure-java/
By Werner Randelshofer
I'm using ImageIO.read to process uploaded image files. The code is similar to
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(image.getContents()));
I've managed to solve most of the issues, but this one has left me clueless. The uploaded image has a JCS_YCCK profile, as defined in com.sun.imageio.plugins.jpeg.JPEG, which is not supported by com.sun.imageio.plugins.jpeg.JPEGImageReader. This leads to a nice stack trace similar to:
Caused by: javax.imageio.IIOException: Unsupported Image Type
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:910)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:885)
at javax.imageio.ImageIO.read(ImageIO.java:1422)
at javax.imageio.ImageIO.read(ImageIO.java:1326)
at com.example.ImageWriter.resizeEmbeddableImageInPlace(ImageWriter.java:231)
How can I process this type of JPEG using Java's ImageIO?
Update: I've tried Commons-Sanselan, indicated by an answer, but unfortunately it does not support JPEG files:
org.apache.sanselan.ImageReadException: Sanselan cannot read or write JPEG images.
at org.apache.sanselan.formats.jpeg.JpegImageParser.getBufferedImage(JpegImageParser.java:90)
at org.apache.sanselan.Sanselan.getBufferedImage(Sanselan.java:1264)
at org.apache.sanselan.Sanselan.getBufferedImage(Sanselan.java:1231)
One possible solution is to use the Java Advanced Imaging Image IO extensions. When properly installed, the conversion works out of the box.
The problem is that it does not play well with Maven, so I've asked Using Java Advanced Imaging with Maven. If that works out, this answer will be accepted.
I don't know for ImageIO, but you could use the Commons Sanselan library, which offers easy ways to access all sorts of images.