Hi am getting an exception
java.lang.ClassCastException: org.dcm4cheri.util.UIDGeneratorImpl cannot be cast to org.dcm4che.util.UIDGenerator while adding dicom header to a jpeg and save the image as DICOM.The code snippet as well as exception stacktrace is as follows: I am using Tudor Dicom Tools and dcm4che.jar. Code: -------------------------------------------------------------------------------- File f1 = new File("D: ScanImage224.jpg"); File f2 = new File("D: ScanImage224.dcm"); Image image = ImageIO.read(f1); DicomExporter de = new DicomExporter(); DicomHeader dh = new DicomHeader(); dh.createDefaultHeader(); ImagePlus imp = new ImagePlus("",image); de.export(imp, f2, dh); Exception -------------------------------------------------------------------------------- java.lang.ClassCastException: org.dcm4cheri.util.UIDGeneratorImpl cannot be cast to org.dcm4che.util.UIDGenerator at org.dcm4che.util.UIDGenerator.getInstance(UIDGenerator.java:51) at org.dcm4cheri.imageio.plugins.DcmImageWriter.getDefaultStreamMetadata(DcmImageWriter.java:328) at lu.tudor.santec.dicom.exporter.DicomExporter.export(DicomExporter.java:111) at lu.tudor.santec.dicom.exporter.DicomExporter.export(DicomExporter.java:91) at ij.gui.VerticalToolbar.exportToDICOM(VerticalToolbar.java:545) at ij.gui.VerticalToolbar.actionPerformed(VerticalToolbar.java:479) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) |
> Problem while adding dicom header to a jpeg and save the image as DICOM
> > Hi am getting an exception > java.lang.ClassCastException: org.dcm4cheri.util.UIDGeneratorImpl cannot be > cast to org.dcm4che.util.UIDGenerator > while adding dicom header to a jpeg and save the image as DICOM.The code > snippet as well as > exception stacktrace is as follows: > I am using Tudor Dicom Tools and dcm4che.jar. Seems you are using an old version of the DICOM Tools? We are using the dcm4che2 libs since some time and have done a lot of changes and new features. The code for exporting has although changed a bit: DicomExporter exporter = new DicomExporter(); File dcmFile = new File("/home/hermenj/jhermen.dcm"); ImagePlus ip = new ImagePlus("/home/hermenj/img.jpg"); DicomObject dObj = exporter.createHeader(ip, true, true, true); // if wanted, set additional tags... DicomAnonymizer.addTag(dObj, Tag.PatientName, "Testpatient"); exporter.writeImage(dObj, ip, dcmFile); Please try the latest version from http://santec.tudor.lu/project/optimage/dicom/start and be sure to exchange all dcm4che libs with the ones from the new dicom-tools. Greets Johannes ----------------------------------------------------------------- Johannes Hermen - Ingenieur de Recherche [hidden email] ----------------------------------------------------------------- CRP Henri Tudor http://www.santec.tudor.lu 29, Avenue John F. Kennedy L-1855 Luxembourg ----------------------------------------------------------------- |
Hi,
Thanks for your reply .. the code I am using is working fine if I execute it as a standalone program .. but I am using the code in a signed applet which is integrated in a web application ... I am getting the exception when accessed from multiple webclients... FYI. I am using dcm4che 1.4.9 -Phanikanth
|
Free forum by Nabble | Edit this page |